/* ============================================================
   Invoice Adventure — Layout & Components
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; }

#app {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 800px at 50% -10%, #142046 0%, transparent 60%),
    radial-gradient(900px 700px at 90% 110%, #20183a 0%, transparent 55%),
    var(--bg);
}

/* ---------- The cinematic 16:9 stage ---------- */
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  background: var(--stage-bg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  user-select: none;
}

/* Letterbox cinematic vignette overlay */
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  box-shadow: inset 0 0 180px 30px rgba(0, 0, 0, 0.55);
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.28), transparent 14%, transparent 84%, rgba(0,0,0,0.42));
}

/* ---------- Scene (SVG background + hotspots) ---------- */
#scene-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
}
#scene-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.scene-fade {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--med) var(--ease);
}
.scene-fade.show { opacity: 1; pointer-events: all; }

/* Hotspot hit areas (transparent, over the SVG) */
.hotspot {
  position: absolute;
  cursor: pointer;
  z-index: 20;
  border-radius: 4px;
  transition: box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.hotspot.exit { cursor: pointer; }
#stage.show-hotspots .hotspot {
  background: rgba(126, 227, 220, 0.10);
  box-shadow: inset 0 0 0 1px rgba(126, 227, 220, 0.5);
}
.hotspot:hover {
  background: rgba(244, 210, 122, 0.12);
  box-shadow: inset 0 0 0 1.5px var(--gold-400), 0 0 22px rgba(232, 181, 75, 0.25);
}
.hotspot.exit:hover {
  background: rgba(126, 227, 220, 0.14);
  box-shadow: inset 0 0 0 1.5px var(--teal-400);
}

/* ---------- Cursor label (hover tooltip following pointer) ---------- */
#cursor-label {
  position: absolute;
  z-index: 70;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-950);
  background: var(--gold-300);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -150%);
  transition: opacity var(--fast) var(--ease);
  white-space: nowrap;
}
#cursor-label.show { opacity: 1; }
#cursor-label.exit { background: var(--teal-300); }

/* ---------- Top HUD ---------- */
#hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(to bottom, rgba(7, 11, 22, 0.82), transparent);
  pointer-events: none;
}
#hud-top > * { pointer-events: auto; }

.location-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 10px;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.location-chip .flag {
  width: 26px; height: 18px; border-radius: 3px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.18);
  flex: none;
}
.location-chip .loc-text small {
  display: block; font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-faint);
}
.location-chip .loc-text b { font-size: 14px; font-weight: 700; }

.hud-spacer { flex: 1; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--surface-line);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease), border-color var(--fast);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--gold-400); transform: translateY(-1px); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  color: var(--ink-950); background: var(--gold-400);
  border-radius: 999px; box-shadow: var(--shadow-1);
}

/* Active character switcher */
.party {
  display: flex; align-items: center; gap: 6px;
  padding: 5px; background: var(--surface); border: 1px solid var(--surface-line);
  border-radius: 999px; backdrop-filter: blur(8px);
}
.party .pc {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text-dim);
  transition: all var(--fast) var(--ease);
}
.party .pc .ava { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none; background: var(--ink-700); }
.party .pc .ava svg { width: 100%; height: 100%; }
.party .pc b { font-size: 12.5px; font-weight: 700; }
.party .pc small { font-size: 10px; color: var(--text-faint); display: block; }
.party .pc.active { background: var(--accent-soft); border-color: var(--gold-400); color: var(--text); }
.party .pc:hover:not(.active) { background: var(--surface-2); }

/* ---------- Objective banner ---------- */
#objective {
  position: absolute;
  top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 38;
  max-width: 70%;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 16px;
  font-size: 13px;
  background: var(--surface); border: 1px solid var(--surface-line);
  border-radius: 999px; backdrop-filter: blur(8px);
  color: var(--text-dim);
  opacity: 0; transition: opacity var(--med) var(--ease), transform var(--med) var(--ease);
}
#objective.show { opacity: 1; }
#objective .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-400); box-shadow: 0 0 10px var(--gold-400); flex: none; }
#objective b { color: var(--text); font-weight: 700; }

/* ---------- Subtitle / narration (cinematic lower third) ---------- */
#subtitle {
  position: absolute;
  left: 50%; bottom: 132px; transform: translateX(-50%) translateY(8px);
  z-index: 45;
  max-width: 74%;
  padding: 12px 22px;
  text-align: center;
  font-size: 17px; line-height: 1.45;
  border-radius: var(--r-md);
  background: rgba(7, 11, 22, 0.74);
  border: 1px solid var(--surface-line);
  backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--med) var(--ease), transform var(--med) var(--ease);
}
#subtitle.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#subtitle .speaker {
  display: block; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  margin-bottom: 4px; font-weight: 800;
}
#subtitle .speaker.ar { color: var(--gold-300); }
#subtitle .speaker.ap { color: var(--teal-300); }
#subtitle .speaker.npc { color: var(--paper-200); }
#subtitle .speaker.narrator { color: var(--text-faint); }
#subtitle .line { color: var(--text); }
#subtitle.npc-tint { border-color: rgba(231, 212, 173, 0.3); }

/* ---------- Interaction coin (modern verb wheel) ---------- */
#coin {
  position: absolute;
  z-index: 75;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fast) var(--ease);
}
#coin.show { opacity: 1; pointer-events: auto; }
#coin .verb {
  position: absolute;
  width: 52px; height: 52px;
  margin: -26px 0 0 -26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(10px);
  transform: scale(0.4);
  opacity: 0;
  transition: transform var(--med) var(--ease), opacity var(--med) var(--ease), background var(--fast), border-color var(--fast);
}
#coin.show .verb { transform: scale(1); opacity: 1; }
#coin .verb:hover { background: var(--gold-400); color: var(--ink-950); border-color: var(--gold-300); }
#coin .verb svg { width: 24px; height: 24px; }
#coin .verb .vlabel {
  position: absolute; top: 54px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; white-space: nowrap;
  color: var(--text-dim); opacity: 0; transition: opacity var(--fast);
}
#coin .verb:hover .vlabel { opacity: 1; color: var(--gold-300); }
#coin .coin-center {
  position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--gold-400); box-shadow: 0 0 14px var(--gold-400);
}

/* ---------- Bottom dock: inventory + controls ---------- */
#dock {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex; align-items: flex-end; gap: 14px;
  padding: 14px 18px 18px;
  background: linear-gradient(to top, rgba(7, 11, 22, 0.9), transparent);
}
#inventory {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  min-height: 76px;
  padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--surface-line);
  border-radius: var(--r-lg); backdrop-filter: blur(8px);
  overflow-x: auto; overflow-y: hidden;
}
#inventory .inv-empty { color: var(--text-faint); font-size: 13px; font-style: italic; padding-left: 6px; }
.inv-item {
  position: relative;
  flex: none;
  width: 60px; height: 56px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast), background var(--fast);
}
.inv-item:hover { transform: translateY(-3px); border-color: var(--gold-400); }
.inv-item.selected {
  border-color: var(--gold-400);
  background: var(--accent-soft);
  box-shadow: 0 0 18px rgba(232, 181, 75, 0.3);
}
.inv-item svg { width: 40px; height: 40px; pointer-events: none; }
.inv-item .new-pip {
  position: absolute; top: -4px; right: -4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--emerald-400); box-shadow: 0 0 8px var(--emerald-400);
}

/* ---------- Generic panel / modal ---------- */
.scrim {
  position: absolute; inset: 0; z-index: 90;
  background: rgba(5, 8, 16, 0.66);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--med) var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }
.panel {
  width: min(680px, 86%);
  max-height: 82%;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--surface-line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-glow);
  transform: translateY(14px) scale(0.98);
  transition: transform var(--med) var(--ease);
  overflow: hidden;
}
.scrim.show .panel { transform: none; }
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--surface-line);
}
.panel-head h2 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: 21px; letter-spacing: 0.02em;
}
.panel-head .sub { font-size: 12px; color: var(--text-faint); }
.panel-body { padding: 20px 22px; overflow-y: auto; }
.panel .close {
  margin-left: auto;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--surface-line);
  color: var(--text); cursor: pointer; font-size: 18px; line-height: 1;
}
.panel .close:hover { background: var(--rouge-400); color: #fff; border-color: var(--rouge-400); }

/* ---------- Compliance Codex (journal) ---------- */
#codex .panel { background: linear-gradient(180deg, #1a2138, #141a2c); }
.codex-entry {
  position: relative;
  margin-bottom: 14px; padding: 16px 18px 16px 20px;
  background: linear-gradient(180deg, var(--paper-50), var(--paper-100));
  color: var(--paper-ink);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.codex-entry::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--gold-500); border-radius: var(--r-md) 0 0 var(--r-md);
}
.codex-entry.ereporting::before { background: var(--bleu-400); }
.codex-entry h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 17px; }
.codex-entry p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.codex-entry .tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: var(--gold-500); color: #fff; margin-bottom: 8px;
}
.codex-entry.ereporting .tag { background: var(--bleu-400); }
.codex-entry .cite { font-size: 11px; color: #8a7a5c; font-style: italic; }
.codex-empty { color: var(--text-faint); text-align: center; padding: 30px; font-style: italic; }

/* Codex progress meter */
.codex-meter { margin-bottom: 18px; }
.codex-meter .bar { height: 9px; border-radius: 999px; background: var(--ink-700); overflow: hidden; }
.codex-meter .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); transition: width var(--slow) var(--ease); }
.codex-meter .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }

/* ---------- Dialog (branching conversation) ---------- */
#dialog {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 80;
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(to top, rgba(7,11,22,0.96), rgba(7,11,22,0.7) 70%, transparent);
  transform: translateY(110%);
  transition: transform var(--med) var(--ease);
}
#dialog.show { transform: none; }
#dialog .npc-line {
  align-self: center; max-width: 78%; text-align: center;
  font-size: 18px; line-height: 1.5; color: var(--paper-100);
  min-height: 28px;
}
#dialog .npc-line .who { display:block; font-size:11px; letter-spacing:0.16em; text-transform:uppercase; color: var(--paper-300); margin-bottom: 4px; font-weight: 800; }
#dialog .options { display: flex; flex-direction: column; gap: 7px; max-width: 760px; width: 100%; margin: 6px auto 0; }
#dialog .opt {
  text-align: left; padding: 11px 16px;
  background: var(--surface); border: 1px solid var(--surface-line); color: var(--text);
  border-radius: var(--r-md); cursor: pointer; font-size: 14.5px;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
#dialog .opt:hover { background: var(--accent-soft); border-color: var(--gold-400); transform: translateX(4px); }
#dialog .opt .num { color: var(--gold-300); font-weight: 800; margin-right: 8px; }
#dialog .opt.asked { opacity: 0.55; }

/* ---------- Toast (small transient notice, e.g. "Codex updated") ---------- */
#toasts {
  position: absolute; top: 76px; right: 18px; z-index: 85;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--surface-line);
  border-left: 3px solid var(--gold-400);
  border-radius: var(--r-md); backdrop-filter: blur(8px);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  transform: translateX(120%); opacity: 0;
  transition: transform var(--med) var(--ease), opacity var(--med) var(--ease);
}
.toast.show { transform: none; opacity: 1; }
.toast.codex { border-left-color: var(--gold-400); }
.toast.item { border-left-color: var(--teal-400); }
.toast.success { border-left-color: var(--emerald-400); }
.toast b { display: block; font-size: 13px; }
.toast small { color: var(--text-dim); }
.toast .ic { width: 20px; height: 20px; flex: none; }

/* ---------- Title / menu screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 95;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 6%;
  background:
    radial-gradient(900px 600px at 50% 18%, rgba(31,42,82,0.7), transparent 65%),
    linear-gradient(180deg, var(--ink-950), #0a0f1f);
  opacity: 0; pointer-events: none; transition: opacity var(--slow) var(--ease);
}
.screen.show { opacity: 1; pointer-events: auto; }
.screen .kicker { font-size: 13px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--gold-400); margin-bottom: 8px; }
.screen h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 6.4vw, 76px); line-height: 0.98; margin: 0 0 6px;
  background: linear-gradient(180deg, var(--paper-50), var(--gold-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 30px rgba(232,181,75,0.18);
}
.screen .tagline { color: var(--text-dim); font-size: clamp(13px, 1.7vw, 17px); max-width: 560px; margin: 8px 0 30px; }
.btn {
  font-family: var(--font-ui); font-size: 15px; font-weight: 700;
  padding: 13px 26px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold-400); background: var(--gold-400); color: var(--ink-950);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast), background var(--fast);
  box-shadow: 0 8px 26px rgba(232,181,75,0.28);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(232,181,75,0.42); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--surface-line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--gold-400); background: var(--accent-soft); }
.screen .btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.screen .credit { position: absolute; bottom: 18px; font-size: 11px; color: var(--text-faint); }

/* Character select cards on title */
.cast { display: flex; gap: 18px; margin: 22px 0 30px; flex-wrap: wrap; justify-content: center; }
.cast .card {
  width: 180px; padding: 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--surface-line);
}
.cast .card .pic { width: 100%; height: 150px; border-radius: var(--r-md); overflow: hidden; background: var(--ink-800); margin-bottom: 10px; }
.cast .card .pic svg { width: 100%; height: 100%; }
.cast .card b { font-family: var(--font-display); font-size: 17px; }
.cast .card small { display: block; color: var(--text-dim); font-size: 12px; margin-top: 4px; line-height: 1.4; }

/* ---------- Auth (account button + modal) ---------- */
.icon-btn.authed { border-color: var(--gold-400); }
.icon-btn .acct-initial {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold-400); color: var(--ink-950);
  font-weight: 800; font-size: 13px; display: grid; place-items: center;
}
.icon-btn .acct-ic { display: inline-grid; place-items: center; }
.icon-btn .acct-ic svg { width: 21px; height: 21px; }

.auth-panel { width: min(440px, 92%); }
.auth-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
  background: var(--surface-2); padding: 5px; border-radius: var(--r-md);
}
.auth-tab {
  flex: 1; padding: 9px; border: none; background: transparent;
  color: var(--text-dim); border-radius: var(--r-sm); cursor: pointer;
  font-weight: 700; font-size: 14px; transition: background var(--fast), color var(--fast);
}
.auth-tab.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--surface-line); }
.auth-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f2330; border: 1px solid #fff; box-shadow: var(--shadow-1);
}
.auth-google:hover { background: #f1f1f1; }
.auth-or { display: flex; align-items: center; text-align: center; color: var(--text-faint); font-size: 12px; margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--surface-line); }
.auth-or span { padding: 0 12px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field span { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.auth-form input {
  padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--surface-line); background: var(--ink-900);
  color: var(--text); font-size: 14px; font-family: inherit; width: 100%;
}
.auth-form input:focus { outline: none; border-color: var(--gold-400); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-form .btn { margin-top: 6px; }
.auth-err { color: var(--rouge-400); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.auth-notice {
  background: var(--surface-2); border: 1px solid var(--surface-line);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 13px;
  color: var(--text-dim); margin-bottom: 16px; line-height: 1.5;
}
.auth-account { display: flex; flex-direction: column; gap: 16px; }
.acct-row { display: flex; align-items: center; gap: 14px; }
.acct-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  color: var(--ink-950); display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.acct-row b { font-size: 16px; display: block; }
.acct-row small { color: var(--text-dim); font-size: 13px; }
.auth-sync { font-size: 13px; color: var(--emerald-400); }
.auth-account > .btn { align-self: flex-start; }

.title-account { margin-top: 18px; font-size: 13px; color: var(--text-dim); }
.title-account .muted { color: var(--text-faint); }
.linklike {
  background: none; border: none; color: var(--gold-300); cursor: pointer;
  font: inherit; font-size: 13px; text-decoration: underline; padding: 0;
}
.linklike:hover { color: var(--gold-300); filter: brightness(1.15); }

/* ---------- Settings switch (in Account modal) ---------- */
.auth-settings { margin-top: 18px; }
.settings-divider { display: flex; align-items: center; text-align: center; color: var(--text-faint); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 8px; }
.settings-divider::before, .settings-divider::after { content: ""; flex: 1; height: 1px; background: var(--surface-line); }
.settings-divider span { padding: 0 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.setting-row b { font-size: 14px; display: block; }
.setting-row small { color: var(--text-dim); font-size: 12px; }
.switch { width: 48px; height: 28px; border-radius: 999px; background: var(--ink-700); border: 1px solid var(--surface-line); position: relative; cursor: pointer; transition: background var(--fast); flex: none; padding: 0; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--fast) var(--ease); box-shadow: var(--shadow-1); }
.switch.on { background: var(--emerald-400); border-color: var(--emerald-400); }
.switch.on .knob { transform: translateX(20px); }

/* ---------- Mini-games panel ---------- */
.mg-grid { display: grid; gap: 12px; }
.mg-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--surface-line); color: var(--text); cursor: pointer; transition: transform var(--fast), border-color var(--fast), background var(--fast); position: relative; }
.mg-card:hover:not(.soon) { transform: translateY(-2px); border-color: var(--gold-400); background: var(--surface-2); }
.mg-card .mg-emoji { font-size: 30px; }
.mg-card b { font-family: var(--font-display); font-size: 17px; }
.mg-card small { color: var(--text-dim); font-size: 13px; line-height: 1.4; }
.mg-card .mg-stat { margin-top: 6px; font-size: 12px; color: var(--gold-300); font-weight: 700; }
.mg-card.soon { opacity: 0.5; cursor: not-allowed; }
.mg-card .mg-soon { position: absolute; top: 14px; right: 14px; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--surface-line); padding: 3px 8px; border-radius: 999px; }

/* ---------- Quiz overlay ---------- */
.quiz-screen { z-index: 97; }
.quiz-card {
  width: min(640px, 92%); max-height: 90%; overflow-y: auto;
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--surface-line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-glow); padding: 28px; text-align: center;
}
.quiz-h1 { font-family: var(--font-display); font-size: clamp(26px, 4.5vw, 40px); margin: 4px 0 8px; color: var(--paper-50); }
.quiz-tag { color: var(--text-dim); font-size: 14px; margin: 0 0 18px; line-height: 1.5; }
.quiz-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.quiz-chip { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r-md); padding: 10px 14px; min-width: 96px; }
.quiz-chip b { display: block; font-size: 18px; color: var(--gold-300); }
.quiz-chip small { color: var(--text-dim); font-size: 11px; }
.shelf-title { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.badge-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 10px; margin-bottom: 22px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--surface-line); }
.badge .badge-emoji { font-size: 24px; }
.badge .badge-name { font-size: 10px; color: var(--text-dim); text-align: center; line-height: 1.2; }
.badge.locked { opacity: 0.4; filter: grayscale(1); }
.badge.got { border-color: var(--gold-400); background: var(--accent-soft); }
.badge.pop { animation: badgePop 0.5s var(--ease); }
@keyframes badgePop { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

.quiz-play { text-align: left; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.quiz-score { color: var(--gold-300); font-weight: 700; }
.quiz-timer { height: 6px; border-radius: 999px; background: var(--ink-700); overflow: hidden; margin-bottom: 18px; }
.quiz-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--emerald-400), var(--gold-400)); }
.quiz-topic { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; }
.quiz-topic.france { background: rgba(77, 124, 224, 0.2); color: #9bbcff; }
.quiz-topic.germany { background: rgba(241, 196, 15, 0.16); color: var(--gold-300); }
.quiz-q { font-family: var(--font-display); font-size: clamp(18px, 2.6vw, 24px); line-height: 1.35; margin: 0 0 18px; color: var(--text); }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 13px 15px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--surface-line); color: var(--text); cursor: pointer; font-size: 14.5px; transition: background var(--fast), border-color var(--fast), transform var(--fast); }
.quiz-opt:hover:not(.locked) { border-color: var(--gold-400); background: var(--accent-soft); transform: translateX(3px); }
.quiz-opt .opt-key { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 800; font-size: 13px; color: var(--gold-300); }
.quiz-opt.locked { cursor: default; }
.quiz-opt.correct { border-color: var(--emerald-400); background: rgba(79, 191, 139, 0.16); }
.quiz-opt.correct .opt-key { background: var(--emerald-400); color: var(--ink-950); }
.quiz-opt.wrong { border-color: var(--rouge-400); background: rgba(224, 86, 107, 0.14); }
.quiz-opt.wrong .opt-key { background: var(--rouge-400); color: #fff; }
.quiz-explain { max-height: 0; overflow: hidden; opacity: 0; transition: opacity var(--med), max-height var(--med); }
.quiz-explain.show { max-height: 420px; opacity: 1; margin-top: 16px; }
.ex-verdict { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.ex-verdict.ok { color: var(--emerald-400); }
.ex-verdict.no { color: var(--rouge-400); }
.quiz-explain p { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; margin: 0 0 14px; }
.quiz-explain .btn { width: 100%; }

.quiz-results { text-align: center; }
.medal { font-size: 64px; line-height: 1; margin: 6px 0; animation: badgePop 0.6s var(--ease); }
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
@media (max-width: 520px) { .result-grid { grid-template-columns: repeat(2, 1fr); } }
.newbest { color: var(--gold-300); font-weight: 800; margin-bottom: 14px; }
.new-badges { margin: 8px 0 18px; }
.nb-title { font-size: 13px; color: var(--gold-300); font-weight: 800; margin-bottom: 10px; }
.nb-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.rank-box { background: var(--surface); border: 1px solid var(--surface-line); border-radius: var(--r-md); padding: 14px; margin-bottom: 18px; }
.rank-now { font-size: 16px; margin-bottom: 8px; }
.rank-bar { height: 8px; border-radius: 999px; background: var(--ink-700); overflow: hidden; margin-bottom: 6px; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-300)); transition: width var(--slow) var(--ease); }
.rank-box small { color: var(--text-dim); font-size: 12px; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* Small screens: keep playable */
@media (max-width: 720px) {
  #subtitle { font-size: 14px; bottom: 116px; }
  .party .pc small { display: none; }
}
