:root {
  --ink: #14183a;
  --navy: #1f2f6b;
  --blue: #3d55c4;
  --sky: #8fb4ff;
  --cream: #f3ead6;
  --paper: #fffaf0;
  --pink: #ec8fa6;
  --gold: #f6c343;
  --green: #3fbf6f;
  --red: #e2574c;
  --muted: #6b7088;
  --px: 4px;
  --font-title: "Press Start 2P", monospace;
  --font-body: "Pixelify Sans", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b0d22; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#app {
  position: relative;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  overflow: hidden;
  box-shadow: 0 0 0 4px #000, 0 0 60px rgba(0,0,0,.6);
}

/* ---------------- HUD ---------------- */
#hud {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--ink); color: #fff; z-index: 5;
  border-bottom: 4px solid #000;
}
#progress { display: flex; align-items: center; gap: 6px; font-family: var(--font-title); font-size: 9px; flex: 1; min-width: 0; }
#progress .bar { display: flex; gap: 3px; flex: 1; max-width: 220px; }
#progress .seg { flex: 1; height: 10px; background: #2b3160; box-shadow: inset 0 0 0 2px #000; }
#progress .seg.done { background: var(--gold); }
#progress .seg.now { background: var(--sky); animation: blink 1s steps(2) infinite; }
.hud-buttons { display: flex; gap: 6px; }
.hud-btn {
  width: 34px; height: 34px; font-size: 16px; line-height: 1;
  background: #2b3160; border: 0; box-shadow: inset 0 0 0 3px #000, inset -3px -3px 0 3px #1c2147;
}
.hud-btn.off { opacity: .45; filter: grayscale(1); }

/* ---------------- STAGE ---------------- */
#stage {
  position: relative; flex: 1 1 52%; min-height: 220px; overflow: hidden;
  background: #222;
  border-bottom: 4px solid #000;
}
#app.full #stage { flex-basis: 100%; border-bottom: 0; }
#app.full #panel { display: none; }
#bg, #scenery, #actors, #fx { position: absolute; inset: 0; }
#bg {
  background-size: cover; background-position: center bottom;
  image-rendering: pixelated; image-rendering: crisp-edges;
  transition: opacity .35s steps(4);
}
#bg canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
#fx { pointer-events: none; z-index: 4; }
#actors { z-index: 2; pointer-events: none; }
#actors .tap { pointer-events: auto; }
#scenery { z-index: 1; }

.sprite {
  width: calc(16px * var(--scale, 4));
  height: calc(24px * var(--scale, 4));
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block;
}
.sprite.flip { transform: scaleX(-1); }

.actor {
  position: absolute; bottom: 6%;
  transform: translateX(-50%);
  transition-property: left, bottom, opacity;
  transition-timing-function: linear;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.35));
}
.actor .name-tag {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-title); font-size: 7px; color: #fff; background: rgba(20,24,58,.85);
  padding: 3px 4px; white-space: nowrap;
}

/* speech bubble in the stage */
.bubble {
  position: absolute; z-index: 6; max-width: 70%;
  background: var(--paper); color: var(--ink);
  padding: 8px 10px; font-size: 15px; line-height: 1.25;
  box-shadow: 0 0 0 3px #000, 4px 4px 0 3px rgba(0,0,0,.35);
  animation: pop .18s steps(3);
}
.bubble b { font-family: var(--font-title); font-size: 8px; display: block; margin-bottom: 4px; color: var(--blue); }
.bubble::after {
  content: ""; position: absolute; bottom: -9px; left: 18px; width: 10px; height: 10px;
  background: var(--paper); box-shadow: 3px 3px 0 0 #000; transform: rotate(45deg);
}

/* ---------------- PANEL ---------------- */
#panel {
  position: relative; flex: 1 1 48%; min-height: 0;
  background: #262c5c;
  background-image: linear-gradient(#2b3266 2px, transparent 2px), linear-gradient(90deg, #2b3266 2px, transparent 2px);
  background-size: 16px 16px;
  overflow-y: auto; overflow-x: hidden;
  padding: 12px 12px max(16px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.box {
  position: relative;
  background: var(--paper);
  padding: 14px 14px 12px;
  box-shadow: 0 0 0 4px #000, inset -4px -4px 0 0 #e1d6bd;
  margin: 4px 4px 14px;
}
.speaker {
  position: absolute; top: -14px; left: 10px;
  font-family: var(--font-title); font-size: 9px; color: #fff; background: var(--blue);
  padding: 5px 7px; box-shadow: 0 0 0 3px #000;
}
.dialogue-text { font-size: 19px; line-height: 1.3; min-height: 2.6em; }
.dialogue-text.q { font-size: 18px; font-weight: 600; }
.next-hint {
  position: absolute; right: 10px; bottom: 6px; font-family: var(--font-title); font-size: 10px;
  color: var(--blue); animation: bounce .6s steps(2) infinite;
}
.tap-anywhere { cursor: pointer; }

.title { font-family: var(--font-title); line-height: 1.5; }
h2.title { font-size: 13px; margin: 0 0 10px; color: #fff; text-align: center; text-shadow: 3px 3px 0 #000; }

.btn {
  display: block; width: 100%;
  background: var(--paper); color: var(--ink);
  border: 0; padding: 13px 14px; margin: 0 0 12px;
  font-size: 18px; font-weight: 600; text-align: left; line-height: 1.2;
  box-shadow: 0 0 0 4px #000, inset -4px -4px 0 0 #d9ceb4;
  transition: transform .08s steps(2);
}
.btn:active { transform: translate(2px, 2px); }
.btn.primary { background: var(--gold); text-align: center; font-family: var(--font-title); font-size: 13px; box-shadow: 0 0 0 4px #000, inset -4px -4px 0 0 #c99a22; }
.btn.ghost { background: #3a4180; color: #fff; text-align: center; font-size: 16px; box-shadow: 0 0 0 4px #000, inset -4px -4px 0 0 #2b3166; }
.btn.chosen { background: var(--sky); box-shadow: 0 0 0 4px #000, inset -4px -4px 0 0 #5d86d8; }
.btn.squash { animation: squash .35s steps(4); }
.btn small { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
.row { display: flex; gap: 12px; }
.row .btn { text-align: center; }

/* answer arena: avatar jumps onto choices */
.arena { position: relative; padding: 6px 4px 92px; }
.arena .chooser { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; will-change: transform; }
.arena .grid-yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.arena .grid-yesno .btn { text-align: center; font-family: var(--font-title); font-size: 14px; padding: 18px 8px; }
.arena .hearts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 8px; }
.heart {
  background: none; border: 0; padding: 4px 0 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: var(--font-title); font-size: 9px; color: #fff;
}
.heart svg { width: 40px; height: 36px; image-rendering: pixelated; }
.heart.on svg .fill { fill: var(--red); }
.heart.squash { animation: squash .35s steps(4); }
.scale-labels { display: flex; justify-content: space-between; color: #cfd5ff; font-size: 13px; margin-top: 6px; }
.next-row { margin-top: 4px; animation: slideup .25s steps(4); }

/* pencil + text box */
.pencil-zone { position: relative; height: 90px; }
.pencil {
  position: absolute; width: 96px; height: 16px; left: 50%; top: 20px;
  transform-origin: 50% 50%;
  background: linear-gradient(90deg, #f3a6b5 0 14%, #b8b8c8 14% 22%, #f6c343 22% 82%, #f1d7a8 82% 94%, #333 94% 100%);
  box-shadow: 0 0 0 3px #000;
  clip-path: polygon(0 0, 94% 0, 100% 50%, 94% 100%, 0 100%);
}
.pencil.drop { animation: pencildrop .55s steps(6) forwards; }
.dust { position: absolute; width: 8px; height: 8px; background: #d9d2c0; animation: dust .5s steps(4) forwards; }
textarea.note {
  width: 100%; min-height: 110px; resize: vertical;
  font: inherit; font-size: 18px; line-height: 1.3;
  background: #fffbe0; color: var(--ink);
  border: 0; padding: 12px; outline: none;
  box-shadow: 0 0 0 4px #000, inset 0 -3px 0 #e8e0b0;
  background-image: repeating-linear-gradient(transparent 0 25px, #e6dca6 25px 26px);
  animation: rise .35s steps(5);
}
textarea.note:focus { box-shadow: 0 0 0 4px var(--blue); }

/* course list */
.search {
  width: 100%; font: inherit; font-size: 18px; padding: 10px 12px; border: 0; margin: 0 4px 14px; width: calc(100% - 8px);
  box-shadow: 0 0 0 4px #000; background: var(--paper);
}
.group-label { font-family: var(--font-title); font-size: 9px; color: var(--gold); margin: 14px 4px 10px; }
.course-btn { font-size: 16px; padding: 11px 12px; }
.course-btn .code { float: right; font-family: var(--font-title); font-size: 9px; color: var(--blue); margin-top: 3px; }
.course-btn.flash { animation: flash .4s steps(2) 2; }

/* character creator */
.opt-row { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; margin: 0 4px 12px; }
.opt-row .arrow { height: 44px; border: 0; background: var(--gold); font-family: var(--font-title); font-size: 12px; box-shadow: 0 0 0 3px #000, inset -3px -3px 0 0 #c99a22; }
.opt-row .arrow:active { transform: translate(2px,2px); }
.opt-val { background: var(--paper); box-shadow: 0 0 0 3px #000; padding: 8px 6px; text-align: center; }
.opt-val .lbl { font-family: var(--font-title); font-size: 7px; color: var(--muted); display: block; margin-bottom: 4px; }
.opt-val .val { font-size: 17px; font-weight: 600; display: flex; gap: 6px; justify-content: center; align-items: center; }
.swatch { width: 18px; height: 18px; display: inline-block; box-shadow: 0 0 0 2px #000; }
.platform {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  width: 150px; height: 26px; background: #3b4385; box-shadow: 0 0 0 4px #000, inset 0 6px 0 #5560b8;
}
.spotlight { position: absolute; left: 50%; top: 0; bottom: 0; width: 220px; transform: translateX(-50%);
  background: linear-gradient(rgba(255,255,220,.0), rgba(255,255,220,.18)); clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); }

/* ---------------- TITLE ---------------- */
.title-screen { position: absolute; inset: 0; z-index: 5; pointer-events: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14% 18px 10%; color: #fff; }
.title-screen h1 {
  font-family: var(--font-title); font-size: 21px; line-height: 1.45; margin: 0;
  text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 0 6px 0 var(--navy);
  animation: drop .7s steps(7);
}
.title-screen h1 span { color: var(--gold); display: block; font-size: 30px; }
.title-screen .sub { margin-top: 12px; font-size: 18px; background: rgba(20,24,58,.75); padding: 6px 10px; box-shadow: 0 0 0 3px #000; }
.press-start { margin-top: auto; font-family: var(--font-title); font-size: 14px; background: var(--gold); color: var(--ink); border: 0; padding: 16px 20px; box-shadow: 0 0 0 4px #000, inset -4px -4px 0 #c99a22; animation: blink 1.1s steps(2) infinite; }
.tip { margin-top: 14px; font-size: 15px; background: rgba(0,0,0,.6); padding: 6px 10px; }
.cloud { position: absolute; height: 14px; background: #e9edf7; box-shadow: 0 0 0 0 #000; opacity: .85; animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; }
.cloud::before { width: 50%; height: 12px; left: 15%; top: -10px; }
.cloud::after { width: 30%; height: 8px; left: 50%; top: -16px; }

.walker { position: absolute; bottom: 9%; animation: walkacross linear infinite; }

/* overlays */
.banner {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%);
  font-family: var(--font-title); font-size: 17px; color: var(--gold); text-align: center; white-space: nowrap;
  background: var(--ink); padding: 16px 18px; box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--gold);
  animation: zoom .4s steps(5); z-index: 8;
}
.banner small { display: block; font-size: 9px; color: #fff; margin-top: 8px; }
.wipe { position: absolute; inset: 0; z-index: 20; pointer-events: none; display: grid; grid-template-columns: repeat(8, 1fr); grid-auto-rows: 1fr; }
.wipe i { background: #000; animation: wipein .32s steps(4) forwards; opacity: 0; }
.wipe.out i { animation: wipeout .32s steps(4) forwards; opacity: 1; }

.door {
  position: absolute; bottom: 14%; width: 19%; height: 46%;
  background: #6b4a2b; border: 0; padding: 0;
  box-shadow: 0 0 0 4px #000, inset 0 0 0 5px #8a6238, inset -8px 0 0 5px #5a3d22;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.door .plaque { margin-top: 10%; width: 86%; background: var(--paper); box-shadow: 0 0 0 3px #000; font-size: 22px; padding: 3px 0; }
.door .lbl { margin-top: 6px; font-family: var(--font-title); font-size: 6.5px; color: #fff; line-height: 1.5; padding: 0 3px; text-shadow: 1px 1px 0 #000; }
.door .knob { position: absolute; right: 12%; top: 58%; width: 7px; height: 7px; background: var(--gold); box-shadow: 0 0 0 2px #000; }
.door.glow { animation: glow .8s steps(2) infinite; }
.door.done::after { content: "✅"; position: absolute; top: -26px; font-size: 20px; }
.door.locked { filter: brightness(.6); }
.arrow-down { position: absolute; font-size: 22px; animation: bounce .5s steps(2) infinite; pointer-events: none; z-index: 3; color: var(--gold); text-shadow: 2px 2px 0 #000; font-family: var(--font-title); }

.confetti { position: absolute; top: -12px; width: 8px; height: 8px; animation: fall linear forwards; }
.badge { width: 150px; height: 150px; margin: 0 auto 12px; display: block; animation: spin 1s steps(10); image-rendering: pixelated; }
.cert-wrap { text-align: center; }
.cert-wrap canvas { width: 100%; max-width: 360px; image-rendering: pixelated; box-shadow: 0 0 0 4px #000; }
.center { text-align: center; }
.white { color: #fff; }
.lock-icon { font-size: 48px; text-align: center; display: block; margin: 4px 0 6px; animation: lockclick .6s steps(3); }
.small-print { color: #cfd5ff; font-size: 14px; text-align: center; margin: 4px 0 12px; }

/* ---------------- ANIMATIONS ---------------- */
@keyframes blink { 50% { opacity: .35; } }
@keyframes bounce { 50% { transform: translateY(-4px); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes drop { from { transform: translateY(-160px); } 70% { transform: translateY(8px); } }
@keyframes drift { from { transform: translateX(-140px); } to { transform: translateX(620px); } }
@keyframes walkacross { from { left: -60px; } to { left: 110%; } }
@keyframes squash { 30% { transform: scale(1.06, .78) translateY(6px); } 60% { transform: scale(.96, 1.08); } }
@keyframes slideup { from { transform: translateY(30px); opacity: 0; } }
@keyframes rise { from { transform: translateY(40px) scaleY(.2); opacity: 0; } }
@keyframes pencildrop {
  0% { transform: translate(-50%, -30px) rotate(-20deg); }
  60% { transform: translate(-50%, 46px) rotate(8deg); }
  80% { transform: translate(-50%, 36px) rotate(-4deg); }
  100% { transform: translate(-50%, 48px) rotate(0deg); }
}
@keyframes dust { to { transform: translate(var(--dx), -18px); opacity: 0; } }
@keyframes flash { 50% { background: var(--gold); } }
@keyframes zoom { from { transform: translate(-50%,-50%) scale(.3); } 70% { transform: translate(-50%,-50%) scale(1.1); } }
@keyframes wipein { to { opacity: 1; } }
@keyframes wipeout { to { opacity: 0; } }
@keyframes glow { 50% { box-shadow: 0 0 0 4px #000, 0 0 0 8px var(--gold), inset 0 0 0 5px #8a6238; } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes spin { from { transform: rotateY(0) scale(.2); } to { transform: rotateY(1080deg) scale(1); } }
@keyframes lockclick { 0% { transform: translateY(-10px); } 60% { transform: translateY(3px); } }

body.fast *, body.fast *::before, body.fast *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (min-height: 760px) { .dialogue-text { font-size: 20px; } }

/* ---------------- LANGUAGES ---------------- */
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 4px; }
.lang-btn { text-align: center; padding: 12px 6px; margin: 0; font-size: 19px; }
.lang-btn small { font-size: 12px; margin-top: 2px; }
html.nonlatin .title, html.nonlatin .speaker, html.nonlatin .press-start, html.nonlatin .banner,
html.nonlatin .title-screen h1, html.nonlatin .btn.primary, html.nonlatin .group-label, html.nonlatin #progress,
html.nonlatin .door .lbl, html.nonlatin .opt-val .lbl, html.nonlatin .grid-yesno .btn { font-weight: 800; letter-spacing: 0; }
html.nonlatin .title-screen h1 { font-size: 26px; }
html.nonlatin .title-screen h1 span { font-size: 36px; }
html.nonlatin .speaker { font-size: 12px; }
html.nonlatin h2.title { font-size: 17px; }
html.nonlatin .btn.primary { font-size: 17px; }
html.nonlatin .door .lbl { font-size: 10px; }
html.nonlatin .opt-val .lbl { font-size: 11px; }
html.nonlatin .group-label { font-size: 13px; }
html.nonlatin .banner { font-size: 22px; }
html.nonlatin .banner small { font-size: 13px; }
html.nonlatin .press-start { font-size: 18px; }
html.nonlatin #progress { font-size: 11px; }
html.nonlatin .grid-yesno .btn { font-size: 18px; }
html[dir="rtl"] .opt-row, html[dir="rtl"] .hearts, html[dir="rtl"] .scale-labels, html[dir="rtl"] #hud { direction: ltr; }
html[dir="rtl"] .opt-val, html[dir="rtl"] .scale-labels span { direction: rtl; }
html[dir="rtl"] .speaker { left: auto; right: 10px; }
html[dir="rtl"] .next-hint { right: auto; left: 10px; transform: scaleX(-1); }
html[dir="rtl"] .btn { text-align: right; }
html[dir="rtl"] .course-btn .code { float: left; }
#app.picker #stage { flex: 0 0 26%; }
#app.picker .title-screen { padding-top: 6%; }
#app.picker .title-screen h1 { font-size: 34px !important; }
html.nonlatin .box { padding-top: 22px; }

/* ---------------- STUDENT CARD TAP ---------------- */
.card-head { position: absolute; left: 12px; right: 12px; top: 12px; background: var(--paper); padding: 10px 12px; box-shadow: 0 0 0 4px #000; text-align: center; font-size: 17px; }
.card-head b { display: block; font-family: var(--font-title); font-size: 13px; color: var(--blue); margin-bottom: 6px; }
.reader-ring { position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px; border: 4px dashed var(--gold); border-radius: 50%; animation: pulse 1s steps(3) infinite; }
.reader-ring.near { border-style: solid; border-color: #fff; }
.reader-ring.ok { border: 6px solid var(--green); box-shadow: 0 0 24px var(--green); animation: none; }
@keyframes pulse { 50% { transform: scale(1.18); opacity: .6; } }
.screen-glow { position: absolute; width: 70px; margin-left: -35px; margin-top: -40px; padding: 26px 2px; text-align: center; font-family: var(--font-title); font-size: 7px; color: #fff; background: #1f9a4a; box-shadow: 0 0 0 3px #000, 0 -8px 0 0 #6dff8f; opacity: 0; }
.screen-glow.on { opacity: 1; animation: pop .25s steps(3); }
.idcard { position: absolute; left: 0; top: 0; width: 110px; height: 72px; z-index: 30; touch-action: none; cursor: grab; background: #fff; box-shadow: 0 0 0 3px #000, 6px 6px 0 rgba(0,0,0,.35); }
.idcard:active { cursor: grabbing; }
.idcard .lanyard { position: absolute; left: 47px; top: -60px; width: 16px; height: 60px; background: repeating-linear-gradient(#2f6fd6 0 6px, #2a62bf 6px 8px); box-shadow: 0 0 0 2px #000; }
.idcard .card-top { height: 16px; background: #1f2f6b; color: #fff; font-family: Georgia, serif; font-size: 12px; padding-left: 6px; line-height: 16px; }
.idcard .card-body { display: flex; gap: 6px; padding: 5px 6px; align-items: center; }
.idcard canvas { width: 32px; height: 24px; image-rendering: pixelated; box-shadow: 0 0 0 2px #000; background: #cfe3ff; }
.idcard .card-text b { display: block; font-family: var(--font-title); font-size: 7px; margin-bottom: 4px; }
.idcard .card-text i { display: block; height: 3px; width: 56px; background: #c9c9d6; margin-bottom: 3px; }
.idcard .card-strip { position: absolute; left: 0; right: 0; bottom: 6px; height: 6px; background: repeating-linear-gradient(90deg, #000 0 2px, #fff 2px 4px, #000 4px 5px, #fff 5px 8px); }
.card-auto { position: absolute; left: 50%; top: 150px; width: auto; transform: translateX(-50%); z-index: 29; font-size: 15px; padding: 9px 14px; }
#bg.door-open { transform: scale(1.35) translateX(18%); transition: transform .6s steps(6); }
.sticky { position: absolute; left: 44%; top: 34%; width: 46px; height: 42px; background: #fff59d; box-shadow: 0 0 0 3px #000, 4px 4px 0 rgba(0,0,0,.3); color: #e2574c; font-size: 22px; text-align: center; line-height: 42px; transform: rotate(-6deg); animation: pop .3s steps(3); }
.card-head em { display: block; font-style: normal; font-size: 15px; color: var(--ink); margin-top: 6px; background: #eef2ff; padding: 4px 6px; }
.card-head em:empty { display: none; }
.card-head em.pop { animation: pop .2s steps(3); }

/* keep NEXT / SUBMIT / SKIP visible on small phones */
.next-row { position: sticky; bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); z-index: 6; margin: 0 -12px; padding: 12px 16px max(16px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(38,44,92,0), #262c5c 22%); }
.next-row .btn { margin-bottom: 0; }
@media (max-height: 720px) {
  #stage { flex-basis: 34%; min-height: 160px; }
  .arena { padding-bottom: 84px; }
  .dialogue-text { font-size: 17px; min-height: 0; }
  .btn { padding: 11px 12px; font-size: 16px; }
}

/* ================= LAPTOP / DESKTOP LAYOUT =================
   Picture on the left, questions on the right. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  body {
    background-color: #0b0d22;
    background-image: linear-gradient(#141a44 2px, transparent 2px), linear-gradient(90deg, #141a44 2px, transparent 2px);
    background-size: 32px 32px;
  }
  #app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(400px, 36vw, 540px);
    grid-template-rows: auto minmax(0, 1fr);
    width: min(100vw, calc((100dvh - 60px) * 0.82 + clamp(400px, 36vw, 540px)));
    max-width: none;
  }
  #hud { grid-column: 1 / -1; padding: 10px 16px; }
  #progress { font-size: 11px; }
  #progress .bar { max-width: 360px; }
  .hud-btn { width: 40px; height: 40px; font-size: 18px; }
  #stage, #app.full #stage, #app.picker #stage { grid-column: 1; grid-row: 2; min-height: 0; border-bottom: 0; border-right: 4px solid #000; }
  #panel, #app.full #panel { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; justify-content: safe center; padding: 24px 22px; }
  #app:not(:has(#hud:not([hidden]))) #stage, #app:not(:has(#hud:not([hidden]))) #panel { grid-row: 1 / -1; }
  /* empty side panel during cut-scenes */
  #panel:empty::after {
    content: "wbs"; align-self: center; font-family: Georgia, serif; font-size: 64px; color: #fff;
    background: #2b3f9e; padding: 6px 26px 14px; box-shadow: 0 0 0 5px #000, 10px 10px 0 rgba(0,0,0,.35);
    animation: bounce 1.6s steps(2) infinite;
  }
  /* bigger characters and text */
  #stage .actor .sprite { width: calc(16px * var(--scale, 4) * 1.4); height: calc(24px * var(--scale, 4) * 1.4); }
  .dialogue-text { font-size: 22px; }
  .dialogue-text.q { font-size: 21px; }
  .btn { font-size: 19px; padding: 14px 16px; }
  .btn:hover { filter: brightness(1.06); transform: translate(-1px, -1px); }
  .speaker { font-size: 10px; }
  h2.title { font-size: 15px; }
  .bubble { font-size: 17px; max-width: 55%; }
  .title-screen h1 { font-size: 30px; }
  .title-screen h1 span { font-size: 44px; }
  .title-screen .sub { font-size: 21px; }
  .press-start { font-size: 18px; padding: 20px 28px; }
  .banner { font-size: 24px; }
  .lang-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
  .lang-btn { font-size: 21px; padding: 14px 8px; }
  .next-row { position: static; margin: 0; padding: 12px 0 0; background: none; }
  .arena { padding-bottom: 96px; }
}
