:root {
  color-scheme: dark;

  /* Surface layers */
  --bg: #0b0e14;
  --topbar-bg: #0d1118;
  --surface-sunken: #080a0f;
  --surface: #111621;
  --surface-raised: #171e2d;
  --surface-hover: #1e273a;
  --surface-active: #243047;

  /* Border ladder */
  --border-subtle: #1c2436;
  --border: #263148;
  --border-strong: #374666;

  /* Text ladder (all verified >= 4.5:1 on surfaces) */
  --text: #edf2f9;
  --text-secondary: #c5d1e3;
  --text-muted: #91a2bd;
  --text-on-accent: #04121d;

  /* Semantic accents and states */
  --accent: #38bdf8;
  --accent-hover: #5ccbfa;
  --accent-active: #1daae8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-border: rgba(56, 189, 248, 0.42);
  --focus-ring: #7dd3fc;

  --hot: #fb923c;
  --hot-soft: rgba(251, 146, 60, 0.14);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --ok-border: rgba(52, 211, 153, 0.3);

  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --warn-border: rgba(251, 191, 36, 0.3);

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --danger-border: rgba(248, 113, 113, 0.38);

  /* Typography (fixed rem scale for Operate density) */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.625rem;

  /* Rhythm, layout, and depth */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-pill: 999px;

  --control-height: 2.375rem;
  --measure: 68ch;
  --container-max: 1180px;

  --dur-fast: 150ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  scrollbar-color: var(--border-strong) var(--bg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  accent-color: var(--accent);
  caret-color: var(--accent);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-border);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

h1, h2, h3 {
  text-wrap: balance;
  letter-spacing: -0.015em;
}

p, li {
  text-wrap: pretty;
}

li::marker {
  color: var(--text-muted);
}

code {
  font-family: var(--font-mono);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  padding: 0.1em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:hover,
.skip-link:focus {
  top: var(--space-3);
  color: var(--text-on-accent);
  background: var(--accent-hover);
  text-decoration: none;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-sm {
  width: 0.875rem;
  height: 0.875rem;
}
.icon-brand {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--accent);
}

/* Data wears mono with tabular numerals (DESIGN.md: Mono-For-Data Rule) */
.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Layout primitives (Every Layout: Container, Stack, Cluster) */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, var(--space-4));
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--space-2));
}

/* Top navigation bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 3.75rem;
  padding-block: var(--space-2);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  color: var(--text);
  padding: var(--space-1) 0;
  border-radius: var(--radius-sm);
}
.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  scrollbar-width: thin;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  min-height: 2.25rem;
  padding: 0.4375rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}
.nav-link.active {
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Main & footer */
.main {
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
}

.footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-5);
  padding-bottom: var(--space-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  font-variant-numeric: tabular-nums;
}
.footer > span:first-child {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Page & section headers */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
}
.page-title .tabular {
  font-size: var(--text-lg);
  font-weight: 400;
}
.page-subtitle {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: var(--measure);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
}

.muted { color: var(--text-muted); }
.small { font-size: var(--text-sm); }
.tiny { font-size: var(--text-xs); }
.warn-text { color: var(--warn); }

.link-subtle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-out);
}
.link-subtle:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Surface containers */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--control-height);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-raised);
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn[aria-busy="true"] .icon-sync {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}
.btn-primary:active:not(:disabled) {
  background: var(--accent-active);
}

.btn-secondary {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-block {
  width: 100%;
  margin-top: var(--space-3);
}

/* Badges & status pills */
.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1875rem 0.5625rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  white-space: nowrap;
}
.badge-muted {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-ok,
.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok-border);
}
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.status-pill {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Filter bar & form controls */
.filter-bar {
  margin-bottom: var(--space-6);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1 1 16rem;
  min-width: 12rem;
}
.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input,
.select {
  height: var(--control-height);
  background: var(--surface-sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.input:hover,
.select:hover {
  border-color: var(--border-strong);
}
.input:focus,
.select:focus {
  border-color: var(--accent);
}
.input-search {
  width: 100%;
  padding-left: 2.25rem;
}
.select {
  flex: 0 1 auto;
  cursor: pointer;
}

/* Trend strip & topic chips */
.trend-strip {
  margin-bottom: var(--space-6);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.25rem 0.6875rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.25;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.chip:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text);
  text-decoration: none;
}
.chip-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-active:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.chip-active .chip-count {
  color: var(--accent);
}

.chip-sm {
  min-height: 1.75rem;
  font-size: var(--text-xs);
  padding: 0.1875rem 0.5625rem;
  color: var(--text-secondary);
}

.chip-count {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.hot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hot);
  display: inline-block;
  flex-shrink: 0;
}

/* Feed list & video cards (Every Layout Sidebar primitive) */
.feed-section {
  display: flex;
  flex-direction: column;
}

.video-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.video-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.video-card:hover {
  border-color: var(--border-strong);
}

.video-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-start;
}

.thumb-wrap {
  flex: 1 1 210px;
  max-width: 232px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  display: block;
}
.thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.video-meta {
  flex: 999 1 320px;
  min-width: 0;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}
.meta-line > .muted {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
/* Decorative dot rendered as a 1px rule instead of a glyph */
.meta-sep {
  display: inline-block;
  width: 1px;
  height: 0.75rem;
  background: var(--border-strong);
  font-size: 0;
  user-select: none;
}

.channel-tag {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.video-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.32;
  max-width: var(--measure);
}
.video-title a {
  color: var(--text);
}
.video-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.video-summary {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
  line-height: 1.55;
  max-width: var(--measure);
}

.takeaway-list {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.takeaway-list li {
  margin-bottom: var(--space-1);
  max-width: var(--measure);
}
.takeaway-list li:last-child {
  margin-bottom: 0;
}
.takeaway-list.compact {
  margin-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
}
.video-card > .takeaway-list.compact {
  margin-top: 0;
}

.video-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-top: var(--space-1);
}

.card-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.card-links .link-subtle {
  padding-block: 0.25rem;
}

/* Empty states */
.empty {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.empty h2,
.empty h3 {
  margin: 0;
  font-size: var(--text-lg);
}
.empty p {
  margin: 0;
  max-width: 48ch;
}
.empty-actions {
  margin-top: var(--space-3);
}

/* Video detail */
.breadcrumb {
  margin-bottom: var(--space-4);
}

.detail-header {
  margin-bottom: var(--space-5);
}

.detail-title {
  margin: var(--space-2) 0 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.22;
  max-width: 56ch;
}

.detail-media-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: var(--space-5);
  align-items: start;
  margin-bottom: var(--space-6);
}

.embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}
.embed-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.detail-side .card {
  padding: var(--space-4);
}
.detail-side-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.detail-body {
  max-width: 74ch;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.detail-section {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border-subtle);
}
.detail-section:first-child {
  padding-top: 0;
  border-top: 0;
}
.detail-section h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 600;
}

.lead {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: var(--measure);
}

.moments-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.moment-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.moment-item:hover {
  background: var(--surface-raised);
  border-color: var(--accent-border);
  color: var(--text);
  text-decoration: none;
}

.ts-pill {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.1875rem 0.4375rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
a.ts-pill:hover {
  background: var(--accent-border);
  color: var(--accent-hover);
  text-decoration: none;
}

.transcript-box summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.transcript-box summary::-webkit-details-marker {
  display: none;
}
.transcript-box summary:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--text);
}
.transcript-chevron {
  transition: transform var(--dur-fast) var(--ease-out);
  color: var(--text-muted);
}
.transcript-box[open] .transcript-chevron {
  transform: rotate(180deg);
}

.transcript-scroll {
  max-height: 460px;
  overflow-y: auto;
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.55;
  scrollbar-color: var(--border-strong) var(--surface-sunken);
}
.seg-row {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
}
.seg-row span {
  color: var(--text-secondary);
  max-width: var(--measure);
}
.transcript-plain {
  white-space: pre-wrap;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-3) 0 0;
  max-width: var(--measure);
}

.source-meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.source-meta strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Trends page */
.window-tabs {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.window-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.window-tab:hover {
  color: var(--text);
  background: var(--surface-raised);
  text-decoration: none;
}
.window-tab.active,
.window-tab.active:hover {
  background: var(--accent);
  color: var(--text-on-accent);
}

.trends-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.trend-list {
  padding: var(--space-4);
}
.trend-list h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-base);
  font-weight: 600;
}

.trend-row {
  display: block;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text);
  border: 1px solid transparent;
  margin-bottom: var(--space-1);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.trend-row:last-child {
  margin-bottom: 0;
}
.trend-row:hover {
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
}
.trend-row.active {
  background: var(--surface-raised);
  border-color: var(--accent-border);
}

.trend-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}
.trend-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.bar-track {
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  margin: var(--space-2) 0 var(--space-1);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
}
.bar-hot {
  background: var(--hot);
}

.trend-channels {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.trend-video-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.trend-video-card .video-title {
  margin-bottom: 0;
}
.trend-video-card .card-links {
  margin-top: var(--space-2);
}

/* Channels page */
.category-block {
  margin-bottom: var(--space-8);
}
.category-block:last-child {
  margin-bottom: 0;
}
.category-title {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}
.channel-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.channel-card:hover {
  border-color: var(--border-strong);
}
.channel-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.channel-card-head h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
}
.channel-card-head h3 a {
  color: var(--text);
}
.channel-card-head h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}
.channel-handle {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.channel-card-stats {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.channel-card-stats strong,
.channel-card-stats .muted {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.channel-card-stats strong {
  font-weight: 600;
}

/* Responsive structural breakpoints */
@media (max-width: 900px) {
  .detail-media-grid,
  .trends-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .container {
    padding-inline: var(--space-4);
  }
  .topbar {
    position: static;
  }
  .topbar-inner {
    gap: var(--space-2);
    padding-block: var(--space-3);
  }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 2px;
    /* room for focus rings clipped by the scroll container */
    padding: 3px;
    margin: -3px;
  }
  .nav-link {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
  }
  .actions {
    margin-left: auto;
  }
  .status-pill {
    display: none;
  }
  .thumb-wrap {
    max-width: none;
  }
  .filter-form .select {
    flex: 1 1 calc(50% - var(--space-2));
    min-width: 8.5rem;
  }
  .card {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .btn,
  .nav-link,
  .chip,
  .video-card,
  .channel-card,
  .trend-row,
  .window-tab,
  .moment-item,
  .transcript-box summary,
  .transcript-chevron {
    transition: none;
  }
  .btn[aria-busy="true"] .icon-sync {
    animation: none;
  }
  .btn:active:not(:disabled) {
    transform: none;
  }
}
