:root {
  --bg: #0a0d14;
  --bg-deep: #05070b;
  --fg: #ffc752;
  --fg-dim: #b8893a;
  --fg-muted: #6a4f1f;
  --accent: #ff5b3a;
  --green: #73ff8c;
  --line: rgba(255, 199, 82, 0.18);
  --mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   CRT power-on intro — runs once on page load.
   Stage 1 (0–18%):  thin bright horizontal beam draws in (scaleX 0→1)
   Stage 2 (18–45%): beam expands vertically (scaleY → 1) and brightens
   Stage 3 (45–60%): white screen flash settles back
   Stage 4 (60–100%): black overlay fades, revealing the page
   ============================================================ */
.crt-poweron {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  pointer-events: none;
  animation: crt-poweron-fade 1.55s ease-out forwards;
}
.crt-poweron-beam {
  position: absolute;
  inset: 0;
  background: #fff;
  transform-origin: 50% 50%;
  transform: scale(0, 0.002);
  opacity: 0;
  animation: crt-poweron-beam 1.55s cubic-bezier(0.55, 0, 0.35, 1) forwards;
  box-shadow: 0 0 60px 20px rgba(255,255,255,0.5);
}
@keyframes crt-poweron-beam {
  0%   { transform: scale(0, 0.002); opacity: 0; }
  6%   { transform: scale(0.05, 0.002); opacity: 0.6; }
  18%  { transform: scale(1, 0.003); opacity: 1; }
  32%  { transform: scale(1, 0.01); opacity: 1; }
  45%  { transform: scale(1, 1); opacity: 0.95; }
  55%  { transform: scale(1, 1); opacity: 0.4; }
  70%  { transform: scale(1, 1); opacity: 0; }
  100% { transform: scale(1, 1); opacity: 0; }
}
@keyframes crt-poweron-fade {
  0%, 55%   { background: #000; }
  70%       { background: rgba(0, 0, 0, 0.55); }
  99%       { background: transparent; opacity: 1; visibility: visible; }
  100%      { background: transparent; opacity: 0; visibility: hidden; pointer-events: none; }
}
/* Reduce-motion users: skip the animation, page is just there. */
@media (prefers-reduced-motion: reduce) {
  .crt-poweron { display: none; }
}

html {
  background: var(--bg-deep);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

/* Font-size scaler — drives rem-sized type via html font-size base unit. */
html.font-sm { font-size: 14px; }
html.font-lg { font-size: 19px; }

/* High contrast mode — brighter fg, dropped subtleties, disabled bg noise.
   Goal: WCAG AAA contrast (7:1+) for body text without losing the brand. */
html.high-contrast {
  --fg: #ffe9a8;
  --fg-dim: #ffd97a;
  --fg-muted: #b08838;
  --bg: #000;
  --bg-deep: #000;
  --line: rgba(255, 233, 168, 0.55);
}
html.high-contrast .hero,
html.high-contrast .features,
html.high-contrast .feat,
html.high-contrast .shots,
html.high-contrast .manifest,
html.high-contrast .topbar,
html.high-contrast .footer {
  background-color: #000 !important;
  background-image: none !important;
  border-width: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 233, 168, 0.18);
}
/* Kill decorative animations + overlays — they cost contrast for vibe */
html.high-contrast .scanlines,
html.high-contrast .vignette,
html.high-contrast .flicker,
html.high-contrast .bg-canvas,
html.high-contrast .glitch::before,
html.high-contrast .glitch::after,
html.high-contrast .hero::before,
html.high-contrast .features::before,
html.high-contrast .shots::before,
html.high-contrast .manifest::before {
  display: none !important;
}
html.high-contrast .section-title,
html.high-contrast .feat h3 {
  text-shadow: none;
}
html.high-contrast .glitch {
  text-shadow: none;
}

body {
  position: relative;
  overflow-x: hidden;
  padding: 1rem 1rem 4rem;
  /* Transparent so the bg-canvas (z-index: -1) shines through */
  background: transparent;
}

/* Signature glyph-tile background canvas — port of glitch_bg.gdshader */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
  background:
    radial-gradient(ellipse at center, var(--bg) 0%, var(--bg-deep) 75%, #000 100%);
}

/* CRT scanlines overlay */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.18) 3px,
      rgba(0,0,0,0.18) 3px
    );
  mix-blend-mode: multiply;
}

/* Soft vignette — heavier than a normal page, sells the curved-CRT pull-in */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 96;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 95% at 50% 50%, transparent 45%, rgba(0,0,0,0.45) 80%, rgba(0,0,0,0.85) 100%);
}

/* Subtle CRT flicker */
.flicker {
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: rgba(255, 199, 82, 0.012);
  animation: flick 5.2s steps(2) infinite;
}
@keyframes flick {
  0%, 96%, 100% { opacity: 0; }
  97% { opacity: 0.6; }
  98% { opacity: 0.1; }
  99% { opacity: 0.4; }
}

/* Top bar — 3-column grid: [brand] [nav, centered] [a11y].
   Grid keeps the nav truly centered regardless of brand/a11y widths. */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
}
.topbar > .brand   { justify-self: start; }
.topbar > .topnav  { justify-self: center; }
.topbar > .a11y    { justify-self: end; }
.brand {
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--fg);
  text-shadow: 0 0 8px rgba(255,199,82,0.5);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { color: var(--fg); text-shadow: 0 0 12px rgba(255,199,82,0.8); }

/* Topbar nav */
.topnav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}
.topnav a {
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.topnav a:hover {
  color: var(--fg);
  border-color: var(--line);
  background: rgba(255, 199, 82, 0.04);
}
.topnav a:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  color: var(--fg);
}
.status-text { font-variant-numeric: tabular-nums; }

/* A11y controls cluster — font-size buttons + contrast toggle. */
.a11y {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.a11y-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  min-width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.a11y-btn:hover {
  color: var(--fg);
  border-color: var(--fg-dim);
  background: rgba(255, 199, 82, 0.06);
}
.a11y-btn:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
.a11y-btn.is-active {
  color: var(--fg);
  border-color: var(--fg);
  background: rgba(255, 199, 82, 0.12);
}
.a11y-btn[data-font="sm"] { font-size: 0.6rem; }
.a11y-btn[data-font="lg"] { font-size: 0.95rem; font-weight: 700; }
.a11y-btn[data-contrast] { font-size: 0.95rem; }

/* Skip-to-content — visible only when focused via keyboard */
.skip-link {
  position: fixed;
  top: -100px;
  left: 8px;
  z-index: 250;
  background: var(--fg);
  color: #000;
  padding: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 8px;
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Universal focus-visible — visible amber ring for keyboard users */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
main:focus-visible { outline: none; }  /* main only gets focus for skip-link target */
.status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green), 0 0 12px var(--green);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Shared terminal-style panel backdrop. Every content block gets this so
   the glyph-tile bg never fights text. Slight alpha lets the pattern bleed
   through so blocks read as terminal windows over the screen, not opaque
   stickers.

   Visual stack on each panel:
     1. background-color: dark-fill terminal
     2. background-image: top-highlight gradient → curvature illusion
     3. inset box-shadow: top edge gleam + bottom edge shadow (curved-glass feel)
     4. ::before pseudo: animated scanline-tear glitch
     5. ::after pseudo: glyph corner tick mark
     6. h3 / .section-title: chromatic-aberration text-shadow
*/
.hero, .features, .shots, .manifest, .topbar, .footer {
  position: relative;
  border-radius: 4px;
  border: 1px solid var(--line);
  background-color: rgba(5, 7, 11, 0.92);
  background-image:
    linear-gradient(180deg,
      rgba(255, 199, 82, 0.025) 0%,
      transparent 25%,
      transparent 75%,
      rgba(0, 0, 0, 0.22) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 199, 82, 0.07),
    inset 0 -2px 0 rgba(0, 0, 0, 0.6),
    inset 0 0 80px rgba(0, 0, 0, 0.4),
    0 0 14px rgba(255, 199, 82, 0.04);
  overflow: hidden;
}

/* Big panels get the animated scanline glitch overlay */
.hero::before,
.features::before,
.shots::before,
.manifest::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 47%,
    rgba(255, 199, 82, 0.05) 48%,
    rgba(255, 199, 82, 0.18) 50%,
    rgba(255, 199, 82, 0.05) 52%,
    transparent 53%
  );
  mix-blend-mode: screen;
  animation: panel-scan 9s linear infinite;
  z-index: 0;
}
.features::before { animation-duration: 11s; animation-delay: -3s; }
.shots::before    { animation-duration: 8s;  animation-delay: -5s; }
.manifest::before { animation-duration: 12s; animation-delay: -2s; }

@keyframes panel-scan {
  0%   { transform: translateY(-110%); opacity: 0; }
  6%   { opacity: 0.7; }
  94%  { opacity: 0.7; }
  100% { transform: translateY(110%); opacity: 0; }
}

/* Corner glyph tick — terminal frame marker */
.hero::after,
.features::after,
.shots::after,
.manifest::after {
  content: "▘ ▝";
  position: absolute;
  top: 4px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-dim);
  opacity: 0.45;
  pointer-events: none;
  letter-spacing: 0;
  z-index: 1;
  white-space: nowrap;
}

/* Make sure panel content paints above the scanline ::before */
.hero > *, .features > *, .shots > *, .manifest > * {
  position: relative;
  z-index: 2;
}

/* Chromatic aberration on section titles + feat headings — RGB split */
.section-title,
.feat h3 {
  text-shadow:
    -0.6px 0 rgba(255, 91, 58, 0.55),
     0.6px 0 rgba(115, 255, 140, 0.45);
}

/* HERO */
.hero {
  padding: 2.5rem 2rem 3rem;
  text-align: left;
}
.prompt {
  color: var(--fg-dim);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.glitch {
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.95;
  position: relative;
  color: var(--fg);
  text-shadow:
    0 0 12px rgba(255,199,82,0.4),
    0 0 24px rgba(255,199,82,0.2);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.glitch::before {
  color: var(--accent);
  transform: translate(-2px, 0);
  mix-blend-mode: screen;
  animation: glitch-1 4.5s infinite steps(1);
  clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
  opacity: 0.7;
}
.glitch::after {
  color: var(--green);
  transform: translate(2px, 0);
  mix-blend-mode: screen;
  animation: glitch-2 5.7s infinite steps(1);
  clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
  opacity: 0.6;
}
@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0, 0); }
  92% { transform: translate(-3px, 1px); }
  94% { transform: translate(2px, -1px); }
  96% { transform: translate(-1px, 0); }
}
@keyframes glitch-2 {
  0%, 88%, 100% { transform: translate(0, 0); }
  91% { transform: translate(2px, -1px); }
  93% { transform: translate(-2px, 0); }
  95% { transform: translate(1px, 1px); }
}

/* Inline 3D spinning tower — real Three.js port of res://scripts/tower/segment.gd.
   8-panel cylinder, red wireframe, cyan ghost, 90° elastic-snap rotations. */
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.4rem, 1.5vw, 1.2rem);
}

.tower {
  --tower-w: clamp(2rem, 5.5vw, 3.2rem);
  display: inline-block;
  width: var(--tower-w);
  height: calc(var(--tower-w) * 2.4);
  cursor: pointer;
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 0;
  outline: none;
  vertical-align: middle;
  position: relative;
  filter: drop-shadow(0 0 14px rgba(115, 255, 140, 0.22));
}
.tower:focus-visible {
  filter: drop-shadow(0 0 18px rgba(115, 255, 140, 0.55));
}
#tower-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Faint base plate to suggest the segment grounding */
.tower::after {
  content: "";
  position: absolute;
  bottom: 4%;
  left: 12%;
  right: 12%;
  height: 4px;
  background: radial-gradient(ellipse at center, rgba(255, 199, 82, 0.32), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.6rem);
  font-weight: 400;
  color: var(--fg-dim);
  letter-spacing: 0.15em;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}
.tagline {
  font-size: 1rem;
  color: var(--fg);
  opacity: 0.85;
  max-width: 30em;
  margin-bottom: 2rem;
}

/* CTA badges */
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.badge {
  display: inline-flex;
  flex-direction: column;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.badge::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--fg);
  transform: translateY(100%);
  transition: transform 0.2s ease;
  z-index: 0;
}
.badge:hover::before { transform: translateY(0); }
.badge:hover { color: var(--bg); }
.badge span { position: relative; z-index: 1; }
.badge-line-1 { font-size: 0.65rem; opacity: 0.7; }
.badge-line-2 { font-size: 1rem; font-weight: 700; }

/* Disabled badges — coming-soon state. Visually dim + non-interactive +
   shows a small SOON pill in the corner. */
.badge.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: var(--fg-muted);
  color: var(--fg-muted);
  pointer-events: none;          /* kill hover + clicks */
  background-image:
    repeating-linear-gradient(135deg,
      rgba(255, 199, 82, 0.04) 0,
      rgba(255, 199, 82, 0.04) 6px,
      transparent 6px,
      transparent 12px);
}
.badge.is-disabled .badge-line-2 { color: var(--fg-muted); }
.badge.is-disabled::before { display: none; }   /* nuke the slide-fill hover */
.badge-soon {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  color: var(--fg);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.cta-note {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.2em;
  margin-top: 0.5rem;
}

/* Features carousel — panel container with horizontal scroll-snap rail. */
.features {
  padding: 1.75rem 1.5rem 1.25rem;
}

/* Shared rail header: section title + prev/next buttons */
.rail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.rail-header .section-title { margin: 0; }
.rail-nav {
  display: flex;
  gap: 0.4rem;
}
.rail-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.rail-btn:hover {
  color: var(--fg);
  border-color: var(--fg-dim);
  background: rgba(255, 199, 82, 0.06);
}
.rail-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.rail-btn:disabled { opacity: 0.35; cursor: default; }

/* The horizontal track — scroll-snap, edge fade mask, hidden ugly scrollbar */
.feat-rail {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.25rem 0.125rem 0.75rem;
  scroll-snap-type: x mandatory;
  scroll-padding: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
.feat-rail::-webkit-scrollbar { height: 6px; }
.feat-rail::-webkit-scrollbar-thumb { background: var(--fg-dim); border-radius: 3px; }
.feat-rail::-webkit-scrollbar-track { background: transparent; }

/* Each feature card — fixed width, scroll-snap, terminal-card look */
.feat {
  flex: 0 0 auto;
  width: clamp(220px, 28vw, 270px);
  scroll-snap-align: start;
  padding: 1.25rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
}
.feat:hover { border-color: var(--fg-dim); background: rgba(0, 0, 0, 0.7); }
.feat-num {
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.25em;
  margin-bottom: 0.5rem;
}
.feat h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
  color: var(--fg);
}
.feat p {
  font-size: 0.85rem;
  color: var(--fg-dim);
  line-height: 1.55;
}

/* Section title */
.section-title {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--fg-dim);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}

.shots {
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
}
/* Screenshots gallery — horizontal scroll-snap rail.
   Each card frames a phone screenshot like a stripped-down device chrome. */
.screens-rail {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.5rem 0.25rem 1rem;
  scroll-snap-type: x mandatory;
  scroll-padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim) transparent;
  /* Reveal that there's more content off-screen via mask fade on edges. */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}
.screens-rail::-webkit-scrollbar {
  height: 6px;
}
.screens-rail::-webkit-scrollbar-thumb {
  background: var(--fg-dim);
  border-radius: 3px;
}
.screens-rail::-webkit-scrollbar-track {
  background: transparent;
}

.screen-card {
  flex: 0 0 auto;
  width: clamp(180px, 22vw, 240px);
  scroll-snap-align: start;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  margin: 0;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(255, 199, 82, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.screen-card:hover,
.screen-card:focus-within {
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.9),
    0 0 24px rgba(255, 199, 82, 0.18),
    0 12px 32px rgba(0, 0, 0, 0.7);
}
.screen-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
  background: #000;
}
.screen-card .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.4rem 0.75rem 0.6rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 30%, transparent);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
  text-align: center;
  font-family: var(--mono);
  pointer-events: none;
}

.cs-sub {
  font-size: 0.7rem;
  color: var(--fg-muted);
  letter-spacing: 0.2em;
  margin-top: 0.5rem;
  text-transform: uppercase;
}

/* Manifest terminal block */
.manifest {
  padding: 2rem 1.5rem;
}
.terminal {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  padding: 1.5rem;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.875rem;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.7;
}
.terminal::selection { background: var(--fg); color: var(--bg); }

/* Footer */
.footer {
  margin-top: 2rem;
  padding: 1.5rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.footer-h {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.2em;
  margin-bottom: 0.75rem;
}
.footer-col a {
  display: block;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--fg); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.15em;
}
.cursor {
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* Mobile tweaks (≤ 600px) */
@media (max-width: 600px) {
  body { padding: 0.5rem 0.5rem 3rem; }

  /* Topbar — tighten everything; switch to flex-wrap so brand + nav + a11y
     stack into rows cleanly when 3 columns won't fit */
  .topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    font-size: 0.6rem;
    gap: 0.4rem 0.6rem;
    letter-spacing: 0.08em;
  }
  .topbar > .brand,
  .topbar > .topnav,
  .topbar > .a11y { justify-self: auto; }
  .brand { letter-spacing: 0.18em; font-size: 0.75rem; }
  .topnav { gap: 0.1rem; }
  .topnav a { padding: 0.25rem 0.4rem; font-size: 0.6rem; letter-spacing: 0.1em; }
  .a11y { gap: 0.15rem; }
  .a11y-btn { padding: 0.15rem 0.35rem; min-width: 1.55rem; height: 1.55rem; font-size: 0.65rem; }
  .a11y-btn[data-font="sm"] { font-size: 0.55rem; }
  .a11y-btn[data-font="lg"] { font-size: 0.85rem; }
  .a11y-btn[data-contrast] { font-size: 0.85rem; }

  /* Main flow */
  main { padding: 1rem 0; gap: 0.75rem; }

  /* Hero — smaller padding, tighter title row */
  .hero { padding: 1.5rem 1.25rem 2rem; }
  .glitch { font-size: clamp(2.2rem, 13vw, 3.5rem); letter-spacing: 0.02em; }
  .subtitle { font-size: clamp(0.85rem, 3.5vw, 1.1rem); margin-bottom: 1rem; }
  .tagline { font-size: 0.85rem; margin-bottom: 1.25rem; }
  .title-row { gap: 0.5rem; }

  /* Buttons / badges */
  .cta { gap: 0.5rem; }
  .badge { padding: 0.7rem 1rem; }
  .badge-line-1 { font-size: 0.6rem; }
  .badge-line-2 { font-size: 0.85rem; }
  .cta-note { font-size: 0.65rem; }

  /* Feature panels */
  .feat { padding: 1.25rem 1rem 1.25rem; }
  .feat h3 { font-size: 0.95rem; }
  .feat p { font-size: 0.825rem; }

  /* Section titles */
  .section-title { font-size: 0.8rem; }

  /* Screens rail */
  .screens-rail { gap: 0.6rem; padding: 0.25rem 0.125rem 0.75rem; }
  .screen-card { width: clamp(150px, 50vw, 200px); border-radius: 10px; }
  .screen-card .caption { padding: 1rem 0.5rem 0.5rem; font-size: 0.55rem; letter-spacing: 0.15em; }

  /* Manifest terminal — shrink the pre block padding */
  .manifest { padding: 1.25rem 1rem; }
  .terminal { padding: 1rem; font-size: 0.75rem; }

  /* Footer */
  .footer { padding: 1.25rem 1rem; margin-top: 1rem; }
  .footer-inner { gap: 1.25rem; padding-bottom: 1.25rem; }
  .footer-h { font-size: 0.65rem; }
  .footer-col a { font-size: 0.8rem; }
  .footer-bottom { font-size: 0.65rem; }

  /* Panel pseudo overlays — smaller corner glyphs */
  .hero::after, .features::after, .shots::after, .manifest::after {
    font-size: 0.6rem;
    top: 3px;
    left: 6px;
    right: 6px;
  }
  /* Carousel mobile tweaks */
  .features { padding: 1.25rem 1rem 1rem; }
  .rail-header { margin-bottom: 0.75rem; }
  .rail-btn { width: 1.7rem; height: 1.7rem; font-size: 0.65rem; }
  .feat-rail { gap: 0.6rem; }
  .feat { width: clamp(180px, 70vw, 230px); padding: 1rem 0.85rem; }
}

/* Extra-tight (≤ 380px iPhone SE / small Android) */
@media (max-width: 380px) {
  .topbar { padding: 0.35rem 0.5rem; gap: 0.3rem 0.4rem; }
  .topnav a { padding: 0.2rem 0.3rem; font-size: 0.55rem; }
  .a11y-btn { min-width: 1.4rem; height: 1.4rem; }
  .glitch { font-size: 2rem; }
  .hero { padding: 1.25rem 1rem 1.75rem; }
  .feat { padding: 1rem 0.85rem; }
}

/* Reduced motion — disable all decorative animations. Functional ones in JS
   already gate on this same media query (tower3d.js, bg.js). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .glitch::before, .glitch::after,
  .dot, .flicker, .cursor,
  .hero::before, .features::before, .shots::before, .manifest::before {
    animation: none !important;
  }
  .crt-poweron { display: none; }
}
