:root {
  --bg: #07050c;
  --ink: #f5f1e6;
  --muted: #b9aee0;
  --line: rgba(255, 255, 255, 0.14);
  --yellow: #F0C818;
  --purple: #5B21D6;
  --purple-2: #7b4dff;
  --cream: #F5F1E6;
  --paper: #fffaf1;
  --paper-2: #f6ecdc;
  --paper-ink: #241d33;
  --paper-muted: #6b6280;
  --pixel: 'Jersey 10', 'DM Sans', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; overflow: hidden; height: 100dvh; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* ---- top bar ------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  flex: none;
  background: linear-gradient(#0d0918, #07050c);
  border-bottom: 1px solid rgba(123, 77, 255, 0.25);
  z-index: 20;
}
.brand {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--pixel);
  font-size: 26px;
  letter-spacing: 0.5px;
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  white-space: nowrap;
}
.brand canvas { width: 26px; height: 26px; image-rendering: pixelated; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pixel);
  font-size: 19px;
  color: var(--muted);
  white-space: nowrap;
}
.progress .bar { width: 72px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--yellow); transition: width 0.5s ease; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.icon-btn.muted #soundWaves { display: none; }
.icon-btn.muted { color: var(--muted); }

.btn {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.3px;
  line-height: 1;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--yellow); color: #1d1034; box-shadow: 0 3px 0 #a8870c; }
.btn-primary:hover { background: #ffd83a; }
.btn-primary:active { box-shadow: 0 1px 0 #a8870c; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid rgba(255, 255, 255, 0.28); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); }
.btn-big { font-size: 26px; padding: 13px 26px; }
.btn-small { font-size: 17px; padding: 6px 12px; }

/* ---- stage: the 3D lab fills it ----------------------------- */

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#lab { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* the label that floats over whatever you're standing next to */
.prompt {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -100%);
  font-family: var(--pixel);
  font-size: 22px;
  letter-spacing: 0.5px;
  padding: 5px 12px 5px 6px;
  border-radius: 10px;
  background: rgba(20, 14, 38, 0.9);
  border: 1.5px solid rgba(240, 200, 24, 0.7);
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  animation: promptIn 0.2s ease;
}
.prompt kbd {
  display: inline-block;
  font-family: var(--pixel);
  font-size: 18px;
  min-width: 26px;
  text-align: center;
  padding: 1px 6px;
  margin-right: 6px;
  border-radius: 6px;
  background: var(--yellow);
  color: #1d1034;
}
@keyframes promptIn { from { opacity: 0; transform: translate(-50%, -80%); } }

/* the flashback: a pixel screen that fills the view once the camera dives in */
.episode {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: #05030a;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.episode.in { opacity: 1; }
.crt { position: relative; line-height: 0; }
.crt::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, 0.45) 100%);
}
#screen { display: block; image-rendering: pixelated; touch-action: none; }

.hud {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(760px, calc(100% - 24px));
  width: max-content;
  padding: 9px 10px 9px 16px;
  border-radius: 999px;
  background: rgba(13, 8, 30, 0.88);
  border: 1px solid rgba(123, 77, 255, 0.35);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.hud.top { bottom: auto; top: 12px; }
.hud.empty { opacity: 0; }
.hud.empty button { pointer-events: none; }
.hud #hudText { line-height: 1.3; }
.hud button { pointer-events: auto; flex: none; }

.panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9;
  max-width: 780px;
  margin: 0 auto;
  max-height: calc(100% - 32px);
  overflow: auto;
  animation: panelIn 0.3s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes panelIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } }

/* speech */
.talk {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 0 0 3px var(--purple), 0 14px 36px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  user-select: none;
}
.portrait {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: #d9ccff;
  image-rendering: pixelated;
}
.talk-body { flex: 1; min-width: 0; }
.talk-name { font-family: var(--pixel); font-size: 20px; color: var(--purple); margin-bottom: 2px; }
.talk-text { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; min-height: 1.4em; }
.talk-next {
  flex: none;
  align-self: flex-end;
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--paper-muted);
  background: none;
  border: 0;
  cursor: pointer;
  animation: bob 1s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(3px); } }

/* cards */
.card {
  --accent: var(--yellow);
  display: flex;
  gap: 18px;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 0 0 3px #1d1034, 0 16px 40px rgba(0, 0, 0, 0.5);
  border-top: 6px solid var(--accent);
}
.card-art {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, #fff7ea);
}
.card-art canvas { image-rendering: pixelated; }
.card-main { flex: 1; min-width: 0; }
.card-kicker { margin: 0 0 2px; font-family: var(--pixel); font-size: 18px; color: var(--purple); letter-spacing: 0.5px; }
.card-meta { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--paper-muted); }
.card h2 { margin: 0 0 8px; font-family: var(--pixel); font-weight: 400; font-size: 34px; line-height: 1; }
.card p.body { margin: 0 0 12px; font-size: 16px; line-height: 1.5; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.tags li {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, #fff);
  color: color-mix(in srgb, var(--accent) 40%, #241d33);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.card .btn-ghost { color: var(--paper-ink); border-color: rgba(36, 29, 51, 0.25); }
.card .btn-ghost:hover { background: rgba(36, 29, 51, 0.06); }

/* ---- the real thing: the clip that plays after a flashback ---- */
.reel {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7, 5, 12, 0.96);
  animation: panelIn 0.3s ease;
}
.reel-box { width: min(960px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 10px; }
.reel-kicker { margin: 0; font-family: var(--pixel); font-size: 22px; letter-spacing: 1px; color: var(--yellow); }
.reel-kicker span { color: var(--ink); }
.reel video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 230px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  box-shadow: 0 0 0 3px var(--accent, var(--yellow)), 0 18px 50px rgba(0, 0, 0, 0.6);
}
.reel-line { margin: 0; font-size: 16px; line-height: 1.45; color: var(--ink); }
.reel-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---- title -------------------------------------------------- */

.title {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(7, 5, 12, 0.35) 0%, rgba(7, 5, 12, 0.85) 75%);
  animation: fadeIn 0.6s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.title-card {                       /* a dark panel, so the busy lab behind never runs through the words */
  width: min(560px, 100%); text-align: center;
  padding: 26px 28px 22px; border-radius: 18px;
  background: rgba(14, 9, 24, 0.78); border: 1px solid rgba(123, 77, 255, 0.35);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.title-note { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 14px 0 0; }
#titleLogo { width: 102px; height: 102px; image-rendering: pixelated; margin-bottom: 10px; filter: drop-shadow(0 0 22px rgba(240, 200, 24, 0.35)); }
.kicker { margin: 0 0 4px; font-family: var(--pixel); font-size: 22px; letter-spacing: 1px; color: var(--yellow); }
.title h1 {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(60px, 13vw, 96px);
  line-height: 0.9;
  text-shadow: 0 0 28px rgba(123, 77, 255, 0.8), 0 4px 0 var(--purple);
}
.tagline { margin: 0 0 14px; font-weight: 700; color: var(--muted); font-size: 15px; }
.blurb { margin: 0 auto 22px; max-width: 36ch; font-size: 17px; line-height: 1.5; }
.title-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.linkish { margin-top: 14px; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 14px; }

/* ---- no-WebGL menu ------------------------------------------ */

.fallback { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 16px; background: #0d0918; overflow: auto; }
.fb-card { width: min(720px, 100%); }
.fb-card h2 { font-family: var(--pixel); font-weight: 400; font-size: 48px; margin: 0; }
.fb-card p { color: var(--muted); }
.fb-eps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.fb-ep { text-align: left; font-family: var(--pixel); font-size: 26px; padding: 14px; border-radius: 12px; border: 2px solid var(--c); background: rgba(255, 255, 255, 0.04); cursor: pointer; }
.fb-ep span { display: block; font-size: 16px; color: var(--c); }
.fb-exs { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-ex { font-size: 14px; font-weight: 700; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; }

/* ---- small screens ------------------------------------------ */

@media (max-width: 560px) {
  .topbar { padding: 6px 10px; gap: 8px; }
  .brand span { display: none; }
  .progress .bar { display: none; }
  .progress { font-size: 17px; }
  #resumeBtn { font-size: 17px; padding: 8px 11px; }
  .panel { left: 8px; right: 8px; bottom: 8px; max-height: 64%; }
  .card { flex-direction: column; gap: 12px; padding: 14px; }
  .card-art { width: 100%; height: 90px; }
  .card h2 { font-size: 29px; }
  .card p.body { font-size: 15px; }
  .talk-text { font-size: 16px; }
  .hud { font-size: 13.5px; bottom: 10px; }
}

/* ---- résumé page -------------------------------------------- */

.resume { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--paper-2); color: var(--paper-ink); animation: fadeIn 0.2s ease; }
.resume-bar {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(246, 236, 220, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(36, 29, 51, 0.1);
}
.resume-bar .btn-ghost { color: var(--paper-ink); border-color: rgba(36, 29, 51, 0.25); }
.resume-bar .right { display: flex; gap: 8px; }
.sheet {
  max-width: 820px;
  margin: 24px auto 48px;
  padding: 40px 44px;
  background: var(--paper);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 12px 40px rgba(60, 40, 30, 0.1);
}
.sheet header h1 { margin: 0; font-family: var(--pixel); font-weight: 400; font-size: 56px; line-height: 1; }
.sheet header .sub { margin: 6px 0 0; font-weight: 700; color: var(--paper-muted); }
.sheet header .contact { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; }
.sheet a { color: var(--purple); font-weight: 700; }
.sheet h2 {
  margin: 32px 0 12px;
  font-family: var(--pixel); font-weight: 400; font-size: 21px;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--purple);
  display: flex; align-items: center; gap: 10px;
}
.sheet h2::after { content: ''; flex: 1; height: 2px; background: rgba(91, 33, 214, 0.15); }
.sheet p { line-height: 1.6; margin: 0; }
.job { margin: 0 0 20px; }
.job-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; }
.job-head strong { font-size: 17px; }
.job-head .when { color: var(--paper-muted); font-weight: 700; font-size: 14px; white-space: nowrap; }
.job .role { margin: 2px 0 6px; color: var(--paper-muted); font-weight: 600; }
.job ul { margin: 0; padding-left: 20px; }
.job li { margin: 4px 0; line-height: 1.5; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.plain { margin: 0; padding-left: 20px; }
.plain li { margin: 4px 0; line-height: 1.5; }
.skill-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-groups h3 { margin: 0 0 6px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chips li { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #ece3ff; }

@media (max-width: 680px) {
  .sheet { margin: 0; border-radius: 0; padding: 28px 20px; box-shadow: none; }
  .sheet header h1 { font-size: 44px; }
  .two-col, .skill-groups { grid-template-columns: 1fr; }
  .resume-bar .hide-sm { display: none; }
}

@media print {
  .topbar, .stage, .resume-bar, .directory, .pause-notice { display: none !important; }
  body { overflow: visible; background: #fff; }
  .resume { position: static; overflow: visible; background: #fff; }
  .sheet { box-shadow: none; margin: 0; padding: 0; max-width: none; }
}

/* A complete, keyboard-accessible map of the room. */
.directory {
  width: min(940px, calc(100vw - 32px)); max-height: calc(100dvh - 40px);
  margin: auto; padding: 30px; overflow-y: auto;
  color: var(--ink); background: #151020;
  border: 1px solid #47365f; border-radius: 20px;
  box-shadow: 0 30px 100px #0009; font-family: var(--body);
}
.directory::backdrop { background: #07050ccf; backdrop-filter: blur(8px); }
.directory-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.directory-kicker { margin: 0 0 6px; color: var(--yellow); font-size: 11px; letter-spacing: 2px; font-weight: 800; }
.directory h2 { font-family: 'Space Grotesk', var(--body); margin: 0; font-size: clamp(25px, 4vw, 36px); letter-spacing: -1px; }
.directory h3 { margin: 28px 0 12px; font-size: 14px; font-weight: 700; color: #d4c9ed; }
#directoryIntro { color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 65ch; margin: 14px 0 0; }
.directory-episodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.directory-story { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; cursor: pointer; padding: 18px 15px; border: 1px solid #ffffff1f; border-top: 3px solid var(--story-color); border-radius: 12px; background: #211a2c; min-height: 195px; }
.directory-story:hover, .directory-exhibit:hover { background: #31243f; border-color: #9472bc; }
.directory-number { font-size: 10px; letter-spacing: 1.2px; color: var(--story-color); font-weight: 800; }
.directory-story strong { font-family: var(--pixel); font-size: 25px; font-weight: 400; }
.directory-story > span:not(.directory-number):not(.directory-status) { font-size: 12px; line-height: 1.5; color: #c5bbd5; }
.directory-status { margin-top: auto; font-size: 11px; font-weight: 700; color: #efe9f7; }
.directory-exhibits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.directory-exhibit { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; cursor: pointer; border: 1px solid #ffffff1f; border-radius: 10px; background: #1c1625; text-align: left; }
.directory-exhibit strong { font-size: 14px; }
.directory-exhibit span { font-size: 11px; line-height: 1.4; color: var(--muted); }
.directory-home { display: inline-block; color: #d0b7fa; font-size: 13px; margin-top: 24px; text-underline-offset: 4px; }
.pause-notice { position: fixed; z-index: 25; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 16px 22px; border: 1px solid #725394; border-radius: 12px; background: #21172fee; color: var(--ink); text-align: center; font-size: 14px; pointer-events: none; }
#screen:focus-visible { outline-offset: -4px; }
@media (max-width: 900px) { .brand span { display: none; } }
@media (max-width: 700px) { .progress { display: none; } .directory-episodes { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .top-actions { gap: 6px; }
  .top-actions .btn { font-size: 18px; padding: 10px; }
  #resumeBtn { font-size: 18px; padding: 10px; }
  .icon-btn { width: 36px; height: 38px; }
  .directory { padding: 20px 16px; width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .directory-header .btn { font-size: 18px; padding: 9px 10px; }
  .directory-exhibits { grid-template-columns: 1fr; }
  .directory-story { min-height: 170px; padding: 15px 12px; }
  .directory-story strong { font-size: 23px; }
}
@media (max-height: 570px) {
  .title { place-items: start center; }
  .title-card { padding: 12px 0; }
  #titleLogo { width: 64px; height: 64px; margin-bottom: 6px; }
  .title h1 { font-size: 64px; }
  .title-note { display: none; }
}
@media (max-height: 460px) {          /* a phone held sideways: everything, buttons included, fits without scrolling */
  .title { padding: 8px 16px; place-items: center; }
  .title-card { padding: 12px 20px 10px; width: min(620px, 100%); }
  #titleLogo { display: none; }
  .title .kicker { font-size: 17px; margin-bottom: 2px; }
  .title h1 { font-size: 46px; margin-bottom: 4px; }
  .title .tagline { font-size: 13px; margin-bottom: 6px; }
  .title .blurb { font-size: 14px; margin-bottom: 10px; max-width: 52ch; }
  .title .btn-big { font-size: 22px; padding: 9px 20px; }
  .title .linkish { margin-top: 6px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
