/* ============================================================
   rexyrex.github.io — landing page scroll story
   Loaded only by /index.html, after index.css and navbar.css.
   Tokens come from index.css; this file adds the hero, the chapters
   (typing editor, balloon sky, phone track, waveform) and the motion
   gating that /js/landing.js relies on.
   ============================================================ */

/* ---------- 0. Motion gating ---------------------------------- */
/* With JS on and motion allowed, reveal targets start hidden and
   landing.js animates them in. If GSAP never arrives (html.motion-off)
   or the visitor prefers reduced motion, everything is simply visible.
   [data-lines] / [data-chars] elements are revealed by SplitText masks
   instead, so they are left alone here. */

@media (prefers-reduced-motion: no-preference) {
  html.js:not(.motion-off) [data-hero],
  html.js:not(.motion-off) .hero-title,
  html.js:not(.motion-off) [data-reveal],
  html.js:not(.motion-off) [data-reveal-group] > :not([data-lines]):not([data-chars]) {
    opacity: 0;
  }
}

/* ---------- 1. Page frame ------------------------------------- */

body.landing {
  padding-top: 0;
}

.landing-main {
  position: relative;
  z-index: 1;
}

/* Fixed layers behind the page (painted in DOM order: aurora → canvas → flash). */
.aurora,
.hero-canvas,
.hero-flash {
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

.aurora {
  inset: 0;
  overflow: hidden;
}

.aurora i {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  mix-blend-mode: screen;
  will-change: transform;
}

.aurora i:nth-child(1) {
  left: -12vmax;
  top: -22vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%);
  animation: auroraA 22s ease-in-out infinite alternate;
}

.aurora i:nth-child(2) {
  right: -18vmax;
  top: -12vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--tok-num) 28%, transparent), transparent 65%);
  animation: auroraB 27s ease-in-out infinite alternate;
}

.aurora i:nth-child(3) {
  left: 28vw;
  bottom: -34vmax;
  background: radial-gradient(circle, color-mix(in srgb, var(--tok-kw) 20%, transparent), transparent 65%);
  animation: auroraC 31s ease-in-out infinite alternate;
}

@keyframes auroraA {
  to {
    transform: translate(20vmax, 12vmax) scale(1.15);
  }
}

@keyframes auroraB {
  to {
    transform: translate(-16vmax, 16vmax) scale(0.9);
  }
}

@keyframes auroraC {
  to {
    transform: translate(-22vmax, -10vmax) scale(1.2);
  }
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .aurora i {
    mix-blend-mode: multiply;
    opacity: 0.55;
    filter: blur(80px) saturate(1.2);
  }
}

:root[data-theme="light"] .aurora i {
  mix-blend-mode: multiply;
  opacity: 0.55;
  filter: blur(80px) saturate(1.2);
}

.hero-canvas {
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-flash {
  left: 50%;
  top: 50%;
  width: 70vmin;
  height: 70vmin;
  margin: -35vmin 0 0 -35vmin;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 70%, #fff) 0%, color-mix(in srgb, var(--accent) 45%, transparent) 26%, transparent 66%);
  will-change: transform, opacity;
}

html.motion-off .hero-canvas,
html.motion-off .hero-flash,
html.motion-off .aurora {
  display: none;
}

/* ---------- 2. Hero ------------------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--statusbar-h) + 1rem);
}

.hero-inner {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* The particle rex is drawn by the fixed canvas at this box's centre. */
.hero-visual {
  position: relative;
  height: min(38vh, 380px);
  height: min(38svh, 380px);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.hero-rex-fallback {
  width: min(60vw, 300px);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.6s var(--ease);
}

html.js:not(.motion-off) .hero-rex-fallback {
  opacity: 0;
}

html.js .hero-rex-fallback.is-visible {
  opacity: 1;
}

/* Long-press target for the easter egg (see /js/index.js). Invisible;
   the glow from easter-egg.css shows up as a ring while holding. */
.hero .hero-logo {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(52vw, 260px);
  height: min(52vw, 260px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero .hero-logo:hover {
  transform: none;
  border-color: transparent;
}

.hero-copy {
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding-top: 1rem;
  text-align: center;
  will-change: transform, opacity;
}

.hero-eyebrow {
  margin-bottom: 1.1rem;
}

.hero-eyebrow .char {
  display: inline-block;
}

html.motion-on .hero-eyebrow::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.2em;
  vertical-align: -0.12em;
  background: var(--accent);
  animation: caretBlink 1s steps(2, start) infinite;
}

/* .hero h1 in index.css caps the width at 18ch; this title needs the full copy width. */
.hero h1.hero-title {
  font-size: clamp(2rem, 1rem + 4vw, 4.4rem);
  letter-spacing: -0.045em;
  line-height: 1.06;
  margin: 0 auto 1.35rem;
  max-width: none;
  perspective: 700px;
}

.hero-title .word {
  white-space: nowrap;
}

.hero-title .char {
  display: inline-block;
  will-change: transform, opacity;
}

.hero-lede {
  font-size: clamp(1rem, 0.92rem + 0.45vw, 1.2rem);
  color: var(--fg-muted);
  max-width: 56ch;
  margin: 0 auto;
}

.hero-lede strong {
  color: var(--fg);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.75rem;
}

.hero-cue {
  margin: clamp(1.25rem, 4vh, 3rem) auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.hero-cue-line {
  position: relative;
  width: 1px;
  height: 2.6rem;
  background: var(--line-strong);
  overflow: hidden;
}

.hero-cue-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: cueDrop 1.8s var(--ease) infinite;
}

@keyframes cueDrop {
  to {
    top: 100%;
  }
}

/* ---------- 3. Statement -------------------------------------- */
/* Pinned for a while once centred: the words are lit and the rex bursts. */

.statement {
  min-height: 60vh;
  min-height: 60svh;
  display: grid;
  align-items: center;
  padding: clamp(3rem, 8vh, 6rem) 0;
}

.statement-text {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(1.3rem, 0.85rem + 2.3vw, 2.7rem);
  letter-spacing: -0.03em;
  line-height: 1.32;
  max-width: 30ch;
  margin: 0 auto;
  text-align: center;
  text-wrap: balance;
  color: var(--fg);
  will-change: transform, opacity, filter;
}

.statement-text .st-word {
  display: inline-block;
  will-change: opacity, transform;
}

/* ---------- 4. Chapters --------------------------------------- */

.chapter {
  position: relative;
}

.chapter-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding-top: var(--nav-h);
  padding-bottom: var(--statusbar-h);
  background: var(--bg);
}

html.motion-off .stage {
  height: auto;
  min-height: 0;
  padding-top: clamp(3rem, 8vw, 5rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.chapter-copy {
  max-width: 34rem;
}

.chapter-copy .eyebrow {
  display: block;
  margin-bottom: 0.9rem;
}

.chapter-copy h2 {
  font-size: clamp(1.7rem, 1.05rem + 2.6vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 1rem;
  max-width: 17ch;
}

/* SplitText line masks (mask: "lines") need the lines to be blocks. */
.chapter-copy h2 .line {
  display: block;
}

.chapter-copy p {
  color: var(--fg-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0;
}

.chapter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 1.6rem;
}

/* ---------- 5. /typing/ — editor mockup (types on its own) ------ */

.chapter-typing {
  padding: clamp(4rem, 10vh, 7rem) 0;
}

.editor {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  overflow: hidden;
  min-width: 0;
}

.editor-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.editor-bar::-webkit-scrollbar {
  display: none;
}

.editor-tab {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.55rem 1rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--fg-faint);
  border-right: 1px solid var(--line);
  border-top: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.editor-tab b {
  font-weight: 500;
}

.editor-tab i {
  font-style: normal;
  font-size: 0.66rem;
  opacity: 0.75;
}

.editor-tab.is-active {
  color: var(--fg);
  background: var(--bg-raised);
  border-top-color: var(--accent);
}

.editor-bar-spacer {
  flex: 1;
}

.editor-bar-meta {
  align-self: center;
  padding: 0 0.9rem;
  font-size: 0.66rem;
  color: var(--fg-faint);
  white-space: nowrap;
}

.editor .editor-body {
  margin: 0;
  padding: 1.4rem 1.5rem 1.6rem;
  min-height: 9.5rem;
  font-size: clamp(0.95rem, 0.8rem + 0.5vw, 1.2rem);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  color: var(--fg);
}

.editor-typed {
  color: var(--fg);
}

.editor-rest {
  color: var(--fg-faint);
}

.editor-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  vertical-align: -0.18em;
  margin: 0 1px;
  background: var(--accent);
  animation: caretBlink 1s steps(2, start) infinite;
}

@keyframes caretBlink {
  50% {
    opacity: 0;
  }
}

.editor-status {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0.45rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--bg-inset);
  font-size: 0.72rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
}

.editor-status b {
  font-weight: 500;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.editor-status-spacer {
  flex: 1;
}

.editor-status-mode {
  color: var(--accent);
}

/* ---------- 6. /deadlyBalloons/ — the sky ---------------------- */

.stage-sky {
  background:
    radial-gradient(ellipse 90% 55% at 50% 100%, var(--accent-soft), transparent 70%),
    var(--bg-inset);
}

.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bl {
  position: absolute;
  left: var(--x);
  top: var(--y, 100%);
  width: var(--w);
  height: var(--w);
  will-change: transform;
}

.bl-far {
  filter: blur(1.4px);
  opacity: 0.72;
}

.bl-sway {
  display: block;
  width: 100%;
  height: 100%;
  animation: sway 6s ease-in-out infinite alternate;
  animation-delay: var(--sd, 0s);
  transform-origin: 50% 90%;
}

.bl img {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.35));
  -webkit-user-drag: none;
  pointer-events: auto;
  cursor: crosshair;
}

.bl-far img {
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.25));
}

.bl[data-scripted] img,
.bl[data-popped] img {
  pointer-events: none;
  cursor: default;
}

@keyframes sway {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(6deg);
  }
}

/* Pop pieces: a ring flash, shards in the balloon's colour, a score float. */
.pop-ring {
  position: absolute;
  left: 20%;
  top: 15%;
  width: 60%;
  height: 60%;
  border: 3px solid #fff;
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 24px 4px rgba(255, 255, 255, 0.35), inset 0 0 18px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.shard {
  position: absolute;
  left: 46%;
  top: 40%;
  width: 13%;
  height: 7%;
  border-radius: 45%;
  background: var(--shard, #2a9a35);
  opacity: 0;
  pointer-events: none;
}

.pop-score {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(14px, calc(var(--w) * 0.14), 30px);
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.sky-hud {
  position: absolute;
  z-index: 2;
  top: calc(var(--nav-h) + 1rem);
  left: var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  pointer-events: none;
}

.sky-hud b {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sky-hud-hint {
  color: var(--fg-faint);
}

.sky-rex {
  position: absolute;
  bottom: calc(var(--statusbar-h) - 12px);
  width: clamp(120px, 18vw, 230px);
  height: auto;
  z-index: 20;
  will-change: transform;
  -webkit-user-drag: none;
}

.sky-rex-green {
  left: 2%;
}

.sky-rex-red {
  right: 2%;
}

html.motion-off .stage-sky {
  min-height: 80vh;
}

html.motion-off .bl {
  top: auto;
  bottom: var(--b, 10%);
}

html.motion-off .sky-rex-red {
  transform: scaleX(-1);
}

html.motion-off .sky-hud-hint {
  display: none;
}

.chapter-copy-glass {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 36rem;
  text-align: center;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .chapter-copy-glass {
    background: var(--bg);
  }
}

.chapter-copy-glass h2,
.chapter-copy-glass p {
  margin-left: auto;
  margin-right: auto;
}

.chapter-copy-glass .chapter-actions {
  justify-content: center;
}

/* ---------- 7. /apps/ — phones on a horizontal track ---------- */

.stage-apps {
  align-content: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: clamp(1.25rem, 4vh, 3rem);
}

.chapter-copy-wide {
  width: 100%;
  max-width: var(--measure);
}

.chapter-copy-wide h2 {
  max-width: none;
}

.apps-track {
  --track-pad: max(var(--gutter), calc((100vw - var(--measure)) / 2 + var(--gutter)));
  display: flex;
  align-items: flex-start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  width: max-content;
  padding: 0.75rem var(--track-pad) 1.25rem;
  will-change: transform;
}

.phone {
  position: relative;
  flex: 0 0 auto;
  width: clamp(190px, 19vw, 228px);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
  transform-style: preserve-3d;
}

.phone:hover {
  text-decoration: none;
}

/* Hardware */
.phone-frame {
  display: block;
  position: relative;
  border-radius: 38px;
  padding: 9px;
  background: linear-gradient(155deg, #4a5156 0%, #1a1e21 38%, #0b0d0f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 30px 60px -28px rgba(0, 0, 0, 0.85),
    var(--shadow);
  transform-style: preserve-3d;
  will-change: transform;
  transition: box-shadow 0.25s var(--ease);
}

.phone-frame::before,
.phone-frame::after {
  content: "";
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: #2b3136;
}

.phone-frame::before {
  left: -3px;
  top: 22%;
  height: 11%;
}

.phone-frame::after {
  right: -3px;
  top: 27%;
  height: 16%;
}

.phone:hover .phone-frame,
.phone:focus-visible .phone-frame {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 34px 70px -28px rgba(0, 0, 0, 0.9),
    0 0 0 5px color-mix(in srgb, var(--tint) 24%, transparent),
    var(--shadow);
}

.phone-glare {
  position: absolute;
  inset: 0;
  border-radius: 38px;
  pointer-events: none;
  background: radial-gradient(55% 45% at var(--gx, 28%) var(--gy, 18%), rgba(255, 255, 255, 0.16), transparent 70%);
  mix-blend-mode: screen;
}

/* Screen */
.phone-screen {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  aspect-ratio: 9 / 19.5;
  border-radius: 30px;
  padding: 9px 12px 10px;
  background: var(--bg-inset);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
  color: var(--fg-muted);
}

.phone-screen::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 30%;
  height: 11px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #0a0c0d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 3;
}

.phone-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.25rem;
}

.phone-label b {
  font-weight: 600;
  color: var(--fg);
  font-size: 0.98rem;
  line-height: 1.3;
}

.phone-label i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--tint);
}

.phone-stores {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--fg-faint);
}

/* UI kit shared by the mockups: one tint per app. */
.ui-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  color: var(--fg);
  padding: 2px 4px 0;
}

.ui-status b {
  font-weight: 600;
}

.ui-status-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ui-sig {
  display: block;
  width: 13px;
  height: 8px;
  background: repeating-linear-gradient(to right, currentColor 0 2.2px, transparent 2.2px 3.3px);
  clip-path: polygon(0 62%, 100% 0, 100% 100%, 0 100%);
}

.ui-wifi {
  display: block;
  position: relative;
  width: 11px;
  height: 11px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
}

.ui-wifi::after {
  content: "";
  position: absolute;
  left: 2.5px;
  top: 3.5px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

.ui-bat {
  display: block;
  position: relative;
  width: 16px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.ui-bat::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  right: 3px;
  border-radius: 1px;
  background: var(--accent);
}

.ui-bat::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 1.5px;
  width: 2px;
  height: 3.5px;
  border-radius: 0 1px 1px 0;
  background: currentColor;
}

.ui-appbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--fg);
  padding: 4px 2px 0;
}

.ui-appbar b {
  font-weight: 600;
}

.ui-icon {
  font-style: normal;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  color: var(--tint);
  font-size: 11px;
}

.ui-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.ui-card-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--tint) 22%, var(--bg-raised)), var(--bg-raised) 70%);
}

.ui-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ui-kicker {
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.ui-big {
  font-size: 22px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.ui-big small {
  font-size: 10px;
  font-weight: 500;
  color: var(--tint);
  margin-right: 4px;
  letter-spacing: 0;
}

.ui-row-stats {
  display: flex;
  gap: 10px;
  font-size: 8.5px;
}

.ui-row-stats b {
  color: var(--fg);
  font-weight: 500;
}

.ui-bar {
  display: block;
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.ui-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--tint);
  transition: width 1.1s var(--ease);
}

.is-live .ui-bar > span,
html.motion-off .ui-bar > span {
  width: var(--p);
}

.ui-bar-wide {
  height: 6px;
}

.ui-fine {
  font-size: 8.5px;
  font-weight: 400;
  font-style: normal;
  color: var(--fg-faint);
}

.ui-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  padding: 1px 7px;
  border-radius: 999px;
}

.ui-test {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
}

.ui-test i {
  font-style: normal;
  width: 38px;
  color: var(--fg-muted);
}

.ui-test b {
  width: 46px;
  white-space: nowrap;
  text-align: right;
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ui-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ui-chips span {
  font-size: 8.5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg-muted);
  white-space: nowrap;
}

.ui-chips span.on {
  background: var(--tint);
  border-color: var(--tint);
  color: var(--bg);
  font-weight: 600;
}

.ui-sheet {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.ui-sheet-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ui-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 25%, transparent);
}

.ui-sheet-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ui-sheet-text b {
  color: var(--fg);
  font-weight: 600;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-sheet-text i {
  font-style: normal;
  font-size: 8px;
  color: var(--fg-faint);
}

.ui-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ui-rows > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
  color: var(--fg);
  padding: 4px 6px;
  border-radius: 7px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
}

.ui-rows b {
  margin-left: auto;
  color: var(--fg-faint);
  font-weight: 400;
}

.ui-tag {
  font-style: normal;
  font-size: 7.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint);
}

.ui-nav {
  margin-top: auto;
  display: flex;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
}

.ui-nav i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
}

.ui-nav i.on {
  width: 22px;
  background: var(--tint);
}

/* QR scanner */
.qr-cam {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 0.92;
  border-radius: 12px;
  background: radial-gradient(80% 80% at 50% 40%, #2b3238, #0d1012);
  overflow: hidden;
}

.qr {
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  gap: 1px;
  width: 60%;
  aspect-ratio: 1;
  padding: 6px;
  background: #fff;
  border-radius: 6px;
}

.qr i {
  display: block;
  background: transparent;
}

.qr i.on {
  background: #111;
}

.qr-frame {
  position: absolute;
  inset: 10%;
}

.qr-frame i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid var(--tint);
}

.qr-frame i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 4px 0 0 0; }
.qr-frame i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 4px 0 0; }
.qr-frame i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 4px; }
.qr-frame i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 4px 0; }

.qr-scan {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 12%;
  height: 2px;
  background: var(--tint);
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--tint) 60%, transparent);
  animation: scan 2.2s ease-in-out infinite alternate;
}

@keyframes scan {
  to {
    top: 86%;
  }
}

/* Reverse image search */
.ris-photo {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, #8fc6ef 0%, #e0b072 58%, #6b4f2a 100%);
}

.ris-sun {
  position: absolute;
  left: 66%;
  top: 12%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff2c0;
  box-shadow: 0 0 20px 6px rgba(255, 236, 170, 0.55);
}

.ris-mtn {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62%;
  background: #35506a;
  clip-path: polygon(0 100%, 18% 40%, 34% 70%, 52% 20%, 70% 62%, 86% 35%, 100% 100%);
}

.ris-mtn-2 {
  height: 42%;
  background: #22364a;
  clip-path: polygon(0 100%, 12% 60%, 30% 30%, 46% 75%, 62% 45%, 80% 80%, 100% 50%, 100% 100%);
}

.ris-crop {
  position: absolute;
  inset: 14%;
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  box-shadow: 0 0 0 200px rgba(0, 0, 0, 0.18);
}

.ris-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.ris-results i {
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  background: linear-gradient(160deg, hsl(var(--hue) 55% 55%), hsl(calc(var(--hue) + 40) 45% 35%));
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  transition-delay: calc(var(--i) * 80ms);
}

.is-live .ris-results i,
html.motion-off .ris-results i {
  opacity: 1;
  transform: none;
}

/* Deadly Balloons (mobile) */
.ui-db {
  background:
    radial-gradient(90% 50% at 50% 100%, color-mix(in srgb, var(--tint) 24%, transparent), transparent 70%),
    linear-gradient(180deg, #0c1220 0%, #101a2c 100%);
  color: #cbd5e1;
}

.ui-status-dark {
  color: #e5eaf0;
}

.db-hud {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #e5eaf0;
  padding: 4px 4px 0;
}

.db-hud b {
  color: var(--tint);
  font-weight: 600;
}

.db-lives {
  color: var(--tint);
  letter-spacing: 1px;
}

.db-sky {
  position: relative;
  display: block;
  flex: 1;
  overflow: hidden;
}

.db-sky > img,
.db-popper {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(24% * var(--s, 1));
  height: auto;
  animation: dbFloat 3s ease-in-out infinite alternate;
  animation-delay: var(--sd, 0s);
}

.db-popper img {
  display: block;
  width: 100%;
  height: auto;
  animation: dbPop 4s ease-in-out infinite;
}

.db-burst {
  position: absolute;
  left: 18%;
  top: 52%;
  width: 20%;
  aspect-ratio: 1;
  border: 2px solid #fff;
  border-radius: 50%;
  opacity: 0;
  animation: dbBurst 4s ease-out infinite;
}

.db-plus {
  position: absolute;
  left: 16%;
  top: 44%;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  animation: dbPlus 4s ease-out infinite;
}

.db-sky .db-rex {
  position: absolute;
  left: 50%;
  bottom: 0;
  top: auto;
  width: 36%;
  transform: translateX(-50%);
  animation: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.db-shot {
  position: absolute;
  left: calc(50% - 1.5px);
  bottom: 26%;
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: var(--tint);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--tint) 70%, transparent);
  animation: shot 1.2s linear infinite;
  animation-delay: var(--d, 0s);
}

.db-bar {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: #9fb0c4;
  padding: 6px 6px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes dbFloat {
  from {
    transform: translateY(0) rotate(-4deg);
  }
  to {
    transform: translateY(-8px) rotate(4deg);
  }
}

@keyframes dbPop {
  0%, 66% { transform: scale(1); opacity: 1; }
  70% { transform: scale(1.25); opacity: 1; }
  72%, 100% { transform: scale(0); opacity: 0; }
}

@keyframes dbBurst {
  0%, 69% { transform: scale(0.3); opacity: 0; }
  71% { opacity: 1; }
  82%, 100% { transform: scale(2.2); opacity: 0; }
}

@keyframes dbPlus {
  0%, 70% { transform: translateY(0); opacity: 0; }
  72% { opacity: 1; }
  88%, 100% { transform: translateY(-34px); opacity: 0; }
}

@keyframes shot {
  to {
    bottom: 100%;
    opacity: 0;
  }
}

/* KakaoParser */
.kp-summary {
  display: flex;
  gap: 6px;
}

.kp-summary > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 4px;
  border-radius: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
}

.kp-summary b {
  font-size: 11px;
  color: var(--fg);
  font-weight: 600;
}

.kp-summary i {
  font-style: normal;
  font-size: 7.5px;
  color: var(--fg-faint);
  font-family: var(--font-sans);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat i {
  position: relative;
  font-style: normal;
  font-family: var(--font-sans);
  max-width: 80%;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 9.5px;
  line-height: 1.3;
}

.chat i em {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--fg-faint);
  margin-top: 2px;
}

.chat i.me {
  align-self: flex-end;
  background: var(--tint);
  border-color: transparent;
  color: #1c1600;
}

.chat i.me em {
  color: rgba(28, 22, 0, 0.6);
}

.kp-spark {
  display: block;
  width: 100%;
  height: 40px;
}

.kp-area {
  fill: color-mix(in srgb, var(--tint) 22%, transparent);
}

.kp-line {
  fill: none;
  stroke: var(--tint);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 300;
  stroke-dashoffset: 300;
  transition: stroke-dashoffset 1.6s var(--ease);
}

.is-live .kp-line,
html.motion-off .kp-line {
  stroke-dashoffset: 0;
}

/* Love analyzer */
.love-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 0;
}

.love-avatar {
  font-style: normal;
  font-family: var(--font-sans);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #7fb8e6, #3a6ea5);
  box-shadow: 0 0 0 2px var(--bg-inset), 0 0 0 3px var(--line-strong);
}

.love-avatar-2 {
  background: linear-gradient(135deg, #f7a8c0, #d9587f);
}

.love-pair b {
  color: var(--tint);
  font-size: 14px;
  animation: heartBeat 1.4s ease-in-out infinite;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.3); }
  45% { transform: scale(1); }
  60% { transform: scale(1.15); }
}

.love-ring-wrap {
  position: relative;
  width: 96px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.love-ring {
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.love-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 8;
}

.love-fill {
  fill: none;
  stroke: var(--tint);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 263.9;
  stroke-dashoffset: 263.9;
  transition: stroke-dashoffset 1.6s var(--ease);
}

.is-live .love-fill,
html.motion-off .love-fill {
  stroke-dashoffset: calc(263.9 * (1 - var(--p) / 100));
}

.love-ring-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.love-ring-label b {
  font-size: 16px;
  color: var(--fg);
  font-weight: 600;
}

.love-ring-label i {
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 8px;
  color: var(--tint);
}

.love-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-sans);
}

.love-rows > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8.5px;
}

.love-rows i {
  font-style: normal;
  width: 40px;
  color: var(--fg-muted);
}

.love-rows b {
  width: 30px;
  text-align: right;
  color: var(--fg);
  font-weight: 500;
}

/* Exif editor */
.exif-photo {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  aspect-ratio: 4 / 3;
  padding: 7px 8px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(60% 50% at 78% 22%, rgba(255, 236, 190, 0.55), transparent 70%),
    linear-gradient(160deg, #2b3a4a 0%, #4b6a7c 45%, #c9a46a 100%);
}

.exif-photo b {
  position: relative;
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.exif-photo .exif-dim {
  position: relative;
  font-style: normal;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.exif-pin {
  position: absolute;
  top: 30%;
  left: 60%;
  width: 10px;
  height: 10px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--tint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 35%, transparent);
}

/* Saju: the four pillars */
.saju-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.saju-pillars > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0 5px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-inset) 70%, transparent);
}

.saju-pillars i {
  font-style: normal;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  margin-bottom: 2px;
}

.saju-pillars b {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--fg);
}

.saju-pillars b + b {
  color: var(--tint);
}

/* ---------- 8. /music/ — waveform ------------------------------ */

.chapter-music {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 12vh, 8rem) 0;
}

.music-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.wave {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: 1.5rem 1.5rem 1.1rem;
  box-shadow: var(--shadow);
}

.wave-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: clamp(120px, 22vh, 200px);
  cursor: crosshair;
}

.wave-bars i {
  display: block;
  flex: 1;
  height: min(100%, calc(var(--h) * var(--boost, 1) * 100%));
  transform-origin: bottom;
  will-change: transform;
  transition: height 0.3s var(--ease);
}

.wave-bars b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.9;
  transform-origin: bottom;
  animation: barIdle 1.6s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

@keyframes barIdle {
  from {
    transform: scaleY(0.82);
  }
  to {
    transform: scaleY(1);
  }
}

.wave-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-family: var(--font-mono);
}

.wave-title {
  font-weight: 600;
  color: var(--fg);
  font-size: 1.05rem;
}

/* ---------- 9. Index + contact tweaks ------------------------- */

.index-row {
  position: relative;
  overflow: hidden;
}

.index-row::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  transform: translateX(-100%);
  transition: transform 0.7s var(--ease);
  pointer-events: none;
}

.index-row:hover::before {
  transform: translateX(100%);
}

.contact-email .char {
  display: inline-block;
}

.contact-facts {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  max-width: 32rem;
}

/* ---------- 10. Responsive ------------------------------------ */

@media (max-width: 860px) {
  .hero-visual {
    height: min(36vh, 340px);
    height: min(36svh, 340px);
  }

  .chapter-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .chapter-copy h2 {
    max-width: none;
  }

  .chapter-typing {
    padding: clamp(3rem, 8vh, 5rem) 0;
  }

  .editor .editor-body {
    min-height: 7.5rem;
    padding: 1rem 1.1rem 1.2rem;
  }

  .bl {
    width: calc(var(--w) * 0.62);
    height: calc(var(--w) * 0.62);
  }

  .sky-rex {
    width: clamp(90px, 22vw, 130px);
  }

  .sky-hud {
    font-size: 0.66rem;
  }

  .stage-apps {
    height: auto;
    min-height: 0;
    padding-top: clamp(3rem, 10vh, 5rem);
    padding-bottom: 3rem;
  }

  .apps-track {
    width: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    -webkit-overflow-scrolling: touch;
  }

  .apps-track::-webkit-scrollbar {
    display: none;
  }

  .phone {
    width: 216px;
    scroll-snap-align: center;
  }

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

/* Medium-height windows: smaller phones so the pinned row fits above the fold. */
@media (min-width: 861px) and (max-height: 820px) {
  .phone {
    width: clamp(170px, 17vw, 200px);
  }
}

/* Short desktop windows: not enough height to pin the phone row, so it
   scrolls sideways natively (same treatment as narrow screens). */
@media (min-width: 861px) and (max-height: 700px) {
  .stage-apps {
    height: auto;
    min-height: 0;
    padding-top: clamp(3rem, 10vh, 5rem);
    padding-bottom: 3rem;
  }

  .apps-track {
    width: auto;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .apps-track::-webkit-scrollbar {
    display: none;
  }

  .phone {
    scroll-snap-align: center;
  }
}

@media (max-width: 520px) {
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .chapter-copy-glass {
    padding: 1.35rem 1.15rem;
  }

  .chapter-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora i,
  .bl-sway,
  .qr-scan,
  .db-sky > img,
  .db-popper,
  .db-popper img,
  .db-burst,
  .db-plus,
  .db-shot,
  .love-pair b,
  .wave-bars b,
  .hero-cue-line::after,
  .hero-eyebrow::after,
  .editor-caret {
    animation: none;
  }

  .db-popper img {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 11. games.rexy.win — six windows ------------------- */
/* Each game is a little browser window: a title bar in the game's two
   accent colours (from the portal's registry) over a CSS-drawn scene.
   The chapter is a plain reveal section, not a pinned one. */

.chapter-games {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 12vh, 8rem) 0;
  background:
    radial-gradient(ellipse 70% 50% at 80% 0%, color-mix(in srgb, var(--tok-kw) 10%, transparent), transparent 70%),
    var(--bg);
}

.games-copy {
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.net-pill b {
  font-weight: 500;
  color: var(--fg);
  text-transform: none;
  letter-spacing: 0;
}

.net-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-faint);
  transition: background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.net-pill[data-state="up"] .net-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
  animation: netPulse 2.2s ease-in-out infinite;
}

.net-pill[data-state="down"] .net-dot {
  background: var(--danger);
}

@keyframes netPulse {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 10%, transparent);
  }
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.game {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.game:hover {
  text-decoration: none;
}

.game-window {
  display: block;
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.game:hover .game-window,
.game:focus-visible .game-window {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--c1) 55%, var(--line));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--c1) 16%, transparent),
    0 30px 60px -28px color-mix(in srgb, var(--c1) 55%, transparent),
    var(--shadow);
}

.game-titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--bg-inset);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--fg-faint);
}

.game-titlebar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.game-titlebar i:nth-child(1) {
  background: var(--c1);
}

.game-titlebar i:nth-child(2) {
  background: var(--c2);
}

.game-titlebar b {
  font-weight: 400;
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    radial-gradient(90% 70% at 20% 100%, color-mix(in srgb, var(--c1) 26%, transparent), transparent 60%),
    radial-gradient(70% 60% at 90% 10%, color-mix(in srgb, var(--c2) 22%, transparent), transparent 60%),
    var(--bg-inset);
}

.game-emoji {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
  transition: transform 0.35s var(--ease);
}

.game:hover .game-emoji {
  transform: translateY(-4px) rotate(-6deg) scale(1.08);
}

.game-art > i {
  position: absolute;
  display: block;
  font-style: normal;
}

/* Rexy Arcade: a tile maze, three fire eggs, a blast */
.art-party {
  background-image:
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 7%, transparent) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--fg) 7%, transparent) 0 1px, transparent 1px 22px),
    radial-gradient(90% 70% at 20% 100%, color-mix(in srgb, var(--c1) 26%, transparent), transparent 60%),
    radial-gradient(70% 60% at 90% 10%, color-mix(in srgb, var(--c2) 22%, transparent), transparent 60%);
}

.art-egg {
  width: 14px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(160deg, #fff4d6, var(--c1));
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--c1) 55%, transparent);
  animation: eggBob 1.8s ease-in-out infinite alternate;
}

.art-egg.e1 { left: 18%; top: 26%; }
.art-egg.e2 { left: 42%; top: 58%; animation-delay: -0.6s; }
.art-egg.e3 { left: 66%; top: 22%; animation-delay: -1.1s; }

@keyframes eggBob {
  to {
    transform: translateY(-4px);
  }
}

.art-blast {
  left: 30%;
  top: 40%;
  width: 26%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, var(--c2), transparent);
  filter: blur(1px);
  opacity: 0.85;
  animation: blast 2.6s ease-in-out infinite;
}

@keyframes blast {
  0%, 60% { transform: scaleX(0); opacity: 0; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1.1); opacity: 0; }
}

/* FRONTLINE: floor grid in perspective, a crosshair, hit markers */
.art-floor {
  left: -20%;
  right: -20%;
  bottom: 0;
  height: 55%;
  background:
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--c2) 35%, transparent) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--c2) 35%, transparent) 0 1px, transparent 1px 18px);
  transform: perspective(220px) rotateX(58deg);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(180deg, transparent, #000 60%);
}

.art-cross {
  left: 50%;
  top: 46%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1.5px solid var(--fg);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c1) 30%, transparent);
}

.art-cross::before,
.art-cross::after {
  content: "";
  position: absolute;
  background: var(--fg);
}

.art-cross::before {
  left: 50%;
  top: -8px;
  bottom: -8px;
  width: 1.5px;
  margin-left: -0.75px;
}

.art-cross::after {
  top: 50%;
  left: -8px;
  right: -8px;
  height: 1.5px;
  margin-top: -0.75px;
}

.art-hit {
  width: 10px;
  height: 10px;
  border: 2px solid var(--c1);
  border-radius: 50%;
  animation: hit 2s ease-out infinite;
}

.art-hit.h1 { left: 24%; top: 30%; }
.art-hit.h2 { left: 70%; top: 52%; animation-delay: -1s; }

@keyframes hit {
  0% { transform: scale(0.4); opacity: 1; }
  70%, 100% { transform: scale(2.2); opacity: 0; }
}

/* OVERCLOCK: circuit traces, glowing nodes, a core */
.art-trace {
  height: 2px;
  background: color-mix(in srgb, var(--c2) 70%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c2) 50%, transparent);
}

.art-trace.t1 { left: 10%; top: 30%; width: 46%; }
.art-trace.t2 { left: 56%; top: 30%; width: 2px; height: 42%; }
.art-trace.t3 { left: 22%; top: 72%; width: 36%; }

.art-node {
  width: 10px;
  height: 10px;
  margin: -4px;
  border-radius: 50%;
  background: var(--c2);
  box-shadow: 0 0 10px 2px color-mix(in srgb, var(--c2) 60%, transparent);
  animation: nodePulse 1.6s ease-in-out infinite;
}

.art-node.n1 { left: 10%; top: 30%; }
.art-node.n2 { left: 22%; top: 72%; animation-delay: -0.5s; }
.art-node.n3 { left: 58%; top: 72%; animation-delay: -1s; }

@keyframes nodePulse {
  50% { transform: scale(1.5); }
}

.art-core {
  left: 56%;
  top: 30%;
  width: 22px;
  height: 22px;
  margin: -11px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 0 18px 4px color-mix(in srgb, var(--c1) 55%, transparent);
  animation: coreSpin 6s linear infinite;
}

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

/* SPOOKY FRIENDS: a dark room, a flashlight beam, two eyes that blink */
.art-spooky {
  background: #0b0a12;
}

.art-beam {
  left: -10%;
  bottom: -20%;
  width: 90%;
  height: 130%;
  background: conic-gradient(from -62deg at 0% 100%, transparent 0deg, color-mix(in srgb, var(--c1) 22%, transparent) 14deg, transparent 30deg);
  animation: beamSweep 5s ease-in-out infinite alternate;
  transform-origin: 0% 100%;
}

@keyframes beamSweep {
  to { transform: rotate(-16deg); }
}

.art-eye {
  top: 36%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5f7a;
  box-shadow: 0 0 10px 2px rgba(255, 95, 122, 0.6);
  animation: blink 4s ease-in-out infinite;
}

.art-eye.l { left: 58%; }
.art-eye.r { left: 66%; }

@keyframes blink {
  0%, 40%, 44%, 100% { transform: scaleY(1); }
  42% { transform: scaleY(0.1); }
}

/* DOODLINGS: a scribble that draws itself, and a wrong guess */
.art-doodle svg {
  position: absolute;
  inset: 8% 10% 12%;
  width: 80%;
  height: 80%;
  overflow: visible;
}

.art-doodle path {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  animation: draw 3.2s ease-in-out infinite;
}

.art-doodle .doodle-1 { stroke: var(--c1); }
.art-doodle .doodle-2 { stroke: var(--c2); animation-delay: 0.6s; }

@keyframes draw {
  0% { stroke-dashoffset: 420; }
  55%, 85% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

.art-guess {
  left: 10%;
  top: 12%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-muted);
  animation: guessPop 3.2s ease-in-out infinite;
}

@keyframes guessPop {
  0%, 50% { opacity: 0; transform: translateY(4px); }
  60%, 90% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* CHESSLINGS: a board in perspective and three pieces */
.art-board {
  left: 12%;
  right: 12%;
  bottom: -4%;
  height: 70%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--c2) 45%, #0f1214) 0 25%, color-mix(in srgb, var(--c1) 30%, #f5efe6) 0 50%) 0 0 / 25% 25%;
  transform: perspective(240px) rotateX(48deg);
  transform-origin: 50% 100%;
  border-radius: 3px;
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.6);
}

.art-piece {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--fg);
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  animation: pieceHop 3s ease-in-out infinite;
}

.art-piece.p1 { left: 24%; top: 36%; }
.art-piece.p2 { left: 46%; top: 22%; color: var(--c1); animation-delay: -1s; }
.art-piece.p3 { left: 62%; top: 44%; font-size: 1.1rem; animation-delay: -2s; }

@keyframes pieceHop {
  0%, 70%, 100% { transform: translateY(0); }
  80% { transform: translateY(-8px); }
}

.game-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.15rem;
}

.game-meta > b {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.game-tagline {
  color: var(--fg-muted);
  font-size: 0.92rem;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.game-tags i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  white-space: nowrap;
}

.game-tags i:first-child {
  color: var(--c1);
  border-color: color-mix(in srgb, var(--c1) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .game-art i,
  .art-doodle path,
  .art-guess {
    animation: none !important;
  }

  .art-doodle path {
    stroke-dashoffset: 0;
  }

  .art-guess {
    opacity: 1;
  }
}

/* ---------- 11b. /Applications/ — native macOS apps -------------- */
/* One little desktop per app: a menu bar with the app's own status item
   and a window (or a popover hanging from the item) drawn in CSS. Bars
   fill and the rex gallops once the card is on screen (.is-live, the same
   observer as the phones). A plain reveal section, not a pinned one. */

.chapter-mac {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 12vh, 8rem) 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%),
    var(--bg);
}

.mac-copy {
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.mac-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 2.5vw, 1.75rem);
}

.mac {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.mac:hover {
  text-decoration: none;
}

.mac-desktop {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(80% 70% at 18% 12%, color-mix(in srgb, var(--tint) 38%, transparent), transparent 62%),
    radial-gradient(60% 60% at 88% 92%, color-mix(in srgb, var(--tint) 20%, transparent), transparent 60%),
    var(--bg-inset);
  box-shadow: var(--shadow);
  transform: translateZ(0);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

a.mac:hover .mac-desktop,
a.mac:focus-visible .mac-desktop {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--tint) 55%, var(--line));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--tint) 16%, transparent),
    0 30px 60px -28px color-mix(in srgb, var(--tint) 55%, transparent),
    var(--shadow);
}

/* The menu bar */
.mac-menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--bg-raised) 82%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
  font-size: 9px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.mac-apple {
  width: 9px;
  height: 10px;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45%;
  background: var(--fg);
  flex-shrink: 0;
}

.mac-menubar > b {
  font-weight: 600;
  color: var(--fg);
}

.mac-menu {
  font-style: normal;
}

.mac-menubar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.mac-clock {
  font-style: normal;
}

.mac-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 17px;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--fg);
}

.mac-item b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.mac-item-on {
  background: color-mix(in srgb, var(--fg) 12%, transparent);
}

/* The pixel rex in Rex Boing's status item: the whole silhouette gallops. */
.rex-run {
  width: 14px;
  height: 13px;
  color: var(--tint);
  fill: currentColor;
  transform-origin: 50% 100%;
}

.is-live .rex-run,
html.motion-off .rex-run {
  animation: rexGallop 0.55s ease-in-out infinite;
}

@keyframes rexGallop {
  0%, 100% {
    transform: translateY(0) scale(1.06, 0.92);
  }
  45% {
    transform: translateY(-3px) scale(0.94, 1.08);
  }
  70% {
    transform: translateY(-1px) scale(1, 1);
  }
}

/* Project Manager's status item: a tiny stack of running instances. */
.pm-glyph {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background:
    linear-gradient(var(--tint), var(--tint)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--tint), var(--tint)) 0 50% / 100% 2px no-repeat,
    linear-gradient(var(--tint), var(--tint)) 0 100% / 100% 2px no-repeat;
}

/* AI Usage Tracker's status item: a ring filled to the reading. */
.ai-ring {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: conic-gradient(var(--tint) calc(var(--p) * 1%), var(--line-strong) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent 55%, #000 58%);
  mask: radial-gradient(farthest-side, transparent 55%, #000 58%);
}

/* Windows and popovers */
.mac-window {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 34px;
  bottom: -6px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 9px 9px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--bg-raised);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.35;
  color: var(--fg-muted);
}

.mac-popover {
  left: auto;
  right: 12px;
  width: 62%;
  top: 27px;
  bottom: auto;
  max-height: calc(100% - 27px);
  border-radius: 9px;
  border-bottom: 1px solid var(--line);
}

.mac-popover::before {
  content: "";
  position: absolute;
  right: 26px;
  top: -5px;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  background: var(--bg-raised);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.mac-titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-inset);
  white-space: nowrap;
}

.mac-titlebar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
}

.mac-titlebar i:nth-child(1) {
  background: #ff5f57;
}

.mac-titlebar i:nth-child(2) {
  background: #febc2e;
}

.mac-titlebar i:nth-child(3) {
  background: #28c840;
}

.mac-titlebar b {
  margin-left: 5px;
  font-weight: 500;
  color: var(--fg);
}

.mac-titlebar em {
  margin-left: auto;
  font-style: normal;
  color: var(--fg-faint);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mac-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 9px;
  min-width: 0;
}

.mac-body .ui-kicker {
  white-space: nowrap;
}

.mac-body .ui-fine {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mac-split {
  display: grid;
  grid-template-columns: 34% minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.mac-sidebar {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
  background: var(--bg-inset);
  overflow: hidden;
}

.mac-sidebar .ui-kicker {
  padding: 0 5px 2px;
}

.mac-sidebar i {
  display: flex;
  align-items: center;
  gap: 5px;
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 8.5px;
  color: var(--fg-muted);
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mac-sidebar i::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--dot, var(--tint));
  flex-shrink: 0;
}

.mac-sidebar i.on {
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  color: var(--fg);
}

.mac-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 9px;
  min-width: 0;
}

/* Rex Boing: the processor hero and per-core bars (E-cluster dim, P-cluster in the tint) */
.rb-hero {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.core-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 22px;
  flex: 1;
}

.core-bars i {
  flex: 1;
  height: 8%;
  border-radius: 1px;
  background: color-mix(in srgb, var(--tint) 45%, var(--line));
  transition: height 0.9s var(--ease);
}

.core-bars i.p {
  background: var(--tint);
}

.is-live .core-bars i,
html.motion-off .core-bars i {
  height: var(--h);
}

/* App Manager: a deploy console and an installs chart */
.am-console {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  font-size: 7.5px;
  color: var(--fg-muted);
  min-width: 0;
}

.am-console i {
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-console i.ok {
  color: var(--ok);
}

.am-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
}

.am-chart i {
  flex: 1;
  height: 6%;
  border-radius: 1px 1px 0 0;
  background: var(--tint);
  opacity: 0.85;
  transition: height 0.9s var(--ease);
}

.is-live .am-chart i,
html.motion-off .am-chart i {
  height: var(--h);
}

/* Project Manager: instance rows */
.pm-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-inset);
  white-space: nowrap;
  min-width: 0;
}

.pm-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-name {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.pm-name b {
  color: var(--fg);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-name i {
  font-style: normal;
  font-size: 7.5px;
  color: var(--fg-faint);
}

.pm-inst b {
  color: var(--tint);
  font-weight: 600;
}

.is-idle .pm-inst b {
  color: var(--fg-faint);
}

.pm-dup {
  font-style: normal;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
  border-radius: 3px;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 16%, transparent);
}

.pm-who {
  color: var(--fg-faint);
}

.pm-btn {
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-size: 7.5px;
}

.pm-btn-go {
  border-color: color-mix(in srgb, var(--tint) 45%, transparent);
  color: var(--tint);
}

.pm-git {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 2px 0;
  white-space: nowrap;
  overflow: hidden;
}

.pm-git b {
  margin-left: auto;
  font-weight: 400;
  color: var(--fg-faint);
}

/* AI Usage Tracker: each bar carries the slice used since the last refresh in amber */
.ai-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 30px 34px;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ai-row i {
  font-style: normal;
  color: var(--fg-muted);
}

.ai-row b {
  text-align: right;
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ai-row em {
  font-style: normal;
  font-size: 7.5px;
  color: var(--warn);
}

.ai-bar {
  position: relative;
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.ai-bar > span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 3px;
  transition: width 1.1s var(--ease);
}

.ai-bar .ai-new {
  background: var(--warn);
}

.ai-bar .ai-old {
  background: var(--tint);
}

.is-live .ai-bar > span,
html.motion-off .ai-bar > span {
  width: var(--p);
}

/* Captions under each desktop */
.mac-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.15rem;
}

.mac-meta > b {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.mac-tagline {
  color: var(--fg-muted);
  font-size: 0.92rem;
}

.mac-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.mac-tags i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--fg-faint);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  white-space: nowrap;
}

.mac-tags i:first-child {
  color: var(--tint);
  border-color: color-mix(in srgb, var(--tint) 40%, transparent);
}

/* ---------- 11c. ~/teslamate-dashboard/ — the car screen ------------ */
/* The dashboard as it looks on the car's display: a dark map with a route
   that draws itself and a dot that follows it (SMIL animateMotion, so it
   moves in the SVG's own units), glass cards, four rolling charts. The
   screen stays dark on the light theme, like a real display would. */

.chapter-tesla {
  border-top: 1px solid var(--line);
  padding: clamp(4rem, 12vh, 8rem) 0;
  background:
    radial-gradient(ellipse 55% 50% at 85% 100%, rgba(59, 130, 246, 0.12), transparent 70%),
    var(--bg);
}

.car {
  display: block;
  min-width: 0;
  padding: 7px;
  border-radius: 16px;
  background: #0b0d12;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.car-screen {
  --map: #0a0e1a;
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: var(--map);
  color: #e5e7eb;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.3;
}

.car-map {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 60% at 65% 45%, rgba(59, 130, 246, 0.14), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 26px),
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.05) 38.4%, rgba(255, 255, 255, 0.05) 40%, transparent 40.4%),
    linear-gradient(20deg, transparent 58%, rgba(255, 255, 255, 0.045) 58.4%, rgba(255, 255, 255, 0.045) 59.6%, transparent 60%),
    var(--map);
}

.car-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.car-route-line {
  fill: none;
  stroke: #3b82f6;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.7));
}

.car.is-live .car-route-line,
html.motion-off .car-route-line {
  animation: routeDraw 2.6s var(--ease) forwards;
}

@keyframes routeDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.car-dot-core {
  fill: #3b82f6;
  stroke: #fff;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.car-dot-pulse {
  fill: rgba(59, 130, 246, 0.35);
  transform-box: fill-box;
  transform-origin: center;
  animation: carPulse 1.8s ease-out infinite;
}

@keyframes carPulse {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.car-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(15, 20, 35, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  min-width: 0;
}

.car-kicker {
  font-style: normal;
  font-size: 7px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9ca3af;
}

.car-card > b {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.car-card > b small {
  font-size: 8.5px;
  font-weight: 400;
  color: #9ca3af;
  margin-left: 3px;
  letter-spacing: 0;
}

.car-card > em {
  font-style: normal;
  font-size: 7.5px;
  color: #9ca3af;
  white-space: nowrap;
}

.car-speed {
  left: 4%;
  top: 6%;
  width: 30%;
}

.car-speed > b {
  font-size: 30px;
}

.car-pill {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 7px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #10b981;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.car-battery {
  left: 4%;
  top: 44%;
  width: 30%;
}

.car-batbar {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.car-batbar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 1.2s var(--ease);
}

.is-live .car-batbar > span,
html.motion-off .car-batbar > span {
  width: var(--p);
}

.car-climate {
  right: 4%;
  top: 6%;
  width: 20%;
}

.car-drive {
  right: 4%;
  top: 34%;
  width: 34%;
}

.car-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  font-size: 7.5px;
  color: #9ca3af;
  white-space: nowrap;
}

.car-stats b {
  display: inline-block;
  margin-right: 3px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.car-charts {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 5%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.car-chart {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 7px 4px;
  border-radius: 7px;
  background: rgba(15, 20, 35, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  min-width: 0;
}

.car-chart i {
  font-style: normal;
  font-size: 6.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-chart svg {
  display: block;
  width: 100%;
  height: 20px;
  overflow: visible;
}

.car-chart polyline {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c) 70%, transparent));
}

/* Landing-page index: the two new paths are long, so the column gets a little wider. */
@media (min-width: 721px) {
  .landing .index-head,
  .landing .index-row {
    grid-template-columns: minmax(8.5rem, 12.5rem) minmax(0, 1fr) auto 1.25rem;
  }
}

@media (max-width: 640px) {
  .mac-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .car-drive {
    display: none;
  }

  .car-climate {
    width: 28%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rex-run,
  .car-dot-pulse {
    animation: none;
  }

  .car-route-line {
    animation: none;
    stroke-dashoffset: 0;
  }

  .car-dot-pulse {
    opacity: 0.5;
  }
}

/* ---------- 12. Contact + now ---------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.now {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  padding: 1.25rem 1.35rem 1.1rem;
  box-shadow: var(--shadow);
}

.now .eyebrow {
  display: block;
  margin-bottom: 0.4rem;
}

.now h3 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

.now-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--fg-muted);
}

.now-list li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.now-list b {
  color: var(--fg);
  font-weight: 600;
}

.now-list kbd {
  font-size: 0.72em;
  padding: 0.05em 0.35em;
}

.now-dot {
  width: 8px;
  height: 8px;
  margin-top: 0.5em;
  border-radius: 50%;
  background: var(--line-strong);
}

.now-dot.is-live {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
  animation: netPulse 2.2s ease-in-out infinite;
}

.now-stamp {
  display: block;
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-faint);
}

@media (max-width: 860px) {
  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 520px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
}
