:root {
  --ocean-1: #071423;
  --ocean-2: #0b2036;
  --ocean-3: #12304d;
  --land: #26405c;
  --land-hover: #3a5f86;
  --border: rgba(170, 205, 235, 0.28);
  --ink: #eef4fb;
  --ink-soft: #a9bbd0;
  --ink-faint: #6f849c;
  --glass: rgba(9, 22, 38, 0.74);
  --glass-line: rgba(255, 255, 255, 0.09);
  --accent: #f6c56b;
  --accent-2: #f39a6b;
  --good: #3ddc97;
  --bad: #ff6b7a;
  --radius: 22px;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.65), 0 2px 0 rgba(255, 255, 255, 0.03) inset;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --panel-w: 400px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(1200px 800px at 70% 20%, var(--ocean-3), var(--ocean-1) 70%) fixed, var(--ocean-1);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- Map ---------- */
#map-wrap { position: fixed; inset: 0; }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
.sphere { fill: url(#ocean-grad); stroke: rgba(160, 200, 240, 0.18); stroke-width: 1; vector-effect: non-scaling-stroke; }
.graticule { pointer-events: none; fill: none; stroke: rgba(160, 200, 240, 0.07); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.country {
  fill: var(--land);
  stroke: var(--border);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  transition: fill 0.25s ease;
}
.country.inactive { fill: #172539; stroke: rgba(170, 205, 235, 0.14); }
.map-interactive .country:not(.inactive):hover,
.map-interactive .marker:hover { fill: var(--land-hover); }
.country.target { fill: var(--accent); stroke: #fff3d6; }
.country.correct { fill: var(--good); stroke: #d8ffee; }
.country.wrong { fill: var(--bad); stroke: #ffe1e5; }
.marker {
  fill: var(--land);
  stroke: rgba(200, 225, 250, 0.7);
  vector-effect: non-scaling-stroke;
  stroke-width: 1.2;
  transition: fill 0.25s ease, opacity 0.3s ease;
}
.marker.hidden { opacity: 0; pointer-events: none; }
.marker.off { opacity: 0.2; pointer-events: none; }
.marker.target { fill: var(--accent); }
.marker.correct { fill: var(--good); }
.marker.wrong { fill: var(--bad); }
.pulse { fill: none; stroke: var(--good); vector-effect: non-scaling-stroke; stroke-width: 2; animation: pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.pulse.target { stroke: var(--accent); }
@keyframes pulse { from { opacity: 0.9; transform: scale(0.6); } to { opacity: 0; transform: scale(2.6); } }
.map-label {
  font-family: var(--sans);
  font-weight: 700;
  fill: #fff;
  paint-order: stroke;
  stroke: rgba(4, 12, 22, 0.85);
  stroke-linejoin: round;
  text-anchor: middle;
  pointer-events: none;
}
.map-label.good { fill: #c9ffe6; }
.map-label.bad { fill: #ffd3d8; }

.tooltip {
  position: fixed;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(5, 14, 26, 0.9);
  border: 1px solid var(--glass-line);
  font-size: 13px;
  font-weight: 600;
  transform: translate(-50%, calc(-100% - 14px));
  white-space: nowrap;
  z-index: 30;
}

.map-controls {
  position: fixed;
  right: 20px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 15;
}
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.15s ease, background 0.2s;
}
.icon-btn:hover { background: rgba(30, 55, 85, 0.85); transform: translateY(-1px); }

/* ---------- Glass ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  z-index: 20;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1b1206;
  font-weight: 800;
  box-shadow: 0 8px 24px -6px rgba(246, 197, 107, 0.6);
}
.brand-name { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: 0.2px; }
.hud {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 10px 8px 18px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.hud-progress { width: 190px; }
.hud-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.progress { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s cubic-bezier(.2,.8,.2,1); }
.hud-stat { display: flex; flex-direction: column; align-items: center; min-width: 46px; }
.hud-stat-value { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.hud-stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.ghost-btn {
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.ghost-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 84px 20px 24px;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 40%, rgba(7, 20, 35, 0.35), rgba(4, 10, 20, 0.78));
  animation: fade 0.4s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.setup-card, .results-card {
  width: min(840px, 100%);
  padding: 36px 38px 30px;
  animation: rise 0.5s cubic-bezier(.2,.8,.2,1);
}
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 4.4vw, 42px); line-height: 1.1; margin: 0 0 28px; }
h1 em { font-style: italic; color: var(--ink-soft); font-weight: 600; }
.step { margin-bottom: 26px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.step-head h2 { font-size: 16px; font-weight: 700; margin: 0; flex: 1; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: rgba(246, 197, 107, 0.14);
  color: var(--accent);
  border: 1px solid rgba(246, 197, 107, 0.35);
}
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 6px; }
.link-btn:hover { text-decoration: underline; }

.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.cat:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.06); }
.cat .cat-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
}
.cat-title { font-weight: 700; font-size: 15px; }
.cat-desc { font-size: 12.5px; color: var(--ink-faint); line-height: 1.35; }
.cat .check {
  position: absolute; top: 12px; right: 12px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: grid; place-items: center;
  font-size: 12px; color: transparent;
  transition: all 0.2s;
}
.cat[aria-pressed="true"] { border-color: rgba(246, 197, 107, 0.6); background: linear-gradient(160deg, rgba(246, 197, 107, 0.14), rgba(246, 197, 107, 0.03)); }
.cat[aria-pressed="true"] .cat-icon { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #23170a; }
.cat[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); color: #23170a; }
.cat .order { position: absolute; bottom: 12px; right: 14px; font-size: 11px; font-weight: 700; color: var(--accent); opacity: 0; }
.cat[aria-pressed="true"] .order { opacity: 0.85; }

.count-row { display: flex; flex-wrap: wrap; gap: 10px; }
.count {
  min-width: 64px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all 0.2s;
}
.count:hover { background: rgba(255, 255, 255, 0.07); }
.count[aria-pressed="true"] { background: var(--ink); color: #0a1626; border-color: var(--ink); }
.count small { font-weight: 600; opacity: 0.7; margin-left: 4px; }
.count.region { font-weight: 600; }
.count.region.custom { border-style: dashed; }
.count.region.custom[aria-pressed="true"] { border-style: solid; }
.count-empty { margin: 0; color: var(--ink-faint); font-size: 14px; }

.custom-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 12px;
}
.custom-tools { display: flex; align-items: center; gap: 12px; }
.search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-faint);
}
.search:focus-within { border-color: rgba(246, 197, 107, 0.6); color: var(--accent); }
.search input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.search input::placeholder { color: var(--ink-faint); }
.custom-count { font-size: 13px; font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.custom-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.chip-btn:hover:not(:disabled) { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.chip-btn:disabled { opacity: 0.4; cursor: default; }
.chip-btn[aria-pressed="true"] { color: #22160a; background: var(--accent); border-color: var(--accent); }
.custom-list {
  max-height: 280px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
  padding-right: 4px;
  overscroll-behavior: contain;
}
.pick {
  display: grid;
  grid-template-columns: auto 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  min-width: 0;
}
.pick:hover { background: rgba(255, 255, 255, 0.05); }
.pick input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.pick img { width: 26px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); }
.pick-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-region { font-size: 11px; color: var(--ink-faint); white-space: nowrap; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.pick:has(input:checked) { background: rgba(246, 197, 107, 0.1); }
.pick-empty { margin: 0; padding: 12px 4px; color: var(--ink-faint); font-size: 14px; grid-column: 1 / -1; }
.count.region[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #22160a; }

.setup-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 6px; border-top: 1px solid var(--glass-line); margin-top: 6px; padding-top: 22px; }
.setup-summary { margin: 0; color: var(--ink-soft); font-size: 14px; }
.setup-summary strong { color: var(--ink); }
.primary-btn {
  border: 0;
  padding: 14px 24px;
  border-radius: 15px;
  font-weight: 700;
  font-size: 15px;
  color: #22160a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 30px -10px rgba(243, 154, 107, 0.65);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -10px rgba(243, 154, 107, 0.75); }
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.secondary-btn {
  padding: 13px 20px;
  border-radius: 15px;
  font-weight: 700;
  font-size: 15px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.05);
}
.secondary-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- Question panel ---------- */
.panel {
  position: fixed;
  z-index: 18;
  left: 22px;
  top: 88px;
  width: var(--panel-w);
  max-height: calc(100% - 112px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rise 0.4s cubic-bezier(.2,.8,.2,1);
}
.panel-head { padding: 18px 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.country-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px; font-weight: 700;
  max-width: 230px;
}
.country-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(246, 197, 107, 0.18); flex: none; }
.country-chip.mystery .chip-dot { background: var(--ink-faint); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06); }
.q-steps { display: flex; gap: 5px; }
.q-steps i { width: 18px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
.q-steps i.now { background: var(--accent); }
.q-steps i.good { background: var(--good); }
.q-steps i.bad { background: var(--bad); }
.panel-body { padding: 18px 20px 8px; overflow-y: auto; }
.panel-foot { padding: 8px 20px 20px; }
.panel-foot:empty { display: none; }

.q-kind { font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.q-text { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.2; margin: 0 0 16px; }
.q-text strong { color: var(--accent); font-weight: 700; }
.q-hint { font-size: 13px; color: var(--ink-faint); margin: -6px 0 14px; }

.shape-box {
  height: 190px;
  border-radius: 16px;
  margin-bottom: 16px;
  background: radial-gradient(circle at 50% 45%, rgba(246, 197, 107, 0.12), rgba(255, 255, 255, 0.02) 70%);
  border: 1px solid var(--glass-line);
  display: grid; place-items: center;
}
.shape-box svg { width: 100%; height: 100%; }
.shape-path { fill: url(#shape-grad); stroke: #ffe7b8; stroke-width: 1; stroke-linejoin: round; filter: drop-shadow(0 8px 18px rgba(246, 160, 90, 0.35)); }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.25;
  transition: transform 0.12s, background 0.2s, border-color 0.2s, opacity 0.3s;
}
.option:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); transform: translateX(3px); }
.option:disabled { cursor: default; }
.key {
  flex: none;
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
}
.option.correct { border-color: var(--good); background: rgba(61, 220, 151, 0.16); }
.option.correct .key { background: var(--good); color: #052a1a; }
.option.wrong { border-color: var(--bad); background: rgba(255, 107, 122, 0.16); }
.option.wrong .key { background: var(--bad); color: #3a0710; }
.option.faded { opacity: 0.45; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.option.wrong { animation: shake 0.35s; }

.flag-options { grid-template-columns: 1fr 1fr; }
.flag-option { flex-direction: column; align-items: stretch; padding: 10px; gap: 8px; }
.flag-option:hover:not(:disabled) { transform: translateY(-2px); }
.flag-option img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); background: #fff; }
.flag-option .flag-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); min-height: 24px; }

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  display: flex; gap: 10px; align-items: flex-start;
  animation: rise 0.3s ease;
}
.feedback.good { background: rgba(61, 220, 151, 0.12); border: 1px solid rgba(61, 220, 151, 0.35); }
.feedback.bad { background: rgba(255, 107, 122, 0.12); border: 1px solid rgba(255, 107, 122, 0.35); }
.feedback .fb-icon { font-size: 16px; line-height: 1.3; }
.feedback strong { font-weight: 700; }

.locate-actions { display: flex; gap: 10px; align-items: center; }
.locate-tip { font-size: 13px; color: var(--ink-faint); margin: 0; flex: 1; }
.continue-btn { width: 100%; display: flex; justify-content: center; gap: 8px; }
.continue-btn .kbd { font-size: 11px; opacity: 0.6; border: 1px solid currentColor; border-radius: 6px; padding: 1px 6px; align-self: center; }

/* Country recap */
.recap { margin-top: 14px; display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--glass-line); }
.recap img { width: 54px; border-radius: 5px; box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
.recap dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; }
.recap dt { color: var(--ink-faint); }
.recap dd { margin: 0; font-weight: 600; }

/* ---------- Results ---------- */
.results-head { display: flex; gap: 28px; align-items: center; margin-bottom: 26px; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 10; }
.ring-fill { fill: none; stroke: url(#ring-grad); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-label b { font-family: var(--serif); font-size: 34px; display: block; line-height: 1; }
.ring-label span { font-size: 12px; color: var(--ink-faint); }
.results-head h1 { margin: 0 0 8px; }
.results-head p { margin: 0; color: var(--ink-soft); }
.breakdown { display: grid; gap: 12px; margin-bottom: 26px; }
.bd-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 14px; align-items: center; font-size: 14px; }
.bd-name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.bd-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bd-bar div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.bd-val { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.missed h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--ink-soft); }
.missed-list { max-height: 230px; overflow-y: auto; display: grid; gap: 6px; margin-bottom: 24px; padding-right: 4px; }
.missed-item { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); font-size: 13.5px; }
.missed-item img { width: 36px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,0.15); }
.missed-item .mi-kind { color: var(--ink-faint); }
.results-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.perfect { padding: 14px; border-radius: 14px; background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.3); margin-bottom: 24px; font-weight: 600; }

/* ---------- Responsive ---------- */
html, body, button { touch-action: manipulation; }
.hud-label { white-space: nowrap; }
@media (hover: none) {
  .kbd, .key-hint { display: none; }
}

/* Phones & small tablets in portrait: the question panel becomes a bottom sheet. */
@media (max-width: 860px) and (orientation: portrait) {
  .panel {
    left: 10px; right: 10px; top: auto; bottom: calc(10px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 58%;
  }
  .map-controls { right: 12px; bottom: auto; top: 76px; }
}

@media (max-width: 860px), (max-height: 520px) {
  .brand-name { display: none; }
  .topbar { padding: 10px 12px; }
  .hud { gap: 10px; padding: 6px 8px 6px 12px; flex: 1; justify-content: space-between; }
  .hud-progress { width: auto; flex: 1; min-width: 0; }
  .hud-stat { min-width: 34px; }
  .hud-stat-value { font-size: 15px; }
  .ghost-btn { padding: 7px 10px; }
  .panel-head { padding: 14px 16px 0; }
  .panel-body { padding: 12px 16px 6px; }
  .panel-foot { padding: 6px 16px 14px; }
  .q-text { font-size: 20px; margin-bottom: 12px; }
  .shape-box { height: 140px; margin-bottom: 12px; }
  .option { padding: 11px 12px; font-size: 14px; }
  .flag-option img { aspect-ratio: 16 / 10; }
  .icon-btn { width: 38px; height: 38px; }
  .category-grid { grid-template-columns: 1fr 1fr; }
  .cat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .setup-card, .results-card { padding: 26px 20px 22px; }
  .setup-footer { flex-direction: column; align-items: stretch; text-align: center; }
  .results-head { flex-direction: column; text-align: center; gap: 16px; }
  .bd-row { grid-template-columns: 110px 1fr 56px; font-size: 13px; }
  .overlay { padding: 70px 12px 16px; place-items: start center; }
}

@media (max-width: 480px) {
  h1 { margin-bottom: 20px; }
  .step { margin-bottom: 20px; }
  .step-head h2 { font-size: 15px; }
  .category-grid { gap: 8px; }
  .cat { padding: 12px; gap: 6px; }
  .cat .cat-icon { width: 32px; height: 32px; border-radius: 10px; }
  .cat-title { font-size: 13.5px; padding-right: 18px; }
  .cat-desc { display: none; }
  .cat .check { top: 10px; right: 10px; width: 18px; height: 18px; }
  .count-row { gap: 8px; }
  .count { min-width: 0; flex: 1 0 calc(25% - 8px); padding: 10px 6px; }
  .count.region { flex: 1 0 calc(50% - 8px); }
  .count.region:first-child { flex-basis: 100%; }
  .custom-panel { padding: 10px; }
  .custom-tools { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .custom-list { max-height: 50vh; grid-template-columns: 1fr; }
  .pick-region { display: none; }
  .hud-word { display: none; }
  .hud-stat-label { font-size: 9px; }
  .q-hint { font-size: 12px; }
}

/* Short landscape screens (phones turned sideways): narrow side panel. */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --panel-w: 300px; }
  .topbar { padding: 8px 12px; }
  .hud { padding: 5px 8px 5px 12px; }
  .panel { left: calc(10px + env(safe-area-inset-left)); top: 62px; max-height: calc(100% - 72px); }
  .panel-head { padding: 12px 14px 0; }
  .panel-body { padding: 10px 14px 4px; }
  .panel-foot { padding: 4px 14px 12px; }
  .q-kind { margin-bottom: 4px; }
  .q-text { font-size: 18px; margin-bottom: 10px; }
  .q-hint { display: none; }
  .shape-box { height: 110px; margin-bottom: 10px; }
  .options { gap: 7px; }
  .option { padding: 8px 10px; font-size: 13.5px; }
  .flag-option img { aspect-ratio: 2 / 1; }
  .feedback { margin-top: 10px; padding: 9px 11px; font-size: 13px; }
  .primary-btn { padding: 11px 18px; }
  .map-controls { right: calc(12px + env(safe-area-inset-right)); bottom: 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .locate-tip { display: none; }
}
