:root {
  --bg-0: #02060f;
  --bg-1: #071325;
  --bg-2: #0a1d36;
  --panel: rgba(6, 20, 38, 0.78);
  --panel-strong: rgba(7, 25, 48, 0.92);
  --text: #d9f8ff;
  --muted: #7fa5bb;
  --neon-cyan: #18f7ff;
  --neon-lime: #adff2f;
  --neon-orange: #ff7a21;
  --neon-red: #ff4f70;
  --border: rgba(24, 247, 255, 0.38);
  --border-soft: rgba(24, 247, 255, 0.22);
  --glow-cyan: 0 0 0.8rem rgba(24, 247, 255, 0.42);
  --glow-lime: 0 0 0.8rem rgba(173, 255, 47, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(24, 247, 255, 0.11), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(173, 255, 47, 0.09), transparent 40%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-0) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background-image:
    linear-gradient(to right, rgba(24, 247, 255, 0.4) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(24, 247, 255, 0.35) 1px, transparent 1px);
  background-size: 42px 42px;
}

a {
  color: var(--neon-cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--neon-lime);
}

.app-shell {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.title-wrap {
  max-width: 760px;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--neon-lime);
}

.app-header h1 {
  margin: 4px 0 4px;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.header-links a {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(9, 32, 58, 0.68);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-links a:hover {
  text-decoration: none;
  box-shadow: var(--glow-cyan);
}

.card-lite,
.app-content {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(170deg, rgba(7, 24, 45, 0.9), rgba(5, 17, 32, 0.94));
  box-shadow: inset 0 0 0 1px var(--border-soft), 0 10px 30px rgba(0, 0, 0, 0.35);
}

.api-config {
  padding: 12px;
  margin-bottom: 12px;
}

.api-row {
  display: grid;
  gap: 8px;
  align-items: center;
  grid-template-columns: 74px minmax(0, 1fr) auto;
}

.api-row label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neon-lime);
}

.api-row input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(4, 14, 27, 0.9);
  color: var(--text);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  padding: 9px 10px;
}

.api-row button {
  border: 1px solid rgba(255, 122, 33, 0.6);
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(255, 122, 33, 0.92), rgba(255, 62, 101, 0.88));
  color: #111;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 9px 12px;
  cursor: pointer;
}

.api-row button:hover {
  box-shadow: 0 0 1rem rgba(255, 122, 33, 0.45);
}

.app-content {
  padding: 14px;
}

.status-block,
.error-block {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 25, 48, 0.82);
  padding: 12px;
}

.error-block {
  border-color: rgba(255, 79, 112, 0.6);
  color: #ffd4dd;
}

.small {
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.toolbar h2 {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 25px);
  color: var(--neon-cyan);
}

.toolbar .counts {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.signal-strip,
.metric-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 12px;
}

.metric-card {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
  background: rgba(8, 28, 52, 0.68);
}

.metric-card .label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric-card .value {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.signal-score {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-good {
  border-color: rgba(173, 255, 47, 0.6);
  color: var(--neon-lime);
  box-shadow: var(--glow-lime);
}

.score-mid {
  border-color: rgba(255, 122, 33, 0.6);
  color: var(--neon-orange);
}

.score-bad {
  border-color: rgba(255, 79, 112, 0.6);
  color: var(--neon-red);
}

.grid {
  display: grid;
  gap: 12px;
}

.channels-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.videos-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  background: rgba(7, 24, 45, 0.84);
  padding: 12px;
}

.split-head {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
}

.card h2,
.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(9, 31, 58, 0.84);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  margin: 8px 0 9px;
  filter: saturate(1.04) contrast(1.04);
}

.meta-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.pill-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(6, 23, 43, 0.9);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
}

.pill-link:hover {
  text-decoration: none;
  box-shadow: var(--glow-cyan);
}

.vote-panel {
  margin-top: 10px;
  border-top: 1px dashed var(--border-soft);
  padding-top: 10px;
}

.vote-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.vote-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 29, 53, 0.88);
  color: var(--text);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.vote-btn:hover {
  box-shadow: var(--glow-cyan);
}

.vote-btn.is-active {
  border-color: rgba(173, 255, 47, 0.68);
  color: var(--neon-lime);
  box-shadow: var(--glow-lime);
}

.vote-stats {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.detail-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

pre {
  white-space: pre-wrap;
  margin: 0;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(4, 14, 28, 0.95);
  padding: 10px;
  color: #c6effa;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.analysis-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.marker-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.marker-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(8, 28, 52, 0.82);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.marker-chip.warn {
  border-color: rgba(255, 122, 33, 0.58);
  color: var(--neon-orange);
}

.marker-chip.bad {
  border-color: rgba(255, 79, 112, 0.6);
  color: var(--neon-red);
}

.trend-list {
  display: grid;
  gap: 7px;
}

.trend-item {
  display: grid;
  gap: 6px;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.trend-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(7, 22, 41, 0.95);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.trend-fill {
  height: 100%;
  background: linear-gradient(90deg, #1af7ff 0%, #adff2f 100%);
  box-shadow: var(--glow-cyan);
}

@media (max-width: 860px) {
  .app-header {
    flex-direction: column;
  }

  .api-row {
    grid-template-columns: 1fr;
  }

  .api-row label {
    margin-bottom: -2px;
  }
}
