/* perfect-ui · <design_plan> v2.5.0
 * Minimal blue-green CRT, matched to the original reference.
 */
:root {
  color-scheme: dark;
  --void: #020303;
  --green: #173e32;
  --blue: #213e68;
  --ice: #cedcff;
  --dust: #89938f;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html { background: var(--void); }

body { margin: 0; }

body, button { -webkit-font-smoothing: antialiased; }
button { font: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

::selection { background: var(--ice); color: var(--green); }

.definitions { position: absolute; width: 0; height: 0; overflow: hidden; }

main {
  min-height: 100svh;
  padding: 40px 20px;
  display: grid;
  place-items: center;
}

.television {
  width: min(86vw, 930px, calc((100svh - 130px) * 1.34));
  position: relative;
  isolation: isolate;
  margin-top: -3svh;
}

.screen {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(105deg, var(--green), var(--blue));
  clip-path: url(#glass-shape);
  isolation: isolate;
  overflow: hidden;
  container-type: inline-size;
}

.phosphor, .grain, .glass-light, .scanlines, .vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.phosphor { z-index: 0; opacity: .95; }

/* Keep every part of the picture beneath the same glass treatment. */
.grain { z-index: 2; opacity: .065; image-rendering: pixelated; }

.glass-light {
  z-index: 3;
  background:
    radial-gradient(ellipse at 27% 8%, rgb(162 211 235 / .14), transparent 60%),
    linear-gradient(180deg, rgb(190 220 255 / .04), transparent 6%, transparent 94%, rgb(80 120 180 / .05));
}

.screen-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
}

.world { position: absolute; inset: 0; }
.world:focus { outline: none; }
.world:focus-visible + .character { --character-glow: rgb(120 165 255 / .4); }

h1 {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  margin: 0;
  max-width: 92%;
  color: var(--ice);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(15px, 3.65vw, 36px);
  font-size: 4.9cqw;
  line-height: 1.4;
  letter-spacing: .025em;
  white-space: nowrap;
  text-align: center;
  text-wrap: nowrap;
  filter: blur(.42px);
  text-shadow:
    -1.3px 0 1px rgb(64 105 255 / .7),
    1.5px .4px 1px rgb(182 195 255 / .55),
    0 0 5px rgb(120 165 255 / .55),
    0 0 16px rgb(82 123 205 / .22);
}

.section-links { position: absolute; top: 57%; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: clamp(14px, 3.6cqw, 34px); white-space: nowrap; }
.section-links a {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 10px 5px;
  color: var(--ice);
  font: clamp(11px, 1.65cqw, 16px) / 1.4 "Courier New", Courier, monospace;
  letter-spacing: .025em;
  text-decoration: none;
  text-shadow: -1px 0 2px rgb(100 120 255 / .35), 0 0 6px rgb(120 165 255 / .35);
}
.section-links a::after { content: ''; position: absolute; bottom: 6px; left: 5px; right: 5px; height: 1px; background: currentColor; opacity: 0; }
.section-links a:hover::after, .section-links a.is-selected::after { opacity: .65; }
.section-links a.is-selected { text-shadow: 0 0 4px var(--ice), 0 0 14px rgb(120 165 255 / .55); }
.section-links a:focus-visible { outline: 1px solid var(--ice); outline-offset: 2px; }

.character {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  transform-origin: 50% 100%;
  pointer-events: none;
  /* Phosphor bloom and slight channel bleed retain the pixel silhouette. */
  filter:
    blur(.3px)
    drop-shadow(-.7px 0 .5px rgb(64 105 255 / .5))
    drop-shadow(.6px .2px .5px rgb(154 197 238 / .3))
    drop-shadow(0 0 2.5px var(--character-glow, rgb(120 165 255 / .25)));
  will-change: transform;
}
.character svg { display: block; width: 100%; height: 100%; overflow: visible; opacity: .92; }
.character[data-facing="left"] svg { transform: scaleX(-1); }
.character[data-pose="0"] .leg-left { transform: translate(-1px, -1px); }
.character[data-pose="0"] .leg-right { transform: translate(1px, 0); }
.character[data-pose="1"] .leg-left { transform: translate(1px, 0); }
.character[data-pose="1"] .leg-right { transform: translate(-1px, -1px); }
.character[data-pose="jump"] .leg-left { transform: translate(-1px, -2px); }
.character[data-pose="jump"] .leg-right { transform: translate(1px, -1px); }

.reading-room { display: none; position: absolute; inset: 14% 16% 25%; color: var(--ice); }
.reading-room:target { display: flex; flex-direction: column; align-items: flex-start; }
.screen.game-ready .reading-room { display: none; }
.screen.game-ready .reading-room.is-active { display: flex; flex-direction: column; align-items: flex-start; }
.screen:not(.game-ready):has(.reading-room:target) .world, .screen.has-reader .world { visibility: hidden; pointer-events: none; }
.reading-room h2 { flex-shrink: 0; margin: 4% 0 7%; font: 700 clamp(23px, 4.7cqw, 42px) / 1.15 Georgia, serif; letter-spacing: .015em; text-wrap: balance; text-shadow: 0 0 9px rgb(120 165 255 / .28); }
.reading-room h2:focus { outline: none; }
.reading-copy { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--dust) transparent; font: clamp(14px, 2.2cqw, 19px) / 1.7 Georgia, serif; max-width: 40ch; padding: 0 4px 12px 0; margin-bottom: clamp(28px, 5cqw, 44px); }
.reading-copy p { margin: 0 0 1em; text-wrap: pretty; }
.quiet { opacity: .8; }
.back-link, .reading-link { color: var(--ice); font: clamp(11px, 1.65cqw, 14px) / 1.6 "Courier New", Courier, monospace; text-underline-offset: 5px; }
.back-link { order: 1; flex-shrink: 0; align-self: flex-end; margin-top: auto; display: inline-grid; align-items: center; min-height: 44px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.reading-link { display: inline-grid; align-items: center; min-height: 44px; }
.back-link:focus-visible, .reading-link:focus-visible { outline: 1px solid var(--ice); outline-offset: 3px; }

.contact {
  position: absolute;
  bottom: 4.5%;
  display: grid;
  justify-items: center;
}

.social-links { display: flex; align-items: center; justify-content: center; gap: 18px; }
.social-links a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 4px;
  color: var(--ice);
  opacity: .75;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  letter-spacing: .06em;
  text-decoration: none;
  text-shadow: 0 0 5px rgb(120 165 255 / .3);
}
.social-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
.social-links a:focus-visible { opacity: 1; outline: 1px solid var(--ice); outline-offset: 3px; }
.social-links a.is-selected, .reading-link.is-selected, .back-link.is-selected { opacity: 1; text-decoration: underline; text-underline-offset: 5px; text-shadow: 0 0 5px var(--ice); }

.scanlines {
  z-index: 4;
  background:
    repeating-linear-gradient(0deg, rgb(0 3 8 / .2) 0, rgb(0 3 8 / .2) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgb(255 80 80 / .03) 0, rgb(70 255 100 / .02) 1px, rgb(60 100 255 / .02) 2px, transparent 3px);
  opacity: .8;
}

.vignette {
  z-index: 5;
  background: radial-gradient(ellipse at 50% 48%, transparent 35%, rgb(0 4 10 / .18) 63%, rgb(0 0 0 / .62) 100%);
  box-shadow: inset 0 0 28px 12px rgb(0 0 0 / .45);
}

.controls { position: absolute; top: calc(100% + 9px); left: 3%; right: 3%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.play-instructions { margin: 0; color: var(--dust); font: 10px / 1.6 "Courier New", Courier, monospace; letter-spacing: .025em; }
.hint-dot { margin: 0 8px; opacity: .6; }
.touch-hint, .touch-controls { display: none; }
.television:not(:has(.game-ready)) .play-instructions { display: none; }
.touch-controls { align-items: center; gap: 4px; }
.touch-controls button { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; border: 1px solid rgb(137 147 143 / .28); border-radius: 3px; color: var(--ice); background: transparent; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; font: 10px "Courier New", Courier, monospace; }
.touch-controls button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: square; }
.touch-controls button.is-held, .touch-controls button:active { background: rgb(206 220 255 / .12); }
.touch-controls button:focus-visible { outline: 1px solid var(--ice); outline-offset: 2px; }
.touch-controls button:disabled { opacity: .35; cursor: default; }

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 10px;
  border: 0;
  border-radius: 3px;
  color: var(--dust);
  background: transparent;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  letter-spacing: .03em;
  cursor: pointer;
  transition: color 160ms var(--ease);
}

.sound-toggle:hover { color: var(--ice); }
.sound-toggle:active { color: var(--ice); background: rgb(206 220 255 / .06); }
.sound-toggle:focus-visible { outline: 1px solid var(--ice); outline-offset: 3px; }
.sound-cross, .sound-toggle[aria-pressed="false"] .sound-waves { display: none; }
.sound-toggle[aria-pressed="false"] .sound-cross { display: block; }

@media (max-width: 600px) {
  main { padding-inline: 10px; }
  .television { width: 100%; max-width: 420px; margin-top: 0; margin-bottom: 58px; }
  .screen { aspect-ratio: 3 / 4; }
  h1 { filter: none; }
  .social-links { gap: 12px; }
  .social-links a { font-size: 10px; }
  .controls { top: calc(100% + 8px); flex-wrap: wrap; gap: 4px; }
  .play-instructions { flex-basis: 100%; text-align: center; font-size: 9px; }
  .hint-dot { margin: 0 4px; }
  .touch-hint { display: inline; }
  .keyboard-hint { display: none; }
  .touch-controls { display: flex; }
  .sound-toggle { font-size: 9px; }
  .reading-room { inset: 12% 12% 29%; }
  .reading-room h2 { margin-top: 6%; }
}

@media (pointer: coarse) and (min-width: 601px) {
  .controls { flex-wrap: wrap; }
  .touch-controls { display: flex; }
  .touch-hint { display: inline; }
  .keyboard-hint { display: none; }
}

@media (max-width: 360px) {
  .sound-toggle { min-width: 44px; justify-content: center; }
  .sound-toggle .sound-label { display: none; }
}

@media (max-height: 550px) and (min-width: 601px) {
  main { padding-block: 40px 100px; }
  .television { width: min(86vw, 760px); margin-top: 0; }
  .screen { min-height: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
