/* The Archive Run — chrisbruce.com
   One stylesheet. Dark arcade-cabinet palette, amber phosphor accent,
   pixel display type over an editorial serif. */

@font-face {
  font-family: 'Press Start 2P';
  src: url('/static/fonts/press-start-2p.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Serif';
  src: url('/static/fonts/plex-serif-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Serif';
  src: url('/static/fonts/plex-serif-400-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Serif';
  src: url('/static/fonts/plex-serif-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0d13;
  --bg-raised: #111623;
  --bg-panel: #151b2ae6;
  --line: #232b3d;
  --text: #e8ebf2;
  --text-muted: #97a1b4;
  --accent: #ffb454;
  --accent-soft: #ffb45426;
  --cable: #6cd3ff;
  --danger: #ff6b6b;
  --ok: #7ce38b;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --font-pixel: 'Press Start 2P', var(--font-mono);
  --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --radius: 10px;
  --header-h: 3.5rem;
  /* Bubble accents — same colors as the in-game era bands. */
  --bubble-ai: #6cd3ff;
  --bubble-crypto: #ffd257;
  --bubble-hardware: #ff9d5c;
  --bubble-social: #c9a0ff;
  --bubble-creative: #ffb454;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Faint blueprint grid + vignette, echoing the OG cards and game bands. */
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #131a2a66, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 41px, #ffffff04 41px 42px),
    repeating-linear-gradient(90deg, transparent 0 41px, #ffffff04 41px 42px),
    var(--bg);
}

img, svg, video, canvas { max-width: 100%; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #ffc87e; }

h1, h2, h3, h4 { line-height: 1.2; text-wrap: balance; }

code { font-family: var(--font-mono); font-size: 0.9em; background: var(--bg-raised); padding: 0.1em 0.35em; border-radius: 4px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  background: var(--accent);
  color: #14100a;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top 120ms ease;
}
.skip-link:focus { top: 0; }

/* ------------------------------------------------------------------ */
/* Site chrome                                                         */
/* ------------------------------------------------------------------ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); }

.cta {
  display: inline-block;
  background: var(--accent);
  color: #14100a !important;
  font-weight: 650;
  text-decoration: none;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 4px 18px var(--accent-soft); }
.cta-big { font-size: 1.15rem; padding: 0.7rem 1.4rem; }

.ghost {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.ghost:hover { border-color: var(--accent); color: var(--accent); }

.socials {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.socials a {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  color: var(--text-muted);
  border-radius: 8px;
}
.socials a:hover { color: var(--accent); background: var(--bg-raised); }
.socials svg { width: 1.15rem; height: 1.15rem; }

/* Mobile-only header controls; unhidden in the narrow-header media block. */
.nav-toggle { display: none; }
.cta-mobile { display: none; }

/* Footer: the credits screen. */
.site-footer {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  text-align: center;
  padding: 3.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(ellipse 90% 120% at 50% 120%, #131a2a88, transparent 65%),
    var(--bg-raised);
}
.footer-credits {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--text);
  margin: 0;
}
.footer-cities {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}
.footer-cities .cities-sep { color: var(--accent); }
.footer-clocks { color: var(--cable); margin-left: 0.6em; }
.footer-role {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.footer-cta-row { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin: 0; }
.site-footer .socials { justify-content: center; }
.colophon {
  margin: 1.2rem 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-width: 40rem;
}

/* ------------------------------------------------------------------ */
/* Text archive (SSR content)                                          */
/* ------------------------------------------------------------------ */

.archive-text, .page {
  max-width: 68rem;
  margin: 0 auto;
  padding: calc(var(--header-h) + 2.5rem) 1.5rem 4rem;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

/* ------------------------------------------------------------------ */
/* Hero — attract mode                                                 */
/* ------------------------------------------------------------------ */

.hero { padding: 1.4rem 0 1rem; }
.game-page .archive-text { padding-top: calc(var(--header-h) + 1.25rem); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
  gap: 2.5rem 3.5rem;
  align-items: center;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 0.8rem;
}
.hero-kicker .clocks { color: var(--cable); margin-left: 0.6em; }

.hero h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.5rem, 5.8vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
  color: var(--text);
}
.hero h1::after {
  content: ".";
  color: var(--accent);
}

.hero-role {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
  border-block: 1px solid var(--line);
  display: inline-block;
  padding: 0.4rem 0;
  margin: 0 0 1.1rem;
}

.tagline {
  max-width: 40rem;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.62;
  color: #c3cadb;
  margin: 0 0 0.85rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.15rem;
}

/* The arcade button. */
.play-cta {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #14100a;
  background: linear-gradient(180deg, #ffc87e, var(--accent));
  border: 0;
  border-radius: 12px;
  padding: 1.05rem 1.6rem;
  cursor: pointer;
  box-shadow: 0 3px 0 #8a5c1d, 0 10px 30px #ffb45426;
  transition: transform 110ms ease, box-shadow 110ms ease;
  animation: cta-glow 3.2s ease-in-out infinite;
}
.play-cta:hover { transform: translateY(1px); box-shadow: 0 2px 0 #8a5c1d, 0 8px 34px #ffb45444; }
.play-cta:active { transform: translateY(3px); box-shadow: 0 0 0 #8a5c1d, 0 4px 20px #ffb45444; }
.play-cta:focus-visible { outline: 3px solid var(--cable); outline-offset: 3px; }
@keyframes cta-glow {
  50% { box-shadow: 0 3px 0 #8a5c1d, 0 12px 40px #ffb45440; }
}
.play-cta-sm { font-size: 0.8rem; padding: 0.7rem 1.05rem; animation: none; border-radius: 9px; }
.chapter-play { margin: 1rem 0 0.5rem; }

/* Attract mode: the arcade-cabinet CTA. The whole cabinet is the button. */
.attract {
  display: block;
  width: 100%;
  margin: 1.5rem 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 20px;
  transition: transform 160ms ease;
}
.attract:hover { transform: translateY(-3px); }
.attract:active { transform: translateY(0); }
.attract:focus-visible { outline: 3px solid var(--cable); outline-offset: 4px; }
.attract-bezel {
  display: block;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid #2c3650;
  background: linear-gradient(180deg, #222a3e, #141a29 55%, #0d1220);
  box-shadow: 0 20px 50px #00000066;
  transition: box-shadow 160ms ease;
}
.attract:hover .attract-bezel,
.attract:focus-visible .attract-bezel {
  box-shadow: 0 24px 60px #00000080, 0 0 40px var(--accent-soft), inset 0 0 0 1px #3a4666;
}
.attract-screen {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  padding: 1.35rem 2.1rem 1.6rem;
  background: radial-gradient(130% 150% at 50% 0%, #0f1930 0%, #070c15 55%, #04070c 100%);
}
.attract-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, #ffffff06 0 1px, transparent 1px 3px);
}
.attract-scan { overflow: hidden; }
.attract-scan::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(180deg, transparent, #6cd3ff10, transparent);
  animation: attract-roll 7s linear infinite;
  will-change: transform;
}
@keyframes attract-roll {
  from { transform: translateY(-70px); }
  to { transform: translateY(260px); }
}
.attract-marquee {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.25rem;
}
.attract-col { display: grid; gap: 0.55rem; justify-items: start; }
.attract-kicker {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  letter-spacing: 0.24em;
  color: var(--text-muted);
}
.attract-title {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 2.6vw, 1.65rem);
  color: #fff;
  text-shadow: 0 0 20px #6cd3ff55, 3px 3px 0 #b8451f, 6px 6px 0 #14100a;
}
.attract-press {
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-shadow: 0 0 14px #ffb45466;
  animation: attract-blink 1.15s steps(2, jump-none) infinite;
}
@keyframes attract-blink {
  50% { opacity: 0; }
}
.attract-runner {
  flex: 0 0 auto;
  width: 72px;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px #00000088);
}
.attract-col-side { justify-items: end; text-align: right; }
.attract-hiscore {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--cable);
  text-shadow: 0 0 12px #6cd3ff44;
}
.attract-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.attract-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: 6px;
}
.attract-strip i { display: block; height: 100%; }
.as-roots { flex: 0 0 26%; background: #7dff9a; }
.as-social { flex: 0 0 16%; background: var(--bubble-social); }
.as-hardware { flex: 0 0 17%; background: var(--bubble-hardware); }
.as-crypto { flex: 0 0 18%; background: var(--bubble-crypto); }
.as-ai { flex: 1 1 auto; background: var(--bubble-ai); box-shadow: 0 0 14px #6cd3ff88; }

@media (max-width: 760px) {
  .attract-screen { padding: 1.3rem 1.3rem 1.6rem; }
  .attract-marquee { flex-direction: column; align-items: flex-start; gap: 1.1rem; }
  .attract-runner { position: absolute; top: 0.2rem; right: 0.2rem; width: 52px; }
  .attract-col-side { justify-items: start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .attract,
  .attract-press { animation: none; transition: none; }
  .attract-scan::after { display: none; }
}

/* Portrait: phosphor ring, scanlines, floating pixel props. */
.hero-portrait {
  position: relative;
  justify-self: center;
  width: min(280px, 60vw);
  aspect-ratio: 1;
}
.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -18%;
  background: radial-gradient(circle, #ffb4542b 0%, transparent 62%);
  z-index: 0;
}
.hero-portrait img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow:
    0 0 0 4px var(--bg),
    0 0 0 7px var(--accent),
    0 0 0 12px var(--bg),
    0 0 0 13px #6cd3ff55,
    0 18px 50px #00000088;
}
.hero-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  background: repeating-linear-gradient(0deg, transparent 0 4px, #0a0d130d 4px 5px);
  box-shadow: inset 0 0 34px #0a0d1355;
  pointer-events: none;
}
.hero-portrait img { filter: contrast(1.04) saturate(1.05); }


/* Stat strip: quarters on the cabinet glass. */
.stat-strip {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.8rem;
  padding: 0;
  margin: 2.8rem 0 0;
}
.stat-strip li {
  background: linear-gradient(180deg, #141a29, #101623);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 0.9rem;
  position: relative;
  overflow: hidden;
}
.stat-strip li::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0.7;
}
.stat-strip strong {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.stat-strip span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

@media (max-width: 780px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { grid-row: 1; margin-bottom: 0.5rem; }
}

/* Section headers: cabinet-marquee labels. */
.listing h2, .tours h2 {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: var(--text);
  margin: 4.2rem 0 0.4rem;
}
.listing h2::after, .tours h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
  transform: translateY(-0.35rem);
}
.listing-intro {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  margin-top: 0.4rem;
  max-width: 46rem;
}

/* Era groups: each bubble keeps its band color from the game. */
.era { --era: var(--accent); margin: 3.2rem 0; padding-left: 1.4rem; border-left: 3px solid var(--era); position: relative; }
.era::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0;
  width: 3px;
  height: 3rem;
  background: var(--era);
  filter: blur(6px);
}
/* Sticky jump links over the listing groups. */
.era-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 0;
  margin: 0 0 1.2rem;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
}
.era-nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
}
.era-nav a:hover { color: var(--text); border-color: var(--accent); }
.era { scroll-margin-top: calc(var(--header-h) + 3.4rem); }

/* Filmmaking reel: embedded players in the listing. */
.reel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
  margin: 1.4rem 0 1.8rem;
}
.reel-item { margin: 0; }
.reel-card {
  position: relative;
  aspect-ratio: 16 / 9;
  perspective: 1100px;
}
.reel-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #000;
  backface-visibility: hidden;
  transition: transform 480ms cubic-bezier(0.4, 0.15, 0.2, 1);
}
.reel-front { display: block; }
.reel-front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.2rem;
  height: 3.2rem;
  margin: -1.6rem 0 0 -1.6rem;
  display: grid;
  place-items: center;
  padding-left: 3px;
  background: var(--accent);
  color: #14100a;
  border-radius: 50%;
  font-size: 0.95rem;
  box-shadow: 0 6px 24px #00000088;
  transition: transform 160ms ease;
}
.reel-card:hover .reel-play { transform: scale(1.1); }
.reel-back { transform: rotateY(180deg); }
.reel-back iframe { width: 100%; height: 100%; border: 0; display: block; }
.reel-card.flipped .reel-front { transform: rotateY(-180deg); }
.reel-card.flipped .reel-back { transform: rotateY(0deg); }
@media (prefers-reduced-motion: reduce) {
  .reel-face { transition: none; }
}
.reel-item figcaption {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text);
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}
.reel-item figcaption span { display: block; color: var(--text-muted); margin-top: 0.15rem; }
@media (max-width: 760px) {
  .reel-grid { grid-template-columns: 1fr; }
}

.era-ai { --era: var(--bubble-ai); }
.era-oss { --era: #a8e6a8; }
.era-crypto { --era: var(--bubble-crypto); }
.era-hardware { --era: var(--bubble-hardware); }
.era-social { --era: var(--bubble-social); }
.era-roots { --era: #7dff9a; }
.era-creative { --era: var(--bubble-creative); }

.era h3 {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--era);
  margin: 0 0 0.3rem;
}
.era-blurb {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  color: var(--text-muted);
  margin-top: 0;
  max-width: 44rem;
}

.cards {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.card {
  height: 100%;
  background: linear-gradient(180deg, #131928, #10151f);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.2rem;
  position: relative;
  overflow: hidden;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 38%;
  height: 2px;
  background: var(--era, var(--accent));
  opacity: 0.65;
  transition: width 200ms ease;
}
.card:hover {
  border-color: var(--era, var(--accent));
  transform: translateY(-3px);
  box-shadow: 0 10px 28px #00000066;
}
.card:hover::before { width: 100%; }
.card h4 { margin: 0 0 0.35rem; font-family: var(--font-serif); font-weight: 600; font-size: 1.22rem; }
.card h4 a { color: var(--text); text-decoration: none; }
.card h4 a:hover { color: var(--era, var(--accent)); }
.card-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.card-sub { color: var(--accent); font-size: 0.9rem; margin: 0 0 0.5rem; }
.card-summary { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.9rem 0 0;
}
.tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cable);
  background: #6cd3ff14;
  border: 1px solid #6cd3ff33;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

/* Focused node article */

.node-article { max-width: 46rem; }
.node-article h1 { font-family: var(--font-serif); font-weight: 600; }
.node-article .body, .prose .body { font-family: var(--font-serif); line-height: 1.8; }
.crumb {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.crumb a { color: var(--text-muted); }
.node-article h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0.25rem 0; }
.subtitle { color: var(--accent); font-size: 1.15rem; margin-top: 0; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}
.metrics > div {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}
.metrics dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.metrics dd { margin: 0.15rem 0 0; font-weight: 650; }

.body { font-size: 1.05rem; }
.body p { margin: 1rem 0; }

.ext-links, .people, .related { margin-top: 2rem; }
.ext-links h2, .people h2, .related h2 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.ext-links ul, .people ul, .related ul { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.4rem; }
.people small { color: var(--text-muted); margin-left: 0.5rem; }
.related .rel {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-right: 0.35rem;
}

.media-link a { font-weight: 650; }

/* Guided tours: quest cards. */

.tour-list {
  list-style: none;
  padding: 0;
  margin: 1.8rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.2rem;
}
.tour {
  background: linear-gradient(180deg, #131928, #10151f);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.3rem 1.2rem;
  position: relative;
  transition: border-color 140ms ease, transform 140ms ease;
}
.tour:hover { border-color: var(--accent); transform: translateY(-3px); }
.tour::before {
  content: "GUIDED TOUR";
  position: absolute;
  top: -0.6rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid #8a643066;
  border-radius: 99px;
  padding: 0.22rem 0.6rem;
  letter-spacing: 0.18em;
}
.tour h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--text);
}
.tour-desc {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
  font-size: 0.98rem;
}
.tour-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
}
.tour-steps li {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
}
.tour-steps li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  flex: 0 0 auto;
}
.tour-steps a { color: #c3cadb; text-decoration: none; }
.tour-steps a:hover { color: var(--accent); }

/* Media embeds (SSR article + reading panel) */

.media-embed { margin: 1.5rem 0; }
.media-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #000;
}
.media-embed img { border-radius: var(--radius); border: 1px solid var(--line); }

/* Essays: the playbook and leading pages */

.essay .lede {
  font-family: var(--font-serif);
  font-size: 1.16rem;
  line-height: 1.7;
  color: #c3cadb;
}
.essay-note {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  border-left: 3px solid var(--line);
  padding-left: 0.8rem;
}
.law { margin: 2.6rem 0; }
.law h2 {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0 0 0.7rem;
}
.law-num {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0.2rem 0.45rem;
  transform: translateY(-0.15rem);
}
.law p { line-height: 1.7; }
.pullquote {
  margin: 1.4rem 0;
  padding: 1.1rem 1.4rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--bg-raised);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--text);
}
.share-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 2.8rem;
}
.share-row .share-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.essay-next {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
}

/* Plain pages (contact) */

.prose { max-width: 44rem; }
.prose h1 { font-family: var(--font-serif); font-weight: 600; font-size: 2.4rem; }
.contact-list { list-style: none; padding: 0; display: grid; gap: 0.6rem; }

.notice-ok { background: #7ce38b1f; border-color: var(--ok); }

.contact-form { display: grid; gap: 0.4rem; margin: 1rem 0 2rem; }
.contact-form label { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.5rem; }
.contact-form select {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  width: 100%;
}
.contact-form select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.contact-form input, .contact-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  width: 100%;
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.contact-form button { justify-self: start; border: 0; font: inherit; cursor: pointer; margin-top: 0.75rem; }
.contact-form .field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.75rem; }
/* Honeypot: physically removed from view but present for bots. */
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------------ */
/* 3D stage + overlays                                                 */
/* ------------------------------------------------------------------ */

.stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
}
#scene { display: block; width: 100%; height: 100%; outline: none; }

/* When the game is live, the text archive is reachable via the Text view
   toggle; keep it in the DOM but visually removed. */
body.game-active { overflow: hidden; }
body.game-active .archive-text { display: none; }
body.game-active .site-footer { display: none; }
body.game-active.text-mode { overflow: auto; }
body.game-active.text-mode .archive-text { display: block; }
body.game-active.text-mode .site-footer { display: flex; }
body.game-active.text-mode .stage { display: none; }

#scene { image-rendering: pixelated; }

/* Game HUD (score / year / chapters) */

.game-hud {
  position: absolute;
  top: calc(var(--header-h) + 0.6rem);
  left: 0.9rem;
  right: 0.9rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  pointer-events: none;
  font-family: var(--font-mono);
}
.game-hud .hud-label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  display: block;
}
.hud-score, .hud-chapters, .hud-year {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  backdrop-filter: blur(8px);
}
.hud-score { display: flex; align-items: baseline; gap: 0.6rem; }
#hud-score { font-size: 1.4rem; font-weight: 700; color: var(--accent); min-width: 3.5ch; }
.hud-best { font-size: 0.68rem; color: var(--text-muted); }
.hud-best span { color: var(--text); }
.hud-year { font-size: 1.25rem; font-weight: 700; color: var(--cable); letter-spacing: 0.06em; }
.hud-chapters { font-size: 0.9rem; }

/* Title screen */

.title-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75rem;
  text-align: center;
  background: radial-gradient(ellipse at 50% 42%, #131a2ae8 0%, #0a0d13f2 70%);
  z-index: 22;
  padding: 1rem;
}
.title-overlay[hidden] { display: none; }
.title-kicker {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  color: var(--text-muted);
}
.title-name {
  margin: 0;
  font-family: var(--font-pixel);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 4.2rem);
  color: var(--accent);
  text-shadow: 0 0 24px #ffb45444, 3px 3px 0 #71501f;
  letter-spacing: 0.04em;
}
.title-sub { margin: 0; color: var(--text); max-width: 34rem; }
.title-controls {
  margin: 0.4rem 0 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 36rem;
}
.title-overlay .cta { border: 0; cursor: pointer; font-family: var(--font-mono); }
.title-alt { margin: 0.25rem 0 0; }

/* Quest banner */

.quest-banner {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: 4.6rem;
  width: min(38rem, calc(100vw - 1.5rem));
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.6rem 2.4rem 0.65rem 1rem;
  backdrop-filter: blur(12px);
  z-index: 21;
  text-align: center;
}
.qb-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.qb-caption { margin: 0.15rem 0 0; font-size: 0.95rem; }
.quest-banner button {
  position: absolute;
  top: 0.45rem;
  right: 0.5rem;
  font: inherit;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.quest-banner button:hover { color: var(--danger); }

/* High scores */

.scores-panel {
  position: absolute;
  top: calc(var(--header-h) + 0.75rem);
  left: 50%;
  translate: -50% 0;
  width: min(24rem, calc(100vw - 2rem));
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 1.1rem;
  backdrop-filter: blur(14px);
  z-index: 30;
  font-family: var(--font-mono);
}
.scores-panel h2 {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-align: center;
}
.scores-list {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: grid;
  gap: 0.25rem;
  counter-reset: rank;
}
.scores-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.9rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}
.scores-list li::before {
  counter-increment: rank;
  content: counter(rank, decimal-leading-zero);
  color: var(--text-muted);
  font-size: 0.75rem;
  width: 1.6rem;
}
.scores-list .sc-name { flex: 1; letter-spacing: 0.08em; }
.scores-list .sc-score { color: var(--cable); font-weight: 700; }
.scores-list li.mine { background: var(--accent-soft); }
.scores-list li.mine .sc-name { color: var(--accent); }
.scores-list li.empty { color: var(--text-muted); font-size: 0.8rem; }
.score-form label { display: block; font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.score-form .sf-row { display: flex; gap: 0.5rem; }
.score-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
}
.score-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.score-form button {
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #14100a;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.score-form button:disabled { opacity: 0.5; cursor: default; }
.sf-note { margin: 0.5rem 0 0; font-size: 0.75rem; color: var(--text-muted); min-height: 1em; }

/* Touch controls */

.touch-controls {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  padding: 0 0.9rem calc(4.4rem + env(safe-area-inset-bottom));
  pointer-events: none;
  z-index: 18;
}
.touch-controls .tc-left, .touch-controls .tc-right {
  display: flex;
  gap: 0.6rem;
  pointer-events: auto;
}
.touch-controls button {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  background: #151b2acc;
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 4.2rem;
  height: 4.2rem;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.touch-controls button:active { border-color: var(--accent); color: var(--accent); }

.stage-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: opacity 400ms ease;
}
.stage-loader.done { opacity: 0; pointer-events: none; }

.hud {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  pointer-events: none;
}
.hud-hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  backdrop-filter: blur(8px);
}
.hud-actions { display: flex; gap: 0.5rem; pointer-events: auto; flex-wrap: wrap; }
.hud-btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.hud-btn:hover { border-color: var(--accent); color: var(--accent); }

.search-panel {
  position: absolute;
  top: calc(var(--header-h) + 0.75rem);
  left: 50%;
  translate: -50% 0;
  width: min(34rem, calc(100vw - 2rem));
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  backdrop-filter: blur(14px);
  z-index: 30;
}
.search-panel input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
}
.search-panel input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.search-filters { display: flex; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; }
.search-filters button {
  font: inherit;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  cursor: pointer;
}
.search-filters button.on { color: var(--accent); border-color: var(--accent); }
.search-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
  display: grid;
  gap: 0.25rem;
}
.search-results button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.search-results button:hover, .search-results button:focus { background: var(--bg-raised); outline: none; }
.search-results .sr-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.reading {
  position: absolute;
  top: calc(var(--header-h) + 0.75rem);
  right: 0.75rem;
  bottom: 4.5rem;
  width: min(27rem, calc(100vw - 1.5rem));
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  backdrop-filter: blur(14px);
  z-index: 20;
  overscroll-behavior: contain;
}
.reading .reading-close {
  position: sticky;
  top: 0;
  float: right;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}
.reading .reading-close:hover { color: var(--text); border-color: var(--accent); }
.reading > h2 { margin: 0.25rem 0; font-size: 1.6rem; }
.reading .crumb { margin: 0; }
.reading .subtitle { font-size: 1rem; }
.reading .metrics { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem; margin: 1rem 0; }
.reading .body { font-size: 0.98rem; }
.reading .reading-actions { display: flex; gap: 0.5rem; margin: 1rem 0 0.5rem; flex-wrap: wrap; }
.reading .reading-actions button, .reading .reading-actions a {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  text-decoration: none;
}
.reading .reading-actions button:hover, .reading .reading-actions a:hover { border-color: var(--accent); color: var(--accent); }
.reading .related button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Story mode */

.stories-panel {
  position: absolute;
  top: calc(var(--header-h) + 0.75rem);
  left: 50%;
  translate: -50% 0;
  width: min(30rem, calc(100vw - 2rem));
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(14px);
  z-index: 30;
}
.stories-panel h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.stories-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.stories-panel button {
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
}
.stories-panel button:hover { border-color: var(--accent); }
.stories-panel .st-title { display: block; font-weight: 650; color: var(--accent); }
.stories-panel .st-desc { display: block; font-size: 0.85rem; color: var(--text-muted); }


/* ------------------------------------------------------------------ */
/* Admin                                                               */
/* ------------------------------------------------------------------ */

.admin { background: var(--bg); }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.admin-header nav { display: flex; align-items: center; gap: 1rem; }
.admin-main { max-width: 72rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.admin-section { margin: 2.5rem 0; }
.admin-section-head { display: flex; align-items: center; justify-content: space-between; }

.admin table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin th, .admin td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); }
.admin .nowrap { white-space: nowrap; font-family: var(--font-mono); font-size: 0.78rem; }
.admin .msg-body { white-space: pre-wrap; max-width: 34rem; }
.admin-tools { margin: 0.5rem 0 0; }
.admin .slug-cloud code { margin-right: 0.4rem; }
.admin th { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); }
.row-actions { display: flex; gap: 0.6rem; align-items: center; }
.inline-form { display: inline; }

.admin button, .admin .button {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.admin button:hover, .admin .button:hover { border-color: var(--accent); }
.admin button.primary { background: var(--accent); color: #14100a; font-weight: 650; border-color: transparent; }
.admin button.danger { color: var(--danger); border-color: #ff6b6b44; background: none; padding: 0.2rem 0.6rem; font-size: 0.8rem; }
.admin button.danger:hover { border-color: var(--danger); }

.admin-form { max-width: 52rem; display: grid; gap: 0.4rem; }
.admin-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0 0 1.25rem; display: grid; gap: 0.4rem; }
.admin-form legend { font-family: var(--font-mono); color: var(--accent); padding: 0 0.5rem; }
.admin-form label { margin-top: 0.6rem; font-size: 0.88rem; color: var(--text-muted); }
.admin-form input, .admin-form textarea, .admin-form select {
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  width: 100%;
}
.admin-form input:focus, .admin-form textarea:focus, .admin-form select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.admin-form input[readonly] { opacity: 0.6; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; }
.field-row.checkboxes { display: flex; gap: 1.5rem; margin-top: 0.75rem; }
.field-row.checkboxes label { display: flex; align-items: center; gap: 0.5rem; margin: 0; color: var(--text); }
.field-row.checkboxes input { width: auto; }

.admin-login { max-width: 22rem; margin: 15vh auto 0; display: grid; gap: 0.75rem; }
.admin-login form { display: grid; gap: 0.75rem; }
.admin-login input { font: inherit; color: var(--text); background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; }
.admin-login button { font: inherit; background: var(--accent); color: #14100a; font-weight: 650; border: 0; border-radius: 8px; padding: 0.6rem; cursor: pointer; }

/* ------------------------------------------------------------------ */
/* Responsiveness & preferences                                        */
/* ------------------------------------------------------------------ */

/* Narrow header: brand + CTA + menu button; links move into a dropdown.
   The threshold is generous because main.js prepends a Play-the-game
   button to the nav, which crowds the row well above phone widths. */
@media (max-width: 860px) {
  .site-header { gap: 0.6rem; }
  .site-header .socials { display: none; }   /* footer still lists them all */
  .cta-mobile { display: inline-block; margin-left: auto; font-size: 0.9rem; padding: 0.4rem 0.85rem; white-space: nowrap; }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
  }
  .nav-toggle svg { width: 1.35rem; height: 1.35rem; }
  .site-header.nav-open .nav-toggle { border-color: var(--accent); color: var(--accent); }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    margin: 0;
    padding: 0.5rem 0.75rem 0.8rem;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 40px #00000088;
  }
  .site-header.nav-open .site-nav { display: flex; }
  .site-nav a { font-size: 1.02rem; padding: 0.8rem 0.65rem; border-radius: 10px; }
  .site-nav a:hover, .site-nav a:active { background: var(--bg-raised); color: var(--text); }
  .site-nav .nav-game-toggle {
    font-size: 1.02rem;
    padding: 0.8rem 0.65rem;
    border: 0;
    border-radius: 10px;
    text-align: left;
  }
  .site-nav .nav-game-toggle:hover, .site-nav .nav-game-toggle:active { background: var(--bg-raised); }
  .site-nav .cta { margin-top: 0.35rem; text-align: center; color: #14100a !important; }
}

/* Small screens: the game controls live in their own strips under the
   canvas instead of floating over the play area. */
.stage[hidden], .touch-controls[hidden] { display: none !important; }
@media (max-width: 720px) {
  .stage { display: flex; flex-direction: column; }
  .title-name { font-size: clamp(1.25rem, 6.2vw, 4.2rem); }
  #scene { flex: 1; height: auto; min-height: 0; }
  .hud { position: static; padding: 0.4rem 0.6rem 0.3rem; }
  .hud-hint { display: none; }
  .hud-actions {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hud-actions::-webkit-scrollbar { display: none; }
  .hud-btn { flex: 0 0 auto; font-size: 0.8rem; padding: 0.35rem 0.75rem; }
  .touch-controls { position: static; padding: 0.4rem 0.9rem calc(0.5rem + env(safe-area-inset-bottom)); }
  .touch-controls button { width: 3.7rem; height: 3.7rem; border-radius: 12px; font-size: 1rem; }

  /* Score strip: compact boxes that fit a phone. */
  .game-hud { left: 0.5rem; right: 0.5rem; gap: 0.4rem; }
  .hud-score, .hud-chapters, .hud-year { padding: 0.25rem 0.55rem; border-radius: 6px; }
  #hud-score { font-size: 1.05rem; }
  .hud-year { font-size: 0.95rem; }
  .hud-chapters { font-size: 0.72rem; }
  .hud-best { display: none; }

  .reading { top: auto; right: 0; bottom: 0; left: 0; width: auto; max-height: 62vh; border-radius: var(--radius) var(--radius) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ */
/* Chat widget                                                         */
/* ------------------------------------------------------------------ */

body.game-active .chat-root { display: none; }

.chat-fab {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  width: 3.4rem;
  height: 3.4rem;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--bg-raised);
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 10px 30px #00000088;
  transition: transform 120ms ease, border-color 120ms ease;
}
.chat-fab:hover { transform: translateY(-2px); border-color: var(--accent); }
.chat-fab img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.chat-dot {
  position: absolute;
  right: 0.05rem;
  bottom: 0.05rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: #5b6473;
  border: 2px solid var(--bg);
}
.chat-dot.on { background: var(--ok); box-shadow: 0 0 10px #7ce38b88; }
.chat-dot.idle { background: var(--accent); box-shadow: 0 0 10px #ffb45488; }
.chat-dot.dnd { background: var(--danger); box-shadow: 0 0 10px #ff6b6b88; }

.chat-panel[hidden] { display: none; }

/* Compact link-preview card inside a chat bubble. */
.chat-msg a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.chat-unfurl {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  margin-top: 0.45rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #ffffff26;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: #0a0d1366;
  text-decoration: none !important;
  min-width: 0;
}
.chat-unfurl-thumb {
  flex: 0 0 auto;
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 6px;
}
.chat-unfurl-body { display: grid; gap: 0.12rem; min-width: 0; align-content: center; }
.chat-unfurl-site {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}
.chat-unfurl-title {
  font-weight: 650;
  font-size: 0.82rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-unfurl-desc {
  font-size: 0.74rem;
  line-height: 1.35;
  opacity: 0.75;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-unfurl:hover { border-color: var(--accent); }
.chat-panel {
  position: fixed;
  right: 1.1rem;
  bottom: 5.1rem;
  width: min(21rem, calc(100vw - 2rem));
  max-height: min(30rem, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  background: #10151f;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px #000000aa;
  z-index: 60;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raised);
}
.chat-head img { border-radius: 50%; }
.chat-head-meta { display: grid; line-height: 1.25; }
.chat-head-meta strong { font-size: 0.95rem; }
.chat-sub { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }
.chat-sub.on { color: var(--ok); }
.chat-sub.idle { color: var(--accent); }
.chat-sub.dnd { color: var(--danger); }
.chat-close {
  margin-left: auto;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.chat-close:hover { color: var(--text); }

.chat-body { padding: 1rem; display: grid; gap: 0.7rem; }
.chat-body p { margin: 0; font-size: 0.92rem; color: #c3cadb; }
.chat-body .cta { justify-self: start; }
.chat-links { font-size: 0.8rem; color: var(--text-muted); }

.chat-name-form { display: grid; gap: 0.6rem; }
.chat-name-form label { font-size: 0.9rem; }
.chat-name-form input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}
.chat-name-form .cta { border: 0; cursor: pointer; justify-self: start; }

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 10rem;
}
.chat-msg {
  max-width: 82%;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chat-msg.from-you {
  align-self: flex-end;
  background: var(--accent);
  color: #14100a;
  border-bottom-right-radius: 4px;
}
.chat-msg.from-chris {
  align-self: flex-start;
  background: #1b2233;
  border-bottom-left-radius: 4px;
}
.chat-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
  margin: 0.3rem 0;
}
.chat-send {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem;
  border-top: 1px solid var(--line);
}
.chat-send input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
}
.chat-send input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.chat-send button {
  font: inherit;
  font-weight: 650;
  background: var(--accent);
  color: #14100a;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.form-note { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); margin: 0.3rem 0 0.5rem; }
.contact-lede { font-family: var(--font-serif); font-size: 1.1rem; line-height: 1.75; color: #c3cadb; }

/* Admin chat console + badges */
.badge-ok, .badge-dim {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.12rem 0.5rem;
  border-radius: 99px;
  border: 1px solid var(--ok);
  color: var(--ok);
}
.badge-dim { border-color: var(--line); color: var(--text-muted); }

.chat-status-line { color: var(--text-muted); }
.chat-status-line strong { color: var(--ok); }
.chat-console {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 1rem;
  min-height: 26rem;
}
.cc-sessions {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  overflow-y: auto;
}
.cc-sessions h2, .cc-thread h2 { margin: 0 0 0.6rem; font-size: 1rem; }
.cc-sessions ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.cc-sessions button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}
.cc-sessions button:hover { background: var(--bg-raised); }
.cc-sessions button.active { border-color: var(--accent); }
.cc-sessions small { color: var(--text-muted); font-size: 0.68rem; margin-left: auto; }
.cc-unread {
  background: var(--accent);
  color: #14100a;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 0 0.4rem;
}
.cc-empty { color: var(--text-muted); font-size: 0.85rem; }
.cc-thread {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
}
.cc-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem 0;
  min-height: 16rem;
}
.cc-msg {
  max-width: 70%;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.cc-msg.from-chris { align-self: flex-end; background: var(--accent); color: #14100a; }
.cc-msg.from-visitor { align-self: flex-start; background: var(--bg-raised); }
.cc-form { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.cc-form input {
  flex: 1;
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
}

@media (max-width: 700px) {
  .chat-console { grid-template-columns: 1fr; }
}
