/* The interactive room: canvas, HUD, and the panels that sit on the TV, the dev kit and the notepad. */

.is-3d { overflow: hidden; }
.is-3d .page { display: none; }

/* 480p is broadcast 4:3. --fx is how far the 4:3 picture sits in from each side, set every frame
   by main.js from the room (scene.js eases it between widescreen and 4:3 along with the camera),
   and the bars, the top bar and every panel follow it. */
body.is-3d { --fx: 0px; }
.is-3d .topbar {
  position: fixed;
  inset: 0 var(--fx) auto var(--fx);
  padding: 16px 22px;
  background: linear-gradient(rgba(8, 6, 8, 0.55), rgba(8, 6, 8, 0));
}
.is-3d .brand { font-size: 16px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.is-3d .nav a {
  padding: 7px 12px;
  font: 400 21px/1 var(--f-crt);
  letter-spacing: 0.1em;
  color: rgba(239, 230, 214, 0.78);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}
.is-3d .nav a:hover { color: var(--ink); }
.is-3d .nav a[aria-current="page"] { background: var(--ink); color: var(--night); text-shadow: none; }

.stage { --fw: calc(100vw - 2 * var(--fx)); position: fixed; inset: 0; z-index: 10; background: var(--night); }
.stage canvas { display: block; width: 100vw; height: 100vh; }
/* 480p is upscaled smoothly: the VHS pass in js/looks.js is soft on purpose. */

/* The black bars either side of the 4:3 picture, with a CRT's rounded corners. */
.frame-mask {
  position: absolute;
  z-index: 23;
  inset: 0 var(--fx);
  border-radius: min(16px, var(--fx));
  box-shadow: 0 0 0 100vmax #000;
  pointer-events: none;
}

/* ---------- The tape, over everything in the picture (480p only) ---------- */

/* Scanlines, grain, a tracking band (moved by main.js in step with the shader's) and a vignette,
   laid over the room and its panels alike. */
.vhs-film { display: none; position: absolute; z-index: 22; inset: 0 var(--fx); overflow: hidden; pointer-events: none; }
.stage.is-vhs .vhs-film { display: block; }
.vhs-film::before, .vhs-film::after { content: ""; position: absolute; inset: 0; }
.vhs-film::before { background: linear-gradient(rgba(0, 0, 0, 0.12) 50%, transparent 50%) 0 0 / 100% calc(100vh / 300); }
.vhs-film::after { background: radial-gradient(ellipse 72% 78% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.36) 100%); }
.vhs-grain { position: absolute; inset: -50%; opacity: 0.06; animation: grain 0.6s infinite; will-change: transform; }
@keyframes grain {
  0%, 16% { transform: translate(0, 0); }
  17%, 33% { transform: translate(-9%, 6%); }
  34%, 50% { transform: translate(7%, -11%); }
  51%, 66% { transform: translate(-13%, -4%); }
  67%, 83% { transform: translate(4%, 12%); }
  84%, 100% { transform: translate(11%, 3%); }
}
.vhs-band {
  position: absolute;
  inset: 0 0 auto 0;
  height: 6vh;
  opacity: 0.32;
  background-size: 128px 128px;
  -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
  mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
  will-change: transform;
}
/* The panels pick up the tape's faded, warm color, and their text its red and blue fringes. */
.stage.is-vhs :is(.screen, .screen-aside, .sheet, .mag, .gb, .cd, .blow, .start) { filter: saturate(1.12) sepia(0.12) contrast(0.95); }
.stage.is-vhs :is(.screen-scroll, .sheet-scroll, .mag-scroll, .gb, .cd) { text-shadow: 1px 0 rgba(255, 50, 90, 0.3), -1px 0 rgba(50, 140, 255, 0.3); }
.stage.is-vhs .screen--tv .screen-scroll { text-shadow: 1px 0 rgba(255, 50, 90, 0.35), -1px 0 rgba(50, 140, 255, 0.35), 0 0 6px rgba(200, 210, 255, 0.45); }
.stage.is-vhs .screen--ops .screen-scroll { text-shadow: 1px 0 rgba(255, 50, 90, 0.35), -1px 0 rgba(50, 140, 255, 0.35), 0 0 6px rgba(80, 255, 110, 0.5); }

/* ---------- VCR on-screen display (480p only) ---------- */

/* Above the panels, so nothing on screen covers it. */
.vcr { display: none; position: absolute; inset: 0 var(--fx); z-index: 24; pointer-events: none; font: 400 30px/1 var(--f-crt); color: #f4f4ea; letter-spacing: 0.04em; }
.stage.is-vhs .vcr { display: block; }
.vcr span { position: absolute; left: max(3%, 22px); text-shadow: 2px 0 rgba(255, 40, 80, 0.55), -2px 0 rgba(40, 140, 255, 0.55), 0 0 6px rgba(255, 255, 255, 0.35); }
.vcr-play { top: 56px; opacity: 0; transition: opacity 0.3s steps(3); }
.vcr.is-playing .vcr-play { opacity: 1; }
.vcr-stamp { bottom: 14px; white-space: pre; font-size: 26px; line-height: 1.05; opacity: 0.88; }
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.5) 100%);
}

/* While the room loads: a still of it, dimmed, with a blinking line. */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0;
  padding-bottom: 14vh;
  background: linear-gradient(rgba(8, 6, 8, 0.45), rgba(8, 6, 8, 0.7)), url("../assets/room.jpg") center / cover;
  font: 400 28px var(--f-crt);
  letter-spacing: 0.08em;
  color: var(--ink);
}
.loading span { animation: blink 1.1s steps(2, start) infinite; }

/* If the browser takes the graphics card away. */
.lost { position: absolute; inset: 0; z-index: 40; display: grid; place-content: center; gap: 14px; justify-items: center; background: rgba(8, 6, 8, 0.86); font: 400 28px var(--f-crt); color: var(--ink); }
.lost p { margin: 0; }

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  right: calc(var(--fx) + 18px);
  bottom: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
/* In 480p the VCR's date stamp holds the bottom-left corner. */
.stage.is-vhs .hud { max-width: calc(var(--fw) - 230px); }
.hint {
  margin: 0;
  text-align: right;
  font: 400 19px/1.2 var(--f-crt);
  letter-spacing: 0.05em;
  color: rgba(239, 230, 214, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}
.hint kbd { font: inherit; color: var(--lamp); }
.hud-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(239, 230, 214, 0.22);
  border-radius: 999px;
  background: rgba(14, 11, 13, 0.84);
  color: var(--ink);
  font: 400 19px/1 var(--f-crt);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.chip:hover { background: rgba(40, 32, 36, 0.9); border-color: rgba(239, 230, 214, 0.45); }
.chip[aria-pressed="true"] { border-color: var(--lamp); color: var(--lamp); }
.chip--back { border-color: rgba(239, 230, 214, 0.45); }

.tooltip {
  position: absolute;
  z-index: 25;
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(14, 11, 13, 0.88);
  border: 1px solid rgba(239, 230, 214, 0.2);
  color: var(--ink);
  font: 400 19px/1.15 var(--f-crt);
  letter-spacing: 0.04em;
  pointer-events: none;
  /* Long labels wrap inside the box rather than spilling out of it. */
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  overflow-wrap: break-word;
}
.tooltip b { color: var(--lamp); font-weight: 400; }

/* ---------- Start screen, drawn over the TV glass ---------- */

.start {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9em;
  font-family: var(--f-crt);
  font-size: calc(var(--sh, 300px) * 0.11);
  color: var(--crt-ink);
  text-shadow: 0 0 8px rgba(200, 210, 255, 0.6);
}
.start-go {
  padding: 0.1em 0.4em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: inherit;
  cursor: pointer;
  animation: blink 1.1s steps(2, start) infinite;
}
.start-go:hover, .start-go:focus-visible { background: var(--crt-ink); color: var(--crt); text-shadow: none; animation: none; outline: none; }
.start-sound {
  display: flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.12em 0.3em;
  border: 2px solid currentColor;
  font-size: 0.62em;
  text-transform: uppercase;
}
.start-sound span { margin-right: 0.4em; }
.start-sound button {
  padding: 0 0.3em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.start-sound button[aria-pressed="true"] { background: var(--crt-ink); color: var(--crt); }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Screen panels: TV (blue) and dev kit (green phosphor) ---------- */

.screen {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4% / 5.5%;
  font: 400 calc(var(--sh, 400px) * 0.054)/1.14 var(--f-crt);
  transform-origin: 50% 50%;
}
.screen.is-on { animation: crt-on 0.32s ease-out; }
@keyframes crt-on {
  0% { transform: scale(1, 0.008); filter: brightness(4); }
  55% { transform: scale(1, 1.03); filter: brightness(1.6); }
  100% { transform: none; filter: none; }
}
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.42) 100%);
}
.screen--tv { background: var(--crt); color: var(--crt-ink); text-shadow: 0 0 6px rgba(200, 210, 255, 0.45); }
.screen--ops { background: var(--phosphor-bg); color: var(--phosphor); text-shadow: 0 0 6px rgba(80, 255, 110, 0.5); }
.screen-bar {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 1em;
  padding: 0.08em 0.7em;
  text-shadow: none;
  white-space: nowrap;
}
.screen--tv .screen-bar { background: var(--crt-ink); color: var(--crt); }
.screen--ops .screen-bar { background: var(--phosphor); color: var(--phosphor-bg); }
.screen-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.55em 0.9em 1.2em;
  scrollbar-width: none;
  outline: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

.screen section > h2, .screen .polaroid, .screen .section-note { display: none; }
.screen p { margin: 0 0 0.75em; }
.screen h3 { margin: 1em 0 0.35em; font: inherit; text-transform: uppercase; letter-spacing: 0.04em; }
.screen h3::before { content: "> "; }
.screen a { color: inherit; text-decoration: underline; text-underline-offset: 0.12em; }
.screen a:hover, .screen a:focus-visible { background: currentColor; outline: none; }
.screen--tv a:hover, .screen--tv a:focus-visible { color: var(--crt); background: var(--crt-ink); }
.screen--ops a:hover, .screen--ops a:focus-visible { color: var(--phosphor-bg); background: var(--phosphor); }
.screen ul, .screen ol { margin: 0 0 0.8em; padding: 0; list-style: none; }
.screen .tags li::before, .screen .side-quests li::before { content: "- "; }
.screen .facts { margin: 1em 0 0; }
.screen .facts div { display: flex; gap: 0.6em; }
.screen .facts dt { text-transform: uppercase; opacity: 0.7; min-width: 6em; }
.screen .facts dd { margin: 0; }
.screen .lede, .screen .term-line, .screen .p2, .screen .button, .screen .roll-end, .screen .case-id, .screen .roll-role {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

/* Ops log */
.screen .term-line { opacity: 0.75; }
.screen .term-line::after { content: "_"; animation: blink 1s steps(2, start) infinite; }
.screen .case { margin: 1.4em 0 0; }
.screen .case-id { display: inline-block; margin: 0 0 0.2em; padding: 0 0.3em; background: var(--phosphor); color: var(--phosphor-bg); text-shadow: none; }
.screen .case h3 { margin-top: 0.2em; }
.screen .case h3::before { content: ""; }
.screen .case-note { opacity: 0.75; }
.screen .stack { display: flex; flex-wrap: wrap; gap: 0 0.6em; opacity: 0.8; }
.screen .stack li::before { content: "["; }
.screen .stack li::after { content: "]"; }
.screen .rules { counter-reset: rule; }
.screen .rules li { counter-increment: rule; margin-bottom: 0.4em; }
.screen .rules li::before { content: counter(rule) ". "; }
.screen strong { font-weight: 400; text-transform: uppercase; }

/* Credits roll */
.screen .credits { text-align: center; }
.screen .roll { padding: calc(var(--sh, 400px) * 0.45) 0 calc(var(--sh, 400px) * 0.9); }
.screen .roll-block { margin-bottom: 2.2em; }
.screen .roll-role { margin: 0; opacity: 0.7; text-transform: uppercase; font-size: 0.8em; }
.screen .roll h3 { margin: 0 0 0.5em; font-size: 1.25em; }
.screen .roll h3::before { content: ""; }
.screen .roll li span { opacity: 0.7; }
.screen .roll-sub { margin: 0.6em 0 0.3em; opacity: 0.7; text-transform: uppercase; font-size: 0.75em; }
.screen .journey li span { margin-right: 0.4em; color: #ffd36b; }
.screen .journey li + li::before { content: none; }
.screen .roll-end { margin-top: 2em; font-size: 1.4em; }

/* Online */
.screen .online { display: flex; flex-direction: column; justify-content: center; min-height: 100%; text-align: center; }
.screen .p2 { font-size: 1.7em; text-transform: uppercase; color: #ffd36b; }
.screen .p2::after { content: "_"; animation: blink 1.1s steps(2, start) infinite; }
.screen .button {
  display: inline-block;
  margin-top: 0.4em;
  padding: 0.15em 0.6em;
  font-size: 1.25em;
  background: var(--crt-ink);
  color: var(--crt);
  text-decoration: none;
  text-shadow: none;
  text-transform: uppercase;
}

/* Polaroid that sits beside the TV on the About screen */
.screen-aside { position: absolute; z-index: 21; }
.screen-aside .polaroid {
  margin: 0;
  padding: 7% 7% 2%;
  background: #f4efe4;
  color: #2a2a33;
  transform: rotate(3deg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  animation: drop-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
.screen-aside .polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.screen-aside figcaption { padding-top: 4%; text-align: center; font: 400 22px var(--f-hand); }
@keyframes drop-in { from { transform: translateY(-30px) rotate(-4deg); opacity: 0; } }
/* When the Polaroid flies in from the TV it lands instead of dropping. */
.screen-aside.no-drop .polaroid, .polaroid-flight .polaroid { animation: none; }
.polaroid-flight { z-index: 30; pointer-events: none; transform-origin: 0 0; }
.polaroid img.is-pixel { image-rendering: pixelated; }

/* ---------- Notepad (Work) ---------- */

/* Projects and podcasts are on the Game Boy carts in the room; the static page still lists them. */
.sheet .projects, .sheet .podcasts { display: none; }
.sheet .sheet-extra { margin: 4px 0 10px; }

.sheet {
  position: absolute;
  z-index: 20;
  right: calc(var(--fx) + max(var(--fw) * 0.03, 24px));
  top: 58px;
  bottom: 70px;
  width: min(520px, calc(var(--fw) * 0.4));
  background: var(--paper);
  color: var(--paper-ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 0 #cfb862 inset;
  transform: rotate(1deg);
  animation: pad-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.sheet::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 22px;
  background: #8e2b2b;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}
@keyframes pad-in { from { transform: translate(40px, 30px) rotate(5deg); opacity: 0; } }
.sheet { transition: transform 0.35s ease, opacity 0.35s ease; }
/* Slides out of the way while a cartridge is being blown on. */
.sheet.is-away { opacity: 0; transform: translate(60px, 20px) rotate(4deg); pointer-events: none; }
.sheet-scroll {
  position: absolute;
  inset: 22px 0 0 0;
  overflow-y: auto;
  padding: 4px 26px 10px 70px;
  font: 400 17px/21px var(--f-hand);
  background-image:
    linear-gradient(90deg, transparent 52px, rgba(196, 64, 54, 0.55) 52px 54px, transparent 54px),
    repeating-linear-gradient(transparent 0 20px, rgba(70, 110, 170, 0.32) 20px 21px);
  background-attachment: local;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
  outline: none;
}
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0; }
.sheet-head h2 { margin: 0; font: 700 32px/40px var(--f-hand); }
.sheet-head span { font-size: 16px; color: #6b6450; }

/* The selected entry, Felix-style: circled number, name and years, a short blurb, one link. */
.sheet-feature { position: relative; margin: 0 0 12px; }
.sheet-feature .num {
  position: absolute;
  left: -50px;
  top: 2px;
  width: 38px;
  height: 26px;
  border: 2px solid var(--red-pen);
  border-radius: 50%;
  color: var(--red-pen);
  font: 700 15px/22px var(--f-hand);
  text-align: center;
}
.sheet-feature h3 { margin: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font: 700 24px/33px var(--f-hand); }
.sheet-feature h3 small { font-size: 16px; font-weight: 400; white-space: nowrap; }
.sheet-feature .role { margin: 0; color: #4a4536; }
.sheet-feature p { margin: 0; }
.sheet-feature .more { margin-top: 2px; }
.sheet-feature a { color: #1f3f9a; }

.sheet .work > h2, .sheet .section-note, .sheet .pause, .sheet .side-quests { display: none; }
.sheet .work { counter-reset: row; }
.sheet .jobs-title, .sheet .projects h3, .sheet .podcasts h3 {
  margin: 0;
  color: var(--red-pen);
  font: 700 18px/21px var(--f-hand);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.sheet .jobs { display: block; margin: 0 0 5px; }
.sheet .job, .sheet .project { counter-increment: row; position: relative; }
.sheet .job::before, .sheet .project::before {
  content: counter(row, decimal-leading-zero);
  position: absolute;
  left: -46px;
  font-size: 14px;
  color: #6b6450;
}
.sheet .podcasts .project { counter-increment: none; }
.sheet .podcasts .project::before { content: "♪"; left: -42px; }
.sheet .job.is-active::before, .sheet .project.is-active::before { color: var(--red-pen); font-weight: 700; }
.sheet .job header, .sheet .project { display: flex; justify-content: space-between; gap: 12px; }
.sheet .job h3 { margin: 0; font: inherit; }
.sheet .job h3 a, .sheet .project-name { text-decoration: none; color: inherit; }
.sheet .job h3 a:hover, .sheet .job h3 a:focus-visible, .sheet .project-name:hover, .sheet .project-name:focus-visible { text-decoration: underline; outline: none; }
.sheet .job.is-active h3 a, .sheet .project.is-active .project-name { text-decoration: underline wavy var(--red-pen) 1px; }
.sheet .job-meta { display: block; margin: 0 !important; font: inherit; color: #6b6450; white-space: nowrap; }
.sheet .project-years { color: #6b6450; white-space: nowrap; }
.sheet .project-list { margin: 0; padding: 0; list-style: none; }
.sheet .job-role, .sheet .job-body, .sheet .project-where, .sheet .project-desc { display: none; }

/* ---------- Dev kit terminal (AI Ops and Online) ---------- */

.term p, .term ol, .term ul { margin: 0; }
.term .term-out, .term .term-dim, .term .term-prompt { white-space: pre-wrap; }
.term .term-dim { opacity: 0.7; }
.term-prompt::after { content: "_"; animation: blink 1s steps(2, start) infinite; }
.term-dir { list-style: none; padding: 0; margin: 0.2em 0 0.6em !important; }
.term-file {
  display: grid;
  grid-template-columns: 2ch 13ch 1fr;
  gap: 0.6em;
  width: 100%;
  padding: 0 0.3em;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-shadow: inherit;
  cursor: pointer;
}
.term-file .term-n { opacity: 0.6; }
.term-file .term-d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-file.is-sel, .term-file:focus-visible { background: var(--phosphor); color: var(--phosphor-bg); text-shadow: none; outline: none; }
.term-page p, .term-page ol, .term-page ul { margin: 0 0 0.75em; }
.term-page .term-dim { margin: 0 0 0.5em; }
.term .term-h { margin: 0.2em 0 0.6em; font: inherit; text-transform: uppercase; letter-spacing: 0.04em; }
.term .term-h::before { content: ""; }
.bbs-head { margin: 0 0 1em !important; padding: 0.4em 0.7em; border: 2px solid currentColor; }
.bbs-head p { margin: 0; }
.bbs-title { font-size: 1.5em; text-transform: uppercase; color: #ffd36b; text-shadow: 0 0 8px rgba(255, 211, 107, 0.5); }
.term .bbs-head + p, .term .bbs-head ~ p { margin: 0 0 0.8em; }
.bbs-menu { list-style: none; padding: 0; margin: 1em 0 0 !important; }
.bbs-menu li { margin-bottom: 0.3em; }
.term a.bbs-link { text-decoration: none; padding: 0 0.3em; }
.term a.bbs-link:focus-visible, .term a.bbs-link:hover { background: var(--phosphor); color: var(--phosphor-bg); text-shadow: none; outline: none; }

/* ---------- Patch Notes magazine (Blog) ---------- */

.mag {
  position: absolute;
  z-index: 20;
  right: calc(var(--fx) + max(var(--fw) * 0.03, 24px));
  top: 76px;
  bottom: 100px;
  width: min(600px, calc(var(--fw) * 0.46));
  background: #f6f1e7;
  color: #1c1a20;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  transform: rotate(-0.8deg);
  animation: pad-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.mag::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.mag-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 0 34px 40px;
  font: 400 17px/1.6 var(--f-body);
  scrollbar-width: thin;
  outline: none;
}
.mag .blog > h2 { display: none; }
.mag .blog-masthead {
  margin: 0 -34px 0;
  padding: 26px 34px 10px;
  background: #e2422f;
  color: #fff;
  font: 400 54px/0.95 var(--f-display);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #121016;
}
.mag .section-note {
  margin: 0 -34px 24px;
  padding: 8px 34px 12px;
  background: #121016;
  color: #ffd36b;
  font: 700 12px/1.4 var(--f-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mag .posts { margin: 0; padding: 0; list-style: none; counter-reset: issue; }
.mag .post { padding: 16px 0; border-bottom: 2px solid #121016; }
.mag .post-title { display: block; color: #121016; font: 400 26px/1.15 var(--f-display); text-decoration: none; }
.mag .post-title:hover { color: #e2422f; }
.mag .post::before { content: "Issue #" attr(data-issue); display: block; margin-bottom: 4px; color: #2a3bd1; font: 700 12px var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; }
.mag .post time { display: block; margin-top: 6px; color: #6a6470; font: 400 13px var(--f-ui); }
.mag .post-dek { margin: 6px 0 0; color: #3a3640; }
.mag .posts-empty { margin: 8px 0; padding: 22px; border: 3px dashed #121016; font: 400 20px/1.4 var(--f-body); }
.mag .posts-empty::before { content: "NEXT ISSUE"; display: block; margin-bottom: 8px; color: #e2422f; font: 400 28px/1 var(--f-display); }
.mag .posts-empty a { color: #2a3bd1; }
.mag-reader { padding-top: 22px; }
.mag-nav { display: flex; justify-content: space-between; margin: 0 0 18px; font: 700 12px var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; }
.mag-nav a { color: #2a3bd1; text-decoration: none; }
.mag-kicker { margin: 0; color: #e2422f; font: 700 12px var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; }
.mag-post-head h3 { margin: 6px 0 8px; font: 400 34px/1.05 var(--f-display); }
.mag-dek { margin: 0 0 18px; color: #4a4550; font-size: 19px; }
.mag-loading { font: 400 22px var(--f-crt); }
.mag .post-body h2, .mag .post-body h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.15; margin: 1.4em 0 0.4em; }
.mag .post-body blockquote { margin: 1.2em 0; padding: 0.2em 0 0.2em 16px; border-left: 4px solid #e2422f; font-style: italic; }
.mag .post-body a { color: #2a3bd1; }
.mag .post-body img { max-width: 100%; height: auto; }
.mag .post-body code { font-family: var(--f-ui); font-size: 0.9em; background: #e8e1d3; padding: 0 4px; }

/* ---------- Game Boy up close: the cart case ---------- */

.gb {
  position: absolute;
  z-index: 20;
  right: calc(var(--fx) + max(var(--fw) * 0.03, 24px));
  top: 70px;
  max-height: calc(100% - 150px);
  width: min(420px, calc(var(--fw) * 0.36));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #cfcbbf;
  color: #23212b;
  border-radius: 8px 8px 28px 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transform: rotate(0.6deg);
  animation: pad-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.gb-head { padding: 14px 20px 10px; border-bottom: 2px solid #a9a598; }
.gb-kicker { margin: 0; font: 700 11px var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; color: #6a5cb8; }
.gb-head h2 { margin: 4px 0 0; font: 400 26px/1 var(--f-display); }
/* The selected cart, on a little screen-green card. */
.gb-feature { margin: 12px 16px 6px; padding: 12px 14px; background: #9bbc0f; color: #0f380f; border: 3px solid #4e505c; border-radius: 4px; }
.gb-where { margin: 0; font: 400 17px/1 var(--f-crt); text-transform: uppercase; color: #306230; }
.gb-feature h3 { margin: 4px 0 6px; font: 400 26px/1 var(--f-crt); }
.gb-desc { margin: 0; font: 400 14px/1.45 var(--f-body); }
.gb-feature .more { margin: 8px 0 0; font: 700 13px var(--f-ui); }
.gb-feature .more a { color: #0f380f; }
.gb-list { overflow-y: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.gb-group { margin: 10px 20px 2px; font: 700 11px var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; color: #6b6658; }
.gb-list button {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 5px 20px;
  font: 400 15px/1.3 var(--f-body);
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.gb-list button img { width: 24px; height: 24px; image-rendering: pixelated; }
.gb-list button:hover, .gb-list button:focus-visible { background: rgba(0, 0, 0, 0.07); outline: none; }
.gb-list button[aria-current="true"] { background: #6a5cb8; color: #fff; }
.gb-years { font: 400 12px var(--f-ui); opacity: 0.7; }
.gb-keys { margin: 0; padding: 8px 20px 12px; font: 400 12px var(--f-ui); color: #6b6658; border-top: 2px solid #a9a598; }
.gb-keys kbd { font: inherit; color: #23212b; }

/* ---------- Discman up close: the CD case ---------- */

.cd {
  position: absolute;
  z-index: 20;
  right: calc(var(--fx) + max(var(--fw) * 0.03, 24px));
  top: 70px;
  max-height: calc(100% - 150px);
  width: min(420px, calc(var(--fw) * 0.36));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #17151d;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 0 0 5px rgba(255, 255, 255, 0.03);
  transform: rotate(-0.6deg);
  animation: pad-in 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
/* The insert: a sunset-to-night gradient with a little sun and horizon lines. */
.cd-cover {
  position: relative;
  padding: 18px 20px 30px;
  background:
    radial-gradient(circle at 84% 112%, #ffd36b 0 22px, transparent 23px),
    repeating-linear-gradient(180deg, transparent 0 5px, rgba(23, 21, 29, 0.35) 5px 7px) bottom / 100% 20px no-repeat,
    linear-gradient(165deg, #ff8fb8 0%, #b66bff 48%, #2d2f7f 100%);
}
.cd-kicker, .cd-sub { margin: 0; font: 700 11px/1.3 var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.85); }
.cd-cover h2 { margin: 6px 0; font: 400 28px/1 var(--f-display); color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25); }
.cd-sub { text-transform: none; letter-spacing: 0.02em; font-weight: 400; }
/* Now playing, on a Discman-green LCD. */
.cd-now {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 20px 8px;
  background: #8e9a80;
  color: #1d2a14;
  font: 400 24px/1 var(--f-crt);
}
.cd.is-playing .cd-now { background: #a9bf8e; }
.cd-now #cd-num::before { content: "■ "; }
.cd.is-playing .cd-now #cd-num::before { content: "▶ "; }
.cd-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cd-controls { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 8px; padding: 12px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.cd-controls button {
  padding: 8px 0;
  font: 700 14px var(--f-ui);
  color: var(--ink);
  background: #2a2833;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  cursor: pointer;
}
.cd-controls button:hover, .cd-controls button:focus-visible { background: #3a3745; outline: none; }
.cd-tracks { list-style: none; margin: 0; padding: 4px 0 10px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.cd-side { padding: 12px 20px 4px; font: 700 11px var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.cd-tracks button {
  position: relative;
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  align-items: baseline;
  width: 100%;
  padding: 5px 20px;
  font: 400 15px/1.35 var(--f-body);
  text-align: left;
  color: var(--ink-dim);
  background: none;
  border: 0;
  cursor: pointer;
}
.cd-tracks button:hover, .cd-tracks button:focus-visible { color: var(--ink); background: rgba(255, 255, 255, 0.06); outline: none; }
.cd-tracks button[aria-current="true"] { color: #ffd36b; }
.cd-tracks .n, .cd-tracks .len { font: 400 12px var(--f-ui); color: var(--ink-faint); }
.cd-tracks button[aria-current="true"] .n::before { content: "▶"; position: absolute; left: 7px; color: #ffd36b; }
.cd-keys { margin: 0; padding: 8px 20px 12px; font: 400 12px var(--f-ui); color: var(--ink-faint); border-top: 1px solid rgba(255, 255, 255, 0.08); }

/* ---------- Blow on the cartridge (drawn over the TV's blue screen) ---------- */

.blow {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
  font: 400 calc(var(--sh, 300px) * 0.085)/1.1 var(--f-crt);
  color: var(--crt-ink);
  text-align: center;
  text-shadow: 0 0 8px rgba(200, 210, 255, 0.6);
}
.blow p { margin: 0; }
.blow-line { text-transform: uppercase; letter-spacing: 0.04em; }
.blow-go {
  margin-top: 0.3em;
  padding: 0.12em 0.7em;
  border: 3px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1.35em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: inherit;
  cursor: pointer;
  animation: blow-pulse 1.1s ease-in-out infinite;
}
.blow-go:hover, .blow-go:focus-visible { background: var(--crt-ink); color: #1430d4; text-shadow: none; outline: none; }
.blow-sub { font-size: 0.6em; opacity: 0.75; }
@keyframes blow-pulse { 50% { transform: scale(1.06); } }

/* ---------- Pause screen: Player 2 has joined ---------- */

.pausemenu {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    repeating-linear-gradient(rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    rgba(6, 6, 22, 0.62);
  animation: pause-fade 0.2s ease-out;
}
@keyframes pause-fade { from { opacity: 0; } }
.pause-window {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  width: min(940px, 94vw);
  padding: 22px 30px 20px;
  border: 4px solid #eef0ff;
  border-radius: 8px;
  outline: 4px solid #141a5c;
  background: linear-gradient(#2f42d8, #1a2486);
  color: #eef0ff;
  font: 400 24px/1.25 var(--f-crt);
  text-align: center;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: drop-in 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
.pause-window p { margin: 0; }
.pausemenu .pause-scene {
  position: static;
  display: block;
  width: min(384px, 44vw);
  height: auto;
  aspect-ratio: 256 / 224;
  image-rendering: pixelated;
  border: 4px solid #141a5c;
  border-radius: 4px;
  background: #0a0a14;
}
@media (max-width: 760px) {
  .pause-window { grid-template-columns: 1fr; justify-items: center; }
  .pausemenu .pause-scene { width: min(320px, 80vw); }
}
.pause-tag { letter-spacing: 0.2em; text-transform: uppercase; color: #ffd36b; }
.pause-window h2 { margin: 6px 0 2px; font: 400 30px/1.1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; }
.pause-years { opacity: 0.75; }
.pause-text { margin: 14px 0 6px; text-align: left; }
.pause-text p + p { margin-top: 10px; }
.pause-text p:last-child { color: #ffd36b; text-align: center; font-size: 1.15em; }
.pause-hearts { margin: 8px 0 12px !important; color: #ff6fae; letter-spacing: 0.3em; }
.pause-resume {
  padding: 2px 16px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1.15em;
  text-transform: uppercase;
  text-shadow: inherit;
  cursor: pointer;
}
.pause-resume:hover, .pause-resume:focus-visible { background: #eef0ff; color: #1a2486; text-shadow: none; outline: none; }
.pause-hint { margin-top: 6px !important; font-size: 0.8em; opacity: 0.7; }

/* ---------- Toast ---------- */

.toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 74px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(239, 230, 214, 0.25);
  background: rgba(14, 11, 13, 0.85);
  color: var(--ink);
  font: 400 21px/1.1 var(--f-crt);
  letter-spacing: 0.04em;
  animation: drop-in 0.3s ease-out;
}
.toast b { color: var(--lamp); font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .screen.is-on, .sheet, .mag, .toast, .blow-go, .pausemenu, .pause-window, .screen-aside .polaroid { animation: none; }
}
