/* Every color below is from the NES (2C02) hardware palette; the hex
   comment is its palette index. Sprites in sprites.js have their own. */
:root {
  --ink: #000000;         /* 0F */
  --paper: #fce0a8;       /* 37 */
  --white: #fcfcfc;       /* 30 */
  --gray: #7c7c7c;        /* 00 */
  --red: #a80020;         /* 05: text-safe red on paper */
  --pink: #e40058;        /* 15: hearts and large type only */
  --gold: #f8b800;        /* 28 */
  --green: #58d854;       /* 2A */
  --night: #000000;
  --px: 4;
  --lane: 0px;
  --display: "Jersey 10", sans-serif;
  /* Body copy is long-form, so it gets a face built for legibility rather than a pixel font. */
  --body: "Atkinson Hyperlegible Next", system-ui, sans-serif;

  /* 12x12-unit pixel windows with rounded corners, used as 9-slice border images. */
  --frame-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Crect x='2' y='0' width='8' height='1' fill='%23000000'/%3E%3Crect x='1' y='1' width='10' height='1' fill='%23000000'/%3E%3Crect x='0' y='2' width='2' height='8' fill='%23000000'/%3E%3Crect x='10' y='2' width='2' height='8' fill='%23000000'/%3E%3Crect x='1' y='10' width='10' height='1' fill='%23000000'/%3E%3Crect x='2' y='11' width='8' height='1' fill='%23000000'/%3E%3Crect x='2' y='2' width='8' height='8' fill='%23FCE0A8'/%3E%3Crect x='2' y='2' width='8' height='1' fill='%23FCFCFC'/%3E%3Crect x='2' y='2' width='1' height='8' fill='%23FCFCFC'/%3E%3Crect x='2' y='9' width='8' height='1' fill='%23F0D0B0'/%3E%3Crect x='9' y='2' width='1' height='8' fill='%23F0D0B0'/%3E%3C/svg%3E");
  --frame-somber: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Crect x='2' y='0' width='8' height='1' fill='%23000000'/%3E%3Crect x='1' y='1' width='10' height='1' fill='%23000000'/%3E%3Crect x='0' y='2' width='2' height='8' fill='%23000000'/%3E%3Crect x='10' y='2' width='2' height='8' fill='%23000000'/%3E%3Crect x='1' y='10' width='10' height='1' fill='%23000000'/%3E%3Crect x='2' y='11' width='8' height='1' fill='%23000000'/%3E%3Crect x='2' y='2' width='8' height='8' fill='%23BCBCBC'/%3E%3Crect x='2' y='2' width='8' height='1' fill='%23F8F8F8'/%3E%3Crect x='2' y='2' width='1' height='8' fill='%23F8F8F8'/%3E%3Crect x='2' y='9' width='8' height='1' fill='%237C7C7C'/%3E%3Crect x='9' y='2' width='1' height='8' fill='%237C7C7C'/%3E%3C/svg%3E");
  --frame-terminal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Crect x='2' y='0' width='8' height='1' fill='%2358D854'/%3E%3Crect x='1' y='1' width='10' height='1' fill='%2358D854'/%3E%3Crect x='0' y='2' width='2' height='8' fill='%2358D854'/%3E%3Crect x='10' y='2' width='2' height='8' fill='%2358D854'/%3E%3Crect x='1' y='10' width='10' height='1' fill='%2358D854'/%3E%3Crect x='2' y='11' width='8' height='1' fill='%2358D854'/%3E%3Crect x='2' y='2' width='8' height='8' fill='%23000000'/%3E%3Crect x='2' y='2' width='8' height='1' fill='%23B8F818'/%3E%3Crect x='2' y='2' width='1' height='8' fill='%23B8F818'/%3E%3Crect x='2' y='9' width='8' height='1' fill='%2300A800'/%3E%3Crect x='9' y='2' width='1' height='8' fill='%2300A800'/%3E%3C/svg%3E");
  --frame-dialog: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Crect x='2' y='0' width='8' height='1' fill='%23FCFCFC'/%3E%3Crect x='1' y='1' width='10' height='1' fill='%23FCFCFC'/%3E%3Crect x='0' y='2' width='2' height='8' fill='%23FCFCFC'/%3E%3Crect x='10' y='2' width='2' height='8' fill='%23FCFCFC'/%3E%3Crect x='1' y='10' width='10' height='1' fill='%23FCFCFC'/%3E%3Crect x='2' y='11' width='8' height='1' fill='%23FCFCFC'/%3E%3Crect x='2' y='2' width='8' height='8' fill='%23000000'/%3E%3Crect x='2' y='2' width='8' height='1' fill='%237C7C7C'/%3E%3Crect x='2' y='2' width='1' height='8' fill='%237C7C7C'/%3E%3Crect x='2' y='9' width='8' height='1' fill='%23000000'/%3E%3Crect x='9' y='2' width='1' height='8' fill='%23000000'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

/* clip, not hidden: mobile browsers otherwise widen the layout viewport
   for anything that pokes past the edge mid-animation. */
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.55;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--ink); }

canvas, img { image-rendering: pixelated; image-rendering: crisp-edges; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

#sky {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: -1; display: block;
}

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

.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 8px 16px 14px;
  font-family: var(--display); font-size: 22px; line-height: 1; color: var(--white);
  background: linear-gradient(#000000e0, #00000000);
  pointer-events: none;
}
.hud-left { display: flex; align-items: center; gap: 14px; }
.hud-name { color: var(--gold); }
.hud-hearts { display: flex; gap: 4px; }
.hud-hearts i {
  width: 14px; height: 12px; display: block;
  background: var(--pink);
  clip-path: polygon(0 20%, 20% 0, 40% 0, 50% 20%, 60% 0, 80% 0, 100% 20%, 100% 50%, 50% 100%, 0 50%);
}
.hud-stage { margin-left: auto; white-space: nowrap; letter-spacing: .04em; }
.hud-xp {
  position: absolute; left: 16px; right: 16px; bottom: 4px; height: 4px;
  background: #fcfcfc33;
}
.hud-xp-fill { height: 100%; width: 0; background: var(--green); }

@keyframes heartbeat { 50% { transform: scale(1.25); } }

/* ---------- World layout ---------- */

main {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

#trail {
  position: absolute; top: 0; left: 0;
  pointer-events: none; z-index: 0; overflow: visible;
}
#trail .trail-base { stroke: #fcfcfc55; }
#trail .trail-done { stroke: var(--gold); }

.stage {
  position: relative; z-index: 1;
  min-height: 70vh;
  display: flex; align-items: center;
  padding: 12vh 0;
}
#about, #interests, #last-wife, #vision { justify-content: flex-start; }
#photos, #reading, #kids, #life { justify-content: flex-end; }

.card {
  position: relative;
  color: var(--ink);
  background-color: var(--paper);
  background-clip: padding-box;
  width: min(60%, 620px);
  padding: 14px 18px;
  border: 20px solid transparent;
  border-image: var(--frame-paper) 4 fill / 20px;
  filter: drop-shadow(0 14px 18px rgb(0 0 0 / .35));
}
.card-somber { border-image-source: var(--frame-somber); background-color: #bcbcbc; }
.card-terminal { border-image-source: var(--frame-terminal); background-color: var(--ink); color: var(--white); }

.card p { margin: 0 0 16px; max-width: 62ch; }
.card p:last-child { margin-bottom: 0; }

.card h2 {
  font-family: var(--display); font-weight: normal;
  font-size: 56px; line-height: .9; letter-spacing: .01em;
  margin: 0 0 22px;
}
.card-terminal h2 { color: var(--green); }

/* ---------- Hero ---------- */

.hero {
  min-height: 100vh;
  flex-direction: column; justify-content: center;
  text-align: center; color: var(--white);
  padding: 120px 0 30vh;
}
.hero-title {
  font-family: var(--display); font-weight: normal;
  font-size: clamp(88px, 22vw, 240px); line-height: .8; letter-spacing: .02em;
  margin: 0 0 36px; color: var(--white);
  text-shadow: 0 .06em 0 var(--pink), 0 .12em 0 var(--ink);
  animation: title-land .9s steps(6) both;
}
@keyframes title-land {
  0% { transform: translateY(-40vh); }
  70% { transform: translateY(.06em); }
  100% { transform: none; }
}

.dialog {
  max-width: 640px; margin: 0 auto;
  padding: 10px 16px; text-align: left; color: var(--white);
  border: 20px solid transparent;
  border-image: var(--frame-dialog) 4 fill / 20px;
}
.dialog p { margin: 0; }

.press-start {
  font-family: var(--display); font-size: 28px; line-height: 1; color: var(--white);
  margin-top: 36px; letter-spacing: .06em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- About ---------- */

.sheet { display: flex; gap: 28px; align-items: center; margin-bottom: 24px; }
.portrait {
  flex: none; width: 132px; height: 156px;
  background: var(--ink);
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px var(--gold), 0 0 0 12px var(--ink);
  overflow: hidden;
}
/* A real photo, so smooth scaling rather than the global pixelated rendering. */
.portrait img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: 50% 22%;
  image-rendering: auto;
}
/* Reveal on the img, not .portrait: clip-path there would also clip the frame. */
.stage.in .portrait img { animation: scan-in 1s steps(10) .3s both; }
@keyframes scan-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }

.stats { margin: 0; display: grid; gap: 4px; }
.stats div { display: grid; grid-template-columns: 64px 1fr; align-items: baseline; }
.stats dt { font-family: var(--display); font-size: 22px; line-height: 1; color: var(--red); }
.stats dd { margin: 0; }

.needs {
  font-family: var(--display); font-size: 44px; line-height: 1;
  color: var(--red);
}

/* ---------- Photo mode ---------- */

.photo-mode { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 22px; align-items: start; }
.viewer { margin: 0; }
.viewer-canvas {
  display: block; width: 100%; aspect-ratio: 3 / 4;
  background: var(--ink);
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px var(--gold), 0 0 0 12px var(--ink);
}
.viewer figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-top: 22px;
  font-family: var(--display); font-size: 24px; line-height: 1; color: var(--red);
}
.viewer-count { color: var(--ink); font-variant-numeric: tabular-nums; }

.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.slot-btn {
  position: relative; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 3 / 4; background: var(--ink);
  box-shadow: 0 0 0 3px var(--ink);
  transition: transform .15s steps(2), box-shadow .15s steps(2);
}
.slot-btn img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
  filter: grayscale(.85) contrast(.9); opacity: .75;
  transition: filter .2s steps(3), opacity .2s steps(3);
}
.slot-btn:hover img, .slot-btn[aria-pressed="true"] img { filter: none; opacity: 1; }
.slot-btn:hover { transform: translateY(-3px); }
.slot-btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--gold), 0 0 0 9px var(--ink); }
.slot-tag {
  position: absolute; left: 4px; bottom: 4px; padding: 2px 5px;
  font-family: var(--display); font-size: 16px; line-height: 1; color: var(--ink); background: var(--gold);
  white-space: nowrap;
}

/* ---------- Last wife ---------- */

.broken-heart {
  position: absolute; right: 8px; top: 2px;
  width: 66px; height: 60px;
}
.broken-heart canvas { position: absolute; top: 0; left: 0; width: 66px; height: 60px; }
.stage.in .broken-heart .left { animation: crack-left .8s steps(4) 1s forwards; }
.stage.in .broken-heart .right { animation: crack-right .8s steps(4) 1s forwards; }
@keyframes crack-left { to { transform: translate(-6px, 4px) rotate(-14deg); } }
@keyframes crack-right { to { transform: translate(6px, 6px) rotate(12deg); } }

.silver-lining {
  position: relative; padding: 10px 14px;
  background: #f8f8f800;
  transition: background 1.2s steps(6) 1.6s;
}
.stage.in .silver-lining { background: #f8d878; /* 38 */ }

/* ---------- Kids ---------- */

.party {
  display: flex; align-items: flex-end; justify-content: center; gap: 16px;
  min-height: 100px; margin: 0 0 22px;
}
.party canvas { width: calc(var(--w) * 4px); height: calc(var(--h) * 4px); }
.stage.in .party canvas {
  animation: hop .5s steps(2) calc(var(--i) * 120ms) infinite alternate;
}
@keyframes hop { to { transform: translateY(-6px); } }
.kid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kid span { font-family: var(--display); font-size: 20px; line-height: 1; color: var(--red); }

/* ---------- Life ---------- */

.temple {
  position: relative; float: right;
  width: 132px; height: 156px; margin: 0 0 12px 20px;
}
.temple canvas { width: 132px; height: 156px; }
.sparkle {
  position: absolute; width: 6px; height: 6px; background: var(--gold);
  box-shadow: 6px 0 0 var(--gold), -6px 0 0 var(--gold), 0 6px 0 var(--gold), 0 -6px 0 var(--gold);
  opacity: 0; animation: twinkle 1.6s steps(2) infinite;
}
.s1 { left: 12px; top: 20px; }
.s2 { right: 8px; top: 48px; animation-delay: .5s; }
.s3 { left: 64px; top: -8px; animation-delay: 1s; }
@keyframes twinkle { 50% { opacity: 1; } }
.you {
  font-style: normal; color: var(--white); background: var(--red); padding: 0 6px;
  display: inline-block;
}

/* ---------- Interests ---------- */

.word { color: var(--green); display: inline-block; }
.stage.in .word { animation: word-pop .4s steps(3) both; }
.stage.in .word:nth-of-type(1) { animation-delay: .4s; }
.stage.in .word:nth-of-type(2) { animation-delay: .8s; }
.stage.in .word:nth-of-type(3) { animation-delay: 1.2s; }
@keyframes word-pop { 50% { transform: translateY(-8px); color: var(--white); } }

.priority { color: #f87858; /* 26 */ }
.priority::after, .screen p::after {
  content: ""; display: inline-block; width: .5em; height: 1em; margin-left: 4px;
  vertical-align: -.15em; background: currentColor;
  animation: blink .8s steps(1) infinite;
}

/* One monitor per "computers", switched on in step with the words above. */
.crts { display: flex; gap: 18px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.crt {
  width: 150px; padding: 12px 12px 22px;
  background: #bcbcbc; /* 10 */
  box-shadow: inset -4px -4px 0 var(--gray), 0 0 0 4px var(--ink);
  position: relative;
}
.crt::after { /* power LED */
  content: ""; position: absolute; right: 12px; bottom: 8px;
  width: 6px; height: 6px; background: var(--gray);
}
.stage.in .crt::after { background: var(--green); transition: background 0s calc(var(--on) + .3s); }
.screen {
  height: 76px; display: grid; place-items: center; padding: 8px;
  background: #005800; /* 0B, powered off */
  box-shadow: inset 0 0 0 3px var(--ink);
}
.screen p {
  margin: 0; text-align: center;
  font-family: var(--display); font-size: 24px; line-height: .95; color: var(--green);
  opacity: 0;
}
.crt:nth-child(1) { --on: .4s; }
.crt:nth-child(2) { --on: .8s; }
.crt:nth-child(3) { --on: 1.2s; }
.stage.in .screen { animation: power-on .5s steps(4) var(--on) both; }
.stage.in .screen p { opacity: 1; transition: opacity 0s calc(var(--on) + .4s); }
@keyframes power-on {
  0% { clip-path: inset(48% 0 48% 0); background: var(--white); }
  60% { clip-path: inset(0); background: var(--white); }
  100% { clip-path: inset(0); background: var(--ink); }
}

/* ---------- Vision ---------- */

.lineup {
  display: flex; align-items: flex-end; justify-content: center; flex-wrap: wrap;
  gap: 12px; margin: 0 0 26px;
}
.lineup-group { display: flex; align-items: flex-end; gap: 10px; }
.lineup-jeff { width: 66px; height: 105px; }
.lineup canvas:not(.lineup-jeff) { width: calc(var(--w) * 3px); height: calc(var(--h) * 3px); }
.lineup-p2 {
  width: 60px; height: 99px; display: grid; place-items: center;
  border: 3px dashed var(--gray);
  font-family: var(--display); font-size: 48px; line-height: 1; color: var(--pink);
}
.lineup-plus { font-family: var(--display); font-size: 28px; line-height: 1; color: var(--pink); padding-bottom: 6px; }
.stage.in .lineup canvas { animation: hop .5s steps(2) calc(var(--i, 0) * 120ms) infinite alternate; }
.stage.in .lineup-p2 { animation: heartbeat 1s steps(2) infinite; }
.stage.in .lineup-plus { animation: blink 1s steps(1) infinite; }
.vision-lead { font-family: var(--display); font-size: 40px; line-height: 1; }
.vision-cta a { color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.vision-cta a:hover { color: var(--ink); }

/* ---------- Finale ---------- */

.finale {
  /* flex-end so fitFinale() can line the slot up with Jeff's anchor line. */
  flex-direction: column; justify-content: flex-end; align-items: center;
  color: var(--white); text-align: center;
  min-height: 80vh;
}
.finale-title {
  font-family: var(--display); font-size: clamp(56px, 12vw, 120px); line-height: .85;
  text-shadow: 0 .06em 0 var(--pink), 0 .12em 0 var(--ink); margin: 0 0 32px;
  transition: opacity .3s steps(3);
}
.slot {
  position: relative;
  width: 96px; height: 152px;
  display: grid; place-items: center;
  border: 4px dashed #fcfcfc88;
  font-family: var(--display); font-size: 72px; line-height: 1; color: var(--pink);
  transition: border-color .3s steps(3);
}
.slot-q { animation: heartbeat 1s steps(2) infinite; }
.slot.has-p2 .slot-q { display: none; }
.slot.joined { border-color: transparent; }

/* Player 2 stands on the slot's floor at Jeff's scale. */
.p2-canvas {
  position: absolute; left: 50%; bottom: 0;
  width: calc(22px * var(--px)); height: calc(35px * var(--px));
  transform: translateX(-50%);
  transform-origin: 50% 100%;
}
.p2-name {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: min(280px, 80vw); margin: 0; overflow-wrap: anywhere;
  font-family: var(--display); font-size: 24px; line-height: 1; color: var(--gold);
}

/* ---------- Character select + adventure journal ---------- */

[hidden] { display: none !important; }
input, textarea { max-width: 100%; }
input, textarea, button { touch-action: manipulation; }
input, textarea {
  font: inherit; color: var(--ink); background: var(--white);
  border: 2px solid var(--ink); border-radius: 0; padding: 10px 12px;
  caret-color: var(--pink);
}
input::placeholder, textarea::placeholder { color: var(--ink); opacity: .7; }
textarea { display: block; width: 100%; resize: vertical; min-height: 100px; }
.text-link, .text-button { color: var(--red); text-underline-offset: 4px; }
.text-link:hover, .text-button:hover { color: var(--ink); }
.text-button { font: inherit; border: 0; padding: 8px 0; background: none; text-decoration: underline; cursor: pointer; }
.game-button {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 44px; padding: 12px 16px; border: 2px solid var(--ink);
  font-family: var(--display); font-size: 25px; line-height: 1;
  color: var(--ink); background: var(--gold); text-decoration: none; text-align: center;
  cursor: pointer; box-shadow: inset -3px -3px 0 #ac7c00;
}
.game-button.secondary { background: var(--white); box-shadow: inset -3px -3px 0 #bcbcbc; }
.game-button:hover { background: var(--paper); }
.game-button:active { box-shadow: inset 3px 3px 0 #ac7c00; }
.hero-intro { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.hero-intro img { flex: none; object-fit: cover; object-position: 50% 22%; image-rendering: auto; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; margin-top: 28px; }
.hero-actions .text-link, .quick-contact { color: var(--white); }
.quick-contact { margin-top: 22px; font-size: 16px; text-underline-offset: 4px; }
.hud-journal { margin-left: 10px; color: var(--gold); pointer-events: auto; white-space: nowrap; text-underline-offset: 4px; }
#character { justify-content: center; }
.creator-card { width: min(100%, 800px); }
.character-select { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 32px; margin: 28px 0; }
.character-preview { text-align: center; }
#creator-canvas { width: 110px; height: 175px; }
#creator-name { font-family: var(--display); font-size: 28px; overflow-wrap: anywhere; }
.character-preview .game-button { font-size: 22px; padding: 10px; }
.p2-panel { min-width: 0; }
.p2-rows { display: grid; gap: 6px; }
.p2-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 120px 44px; align-items: center; gap: 6px; }
.p2-label { font-family: var(--display); font-size: 22px; line-height: 1; }
.p2-value { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; line-height: 1.1; text-align: center; }
.p2-swatch { flex: none; width: 12px; height: 12px; border: 1px solid var(--ink); }
.p2-arrow { width: 44px; height: 44px; padding: 0; border: 2px solid var(--ink); cursor: pointer; background: var(--white); position: relative; }
.p2-arrow::before { content: ""; position: absolute; inset: 13px 15px; background: var(--ink); clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.p2-arrow.next::before { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.p2-arrow:hover { background: var(--gold); }
.p2-name-field { display: block; margin: 22px 0 8px; font-family: var(--display); font-size: 24px; }
.p2-name-field span { font: 15px var(--body); }
#p2-name-input { width: 100%; }
.p2-go { width: 100%; margin-top: 16px; }
.card h3 { font-family: var(--display); font-weight: normal; font-size: 32px; line-height: 1.1; margin: 28px 0 12px; }
.content-placeholder { padding: 16px 0; border-block: 2px dashed currentColor; margin: 28px 0; }
.content-placeholder h3 { margin-top: 0; }
.content-placeholder p { font-style: italic; }
.favorites { list-style: none; padding: 0; margin: 0; }
.favorites li { padding: 14px 0; border-bottom: 1px solid var(--red); }
.favorites strong { display: block; color: var(--red); }
.favorites span { display: block; margin-top: 4px; }
.journal-prompt { padding-top: 24px; margin-top: 28px; border-top: 2px dashed currentColor; }
.journal-prompt label, .application-card label { display: block; font-weight: 600; margin-bottom: 12px; }
.journal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.journal-status { font-size: 15px; }
.journal-prompt.collected .game-button { background: var(--green); box-shadow: none; }
.card .field-hint { font-size: 15px; line-height: 1.5; margin: 12px 0 0; }
.application-card { width: min(100%, 720px); text-align: left; margin-bottom: 48px; }
.application-card h2 { font-size: 48px; }
#introduction { font-size: 17px; line-height: 1.6; }
.draft-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 8px; }
.application-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.application-actions .game-button { flex: 1 1 200px; }
.finale .contact { margin-top: 70px; }
.lineup-p2.has-player { border-color: transparent; animation: none; }
.lineup .lineup-p2 canvas { width: 60px; height: 99px; animation: none; }
#jeff.at-creator { visibility: hidden; }
#player-companion { position: fixed; top: 0; left: 0; z-index: 9; pointer-events: none; width: calc(22px * var(--px)); height: calc(35px * var(--px)); }

.contact {
  margin-top: 14px; font-size: 24px; color: var(--white);
  text-decoration: underline; text-decoration-color: var(--pink);
  text-decoration-thickness: 3px; text-underline-offset: 6px;
}
.contact:hover, .finale .press-start:hover { color: var(--pink); }

.credits {
  position: relative; z-index: 1;
  text-align: center; color: #fcfcfcaa; font-size: 16px;
  padding: 20px 0 40px;
}

/* ---------- Jeff ---------- */

#jeff {
  position: fixed; top: 0; left: 0; z-index: 10;
  will-change: transform;
  cursor: pointer;
}
#jeff-canvas { display: block; width: calc(22px * var(--px)); height: calc(35px * var(--px)); }
#jeff.jump #jeff-canvas { animation: jump .45s steps(5); }
@keyframes jump { 40% { transform: translateY(-28px); } }
#jeff::after { /* ground shadow */
  content: ""; position: absolute; left: 20%; right: 20%; bottom: -4px; height: 8px;
  background: #0006; border-radius: 50%; z-index: -1;
}
.bubble {
  position: absolute; left: 50%; bottom: 100%;
  min-width: 36px; padding: 6px 10px 4px; margin-bottom: 10px;
  font-family: var(--display); font-size: 24px; line-height: 1; text-align: center; white-space: nowrap;
  background: var(--white); color: var(--ink);
  box-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink);
  transform: translateX(-50%) scale(0); transform-origin: 50% 100%;
  transition: transform .2s steps(3);
}
.bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -4px;
  border: 6px solid transparent; border-top-color: var(--ink);
}
.bubble.show { transform: translateX(-50%) scale(1); }
.bubble.heart { color: var(--pink); }

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
  :root { --px: 3; --lane: 52px; }
  body { font-size: 17px; }
  main { padding: 0 12px; }
  .stage { padding: 9vh 0; scroll-margin-top: 50px; }
  .stage:not(.hero):not(.finale) { justify-content: flex-end !important; }
  .card { width: calc(100% - var(--lane)); padding: 8px 6px; border-width: 16px; border-image-width: 16px; }
  .card h2 { font-size: 44px; }
  .sheet { flex-direction: column; align-items: flex-start; }
  .needs { font-size: 36px; }
  .broken-heart { position: relative; right: auto; top: auto; margin: 0 auto 16px; }
  .temple { width: 88px; height: 104px; }
  .temple canvas { width: 88px; height: 104px; }
  .photo-mode { grid-template-columns: 1fr; gap: 24px; }
  .slots { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .slot-tag { left: 2px; bottom: 2px; padding: 1px 3px; font-size: 13px; }
  .party { gap: 6px; }
  .party canvas { width: calc(var(--w) * 3px); height: calc(var(--h) * 3px); }
  .lineup, .lineup-group { gap: 6px; }
  .vision-lead { font-size: 34px; }
  .lineup-jeff { width: 44px; height: 70px; }
  .lineup-p2 { width: 40px; height: 66px; font-size: 32px; }
  .lineup canvas:not(.lineup-jeff) { width: calc(var(--w) * 2px); height: calc(var(--h) * 2px); }
  .crts { gap: 8px; flex-wrap: nowrap; }
  .crt { width: calc((100% - 16px) / 3); padding: 6px 6px 14px; }
  .crt::after { right: 6px; bottom: 4px; width: 4px; height: 4px; }
  .screen { height: 52px; padding: 8px; }
  .screen p { font-size: 12px; overflow-wrap: anywhere; max-width: 100%; }
  .hud { font-size: 18px; }
  .hud-lv, .hud-hearts { display: none; }
  .creator-card { width: 100%; }
  .character-select { grid-template-columns: 1fr; gap: 20px; }
  .character-preview { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; }
  #creator-canvas { width: 80px; height: 128px; }
  #creator-name { max-width: 120px; margin: 0; font-size: 26px; }
  .p2-row { grid-template-columns: minmax(0, 1fr) 44px minmax(70px, 100px) 44px; gap: 4px; }
  .p2-label { font-size: 20px; }
  .p2-value { font-size: 14px; gap: 4px; }
  .application-card { width: calc(100% - var(--lane)); align-self: flex-end; }
  .application-card h2 { font-size: 40px; }
  .application-actions { flex-direction: column; }
  .application-actions .game-button { flex: auto; }
  .hero-intro { gap: 14px; align-items: flex-start; }
  .hero-intro img { width: 66px; height: 88px; }
  .hero .dialog { padding: 8px; border-width: 16px; border-image-width: 16px; }
  .hero-actions { gap: 16px; }
  .lineup .lineup-p2 canvas { width: 40px; height: 66px; }
  .hud-stage { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .hero { justify-content: flex-start; padding-top: 96px; }
  .hero { padding-bottom: 26vh; }
  .hud { gap: 8px; padding-inline: 12px; }
  .hud-journal { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
