/* ============================================================
   RETRO PIXEL THEME
   ============================================================ */

:root {
  --bg: #0d0b16;
  --panel: #171425;
  --panel-edge: #2a2440;
  --ink: #eae6ff;
  --muted: #8f88b8;
  --yellow: #ffd23f;
  --red: #ff4757;
  --green: #2ed573;
  --blue: #54a0ff;
  --purple: #a55eea;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(84, 160, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 160, 255, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT overlay: scanlines + vignette */
#crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,0.45) 100%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.20) 0 2px, transparent 2px 4px);
  animation: crt-flicker 4s infinite;
}
@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.96; }
}

.hidden { display: none !important; }

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

#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(13, 11, 22, 0.92);
  border-bottom: 4px solid #000;
  box-shadow: 0 4px 0 rgba(84, 160, 255, 0.25);
  z-index: 100;
}

#logo {
  color: var(--yellow);
  font-size: 20px;
  text-shadow: 3px 3px 0 #000;
  cursor: pointer;
  user-select: none;
  padding: 6px;
}

#hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#hud-mission {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
#hud-quest { font-size: 10px; color: var(--blue); letter-spacing: 2px; }

#hud-right { display: flex; align-items: center; gap: 10px; }

#easter-coin {
  opacity: 0;
  cursor: pointer;
  color: var(--yellow);
  padding: 8px;
  user-select: none;
}
#hud-right:hover #easter-coin { opacity: 0.35; }
#easter-coin:hover { opacity: 1 !important; }

.hud-btn {
  font: inherit;
  font-size: 8px;
  background: var(--panel);
  color: var(--ink);
  border: 3px solid #000;
  box-shadow: 0 3px 0 #000;
  padding: 8px 10px;
  cursor: pointer;
}
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }

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

#stage { padding-top: 56px; min-height: 100vh; position: relative; }

.screen { min-height: calc(100vh - 56px); position: relative; }

/* full-screen flash when answers are right/wrong */
#stage::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 90;
}
#stage.flash-red::after  { background: rgba(255, 71, 87, 0.30);  animation: fadeout 0.55s forwards; }
#stage.flash-green::after{ background: rgba(46, 213, 115, 0.25); animation: fadeout 0.55s forwards; }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }

/* ---------------- opener ---------------- */

#screen-opener { overflow: hidden; }
#wall-canvas {
  position: fixed;
  inset: 0;
  touch-action: none;
  display: block;
}
body.armed #wall-canvas { cursor: none; }

#drive-canvas {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

#toast-layer {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 120;
  pointer-events: none;
  width: min(90vw, 560px);
  text-align: center;
}
.toast {
  display: inline-block;
  background: var(--panel);
  border: 4px solid #000;
  box-shadow: 0 6px 0 #000, inset 0 0 0 3px var(--panel-edge);
  color: var(--yellow);
  font-size: 10px;
  line-height: 1.8;
  padding: 14px 18px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------------- quiz ---------------- */

#screen-quiz {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(58px, 6.5vh, 84px) 16px 64px;
  overflow-y: auto;
}

.panel {
  background: var(--panel);
  border: 4px solid #000;
  box-shadow: 0 8px 0 #000, inset 0 0 0 4px var(--panel-edge);
  padding: 28px;
  width: 100%;
  max-width: 740px;
}

#quiz-box {
  --stage-accent: #ff71ce;
  --stage-accent-2: #01cdfe;
  --stage-glow: rgba(255, 113, 206, 0.28);
  background: rgba(18, 14, 34, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow:
    0 10px 0 #000,
    0 0 28px var(--stage-glow),
    inset 0 0 0 4px var(--stage-accent);
  padding: 20px 24px 22px;
  transition: box-shadow 0.25s ease, transform 0.22s ease, opacity 0.22s ease;
}

#quiz-box.quiz-stage-0 {
  --stage-accent: #ff71ce;
  --stage-accent-2: #01cdfe;
  --stage-glow: rgba(255, 113, 206, 0.30);
}
#quiz-box.quiz-stage-1 {
  --stage-accent: #01cdfe;
  --stage-accent-2: #54a0ff;
  --stage-glow: rgba(1, 205, 254, 0.30);
}
#quiz-box.quiz-stage-2 {
  --stage-accent: #ffb84d;
  --stage-accent-2: #ffd23f;
  --stage-glow: rgba(255, 184, 77, 0.32);
}
#quiz-box.quiz-stage-3 {
  --stage-accent: #ffd23f;
  --stage-accent-2: #2ed573;
  --stage-glow: rgba(255, 210, 63, 0.34);
}
#quiz-box.quiz-stage-4 {
  --stage-accent: #ff7b54;
  --stage-accent-2: #ffd23f;
  --stage-glow: rgba(255, 123, 84, 0.38);
}
#quiz-box.quiz-cleared {
  --stage-accent: #2ed573;
  --stage-glow: rgba(46, 213, 115, 0.42);
}

#quiz-box.quiz-enter { animation: quiz-pop-in 0.28s cubic-bezier(0.2, 1.25, 0.4, 1) both; }
#quiz-box.quiz-exit  { animation: quiz-pop-out 0.22s ease-in forwards; }
@keyframes quiz-pop-in {
  from { opacity: 0; transform: translateY(-18px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes quiz-pop-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

#quiz-box.shake { animation: shake 0.4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(5px); }
}

/* Mini pixel road-trip route bar */
#quiz-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 10px 10px;
  margin-bottom: 14px;
  background: rgba(8, 6, 18, 0.72);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #2b2448;
}
.route-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 58px;
}
.route-dot {
  width: 14px;
  height: 14px;
  border: 3px solid #000;
  background: #2b2448;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  color: #000;
}
.route-stop.done .route-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(46, 213, 115, 0.55);
}
.route-stop.active .route-dot {
  background: var(--stage-accent);
  box-shadow: 0 0 10px var(--stage-accent);
  animation: route-pulse 1s steps(2) infinite;
}
@keyframes route-pulse {
  50% { transform: scale(1.18); }
}
.route-label {
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.route-stop.done .route-label { color: var(--green); }
.route-stop.active .route-label { color: var(--stage-accent); }
.route-car {
  position: absolute;
  top: -16px;
  width: 28px;
  height: 18px;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 #000);
  animation: route-car-bob 0.45s steps(2) infinite;
}
@keyframes route-car-bob {
  50% { transform: translateY(-2px); }
}
.route-track {
  flex: 1;
  height: 4px;
  margin-bottom: 14px;
  background: repeating-linear-gradient(
    90deg,
    #3a3355 0 6px,
    transparent 6px 11px
  );
}
.route-track.done {
  background: repeating-linear-gradient(
    90deg,
    var(--green) 0 6px,
    transparent 6px 11px
  );
}

/* Checkpoint header with live character portrait + defeated rocket badge */
#quiz-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 3px dashed rgba(255, 255, 255, 0.14);
}
#quiz-portrait-wrap {
  width: 72px;
  height: 58px;
  flex-shrink: 0;
  background: #0b0816;
  border: 4px solid #000;
  box-shadow: inset 0 0 0 2px var(--stage-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
#quiz-portrait-wrap.taunt {
  box-shadow: inset 0 0 0 2px var(--red), 0 0 14px rgba(255, 71, 87, 0.55);
  animation: portrait-taunt 0.35s steps(2) 2;
}
#quiz-portrait-wrap.cleared {
  box-shadow: inset 0 0 0 2px var(--green), 0 0 14px rgba(46, 213, 115, 0.55);
}
@keyframes portrait-taunt {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.08); }
}
#quiz-portrait {
  width: 64px;
  height: 48px;
  image-rendering: pixelated;
  object-fit: contain;
}
#quiz-header-meta {
  flex: 1;
  min-width: 0;
}
#quiz-checkpoint {
  color: var(--stage-accent);
  font-size: 9px;
  line-height: 1.6;
  letter-spacing: 0.8px;
}
#quiz-speaker {
  color: var(--ink);
  font-size: 8px;
  margin-top: 4px;
  opacity: 0.88;
}
#quiz-progress {
  color: var(--stage-accent-2);
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 6px;
}
#quiz-badge-wrap {
  width: 54px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
}
#quiz-badge {
  width: 50px;
  height: 30px;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 #000);
  animation: badge-hover 1.8s ease-in-out infinite;
}
@keyframes badge-hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

#quiz-text-wrap {
  position: relative;
  cursor: pointer;
}
#quiz-text {
  font-size: 12px;
  line-height: 1.95;
  min-height: 76px;
  color: var(--ink);
}
#quiz-skip-hint {
  margin-top: 6px;
  text-align: right;
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#quiz-text-wrap.is-typing #quiz-skip-hint { opacity: 0.85; }

.typing::after {
  content: "▋";
  color: var(--yellow);
  animation: blink 0.7s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#quiz-hint-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 14px;
  background: rgba(255, 210, 63, 0.08);
  border: 3px solid #000;
  border-left: 5px solid var(--yellow);
  padding: 10px 12px;
  animation: hint-slide 0.22s ease-out;
}
@keyframes hint-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
#quiz-hint-avatar {
  width: 30px;
  height: 44px;
  flex-shrink: 0;
  image-rendering: pixelated;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 #000);
}
#quiz-hint-body { flex: 1; min-width: 0; }
.quiz-hint-tag {
  font-size: 7px;
  color: var(--blue);
  letter-spacing: 1px;
  margin-bottom: 5px;
}
#quiz-hint {
  color: var(--yellow);
  font-size: 9px;
  line-height: 1.9;
}

#quiz-form {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

#quiz-input {
  flex: 1;
  min-width: 190px;
  background: rgba(10, 8, 18, 0.94);
  color: var(--ink);
  border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #3a3355;
  padding: 13px 14px;
  font: inherit;
  font-size: 11px;
  text-transform: uppercase;
  outline: none;
}
#quiz-input:focus { box-shadow: inset 0 0 0 2px var(--stage-accent); }
#quiz-input::placeholder { color: #565078; }

.btn {
  font: inherit;
  font-size: 10px;
  background: var(--yellow);
  color: #111;
  border: 4px solid #000;
  box-shadow: 0 6px 0 #000;
  padding: 13px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #000; }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-secondary { background: var(--blue); color: #fff; }
.btn-small { font-size: 8px; padding: 10px 12px; box-shadow: 0 4px 0 #000; }

#quiz-status-row {
  margin-top: 14px;
  min-height: 36px;
}
#quiz-feedback {
  font-size: 10px;
  line-height: 1.7;
  min-height: 17px;
  color: var(--red);
}
#quiz-feedback.good { color: var(--green); }
#quiz-quip {
  margin-top: 5px;
  font-size: 8px;
  line-height: 1.7;
  color: var(--stage-accent);
  min-height: 14px;
}
#quiz-quip.good { color: var(--yellow); }

@media (max-width: 560px) {
  #quiz-box { padding: 14px 14px 16px; }
  #quiz-badge-wrap { display: none; }
  #quiz-portrait-wrap { width: 56px; height: 46px; }
  #quiz-portrait { width: 50px; height: 38px; }
  #quiz-text { font-size: 10px; min-height: 64px; }
  .route-stop { min-width: 44px; }
  .route-label { font-size: 6px; }
}

/* ---------------- reveal ---------------- */

#screen-reveal { padding: 30px 16px 90px; }

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
}

#reveal-title {
  text-align: center;
  font-size: clamp(15px, 4vw, 28px);
  color: var(--yellow);
  text-shadow: 4px 4px 0 #000;
  margin: 26px auto 44px;
  max-width: 900px;
  line-height: 1.8;
}

#reveal-cards {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1100px;
  margin: 0 auto;
}
#reveal-cards.has-what-items {
  max-width: 948px;
}

.reveal-card {
  background: var(--panel);
  border: 4px solid #000;
  box-shadow: 0 8px 0 #000, inset 0 0 0 4px var(--panel-edge);
  padding: 24px;
  width: 300px;
  opacity: 0;
  transform: translateY(34px) scale(0.9);
}
#reveal-cards.has-what-items .reveal-card {
  flex: 1 1 300px;
  width: auto;
  max-width: 462px;
}
#reveal-cards.has-what-items .reveal-card.reveal-card-wide {
  flex: 1 1 100%;
  width: 100%;
  max-width: 948px;
}
.reveal-card.flip-in { animation: flipIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes flipIn { to { opacity: 1; transform: none; } }

.rc-label { color: var(--blue); font-size: 10px; letter-spacing: 4px; margin-bottom: 14px; }
.rc-icon { font-size: 28px; }
.rc-value { font-size: 13px; line-height: 1.9; margin-top: 12px; }
.rc-detail { font-size: 9px; line-height: 2; color: var(--muted); margin-top: 12px; }
.rc-chips { margin-top: 12px; }
.rc-extra { margin-top: 16px; }

.what-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.what-item {
  background: rgba(10, 8, 20, 0.85);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #2f2850;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.what-item.accent-stay    { box-shadow: inset 0 0 0 2px rgba(84, 160, 255, 0.55); }
.what-item.accent-event   { box-shadow: inset 0 0 0 2px rgba(255, 210, 63, 0.55); }
.what-item.accent-food    { box-shadow: inset 0 0 0 2px rgba(46, 213, 115, 0.55); }
.what-item.accent-travel  { box-shadow: inset 0 0 0 2px rgba(165, 94, 234, 0.55); }
.what-item.accent-default { box-shadow: inset 0 0 0 2px rgba(1, 205, 254, 0.50); }

.what-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.what-badge {
  display: inline-block;
  font-size: 7px;
  letter-spacing: 1px;
  padding: 5px 8px;
  background: var(--panel-edge);
  border: 2px solid #000;
  color: var(--ink);
}
.what-item.accent-stay .what-badge    { color: var(--blue); }
.what-item.accent-event .what-badge   { color: var(--yellow); }
.what-item.accent-food .what-badge    { color: var(--green); }
.what-item.accent-travel .what-badge  { color: var(--purple); }
.what-item.accent-default .what-badge { color: #01cdfe; }

.what-time {
  font-size: 7px;
  color: #a9a1cf;
  line-height: 1.6;
}
.what-item-title {
  font-size: 10px;
  line-height: 1.8;
  color: var(--ink);
}
.what-item-details {
  font-size: 8px;
  line-height: 1.95;
  color: var(--muted);
}
.what-item-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}
.what-link {
  font-size: 7px;
  padding: 8px 10px;
}

.who-chip {
  display: inline-block;
  background: var(--panel-edge);
  border: 2px solid #000;
  padding: 7px 10px;
  margin: 4px 4px 0 0;
  font-size: 9px;
}

#reveal-media {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 54px auto 0;
  max-width: 1100px;
}

.polaroid {
  background: #f5f0e6;
  padding: 12px 12px 14px;
  border: 4px solid #000;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.6);
  color: #111;
}
.polaroid img {
  width: 240px;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #d8d2c4;
}
.polaroid .caption { font-size: 8px; margin-top: 10px; color: #333; line-height: 1.6; }

.photo-slot {
  width: 248px;
  height: 188px;
  border: 4px dashed #4a4370;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8px;
  line-height: 1.8;
  color: #7a739f;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

#reveal-stats {
  margin: 40px auto 0;
  text-align: center;
  font-size: 9px;
  line-height: 1.8;
  color: var(--muted);
  max-width: 780px;
  padding: 22px 22px 24px;
}
.debrief-title {
  color: var(--yellow);
  font-size: 10px;
  letter-spacing: 1px;
  margin-bottom: 18px;
}
.debrief-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.debrief-tile {
  background: rgba(10, 8, 20, 0.85);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #2f2850;
  padding: 12px 10px;
}
.debrief-tile.accent-yellow { box-shadow: inset 0 0 0 2px rgba(255, 210, 63, 0.5); }
.debrief-tile.accent-blue   { box-shadow: inset 0 0 0 2px rgba(84, 160, 255, 0.5); }
.debrief-tile.accent-cyan   { box-shadow: inset 0 0 0 2px rgba(1, 205, 254, 0.5); }
.debrief-tile.accent-green  { box-shadow: inset 0 0 0 2px rgba(46, 213, 115, 0.55); }
.debrief-tile.accent-red    { box-shadow: inset 0 0 0 2px rgba(255, 71, 87, 0.55); }
.dt-label {
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.6px;
}
.dt-value {
  margin-top: 8px;
  font-size: 15px;
  color: var(--ink);
}
.debrief-tile.accent-yellow .dt-value { color: var(--yellow); }
.debrief-tile.accent-blue   .dt-value { color: var(--blue); }
.debrief-tile.accent-cyan   .dt-value { color: #01cdfe; }
.debrief-tile.accent-green  .dt-value { color: var(--green); }
.debrief-tile.accent-red    .dt-value { color: var(--red); }
.dt-sub {
  margin-top: 6px;
  font-size: 7px;
  color: #a9a1cf;
}
.debrief-stages-title {
  margin-top: 18px;
  margin-bottom: 10px;
  font-size: 8px;
  color: #01cdfe;
  letter-spacing: 1px;
}
.debrief-stages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.debrief-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 8, 20, 0.85);
  border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #362e5c;
  padding: 7px 10px;
  font-size: 8px;
}
.dsc-name { color: var(--muted); }
.dsc-val  { color: var(--yellow); }

@media (max-width: 640px) {
  .debrief-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#reveal-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 42px 0 30px;
}

/* ---------------- footer / misc ---------------- */

#footer {
  position: fixed;
  bottom: 8px;
  right: 12px;
  z-index: 100;
  font-size: 8px;
  color: #4a4370;
}
#reset-save { cursor: pointer; }
#reset-save:hover { color: var(--red); text-decoration: underline; }

/* rainbow mode easter egg */
body.rainbow #hud,
body.rainbow .btn,
body.rainbow .reveal-card { animation: hue 1.2s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

/* ---------------- Phaser game screen + overlays (v2) ---------------- */

#screen-game {
  position: fixed;
  inset: 0;
  z-index: 1;
  min-height: 100vh;
  padding-top: 0;
}
#game-container { width: 100%; height: 100%; }
#game-container canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
body.playing #game-container canvas { cursor: none; }

.screen.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(13, 11, 22, 0.92);
  overflow-y: auto;
  padding-top: 56px;
  min-height: 100vh;
}
#screen-quiz.overlay {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(58px, 6.5vh, 84px) 16px 64px;
  background: rgba(13, 11, 22, 0.42);
}
#screen-reveal.overlay {
  padding: 30px 16px 90px;
  animation: reveal-fade-in 0.45s ease-out both;
}
@keyframes reveal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------------- responsive ---------------- */

@media (max-width: 640px) {
  .panel { padding: 18px; }
  #quiz-text { font-size: 11px; min-height: 110px; }
  #quiz-input { font-size: 10px; }
  .reveal-card,
  #reveal-cards.has-what-items .reveal-card { width: 100%; max-width: 100%; flex: 1 1 100%; }
  .what-items-grid { grid-template-columns: 1fr; }
  #hud-mission { max-width: 34vw; }
  #toast-layer { bottom: 72px; }
}
