/* =============================================================
   STRAIN HUNTER DEX — DS-era pixel art tokens + UI shell
   ============================================================= */

:root {
  /* Palette — night dispensary, neon-pixel */
  --bg-0: #0a0c14;
  --bg-1: #131726;
  --bg-2: #1c2138;
  --bg-3: #262d4a;
  --ink-0: #f6f7ff;
  --ink-1: #c7cce8;
  --ink-2: #8a8fb3;
  --ink-3: #4a4f6e;

  --mint: #4af0a8;
  --mint-2: #2bd28a;
  --pink: #ff7b9d;
  --gold: #ffb84d;
  --violet: #9b8cff;
  --sky: #7ec8e3;
  --magenta: #ff5ec4;
  --danger: #ff5a6a;

  /* Type colors (mirrors game.json) */
  --t-CALM: #7ec8e3;
  --t-BLISS: #ffb84d;
  --t-FOCUS: #9b8cff;
  --t-BODY: #ff7b9d;
  --t-SPARK: #4af0a8;
  --t-DREAM: #6a5cff;

  --shadow-pixel: 0 4px 0 rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 6px 0 rgba(0, 0, 0, 0.55), 0 16px 40px rgba(0, 0, 0, 0.6);

  --pixel-font: 'Press Start 2P', system-ui, sans-serif;
  --hud-font: 'VT323', 'Press Start 2P', monospace;
  --ui-font: 'Space Grotesk', system-ui, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--ui-font);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  /* CRT scanline + dot-grid */
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0px,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(circle at 20% 0%, rgba(74, 240, 168, 0.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(155, 140, 255, 0.08), transparent 50%);
  min-height: 100dvh;
  overflow: hidden;
}

button {
  font: inherit;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
}

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

/* =============================================================
   PIXEL BUTTONS (DS-era hard-edged)
   ============================================================= */

.btn-pixel {
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 14px 20px;
  border: 3px solid #000;
  background: var(--bg-2);
  color: var(--ink-0);
  box-shadow: 0 4px 0 #000, inset 0 -3px 0 rgba(0, 0, 0, 0.4),
    inset 0 3px 0 rgba(255, 255, 255, 0.08);
  transition: transform 80ms ease, box-shadow 80ms ease;
  position: relative;
}
.btn-pixel:hover { transform: translateY(-2px); }
.btn-pixel:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.btn-pixel:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--mint) 0%, var(--mint-2) 100%);
  color: #062013;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-ghost {
  background: var(--bg-1);
  color: var(--ink-1);
}
.btn-lg {
  font-size: 13px;
  padding: 18px 28px;
}

/* =============================================================
   OVERLAYS (age gate, start, end)
   ============================================================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: linear-gradient(180deg, rgba(10, 12, 20, 0.92), rgba(10, 12, 20, 0.98));
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, var(--safe-top));
  padding-bottom: max(24px, var(--safe-bot));
  overflow-y: auto;
}
.overlay[data-active='true'] { display: flex; }

/* Age gate */
.age-card {
  max-width: 480px;
  width: 100%;
  background: var(--bg-1);
  border: 3px solid #000;
  box-shadow: var(--shadow-pixel);
  padding: 32px 28px;
  text-align: center;
}
.age-pixel-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.px-leaf { font-size: 36px; color: var(--mint); text-shadow: 0 0 12px var(--mint); }
.px-title {
  font-family: var(--pixel-font);
  font-size: 20px;
  color: var(--ink-0);
  letter-spacing: 0.08em;
}
.px-sub {
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--mint);
  letter-spacing: 0.4em;
}
.age-prompt {
  font-family: var(--pixel-font);
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--ink-0);
}
.age-fine {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-bottom: 24px;
  font-family: var(--ui-font);
}
.age-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Start screen */
.start-stack {
  max-width: 880px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}
.title-art {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.title-row {
  font-family: var(--pixel-font);
  letter-spacing: 0.1em;
}
.title-row--small {
  font-size: 11px;
  color: var(--mint);
  letter-spacing: 0.5em;
}
.title-row--big {
  font-size: clamp(28px, 6vw, 48px);
  color: var(--ink-0);
  text-shadow: 4px 4px 0 #000, 8px 8px 0 var(--violet);
}
.title-row--accent {
  font-size: clamp(14px, 3vw, 22px);
  color: var(--mint);
  letter-spacing: 0.6em;
}
.title-sub {
  font-family: var(--ui-font);
  font-size: 14px;
  color: var(--ink-1);
  margin-top: 8px;
  letter-spacing: 0;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: 760px;
}
.how-card {
  background: var(--bg-1);
  border: 3px solid #000;
  box-shadow: var(--shadow-pixel);
  padding: 18px 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.how-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--mint);
}
.how-num {
  font-family: var(--pixel-font);
  font-size: 10px;
  color: var(--mint);
  letter-spacing: 0.3em;
}
.how-card h3 {
  font-family: var(--pixel-font);
  font-size: 11px;
  margin-top: 8px;
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}
.how-card p {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-1);
}

.start-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.start-foot {
  font-family: var(--ui-font);
  font-size: 12px;
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .how-grid { grid-template-columns: 1fr; }
}

/* =============================================================
   GAME ROOT
   ============================================================= */

.game-root {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}
.game-root[data-active='true'] { display: flex; }

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0a0c14;
  z-index: 1;
}

/* HUD */
.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, var(--safe-top));
  pointer-events: none;
}
.hud-cell { pointer-events: auto; }
.hud-label {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--ink-2);
  letter-spacing: 0.2em;
  margin-bottom: 4px;
}
.hud-value {
  font-family: var(--hud-font);
  font-size: 28px;
  color: var(--ink-0);
  line-height: 1;
}
.hud-left {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 8px 12px;
  display: inline-block;
  box-shadow: var(--shadow-pixel);
  width: max-content;
}
.hud-right {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 8px 12px;
  box-shadow: var(--shadow-pixel);
  margin-left: auto;
  width: max-content;
}
.hud-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}
.hud-center { display: flex; justify-content: center; }

.sponsor-banner {
  background: linear-gradient(90deg, var(--gold), var(--magenta));
  color: #1a0a16;
  padding: 8px 16px;
  border: 3px solid #000;
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: sponsorPulse 1.4s ease-in-out infinite;
  box-shadow: var(--shadow-pixel);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sponsor-spark { animation: sparkRot 1.4s linear infinite; }
@keyframes sponsorPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes sparkRot {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Patient ticket */
.patient-ticket {
  position: absolute;
  left: 16px;
  top: 96px;
  z-index: 4;
  width: 280px;
  background: var(--bg-1);
  border: 3px solid #000;
  box-shadow: var(--shadow-card);
  font-family: var(--ui-font);
  overflow: hidden;
}
.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-2);
  border-bottom: 3px solid #000;
}
.ticket-no {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--mint);
}
.ticket-budget {
  font-family: var(--hud-font);
  font-size: 22px;
  color: var(--gold);
  line-height: 1;
}
.ticket-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ticket-complaint {
  font-size: 14px;
  color: var(--ink-0);
  line-height: 1.4;
}
.ticket-label {
  display: block;
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--ink-2);
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}
.want-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.want-chip {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 5px 8px;
  border: 2px solid #000;
  background: var(--bg-3);
  color: var(--ink-0);
}
.want-chip[data-type='CALM']  { background: var(--t-CALM); color: #08151c; }
.want-chip[data-type='BLISS'] { background: var(--t-BLISS); color: #2a1a04; }
.want-chip[data-type='FOCUS'] { background: var(--t-FOCUS); color: #100a26; }
.want-chip[data-type='BODY']  { background: var(--t-BODY);  color: #2a0816; }
.want-chip[data-type='SPARK'] { background: var(--t-SPARK); color: #062013; }
.want-chip[data-type='DREAM'] { background: var(--t-DREAM); color: #0a0826; color: #fff; }

.ticket-form-val {
  font-family: var(--pixel-font);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-0);
}

/* Tray */
.tray {
  position: absolute;
  left: 50%;
  bottom: max(12px, var(--safe-bot));
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 10px 14px;
  box-shadow: var(--shadow-card);
}
.tray-label {
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--ink-2);
  letter-spacing: 0.2em;
}
.tray-slots { display: flex; gap: 8px; }
.tray-slot {
  width: 56px;
  height: 56px;
  border: 3px solid #000;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--ink-2);
  position: relative;
  overflow: hidden;
}
.tray-slot:not(.tray-slot--empty) {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
}
.tray-slot canvas { width: 100%; height: 100%; }
.tray-slot .tray-slot-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: var(--ink-0);
  font-family: var(--ui-font);
  font-size: 9px;
  text-align: center;
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tray-slot.shiny {
  box-shadow: inset 0 0 0 2px var(--gold), 0 0 14px rgba(255, 184, 77, 0.6);
}

/* Mobile dpad */
.dpad {
  position: absolute;
  bottom: max(96px, calc(var(--safe-bot) + 96px));
  right: 16px;
  z-index: 4;
  display: none;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
}
.dpad-btn {
  background: var(--bg-1);
  border: 3px solid #000;
  color: var(--ink-0);
  font-family: var(--pixel-font);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #000;
}
.dpad-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.dpad-btn:nth-child(1) { grid-column: 2; grid-row: 1; }
.dpad-btn:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad-btn:nth-child(3) { grid-column: 2; grid-row: 2; background: var(--mint); color: #062013; }
.dpad-btn:nth-child(4) { grid-column: 3; grid-row: 2; }
.dpad-btn:nth-child(5) { grid-column: 2; grid-row: 3; }

@media (hover: none) and (pointer: coarse) {
  .dpad { display: grid; }
}

/* =============================================================
   CARD FLIP OVERLAY (catch a strain)
   ============================================================= */

.card-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 14, 0.7);
  backdrop-filter: blur(6px);
}
.card-overlay[data-active='true'] {
  display: flex;
  animation: fadeIn 200ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.card-flip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.card-3d {
  width: 280px;
  height: 392px;
  position: relative;
  transform-style: preserve-3d;
  animation: cardSpin 900ms cubic-bezier(0.6, 0.2, 0.2, 1) forwards;
}
@keyframes cardSpin {
  0%   { transform: rotateY(0deg) scale(0.7); opacity: 0; }
  40%  { transform: rotateY(360deg) scale(1.05); opacity: 1; }
  100% { transform: rotateY(720deg) scale(1); opacity: 1; }
}
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border: 4px solid #000;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-face--front { transform: rotateY(0deg); }
.card-face--back  { transform: rotateY(180deg); }

.card-cta { display: flex; gap: 12px; }

/* The actual card layouts are drawn into <canvas> via JS for that
   crisp pixel-art card look. Front and back canvases inserted by JS. */

/* =============================================================
   END SCREEN
   ============================================================= */

.end-stack {
  max-width: 940px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 12px;
}
.end-title {
  font-family: var(--pixel-font);
  font-size: clamp(20px, 5vw, 32px);
  text-align: center;
  letter-spacing: 0.1em;
  color: var(--mint);
  text-shadow: 4px 4px 0 #000;
}
.end-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.end-stat {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow-pixel);
}
.end-stat-label {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--ink-2);
  letter-spacing: 0.2em;
  margin-bottom: 6px;
}
.end-stat-value {
  font-family: var(--hud-font);
  font-size: 32px;
  color: var(--ink-0);
  line-height: 1;
}
.end-h3 {
  font-family: var(--pixel-font);
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--mint);
  margin-bottom: 12px;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 6px;
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.dex-cell {
  aspect-ratio: 1;
  background: var(--bg-3);
  border: 2px solid #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--ink-2);
}
.dex-cell.caught {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
}
.dex-cell.caught canvas { width: 100%; height: 100%; }
.dex-cell.caught img.bud-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.dex-cell.shiny {
  box-shadow: inset 0 0 0 2px var(--gold);
}
.dex-cell .dex-num {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 6px;
  color: var(--ink-3);
}
.dex-cell.caught .dex-num { color: var(--ink-1); }

.end-share {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
#share-canvas {
  width: 270px;
  height: 378px;
  border: 3px solid #000;
  background: var(--bg-3);
  box-shadow: var(--shadow-card);
}
.end-share-row { display: flex; gap: 10px; flex-wrap: wrap; }

.lead-card {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 3px solid #000;
  padding: 20px;
  box-shadow: var(--shadow-pixel);
}
.lead-copy {
  color: var(--ink-1);
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.lead-form { display: flex; flex-direction: column; gap: 10px; }
.lead-form input[type='email'] {
  font: inherit;
  font-size: 16px;
  padding: 14px;
  background: var(--bg-1);
  border: 3px solid #000;
  color: var(--ink-0);
  outline: none;
}
.lead-form input[type='email']:focus { border-color: var(--mint); }
.lead-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}
.lead-consent input { margin-top: 2px; }
.lead-status {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.1em;
  min-height: 14px;
}
.lead-status[data-state='ok'] { color: var(--mint); }
.lead-status[data-state='err'] { color: var(--danger); }

.end-actions { display: flex; justify-content: center; gap: 14px; }
.end-foot {
  text-align: center;
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 8px;
}

@media (max-width: 640px) {
  .end-stats { grid-template-columns: repeat(2, 1fr); }
  .patient-ticket { width: calc(100% - 32px); top: 76px; }
  .hud { grid-template-columns: 1fr 1fr; }
  .hud-center { grid-column: 1 / -1; order: 3; justify-self: center; }
  .sponsor-banner { font-size: 8px; padding: 6px 10px; }
  .tray-slot { width: 44px; height: 44px; }
}

/* =============================================================
   QUIZ STAGE
   ============================================================= */

.quiz-stage {
  position: relative;
  z-index: 4;
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.quiz-meta { display: flex; flex-direction: column; gap: 8px; }
.quiz-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.quiz-counter {
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-0);
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 6px 10px;
}
.quiz-pill {
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.2em;
  padding: 5px 8px;
  border: 2px solid #000;
  background: var(--bg-3);
  color: var(--ink-0);
}
.quiz-pill--easy   { background: var(--mint); color: #062013; }
.quiz-pill--medium { background: var(--gold); color: #2a1a04; }
.quiz-pill--hard   { background: var(--pink); color: #2a0816; }
.quiz-streak {
  margin-left: auto;
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--gold);
}
.quiz-streak.fire { animation: streakPulse 600ms ease-out; }
@keyframes streakPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); color: var(--mint); }
  100% { transform: scale(1); }
}
.quiz-progress {
  width: 100%;
  height: 8px;
  background: var(--bg-1);
  border: 2px solid #000;
  overflow: hidden;
}
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--gold), var(--danger));
  width: 100%;
  transition: width 200ms linear;
}

/* Scenario card (the question) */
.scenario-card {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border: 3px solid #000;
  box-shadow: var(--shadow-pixel);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.scenario-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--mint);
}
.scenario-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.scenario-icon { font-size: 22px; }
.scenario-title {
  font-family: var(--pixel-font);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--mint);
}
.scenario-prompt {
  font-family: var(--ui-font);
  font-size: clamp(15px, 2.2vw, 20px);
  line-height: 1.4;
  color: var(--ink-0);
  margin-bottom: 10px;
  font-weight: 600;
}
.scenario-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--ui-font);
  font-size: 13px;
  color: var(--ink-1);
}

/* Body row: portrait + text */
.scenario-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}
.scenario-text { min-width: 0; }
.scenario-portrait {
  width: 80px;
  height: 80px;
  border: 3px solid #000;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-3);
  box-shadow: 0 4px 0 #000, 0 0 0 2px var(--mint);
  flex-shrink: 0;
  image-rendering: pixelated;
}
.scenario-portrait[data-active='false'] { display: none; }
.scenario-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
}

/* Terpene chip strip on patient/answer cards */
.scenario-terps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.terp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 2px solid #000;
  background: var(--bg-3);
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--ink-0);
  line-height: 1.3;
}
.terp-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terp-color, var(--mint));
  box-shadow: 0 0 0 1px #000;
}
.terp-chip[data-terp='Caryophyllene'] { --terp-color: #ff7b9d; }
.terp-chip[data-terp='Myrcene']       { --terp-color: #6a5cff; }
.terp-chip[data-terp='Limonene']      { --terp-color: #ffb84d; }
.terp-chip[data-terp='Linalool']      { --terp-color: #b48cff; }
.terp-chip[data-terp='Pinene']        { --terp-color: #4af0a8; }
.terp-chip[data-terp='Humulene']      { --terp-color: #c98232; }
.terp-chip[data-terp='Terpinolene']   { --terp-color: #7ec8e3; }
.terp-chip[data-terp='Ocimene']       { --terp-color: #4ae0c8; }
.terp-chip[data-terp='Nerolidol']     { --terp-color: #d4ccff; }

.answer-meta .terp-chip { font-size: 7px; padding: 2px 5px; }
.scenario-chip {
  background: var(--bg-3);
  border: 2px solid #000;
  padding: 4px 8px;
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.15em;
}
.scenario-chip--type[data-type='CALM']  { background: var(--t-CALM); color: #08151c; }
.scenario-chip--type[data-type='BLISS'] { background: var(--t-BLISS); color: #2a1a04; }
.scenario-chip--type[data-type='FOCUS'] { background: var(--t-FOCUS); color: #100a26; }
.scenario-chip--type[data-type='BODY']  { background: var(--t-BODY);  color: #2a0816; }
.scenario-chip--type[data-type='SPARK'] { background: var(--t-SPARK); color: #062013; }
.scenario-chip--type[data-type='DREAM'] { background: var(--t-DREAM); color: #fff; }

/* Answer cards */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.answer-card {
  background: var(--bg-1);
  border: 3px solid #000;
  box-shadow: var(--shadow-pixel);
  padding: 12px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
  position: relative;
  overflow: hidden;
  text-align: left;
  font-family: var(--ui-font);
  width: 100%;
}
.answer-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #000, 0 16px 30px rgba(0,0,0,0.5); }
.answer-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.answer-card[disabled] { cursor: default; }
.answer-card.correct {
  background: linear-gradient(135deg, rgba(74, 240, 168, 0.25), var(--bg-1));
  border-color: var(--mint);
  box-shadow: 0 0 0 3px var(--mint), 0 6px 0 #000;
  animation: cardWin 600ms ease-out;
}
.answer-card.wrong {
  background: linear-gradient(135deg, rgba(255, 90, 106, 0.25), var(--bg-1));
  border-color: var(--danger);
  animation: cardShake 380ms ease-out;
}
.answer-card.dim { opacity: 0.4; }
.answer-card.shiny-answer::before {
  content: '✦';
  position: absolute;
  top: 4px; right: 6px;
  color: var(--gold);
  font-size: 14px;
  text-shadow: 0 0 8px var(--gold);
  animation: sparkRot 1.4s linear infinite;
}
@keyframes cardWin {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-6px) scale(1.02); }
}
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.answer-sprite {
  width: 64px; height: 64px;
  background: var(--bg-3);
  border: 2px solid #000;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.answer-sprite canvas { width: 100%; height: 100%; }
.answer-sprite img.bud-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}
.answer-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.answer-name {
  font-family: var(--pixel-font);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-0);
  line-height: 1.35;
  word-break: break-word;
}
.answer-name--wrap {
  font-family: var(--ui-font);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  white-space: normal;
}
.answer-sprite--num {
  font-family: var(--pixel-font);
  font-size: 18px;
  color: var(--mint);
  background: var(--bg-2);
}
.answer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.answer-type {
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.1em;
  padding: 3px 5px;
  border: 1.5px solid #000;
}
.answer-type[data-type='CALM']  { background: var(--t-CALM); color: #08151c; }
.answer-type[data-type='BLISS'] { background: var(--t-BLISS); color: #2a1a04; }
.answer-type[data-type='FOCUS'] { background: var(--t-FOCUS); color: #100a26; }
.answer-type[data-type='BODY']  { background: var(--t-BODY);  color: #2a0816; }
.answer-type[data-type='SPARK'] { background: var(--t-SPARK); color: #062013; }
.answer-type[data-type='DREAM'] { background: var(--t-DREAM); color: #fff; }
.answer-stat {
  font-family: var(--hud-font);
  font-size: 14px;
  color: var(--ink-1);
  line-height: 1;
}

/* Reveal banner */
.reveal-banner {
  position: fixed;
  left: 50%;
  bottom: max(16px, var(--safe-bot));
  transform: translate(-50%, 120%);
  width: min(700px, calc(100% - 32px));
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 4px solid #000;
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  z-index: 30;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  transition: transform 280ms cubic-bezier(0.5, 1.5, 0.5, 1);
  pointer-events: none;
}
.reveal-banner[data-state='ok'],
.reveal-banner[data-state='miss'] {
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.reveal-banner[data-state='ok'] { border-color: var(--mint); }
.reveal-banner[data-state='miss'] { border-color: var(--danger); }
.reveal-icon {
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
  font-family: var(--pixel-font);
  font-size: 22px;
  border: 3px solid #000;
}
.reveal-banner[data-state='ok'] .reveal-icon { background: var(--mint); color: #062013; }
.reveal-banner[data-state='miss'] .reveal-icon { background: var(--danger); color: #fff; }
.reveal-title {
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-0);
  margin-bottom: 4px;
}
.reveal-explain {
  font-family: var(--ui-font);
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-1);
}

@media (max-width: 640px) {
  .answers-grid { grid-template-columns: 1fr; gap: 8px; }
  .answer-card { grid-template-columns: 52px 1fr; padding: 10px; gap: 10px; }
  .answer-sprite { width: 52px; height: 52px; }
  .answer-name { font-size: 9px; }
  .answer-name--wrap { font-size: 12.5px; }
  .answer-type { font-size: 7px; padding: 2px 4px; }
  .answer-stat { font-size: 12px; }
  .quiz-stage { padding: 10px 12px 16px; gap: 10px; }
  .scenario-card { padding: 14px; }
  .scenario-prompt { font-size: 15px; }
  .scenario-meta { font-size: 12px; }
  .scenario-portrait { width: 64px; height: 64px; }
  .scenario-body { gap: 10px; }
  .terp-chip { font-size: 7px; padding: 3px 6px; }
  .reveal-banner { grid-template-columns: 36px 1fr; gap: 8px; padding: 10px; }
  .reveal-banner #reveal-next { grid-column: 1 / -1; }
  .quiz-counter { font-size: 9px; padding: 5px 8px; }
  .quiz-pill { font-size: 7px; padding: 4px 6px; }
  .quiz-streak { font-size: 8px; }
}

/* =============================================================
   TOAST / FLOATING SCORES
   ============================================================= */

.toast-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
.toast {
  position: absolute;
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--mint);
  text-shadow: 2px 2px 0 #000;
  animation: toastRise 1100ms ease-out forwards;
}
.toast.shiny { color: var(--gold); }
.toast.miss { color: var(--danger); }
.toast.badge { color: var(--violet); font-size: 11px; }
@keyframes toastRise {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, -60px); opacity: 0; }
}

/* =============================================================
   BADGE notice
   ============================================================= */

.badge-notice {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  background: linear-gradient(180deg, var(--violet), var(--magenta));
  color: #fff;
  border: 4px solid #000;
  padding: 18px 24px;
  font-family: var(--pixel-font);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: center;
  box-shadow: var(--shadow-card);
  animation: badgePop 1.6s ease-out forwards;
  pointer-events: none;
  max-width: 80vw;
}
.badge-notice small {
  display: block;
  font-size: 9px;
  margin-top: 6px;
  opacity: 0.85;
}
@keyframes badgePop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  80% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* =============================================================
   STUDIENHEFT — Clean Clinical UI (Inter / IBM Plex Serif)
   ============================================================= */

#studienheft.studienheft {
  background: linear-gradient(180deg, #f6f7fb 0%, #eef1f8 100%);
  color: #1a1d2b;
  align-items: flex-start;
  padding: 0;
}

/* Tall scrolling overlays must align to top so content isn't clipped above viewport */
#end-screen, #boss-screen { align-items: flex-start; }
#studienheft .sh-wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 36px) 120px;
  font-family: 'Inter', system-ui, sans-serif;
  color: #1a1d2b;
}
#studienheft .sh-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-bottom: 1px solid #d8dde8;
  padding-bottom: 24px;
  margin-bottom: 28px;
}
.sh-brand { display: flex; gap: 16px; align-items: flex-start; }
.sh-mark {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #0d3b2e; color: #4af0a8;
  border-radius: 6px;
  font-size: 28px;
  flex-shrink: 0;
}
.sh-brand-line {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5a6b7e;
  margin-bottom: 4px;
}
.sh-title {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: clamp(22px, 3.6vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  color: #0d1726;
  margin-bottom: 6px;
}
.sh-sub {
  font-size: 14px;
  color: #4a5468;
  line-height: 1.55;
}
.sh-sub strong { color: #0d3b2e; font-weight: 600; }
.sh-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #fff;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  padding: 14px 8px;
}
.sh-meta-cell { text-align: center; padding: 4px 8px; border-right: 1px solid #e6eaf2; }
.sh-meta-cell:last-child { border-right: 0; }
.sh-meta-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a7689;
  margin-bottom: 4px;
}
.sh-meta-value {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 26px;
  font-weight: 600;
  color: #0d3b2e;
  line-height: 1;
}

.sh-section { margin-bottom: 32px; }
.sh-h2 {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #0d1726;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e1e5ee;
}

.sh-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.sh-module-card {
  background: #fff;
  border: 1px solid #d8dde8;
  border-left: 4px solid #4af0a8;
  border-radius: 6px;
  padding: 16px 16px 14px;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.sh-module-card:hover {
  box-shadow: 0 6px 18px rgba(13, 23, 38, 0.08);
  transform: translateY(-1px);
}
.sh-module-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.sh-module-icon { font-size: 22px; line-height: 1; }
.sh-module-id {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: #0d3b2e;
  color: #4af0a8;
  padding: 4px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.sh-module-title {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  color: #0d1726;
  line-height: 1.3;
  flex: 1;
}
.sh-module-en {
  font-size: 11px;
  color: #6a7689;
  font-style: italic;
  margin-bottom: 10px;
  margin-top: -4px;
}
.sh-module-objectives,
.sh-module-facts { margin-top: 8px; }
.sh-module-objectives h4,
.sh-module-facts h4 {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a6b7e;
  margin-bottom: 4px;
  font-weight: 600;
}
.sh-module-objectives ul,
.sh-module-facts ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sh-module-objectives li,
.sh-module-facts li {
  font-size: 13px;
  line-height: 1.5;
  color: #2a3142;
  padding: 2px 0 2px 14px;
  position: relative;
}
.sh-module-objectives li::before,
.sh-module-facts li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: #6a7689;
}
.sh-module-minutes {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7689;
  font-weight: 500;
}

.sh-flow-list {
  list-style: decimal;
  padding-left: 22px;
}
.sh-flow-list li {
  font-size: 14px;
  line-height: 1.6;
  color: #2a3142;
  padding: 4px 0;
}
.sh-flow-list strong { color: #0d3b2e; }

.sh-source-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.sh-source-list li {
  background: #fff;
  border: 1px solid #d8dde8;
  border-radius: 4px;
  padding: 10px 12px;
}
.sh-source-list a {
  font-size: 13px;
  color: #0d3b2e;
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
}
.sh-source-list a:hover { text-decoration: underline; }
.sh-source-list .src-id {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  background: #f0f3f8;
  color: #6a7689;
  padding: 3px 5px;
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: middle;
}
.sh-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: #6a7689;
  font-style: italic;
  line-height: 1.5;
}

.sh-actions {
  position: sticky;
  bottom: 0;
  margin: 0 -36px -120px;
  padding: 18px 36px max(18px, var(--safe-bot));
  background: linear-gradient(180deg, rgba(246, 247, 251, 0) 0%, rgba(246, 247, 251, 0.96) 30%, #f6f7fb 100%);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 10;
}
.sh-actions .btn-pixel { flex: 0 1 auto; }
.btn-pixel.btn-lg { font-size: 13px; padding: 14px 22px; }
@media (max-width: 520px) {
  .sh-actions { margin: 0 -16px -120px; padding: 16px 16px max(16px, var(--safe-bot)); }
  .sh-actions .btn-pixel { width: 100%; }
}

/* =============================================================
   SCENARIO CARD ADDITIONS — module label + question + source
   ============================================================= */

.scenario-head { position: relative; flex-wrap: wrap; }
.scenario-module {
  margin-left: auto;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  background: rgba(74, 240, 168, 0.14);
  color: var(--mint);
  border: 1px solid rgba(74, 240, 168, 0.4);
  padding: 5px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.scenario-question {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(74, 240, 168, 0.08);
  border-left: 3px solid var(--mint);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-0);
  line-height: 1.45;
  border-radius: 0 4px 4px 0;
}

.reveal-source {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.reveal-source-label {
  font-family: var(--pixel-font);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}
.reveal-source-link {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  background: rgba(155, 140, 255, 0.15);
  color: var(--violet);
  border: 1px solid rgba(155, 140, 255, 0.4);
  padding: 3px 7px;
  border-radius: 3px;
  text-decoration: none;
  font-weight: 500;
}
.reveal-source-link:hover { background: rgba(155, 140, 255, 0.25); }

/* =============================================================
   BOSS-EXAM (OSCE) — Clinical with pixel accents
   ============================================================= */

#boss-screen.boss-screen {
  background: linear-gradient(180deg, #0f1422 0%, #0a0c14 100%);
  align-items: flex-start;
  padding: 0;
}
.boss-wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 28px) 60px;
  font-family: 'Inter', system-ui, sans-serif;
}
.boss-header { margin-bottom: 22px; }
.boss-tag {
  display: inline-block;
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.14em;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  color: #fff;
  padding: 6px 9px;
  border: 2px solid #000;
  margin-bottom: 12px;
}
.boss-title {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 600;
  color: var(--ink-0);
  margin-bottom: 14px;
  line-height: 1.2;
}
.boss-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
#boss-stage-num {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--mint);
  white-space: nowrap;
}
.boss-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border: 2px solid #000;
  position: relative;
}
#boss-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mint), var(--mint-2));
  transition: width 0.4s ease;
}

.boss-patient-card {
  display: flex;
  gap: 14px;
  background: var(--bg-1);
  border: 3px solid #000;
  border-left: 4px solid var(--gold);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-pixel);
}
.boss-portrait {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  background: var(--bg-2);
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  image-rendering: pixelated;
}
.boss-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.boss-patient-text { flex: 1; min-width: 0; }
.boss-patient-name {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-0);
  margin-bottom: 4px;
}
.boss-patient-line {
  font-size: 13px;
  color: var(--ink-1);
  line-height: 1.45;
  margin-bottom: 4px;
}
.boss-patient-comeds {
  font-size: 12px;
  color: var(--gold);
  line-height: 1.4;
  font-family: 'Inter', sans-serif;
}

.boss-stage-card {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-pixel);
}
.boss-phase {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--violet);
  margin-bottom: 10px;
}
.boss-prompt {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--ink-0);
  line-height: 1.55;
  margin-bottom: 14px;
}
.boss-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.boss-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  background: var(--bg-2);
  border: 2px solid #000;
  padding: 12px 14px;
  color: var(--ink-0);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
  width: 100%;
}
.boss-option:hover { transform: translateX(2px); background: var(--bg-3); }
.boss-option-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--bg-3);
  color: var(--mint);
  font-family: var(--pixel-font);
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #000;
}
.boss-option-text { flex: 1; }
.boss-option.correct { background: rgba(74, 240, 168, 0.18); border-color: var(--mint); }
.boss-option.correct .boss-option-num { background: var(--mint); color: #062013; }
.boss-option.wrong { background: rgba(255, 90, 106, 0.18); border-color: var(--danger); }
.boss-option.wrong .boss-option-num { background: var(--danger); color: #fff; }
.boss-option.dim { opacity: 0.4; }
.boss-option:disabled { cursor: default; }
.boss-option:disabled:hover { transform: none; background: var(--bg-2); }
.boss-option.correct:disabled:hover,
.boss-option.correct:hover { background: rgba(74, 240, 168, 0.18); }
.boss-option.wrong:disabled:hover,
.boss-option.wrong:hover { background: rgba(255, 90, 106, 0.18); }

.boss-reveal {
  background: var(--bg-2);
  border: 3px solid #000;
  padding: 14px 16px;
  display: none;
}
.boss-reveal[data-state='ok'],
.boss-reveal[data-state='miss'] { display: block; animation: slideUp 0.25s ease; }
.boss-reveal[data-state='hidden'] { display: none; }
.boss-reveal-title {
  font-family: var(--pixel-font);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--mint);
  margin-bottom: 8px;
}
.boss-reveal[data-state='miss'] .boss-reveal-title { color: var(--danger); }
.boss-reveal-rationale {
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--ink-0);
  line-height: 1.55;
  margin-bottom: 10px;
}
.boss-reveal-covers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.boss-cover-chip {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  background: rgba(155, 140, 255, 0.15);
  color: var(--violet);
  border: 1px solid rgba(155, 140, 255, 0.4);
  padding: 3px 7px;
  border-radius: 3px;
}
#boss-next { display: block; width: 100%; }

@keyframes slideUp {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* =============================================================
   CERTIFICATE BANNER + END SCREEN
   ============================================================= */

.cert-banner {
  background: linear-gradient(180deg, var(--mint) 0%, var(--mint-2) 100%);
  color: #062013;
  border: 4px solid #000;
  box-shadow: var(--shadow-pixel);
  padding: 22px 24px 18px;
  text-align: center;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.cert-banner[data-state='fail'] {
  background: linear-gradient(180deg, var(--pink) 0%, #d65a7a 100%);
  color: #2a0612;
}
.cert-banner::before,
.cert-banner::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, #000 0, #000 8px, transparent 8px, transparent 16px);
}
.cert-banner::before { top: 0; }
.cert-banner::after { bottom: 0; }
.cert-stripe {
  font-family: var(--pixel-font);
  font-size: 9px;
  letter-spacing: 0.18em;
  margin-bottom: 10px;
  opacity: 0.85;
}
.cert-title {
  font-family: 'IBM Plex Serif', Georgia, serif;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.15;
}
.cert-grade {
  font-family: var(--pixel-font);
  font-size: clamp(20px, 4vw, 30px);
  letter-spacing: 0.06em;
  margin: 6px 0 10px;
}
.cert-foot {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-style: italic;
  opacity: 0.75;
}

.end-modules {
  background: var(--bg-1);
  border: 3px solid #000;
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-pixel);
}
.end-h3 {
  font-family: var(--pixel-font);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--mint);
  margin-bottom: 12px;
}
.end-module-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.module-bar-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
}
.module-bar-icon { font-size: 18px; line-height: 1; }
.module-bar-label {
  color: var(--ink-1);
  font-weight: 500;
  white-space: nowrap;
}
.module-bar-track {
  height: 10px;
  background: var(--bg-2);
  border: 2px solid #000;
  position: relative;
  min-width: 80px;
}
.module-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--mint-2));
  transition: width 0.6s ease;
}
.module-bar-fill[data-low='true'] { background: linear-gradient(90deg, var(--gold), var(--pink)); }
.module-bar-num {
  font-family: var(--pixel-font);
  font-size: 9px;
  color: var(--mint);
  letter-spacing: 0.05em;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .module-bar-row { grid-template-columns: auto 1fr auto; gap: 8px; font-size: 11px; }
  .module-bar-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}

/* Lead form name input */
#lead-name {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  background: var(--bg-2);
  color: var(--ink-0);
  border: 2px solid #000;
  padding: 12px 14px;
  width: 100%;
  margin-bottom: 8px;
}
#lead-name::placeholder { color: var(--ink-2); }
#lead-name:focus { outline: 2px solid var(--mint); outline-offset: 2px; }
