/* Canonical generated tokens (../beamfall-design-system). This repo's own OKLCH
   primitives below still shadow the same-named canonical primitives (RV-DS-006
   tracks the full repo-wide palette migration); only new UI that opts into a
   .theme-* class (e.g. .destructive-confirm below) consumes canonical semantic
   tokens such as --state-danger / --radius-control. */
@import url("/tokens/generated/beamfall-tokens.css");

:root {
  color-scheme: dark;
  --night-950: oklch(13% 0.012 255);
  --night-900: oklch(18% 0.014 255);
  --night-800: oklch(24% 0.014 250);
  --mist-100: oklch(93% 0.012 235);
  --mist-200: oklch(86% 0.018 235);
  --beam-500: oklch(82% 0.145 92);
  --cyan-500: oklch(74% 0.12 218);
  --green-500: oklch(70% 0.14 150);
  --amber-500: oklch(78% 0.16 78);
  --red-500: oklch(64% 0.17 28);
  --border-subtle: oklch(31% 0.014 250);
  --surface: var(--night-900);
  --surface-raised: var(--night-800);
  --radius: 8px;
  --shadow: 0 24px 60px oklch(5% 0.02 255 / 42%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: var(--night-950);
  color: var(--mist-100);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(118deg, oklch(82% 0.145 92 / 0.16), transparent 33rem),
    radial-gradient(ellipse at 80% -10%, oklch(74% 0.12 218 / 0.13), transparent 32rem),
    var(--night-950);
  color: var(--mist-100);
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  background: var(--beam-500);
  color: var(--night-950);
  padding: 8px 12px;
  border-radius: 6px;
}

.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid var(--beam-500);
  outline-offset: 3px;
}

.site-header,
.site-footer,
main > section {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding-block: 12px;
}

.brand,
nav,
.hero-actions,
.status-row,
.device-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border: 1px solid oklch(82% 0.145 92 / 0.65);
  border-radius: 6px;
  background: linear-gradient(135deg, transparent 22%, var(--beam-500) 23% 34%, transparent 35%);
}

nav {
  gap: 6px;
}

nav a,
.header-cta {
  border-radius: 6px;
  color: var(--mist-200);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  text-decoration: none;
}

nav a[aria-current="page"],
nav a:hover,
.header-cta {
  color: var(--mist-100);
  background: oklch(24% 0.014 250 / 0.76);
}

h1,
h2,
h3,
p {
  margin-block-start: 0;
}

h1 {
  max-width: 760px;
  font-size: 40px;
  line-height: 48px;
  font-weight: 650;
}

h2 {
  font-size: 22px;
  line-height: 30px;
  font-weight: 620;
}

h3 {
  font-size: 16px;
  line-height: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p,
li,
label,
input,
button {
  font-size: 15px;
  line-height: 22px;
}

.lead {
  max-width: 66ch;
  color: var(--mist-200);
}

.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;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
  padding: 8px 14px;
  text-decoration: none;
  white-space: nowrap;
}

.button.large {
  min-height: 48px;
  padding: 13px 22px;
  font-size: 15px;
}

.button.primary {
  background: var(--beam-500);
  border-color: var(--beam-500);
  color: var(--night-950);
}

.button.secondary,
.button.quiet,
.button.soft,
button {
  background: oklch(24% 0.014 250 / 0.74);
  color: var(--mist-100);
}

.button.ghost {
  background: transparent;
  color: var(--mist-100);
  border-color: var(--border-subtle);
}

.button.danger {
  background: var(--red-500);
  border-color: var(--red-500);
  color: var(--night-950);
}

.hero-actions {
  gap: 12px;
  margin-block: 28px 18px;
  flex-wrap: wrap;
}

.open-source-line,
.phase-note,
.inline-status,
.mock-result pre {
  color: var(--mist-200);
  font-size: 13px;
  line-height: 18px;
}

/* ===== Shared marketing section heads + pills ===== */
.section-head {
  max-width: 640px;
  margin: 0 auto 40px;
  text-align: center;
}

.section-head.left {
  margin-inline: 0;
  max-width: none;
  text-align: left;
}

.section-head h2 {
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.section-head p {
  color: var(--mist-200);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--beam-500);
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--mist-200);
}

.pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--beam-500);
}

.pill-beta {
  color: var(--cyan-500);
  border-color: oklch(74% 0.12 218 / 0.42);
}

.pill-beta .dot {
  background: var(--cyan-500);
}

/* ===== Hero (full-width + scrim) ===== */
.hero {
  position: relative;
  min-height: 540px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  margin-block: 24px;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 140% at 85% 0%, oklch(74% 0.12 218 / 0.22), transparent 55%),
    radial-gradient(90% 120% at 10% 100%, oklch(82% 0.145 92 / 0.18), transparent 55%),
    linear-gradient(90deg, var(--night-950) 6%, oklch(13% 0.012 255 / 0.7) 48%, oklch(13% 0.012 255 / 0.35) 100%),
    linear-gradient(0deg, var(--night-950), transparent 42%),
    linear-gradient(135deg, var(--night-900), var(--night-950));
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 56px;
}

.hero h1 {
  max-width: 16ch;
  font-size: 52px;
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 680;
  margin-block: 16px;
}

.hero .sub {
  font-size: 19px;
  line-height: 1.5;
  color: var(--mist-200);
  max-width: 46ch;
  margin-bottom: 28px;
}

.hero-note {
  margin-top: 24px;
}

/* ===== Feature grid (5 features) ===== */
.feature-section,
.teaser-section {
  padding-block: 64px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: oklch(18% 0.014 255 / 0.78);
  padding: 24px;
}

.feature.span2 {
  grid-column: span 2;
}

.feature .ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: oklch(82% 0.145 92 / 0.16);
  color: var(--beam-500);
  font-size: 17px;
  margin-bottom: 12px;
}

.feature h3 {
  margin-bottom: 6px;
}

.feature p {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--mist-200);
  margin-bottom: 0;
}

.feature.privacy {
  border-color: oklch(74% 0.12 218 / 0.35);
  background: linear-gradient(180deg, oklch(74% 0.12 218 / 0.08), oklch(18% 0.014 255 / 0.78));
}

.feature.privacy .ico {
  background: oklch(74% 0.12 218 / 0.18);
  color: var(--cyan-500);
}

.feature.privacy .priv-line {
  color: var(--mist-100);
  font-weight: 600;
  margin-bottom: 8px;
}

.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.platforms .chip {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--mist-200);
  background: var(--surface-raised);
}

/* ===== Poster showcase (9 cards) ===== */
.showcase {
  padding-block: 56px;
  border-block: 1px solid var(--border-subtle);
  background: oklch(18% 0.014 255 / 0.5);
}

.showcase .section-head h2 {
  font-size: 24px;
}

.poster-strip {
  list-style: none;
  margin: 0;
  padding: 0 0 8px;
  display: flex;
  gap: 16px;
  overflow-x: auto;
}

.poster-strip:focus-visible {
  outline: 3px solid var(--beam-500);
  outline-offset: 4px;
  border-radius: var(--radius);
}

.pcard {
  flex: 0 0 auto;
  width: 150px;
}

.pcard .art {
  width: 150px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow);
  background:
    linear-gradient(160deg, oklch(60% 0.13 var(--art-hue) / 0.9), oklch(28% 0.06 var(--art-hue) / 0.95));
}

.pcard .art.square {
  aspect-ratio: 1 / 1;
}

.pcard .meta {
  margin-top: 10px;
  display: grid;
  gap: 2px;
}

.pcard .meta .t {
  font-size: 13px;
  font-weight: 600;
}

.pcard .meta .s {
  font-size: 12px;
  color: var(--mist-200);
}

/* ===== Pricing teaser CTA stack ===== */
.stack-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.teaser-pledge {
  text-align: center;
  margin-top: 24px;
}

/* ===== Pricing tiers ===== */
.pricing-hero,
.compare-section,
.family-section,
.faq-section,
.mock-result {
  padding-block: 64px;
}

.pricing-hero {
  padding-top: 40px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: stretch;
}

.tier {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: oklch(18% 0.014 255 / 0.78);
  padding: 28px;
}

.tier.featured {
  position: relative;
  border-color: oklch(82% 0.145 92 / 0.55);
  box-shadow: 0 0 0 1px oklch(82% 0.145 92 / 0.3), var(--shadow);
}

.tier .tier-tag {
  position: absolute;
  top: -11px;
  left: 28px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--beam-500);
  color: var(--night-950);
  padding: 4px 10px;
  border-radius: 999px;
}

.tier h2 {
  font-size: 17px;
  line-height: 24px;
  margin-bottom: 8px;
}

.tier .who {
  color: var(--mist-200);
  font-size: 13px;
  margin-bottom: 16px;
  min-height: 36px;
}

.tier .amt {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}

.tier .amt .num {
  font-size: 34px;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tier .amt .per {
  color: var(--mist-200);
  font-size: 13px;
}

.tier .ga-strip {
  margin: 4px 0 16px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--amber-500);
  background: oklch(78% 0.16 78 / 0.12);
  border: 1px solid oklch(78% 0.16 78 / 0.35);
  border-radius: 6px;
  padding: 6px 10px;
}

.tier-list {
  list-style: none;
  margin: 12px 0 20px;
  padding: 0;
  flex: 1 1 auto;
}

.tier-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 5px 0;
}

.tier-list li .ck {
  color: var(--green-500);
  flex: 0 0 auto;
}

.tier-list li.muted {
  color: var(--mist-200);
}

.tier-list li.muted .ck {
  color: var(--mist-200);
}

.checkout-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border-subtle);
}

.checkout-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
  padding-block: 8px;
}

.checkout-list b {
  font-variant-numeric: tabular-nums;
}

.checkout-list small {
  grid-column: 1 / -1;
  color: var(--mist-200);
  line-height: 1.4;
}

.checkout-list button {
  grid-column: 1 / -1;
  justify-self: start;
}

.lifetime-pledge {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 20px;
  border: 1px solid oklch(82% 0.145 92 / 0.3);
  background: oklch(82% 0.145 92 / 0.07);
  border-radius: var(--radius);
  padding: 16px;
}

.lifetime-pledge .ico {
  color: var(--beam-500);
  font-size: 18px;
  flex: 0 0 auto;
}

.lifetime-pledge p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--mist-200);
}

.lifetime-pledge p b {
  color: var(--mist-100);
}

.pledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

.pledge-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid oklch(82% 0.145 92 / 0.3);
  color: var(--beam-500);
}

/* ===== Comparison table ===== */
.compare-section {
  padding-top: 0;
}

.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.compare th,
.compare td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.compare thead th {
  color: var(--mist-200);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.compare td.c,
.compare th.c {
  text-align: center;
}

.compare .yes {
  color: var(--green-500);
}

.compare .no {
  color: var(--mist-200);
}

/* ===== Family Sharing panel ===== */
.family-section {
  padding-top: 0;
}

.family-section .panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: oklch(18% 0.014 255 / 0.78);
  padding: 24px 28px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 15px;
}

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--mist-200);
}

.badge.beam {
  color: var(--beam-500);
  border-color: oklch(82% 0.145 92 / 0.45);
  background: oklch(82% 0.145 92 / 0.1);
  margin-left: auto;
}

.fam-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.fam-row .av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(160deg, oklch(62% 0.13 var(--art-hue)), oklch(30% 0.07 var(--art-hue)));
  flex: 0 0 auto;
}

.fam-row .n {
  font-size: 13px;
}

.fam-row .r {
  margin-left: auto;
  font-size: 12px;
  color: var(--mist-200);
}

.fam-note,
.phase-note {
  font-size: 12px;
  color: var(--mist-200);
  line-height: 1.5;
  margin-top: 16px;
}

/* ===== FAQ ===== */
.faq-section {
  padding-top: 0;
}

.faq {
  max-width: 760px;
  margin: 0 auto;
}

.faq details {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: oklch(18% 0.014 255 / 0.78);
  padding: 0 20px;
}

.faq summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  font-size: 14.5px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--mist-200);
  font-size: 18px;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details p {
  margin: 0 0 16px;
  color: var(--mist-200);
  font-size: 13.5px;
  line-height: 1.6;
}

.faq-section .stack-cta {
  margin-top: 24px;
}

.portal-section p,
.link-card p,
.state-examples p {
  color: var(--mist-200);
}

.account-shell,
.link-layout {
  padding-block: 64px;
}

.portal-section,
.link-card,
.state-examples article,
.mock-result {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: oklch(18% 0.014 255 / 0.78);
  padding: 20px;
}

.state-examples {
  display: grid;
  gap: 16px;
}

.account-shell {
  display: grid;
  gap: 20px;
  align-items: start;
}

.account-main {
  display: grid;
  gap: 16px;
}

.auth-form,
[data-device-link] {
  display: grid;
  gap: 10px;
  max-width: 420px;
}

label {
  color: var(--mist-200);
  font-weight: 600;
}

input {
  min-height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: oklch(13% 0.012 255 / 0.85);
  color: var(--mist-100);
  padding: 10px 12px;
}

.license-key-output {
  width: 100%;
  min-height: 112px;
  margin-top: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: oklch(13% 0.012 255 / 0.85);
  color: var(--mist-100);
  padding: 10px 12px;
  resize: vertical;
}

.status-row,
.device-row {
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-block: 12px;
}

.status-row span,
.device-row small {
  color: var(--mist-200);
}

.upgrade-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px 0;
}

.upgrade-tier {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px;
}

.upgrade-tier h3,
.upgrade-tier p {
  margin: 0;
}

.upgrade-tier b {
  display: block;
  margin: 6px 0;
}

.upgrade-tier p {
  font-size: 13px;
}

.success {
  border-color: oklch(70% 0.14 150 / 0.55);
}

.warning {
  border-color: oklch(78% 0.16 78 / 0.55);
}

.danger {
  border-color: oklch(64% 0.17 28 / 0.65);
}

.destructive-confirm {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--state-danger);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  padding: 12px 16px;
}

.destructive-confirm[hidden] {
  display: none;
}

.destructive-confirm p {
  margin: 0;
}

.destructive-confirm .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 840px) {
  .destructive-confirm .actions {
    justify-content: flex-start;
  }
}

.link-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: start;
}

p.untrusted-label,
p.origin-note {
  color: var(--mist-200);
  font-size: 12.5px;
  line-height: 1.5;
}

p.phishing-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--amber-500);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  background: oklch(78% 0.16 78 / 0.12);
  border: 1px solid oklch(78% 0.16 78 / 0.35);
  border-radius: 6px;
  padding: 8px 10px;
}

.state-examples {
  grid-template-columns: repeat(2, 1fr);
}

.code-result {
  margin-top: 20px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border-top: 1px solid var(--border-subtle);
  color: var(--mist-200);
  font-size: 13px;
  line-height: 18px;
  padding-block: 24px 40px;
}

@media (max-width: 840px) {
  .site-header,
  .site-footer,
  main > section {
    width: min(100% - 24px, 1160px);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    flex-wrap: wrap;
  }

  h1 {
    font-size: 34px;
    line-height: 40px;
    max-width: none;
  }

  .feature-grid,
  .price-grid,
  .account-shell,
  .link-layout,
  .state-examples {
    grid-template-columns: 1fr;
  }

  .feature.span2 {
    grid-column: auto;
  }

  .hero {
    min-height: auto;
  }

  .hero-inner {
    padding: 32px 24px;
  }

  .hero h1 {
    font-size: 34px;
    line-height: 40px;
  }

  .hero .sub {
    font-size: 17px;
  }

  .status-row,
  .device-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .upgrade-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

.error-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 96px 24px;
  text-align: center;
}

.error-page a {
  color: var(--beam-500);
}

/* ── TV 10-foot shell (ADR-0156 §2, TVC-7) ─────────────────────────────────
   Tokens mirror the canonical beamfall-design-system TV type ramp / spacing /
   focus-ring (TVC-6). The shell is focus-first: focus is always visible, no
   affordance depends on hover, and the pointer cursor is hidden. */
:root {
  --type-tv-hero: 600 44px/50px system-ui, sans-serif;
  --type-tv-title: 650 24px/30px system-ui, sans-serif;
  --type-tv-body: 400 17px/24px system-ui, sans-serif;
  --type-tv-label: 650 13px/18px system-ui, sans-serif;
  --space-tv-2: 24px;
  --space-tv-3: 32px;
  --space-tv-4: 48px;
  --space-tv-5: 64px;
  --tv-focus-ring: oklch(82% 0.145 92 / 0.9);
}

.tv-shell {
  min-height: 100vh;
  padding: var(--space-tv-4) var(--space-tv-5);
  background: var(--night-950);
  /* 10-foot mode is remote-driven: hide the pointer entirely. */
  cursor: none;
}

.tv-shell[data-theme='light'] {
  --surface: oklch(92% 0.012 235);
  --surface-raised: oklch(98% 0.006 235);
  --night-950: oklch(96% 0.008 235);
  --night-900: oklch(90% 0.012 235);
  --night-800: oklch(84% 0.016 235);
  --mist-100: oklch(17% 0.014 255);
  --mist-200: oklch(34% 0.018 255);
  --border-subtle: oklch(74% 0.02 240);
  --shadow: 0 24px 60px oklch(20% 0.02 255 / 24%);
}

@media (prefers-color-scheme: light) {
  .tv-shell[data-theme='system'] {
    --surface: oklch(92% 0.012 235);
    --surface-raised: oklch(98% 0.006 235);
    --night-950: oklch(96% 0.008 235);
    --night-900: oklch(90% 0.012 235);
    --night-800: oklch(84% 0.016 235);
    --mist-100: oklch(17% 0.014 255);
    --mist-200: oklch(34% 0.018 255);
    --border-subtle: oklch(74% 0.02 240);
    --shadow: 0 24px 60px oklch(20% 0.02 255 / 24%);
  }
}

.tv-shell[data-density='compact'] {
  --space-tv-2: 16px;
  --space-tv-3: 24px;
  --space-tv-4: 32px;
  --space-tv-5: 48px;
}

.tv-shell[data-density='spacious'] {
  --space-tv-2: 32px;
  --space-tv-3: 48px;
  --space-tv-4: 64px;
  --space-tv-5: 80px;
}

.tv-shell[data-type-scale='large'] {
  --type-tv-hero: 600 50px/58px system-ui, sans-serif;
  --type-tv-title: 650 28px/36px system-ui, sans-serif;
  --type-tv-body: 400 20px/28px system-ui, sans-serif;
  --type-tv-label: 650 15px/20px system-ui, sans-serif;
}

.tv-shell[data-type-scale='larger'] {
  --type-tv-hero: 600 56px/64px system-ui, sans-serif;
  --type-tv-title: 650 32px/40px system-ui, sans-serif;
  --type-tv-body: 400 22px/30px system-ui, sans-serif;
  --type-tv-label: 650 17px/24px system-ui, sans-serif;
}

.tv-shell * {
  cursor: none;
}

.tv-nav {
  display: flex;
  gap: var(--space-tv-3);
  margin-bottom: var(--space-tv-5);
}

.tv-nav-item {
  font: var(--type-tv-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mist-200);
  background: transparent;
  border: 0;
  padding: 12px 20px;
  border-radius: var(--radius);
}

.tv-row {
  margin-bottom: var(--space-tv-5);
}

.tv-row-title {
  font: var(--type-tv-title);
  color: var(--mist-100);
  margin: 0 0 var(--space-tv-2);
}

.tv-rail {
  display: flex;
  gap: var(--space-tv-3);
  overflow: hidden;
}

.tv-tile {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: 220px;
  height: 124px;
  border-radius: var(--radius);
  border: 0;
  background: var(--surface-raised);
  color: var(--mist-200);
  font: var(--type-tv-hero);
  display: grid;
  place-items: center;
  /* Focus scale must not shift layout (tvOS SPEC): transform only. */
  transition: transform 120ms ease, box-shadow 120ms ease;
}

/* Focus-visible styling. The D-pad always shows where focus is, so we style
   :focus itself (not only :focus-visible) and lift the focused element. */
.tv-shell [data-tv-focusable]:focus {
  outline: none;
  box-shadow: 0 0 0 4px var(--tv-focus-ring);
}

.tv-tile:focus {
  transform: scale(1.06);
  box-shadow: 0 0 0 4px var(--tv-focus-ring), var(--shadow);
}

/* Hover-state removal: in the 10-foot shell nothing responds to hover; only
   focus drives affordances (ADR-0156 §2 "hover-state removal"). */
.tv-shell [data-tv-focusable]:hover:not(:focus) {
  transform: none;
  box-shadow: none;
}

.tv-detail,
.tv-settings {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: oklch(5% 0.02 255 / 0.72);
}

.tv-detail-panel,
.tv-settings-panel {
  text-align: center;
  padding: var(--space-tv-5);
}

.tv-detail-title {
  font: var(--type-tv-hero);
  color: var(--mist-100);
  margin: 0 0 var(--space-tv-2);
}

.tv-detail-hint {
  font: var(--type-tv-body);
  color: var(--mist-200);
  margin: 0 0 var(--space-tv-4);
}

.tv-detail-action {
  font: var(--type-tv-title);
  color: var(--night-950);
  background: var(--beam-500);
  border: 0;
  border-radius: var(--radius);
  padding: 16px 48px;
}

.tv-settings-panel {
  min-width: min(720px, calc(100vw - var(--space-tv-5) * 2));
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tv-settings-group {
  border: 0;
  margin: 0 0 var(--space-tv-3);
  padding: 0;
  text-align: left;
}

.tv-settings-group legend {
  font: var(--type-tv-label);
  color: var(--mist-200);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.tv-settings-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-tv-2);
}

.tv-setting-option {
  min-height: 68px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--mist-100);
  font: var(--type-tv-body);
}

.tv-setting-option[data-selected='true'] {
  border-color: var(--beam-500);
  color: var(--beam-500);
}

.tv-screensaver {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--night-950);
  animation: tv-screensaver-fade 600ms ease;
}

.tv-screensaver-mark {
  font: var(--type-tv-hero);
  letter-spacing: 0.08em;
  color: var(--mist-200);
  opacity: 0.5;
}

@keyframes tv-screensaver-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Playback surface (TVC-11). Full-screen transport over the <video>; the scrub
   bar, trickplay sprite, and track menu are remote-driven, no pointer. */
.tv-player {
  position: fixed;
  inset: 0;
  background: var(--night-950);
  display: grid;
}

.tv-player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.tv-player-chrome {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-tv-4) var(--space-tv-5) var(--space-tv-5);
  background: linear-gradient(to top, oklch(5% 0.02 255 / 0.85), transparent);
}

.tv-player-title {
  font: var(--type-tv-title);
  color: var(--mist-100);
  margin: 0 0 var(--space-tv-3);
}

.tv-player-scrubber {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  overflow: hidden;
}

.tv-player-scrubber[data-scrubbing='true'] {
  height: 12px;
}

.tv-player-scrubber-fill {
  height: 100%;
  background: var(--beam-500);
}

.tv-player-sprite {
  position: absolute;
  bottom: 120px;
  transform: translateX(-50%);
  border-radius: var(--radius);
  border: 2px solid var(--mist-100);
  box-shadow: var(--shadow);
  image-rendering: auto;
}

.tv-player-status {
  display: flex;
  gap: var(--space-tv-4);
  margin-top: var(--space-tv-2);
  font: var(--type-tv-label);
  color: var(--mist-200);
}

.tv-player-menu {
  position: absolute;
  inset: 0 0 auto auto;
  height: 100%;
  width: 420px;
  padding: var(--space-tv-4);
  background: oklch(8% 0.02 255 / 0.94);
  display: flex;
  flex-direction: column;
  gap: var(--space-tv-2);
}

.tv-player-menu-item {
  display: flex;
  gap: var(--space-tv-2);
  align-items: baseline;
  text-align: left;
  font: var(--type-tv-body);
  color: var(--mist-200);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
}

.tv-player-menu-item[data-focused='true'] {
  box-shadow: 0 0 0 4px var(--tv-focus-ring);
  color: var(--mist-100);
}

.tv-player-menu-item[aria-checked='true'] {
  color: var(--beam-500);
}

.tv-player-menu-kind {
  font: var(--type-tv-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mist-300, var(--mist-200));
  min-width: 5.5em;
}

.tv-player-error {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: 3rem;
  text-align: center;
  background: rgb(8 10 18 / 92%);
}

.tv-player-error button {
  min-width: 12rem;
  min-height: 3.5rem;
  margin-inline: auto;
}

.tv-tile-title {
  font: var(--type-tv-label);
  color: var(--mist-100);
  padding: 0 12px;
  text-align: center;
}

.tv-tile-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  background: var(--beam-500);
}
