/* Atlas Quest */
:root {
  --ink: #f2ece0;
  --ink-dim: #9aa6bd;
  --space: #070b16;
  --panel: rgba(14, 22, 42, 0.82);
  --edge: rgba(140, 180, 255, 0.16);
  --gold: #ffd66b;
  --cyan: #5fd0ff;
  --font: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --edge-space: clamp(10px, 1vw, 24px);
  --panel-width: clamp(21.25rem, 19vw, 30rem);
  --control-size: 2.75rem;
  --text-xs: 0.6875rem;
  --text-sm: 0.75rem;
  --text-md: 0.8125rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.1875rem;
  font-size: clamp(16px, calc(0.2vw + 13px), 18px);
}

html[data-ui-scale="large"] {
  --panel-width: clamp(25rem, 23vw, 36rem);
  font-size: clamp(19px, calc(0.3vw + 14px), 23px);
}

* { box-sizing: border-box; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 14px;
  color: #070b16;
  background: var(--gold);
  border-radius: 7px;
  font-weight: 700;
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); outline: 3px solid CanvasText; outline-offset: 2px; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--space);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
}

#app {
  position: relative;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
}

#app::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #070b16 url('../assets/backgrounds/atlas-field.svg') center / cover no-repeat;
}

/* Grid items default to min-width:auto, so the topbar's min-content width
   was forcing the whole column wider than the viewport (480px inside a
   375px phone) and pushing the map off-screen. */
#app > * { min-width: 0; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(8px, 0.85rem, 16px);
  padding: 10px var(--edge-space);
  background: linear-gradient(180deg, rgba(10, 16, 32, 0.95), rgba(10, 16, 32, 0.6));
  border-bottom: 1px solid var(--edge);
  z-index: 5;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { display: block; width: 26px; height: 26px; flex: 0 0 26px; }
.brand-name { font-weight: 700; letter-spacing: 0.02em; }
.brand-tag {
  font-size: var(--text-xs);
  color: var(--ink-dim);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 2px 8px;
}

.views { display: flex; gap: 4px; margin-left: auto; }

.vbtn, .stylebtn, .tbtn {
  appearance: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 8px;
  min-height: var(--control-size);
  padding: 0.45rem 0.875rem;
  font: inherit;
  font-size: var(--text-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.vbtn:hover, .stylebtn:hover, .tbtn:hover { background: rgba(255, 255, 255, 0.1); }
.vbtn:focus-visible, .stylebtn:focus-visible, .tbtn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.tbtn:disabled { cursor: not-allowed; opacity: .5; }

.vbtn.is-on, .stylebtn.is-on {
  background: rgba(255, 214, 107, 0.16);
  border-color: rgba(255, 214, 107, 0.55);
  color: var(--gold);
}

.tools { display: flex; gap: 4px; }
.tbtn { min-width: var(--control-size); padding: 0.45rem; text-align: center; }
.tbtn.wide { min-width: 0; padding: 0.45rem 0.875rem; }
.display-settings { position: relative; }
.display-settings > summary {
  display: flex;
  align-items: center;
  list-style: none;
  user-select: none;
}
.display-settings > summary::-webkit-details-marker { display: none; }
.display-settings-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  width: max-content;
  min-width: 11rem;
  padding: 8px;
  background: rgba(10, 16, 32, 0.98);
  border: 1px solid var(--edge);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  max-height: calc(100vh - 76px);
  overflow-y: auto;
}
.display-settings-menu .tbtn { width: 100%; }
.quality-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--ink-dim);
  font-size: var(--text-sm);
}
.quality-select {
  min-height: var(--control-size);
  padding: 0.4rem 1.8rem 0.4rem 0.65rem;
  border: 1px solid var(--edge);
  border-radius: 8px;
  color: var(--ink);
  background: #10182b;
  font: inherit;
}
.quality-select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.volume-slider {
  width: 7rem;
  min-height: var(--control-size);
  accent-color: var(--gold);
}
.volume-slider:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.controller-status {
  padding-top: 4px;
  color: var(--ink-dim);
  font-size: var(--text-xs);
  text-align: center;
}

/* ---------- map ---------- */
.map { position: relative; overflow: hidden; }

.controller-cursor {
  position: absolute;
  z-index: 3;
  width: 28px;
  height: 28px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(7, 11, 22, .75), 0 0 18px rgba(255, 214, 107, .65);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
}
.controller-cursor.is-visible { opacity: 1; }

.atlas-canvas {
  display: block;
  position: absolute;
  inset: 0;
  cursor: grab;
}

.atlas-canvas:active { cursor: grabbing; }

/* ---------- readout ---------- */
.readout {
  position: absolute;
  left: var(--edge-space);
  bottom: 60px;
  min-width: 220px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  z-index: 2;
}

.ro-row { display: flex; justify-content: space-between; gap: 18px; padding: 3px 0; }
.ro-key { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); }
.ro-val { font-size: 0.875rem; font-weight: 600; color: var(--gold); }
.ro-val.ro-sel { color: var(--cyan); }

/* ---------- status ---------- */
.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--edge-space);
  border-top: 1px solid var(--edge);
  background: rgba(10, 16, 32, 0.9);
  font-size: var(--text-sm);
  color: var(--ink-dim);
  z-index: 3;
}

.pill {
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 3px 10px;
}

.pill b { color: var(--ink); font-weight: 600; }
.hint { margin-left: auto; }

@media (max-width: 720px) {
  .brand-tag, .hint { display: none; }
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand { flex: 1 1 100%; }
  .views { margin-left: 0; flex: 1 1 auto; }
  .vbtn, .stylebtn { padding: 0.45rem 0.5625rem; font-size: var(--text-sm); }
  .map-styles { padding-left: 0; border-left: 0; }
  .tools { flex-wrap: wrap; }
  .statusbar { gap: 6px; padding: 7px 10px; }
  .readout { left: 10px; right: 10px; bottom: 54px; min-width: 0; }
}

/* ---------- game layer ---------- */
.game-layer {
  position: absolute;
  top: clamp(66px, 5.5rem, 100px);
  right: var(--edge-space);
  width: var(--panel-width);
  max-width: calc(100% - var(--edge-space) - var(--edge-space));
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - clamp(112px, 9rem, 150px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  z-index: 4;
  pointer-events: none;
}

.game-layer > * { pointer-events: auto; }
.game-layer::-webkit-scrollbar { width: 8px; }
.game-layer::-webkit-scrollbar-track { background: transparent; }
.game-layer::-webkit-scrollbar-thumb { background: rgba(154, 166, 189, .35); border-radius: 999px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 0.875rem 1rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 9px;
  min-height: var(--control-size);
  padding: 0.5625rem 1rem;
  font: inherit;
  font-size: var(--text-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hud-target:focus-visible,
.hud-prompt:focus-visible,
.results-title:focus-visible,
.achievement-summary-title:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.btn-sm { padding: 0.4375rem 0.75rem; font-size: var(--text-sm); }
.btn-ghost { background: transparent; }

.btn-primary {
  background: rgba(255, 214, 107, 0.18);
  border-color: rgba(255, 214, 107, 0.6);
  color: var(--gold);
  font-weight: 600;
}

.btn-primary:hover { background: rgba(255, 214, 107, 0.28); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* menu */
.menu-title { margin: 0 0 6px; font-size: var(--text-xl); }
.menu-sub { margin: 0 0 14px; font-size: var(--text-md); color: var(--ink-dim); line-height: 1.45; }
.menu-row { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-row-facts .btn { flex: 1 1 104px; }
.facts-mastery {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(255, 255, 255, .09);
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
}
.menu-progress { margin: 12px 0 6px; color: var(--ink-dim); font-size: var(--text-sm); }
.reset-progress { margin-top: 0; }
.progress-transfer { margin-top: 8px; }
.menu-notice {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid rgba(95, 208, 255, 0.35);
  border-radius: 8px;
  color: var(--cyan);
  font-size: var(--text-sm);
}
.btn-revision {
  width: 100%;
  margin-top: 8px;
  border-color: rgba(218, 177, 92, .5);
  color: var(--gold);
  background: rgba(218, 177, 92, .1);
}
.facts-level {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -4px 0 10px;
  color: var(--ink-dim);
  font-size: var(--text-sm);
}
.facts-level-label { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.facts-level-select {
  min-height: var(--control-size);
  padding: 5px 30px 5px 10px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(12, 18, 31, .94);
  font: inherit;
}
.facts-level-select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.menu-best { margin: 12px 0 0; font-size: var(--text-sm); color: var(--ink-dim); }
.btn-explore { width: 100%; margin-bottom: 2px; }
.btn-journeys { width: 100%; margin-bottom: 2px; border-color: rgba(95, 208, 255, .38); }
.btn-credits,
.btn-trust { width: 100%; margin-top: 9px; }
.btn-tutorial { margin-top: 8px; }
.tutorial-offer {
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid rgba(95, 208, 255, 0.62);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14, 39, 72, 0.92), rgba(17, 27, 49, 0.9));
}
.tutorial-offer-title { margin: 0 0 5px; color: var(--cyan); font-size: var(--text-lg); }
.tutorial-offer-actions { margin-top: 9px; }
.tutorial-instruction {
  margin: 8px 0;
  padding: 9px 11px;
  border-left: 4px solid var(--cyan);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(18, 47, 78, 0.92);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.tutorial-results-lead { margin: 8px 0; color: var(--gold); font-size: var(--text-md); line-height: 1.5; }
.daily-heading { color: var(--cyan); }
.btn-daily {
  width: 100%;
  margin-bottom: 2px;
  border-color: rgba(95, 208, 255, .48);
  background: linear-gradient(135deg, rgba(38, 129, 173, .38), rgba(218, 177, 92, .2));
}
.daily-return { margin: -3px 0 8px; color: var(--cyan); font-size: var(--text-xs); }
.explore-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.explore-head .menu-title { margin: 0; }
.explore-search {
  width: 100%;
  min-height: var(--control-size);
  padding: .55rem .7rem;
  color: var(--ink);
  background: rgba(3, 8, 20, .78);
  border: 1px solid var(--edge);
  border-radius: 9px;
  font: inherit;
}
.explore-search:focus-visible,
.explore-result:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.explore-count { margin: 7px 0; color: var(--ink-dim); font-size: var(--text-xs); }
.explore-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  max-height: 8.75rem;
  margin: 0 0 10px;
  padding: 1px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
.explore-result {
  width: 100%;
  min-height: var(--control-size);
  padding: .4rem .55rem;
  overflow: hidden;
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--edge);
  border-radius: 8px;
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.explore-result:hover,
.explore-result.is-selected { color: var(--gold); border-color: rgba(255, 214, 107, .55); background: rgba(255, 214, 107, .12); }
.explore-details { min-height: 5rem; }
.explore-empty { margin: 8px 0 0; color: var(--ink-dim); font-size: var(--text-sm); line-height: 1.45; }
.explore-identity { display: flex; align-items: center; gap: 12px; }
.explore-flag { width: 72px; height: 54px; object-fit: cover; border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.explore-name { margin: 0; font-size: var(--text-lg); line-height: 1.15; }
.explore-codes, .explore-region { color: var(--ink-dim); font-size: var(--text-xs); }
.explore-region { margin: 7px 0; }
.explore-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; margin: 8px 0; font-size: var(--text-sm); line-height: 1.35; }
.explore-facts dt { color: var(--ink-dim); }
.explore-facts dd { margin: 0; text-align: right; }
.explore-sources { margin: 8px 0; color: var(--ink-dim); font-size: var(--text-xs); line-height: 1.4; }
.explore-practice { width: 100%; }
.journey-title-row, .journey-stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.journey-title { margin: 2px 0 0; font-size: var(--text-lg); }
.journey-region { margin: 2px 0 7px; color: var(--cyan); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; }
.journey-badge {
  padding: 3px 7px;
  color: var(--ink-dim);
  background: rgba(255,255,255,.07);
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: var(--text-xs);
}
.journey-badge.is-complete { color: var(--gold); border-color: rgba(255,214,107,.45); }
.journey-stages { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.journey-stage { padding: 9px; border: 1px solid var(--edge); border-radius: 9px; background: rgba(3,8,20,.45); }
.journey-stage.is-complete { border-color: rgba(83, 209, 139, .35); }
.journey-stage.is-locked { opacity: .58; }
.journey-kind { color: var(--cyan); font-size: var(--text-xs); }
.journey-countries, .journey-goal, .journey-best { margin: 5px 0; color: var(--ink-dim); font-size: var(--text-xs); line-height: 1.35; }
.journey-best { color: var(--gold); }
.journey-stage .btn { width: 100%; margin-top: 4px; }
.credits-panel { overflow-y: auto; }
.trust-panel { overflow-y: auto; }
.trust-section {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: rgba(8, 16, 32, 0.72);
}
.trust-section-title { margin: 0 0 7px; color: var(--gold); font-size: var(--text-md); }
.trust-copy { margin: 5px 0; color: var(--ink-dim); font-size: var(--text-sm); line-height: 1.5; }
.trust-list { margin: 0; padding-left: 1.25rem; color: var(--ink-dim); font-size: var(--text-sm); line-height: 1.5; }
.trust-list li + li { margin-top: 5px; }
.trust-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.trust-status { margin: 10px 0 0; color: var(--cyan); font-size: var(--text-sm); }
@media (max-width: 620px) { .trust-actions { grid-template-columns: 1fr; } }
.credits-list { display: grid; gap: 8px; }
.credits-source {
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(3, 8, 20, .45);
}
.credits-source-title,
.credits-notices-title { margin: 0 0 5px; color: var(--gold); font-size: var(--text-md); }
.credits-meta,
.credits-definition,
.credits-licence,
.credits-url { margin: 4px 0; font-size: var(--text-xs); line-height: 1.45; }
.credits-meta,
.credits-url { color: var(--ink-dim); }
.credits-url { overflow-wrap: anywhere; font-family: ui-monospace, Consolas, monospace; }
.credits-notices-title { margin-top: 14px; }
.credits-notice { margin-top: 7px; border: 1px solid var(--edge); border-radius: 8px; }
.credits-notice-title { padding: 8px 10px; color: var(--cyan); cursor: pointer; font-size: var(--text-sm); }
.credits-notice-text {
  max-height: 16rem;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid var(--edge);
  color: var(--ink-dim);
  background: rgba(0, 0, 0, .2);
  font: 0.6875rem/1.45 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
}
.menu-error {
  margin: 0 0 12px;
  padding: 9px 11px;
  color: #ffd4d4;
  background: rgba(255, 107, 107, 0.14);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 9px;
  font-size: 0.78125rem;
  line-height: 1.4;
}
.loading-title { color: var(--gold); font-size: 1rem; font-weight: 700; margin-bottom: 6px; }

/* hud */
.hud-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.hud-progress { font-size: var(--text-sm); color: var(--ink-dim); letter-spacing: 0.06em; }
.hud-score { margin-left: auto; font-size: 1rem; font-weight: 700; color: var(--gold); }
.hud-ask { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); }
.hud-target { font-size: 1.5625rem; font-weight: 700; line-height: 1.15; margin: 2px 0 0; }

.hud-dots { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); }
.dot-used { background: var(--wrong, #ff6b6b); border-color: transparent; }
.hud-tier { margin-left: auto; font-size: var(--text-xs); color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.hud-actions { display: flex; gap: 6px; margin-top: 12px; }

.hud-found {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  font-size: 0.71875rem;
  line-height: 1.45;
}
.hud-found-label { flex: 0 0 auto; color: var(--green); font-weight: 700; }
.hud-found-values { color: var(--ink-dim); }

.country-answer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 12px;
}

.country-answer-input {
  width: 100%;
  min-height: var(--control-size);
  padding: 0.4375rem 0.625rem;
  color: var(--ink);
  background: rgba(3, 8, 20, 0.72);
  border: 1px solid var(--edge);
  border-radius: 8px;
  font: inherit;
  font-size: 0.78125rem;
}
.country-answer-input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.country-answer-input[aria-invalid="true"] { border-color: #ff9b9b; }
.country-answer-help,
.country-answer-error {
  grid-column: 1 / -1;
  font-size: var(--text-xs);
  line-height: 1.3;
}
.country-answer-help { color: var(--ink-dim); }
.country-answer-error { color: #ff9b9b; }

.flash {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 0.78125rem;
  line-height: 1.45;
}

.flash strong { display: block; margin-bottom: 2px; }
.flash-wrong { background: rgba(255, 107, 107, 0.14); border: 1px solid rgba(255, 107, 107, 0.4); }
.flash-hint { background: rgba(95, 208, 255, 0.12); border: 1px solid rgba(95, 208, 255, 0.35); }
.flash-note { background: rgba(255, 214, 107, 0.1); border: 1px solid rgba(255, 214, 107, 0.3); color: var(--ink-dim); }

/* feedback */
.result-head { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); }
.result-body { font-size: var(--text-lg); font-weight: 600; margin: 4px 0 8px; }
.result.is-right .result-body { color: #5ce08a; }
.result.is-wrong .result-body { color: #ff9b9b; }
.result-note { font-size: 0.78125rem; color: var(--ink-dim); line-height: 1.45; margin-bottom: 8px; }
.result-answer-list {
  max-height: 116px;
  overflow-y: auto;
  margin: 0 0 9px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(3, 8, 20, 0.55);
  border: 1px solid var(--edge);
  border-radius: 8px;
  font-size: 0.71875rem;
  line-height: 1.5;
}

html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.001ms !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *,
  html:not([data-motion="full"]) *::before,
  html:not([data-motion="full"]) *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .panel,
  .btn,
  .vbtn,
  .stylebtn,
  .tbtn,
  .country-answer-input,
  .explore-search,
  .explore-result,
  .achievement-summary { border: 1px solid ButtonText; }
  .is-on,
  .btn-primary,
  .achievement-item.is-unlocked { border-color: Highlight; }
  .daily-share-canvas { forced-color-adjust: none; }
}

.pwa-notice {
  position: fixed;
  left: 50%;
  bottom: 48px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(14, 22, 42, 0.97);
  border: 1px solid rgba(255, 214, 107, 0.5);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
  font-size: 0.78125rem;
}
.pwa-offline { border-color: rgba(95, 208, 255, 0.55); }
.pwa-repair { border-color: rgba(255, 155, 155, 0.65); }
.pwa-dismiss {
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 1.125rem;
  cursor: pointer;
}
.pwa-dismiss:hover,
.pwa-dismiss:focus-visible { color: var(--ink); background: rgba(255, 255, 255, .08); }

/* results */
.results-title { margin: 0 0 12px; font-size: var(--text-xl); }
.results-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stat { text-align: center; }
.stat-v { font-size: 1.125rem; font-weight: 700; color: var(--gold); }
.stat-l { font-size: 0.65625rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.results-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 210px; overflow-y: auto; }
.results-row { display: flex; gap: 10px; padding: 5px 0; font-size: 0.78125rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.results-row.ok .rr-name { color: var(--ink); }
.results-row.no .rr-name { color: #ff9b9b; }
.rr-detail { margin-left: auto; color: var(--ink-dim); text-align: right; }
.results .btn { margin-right: 6px; }
.daily-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(95, 208, 255, .32);
  border-radius: 9px;
  background: rgba(38, 129, 173, .1);
  font-size: var(--text-xs);
}
.daily-result-title { color: var(--cyan); white-space: nowrap; }
.daily-result-copy { color: var(--ink-dim); text-align: right; }
.btn-share-daily { border-color: rgba(95, 208, 255, .4); }
.daily-share-card { margin: 0 0 12px; }
.daily-share-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 40 / 21;
  border: 1px solid rgba(95, 208, 255, .28);
  border-radius: 10px;
  background: #070b16;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.btn-save-daily { border-color: rgba(255, 214, 107, .28); }
.share-card-feedback {
  display: inline-block;
  min-height: 1em;
  color: var(--cyan);
  font-size: var(--text-xs);
  vertical-align: middle;
}
.achievement-summary {
  margin-top: 11px;
  padding: 8px 10px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(3, 8, 20, .38);
}
.achievement-summary-title {
  display: flex;
  align-items: center;
  min-height: var(--control-size);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}
.achievement-list { display: grid; gap: 7px; margin: 9px 0 0; padding: 0; list-style: none; }
.achievement-item { padding: 7px 8px; border-left: 2px solid var(--edge); opacity: .68; }
.achievement-item.is-unlocked { border-color: var(--gold); opacity: 1; }
.achievement-title { display: flex; justify-content: space-between; gap: 8px; font-size: var(--text-sm); font-weight: 700; }
.achievement-state { color: var(--ink-dim); font-size: var(--text-xs); font-weight: 400; }
.achievement-item.is-unlocked .achievement-state { color: var(--gold); }
.achievement-description { margin: 3px 0 0; color: var(--ink-dim); font-size: var(--text-xs); line-height: 1.35; }
.achievement-unlocks {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 214, 107, .4);
  border-radius: 9px;
  background: rgba(218, 177, 92, .12);
  font-size: var(--text-xs);
}
.achievement-unlocks-title { color: var(--gold); }
.achievement-unlock-name + .achievement-unlock-name::before { content: '·'; margin-right: 8px; color: var(--ink-dim); }

.ro-note { margin-top: 6px; font-size: 0.71875rem; color: var(--ink-dim); line-height: 1.4; }

@media (max-width: 720px) {
  .game-layer {
    top: auto;
    bottom: 52px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .readout { display: none; }
  .hud-target { font-size: 1.3125rem; }
  .results-list { max-height: 130px; }
}

@media (max-height: 500px) {
  .display-settings-menu {
    position: fixed;
    top: 60px;
    right: 6px;
    bottom: 6px;
    max-height: none;
  }
  .game-layer {
    top: 66px;
    bottom: 42px;
    max-height: calc(100dvh - 108px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  .readout { display: none; }
  .results-list { max-height: 90px; }
}

/* fact-question variants */
.menu-mode {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gold); margin-top: 14px; margin-bottom: 4px;
}

.map-styles {
  display: flex;
  gap: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--edge);
}
.menu-title + .menu-mode { margin-top: 4px; }
.hud-prompt { font-size: var(--text-lg); font-weight: 600; line-height: 1.3; margin: 2px 0 0; }
.hud-media {
  display: flex;
  justify-content: center;
  margin: 6px 0 9px;
}
.hud-flag {
  width: clamp(132px, 18vw, 224px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 7px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25% 75%, rgba(255,255,255,.08) 75%),
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25% 75%, rgba(255,255,255,.08) 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.28);
}
.hud-flag-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.hud-image-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
}
.image-option {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.24);
}
.image-option:hover, .image-option:focus-visible {
  border-color: var(--gold);
  transform: translateY(-1px);
  outline: 2px solid transparent;
}
.image-option:disabled { cursor: default; transform: none; }
.image-option-flag { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-option-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: rgba(7, 11, 22, 0.86);
  font: 700 12px/1 ui-monospace, Consolas, monospace;
}
.hud-sub { font-size: var(--text-sm); color: var(--ink-dim); margin-top: 5px; }
.hud-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.opt { min-width: 56px; font-variant-numeric: tabular-nums; }
.opt-used { opacity: 0.35; cursor: default; }
.flash-ok { background: rgba(92, 224, 138, 0.13); border: 1px solid rgba(92, 224, 138, 0.4); }
