/* GeoQuest — premium dark geography game */

:root,
body[data-theme="dark"] {
  --bg: #070b14;
  --bg-elev: #0e1628;
  --bg-panel: rgba(12, 20, 38, 0.88);
  --line: rgba(148, 163, 184, 0.18);
  --text: #e8eef8;
  --muted: #93a4bd;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --warn: #fbbf24;
  --danger: #f87171;
  --ok: #34d399;
  --flame: #fb923c;
  --ok-soft: #a7f3d0;
  --bad-soft: #fecaca;
  --radius: 16px;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --map-dim: saturate(0.85) brightness(0.55);
  --panel-grad-a: rgba(45, 212, 191, 0.16);
  --panel-grad-b: rgba(56, 189, 248, 0.12);
  --panel-grad-c: rgba(16, 24, 42, 0.94);
  --panel-grad-d: rgba(8, 12, 22, 0.92);
  --stat-bg: rgba(255, 255, 255, 0.04);
  --chip-bg: var(--bg-panel);
}

body[data-theme="light"] {
  --bg: #d7e8f5;
  --bg-elev: #f4f7fb;
  --bg-panel: rgba(255, 255, 255, 0.96);
  --line: rgba(15, 23, 42, 0.22);
  --text: #0f172a;
  --muted: #334155;
  --accent: #0f766e;
  --accent-2: #1d4ed8;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #047857;
  --flame: #c2410c;
  --ok-soft: #065f46;
  --bad-soft: #991b1b;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  --map-dim: saturate(0.95) brightness(0.94);
  --panel-grad-a: rgba(13, 148, 136, 0.1);
  --panel-grad-b: rgba(37, 99, 235, 0.08);
  --panel-grad-c: rgba(255, 255, 255, 0.97);
  --panel-grad-d: rgba(241, 245, 249, 0.98);
  --stat-bg: rgba(15, 23, 42, 0.05);
  --chip-bg: rgba(255, 255, 255, 0.92);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.theme-toggle {
  position: fixed;
  z-index: 30;
  top: 0.85rem;
  right: 0.85rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  transition: transform 0.15s ease, background 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: scale(0.97);
}

body[data-screen="play"] .theme-toggle {
  display: none;
}

.map-pulse {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0;
}

.map-pulse.go.ok {
  animation: pulseOk 0.65s ease-out;
}

.map-pulse.go.bad {
  animation: pulseBad 0.65s ease-out;
}

@keyframes pulseOk {
  0% {
    opacity: 0;
    box-shadow: inset 0 0 0 0 rgba(52, 211, 153, 0);
  }

  35% {
    opacity: 1;
    box-shadow: inset 0 0 120px 40px rgba(52, 211, 153, 0.22);
  }

  100% {
    opacity: 0;
  }
}

@keyframes pulseBad {
  0% {
    opacity: 0;
    box-shadow: inset 0 0 0 0 rgba(248, 113, 113, 0);
  }

  35% {
    opacity: 1;
    box-shadow: inset 0 0 120px 40px rgba(248, 113, 113, 0.22);
  }

  100% {
    opacity: 0;
  }
}

/* Screens */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  pointer-events: none;
}

.screen.active {
  display: flex;
  pointer-events: auto;
}

/*
  Play HUD must NEVER cover the map with an invisible hit target.
  Flex stretch + pointer-events:auto on .hud was blocking pan/click on land & water.
*/
#screen-play.active {
  display: block;
  pointer-events: none;
}

#screen-play .hud {
  pointer-events: none;
}

#screen-play .hud-top,
#screen-play .prompt-card,
#screen-play .progress-wrap {
  pointer-events: auto;
}

#screen-play .timer-wrap {
  pointer-events: none;
}

#screen-play .type-panel {
  pointer-events: none;
}

#screen-play .type-panel:not([hidden]) {
  pointer-events: auto;
}

#screen-play .feedback-card {
  pointer-events: none;
}

#screen-play .feedback-card.show {
  pointer-events: auto;
}

/* Loading / Home overlays */
.overlay-panel {
  margin: auto;
  width: min(920px, calc(100% - 2rem));
  padding: 2rem;
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--panel-grad-a), transparent 50%),
    radial-gradient(900px 400px at 90% 0%, var(--panel-grad-b), transparent 45%),
    linear-gradient(180deg, var(--panel-grad-c), var(--panel-grad-d));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise 0.55s ease;
  color: var(--text);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 0.4rem;
  background: linear-gradient(120deg, #f8fafc 10%, var(--accent) 55%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid rgba(251, 146, 60, 0.35);
  color: #fdba74;
  font-weight: 600;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.mode-card {
  text-align: left;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 212, 191, 0.45);
  background: rgba(45, 212, 191, 0.08);
}

.mode-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.45rem;
}

.mode-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.mode-blurb,
.mode-high,
.mode-meta {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.mode-high {
  margin-top: 0.4rem;
  color: var(--accent);
}

.mode-meta {
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

/* Settings */
.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.settings-head h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.6rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  outline: none;
}

.field select:focus {
  border-color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #042f2e;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 650;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Token gate */
.loading-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  border: 3px solid rgba(45, 212, 191, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-copy {
  text-align: center;
}

/* HUD */
.hud {
  position: fixed;
  z-index: 12;
  left: 0;
  right: 0;
  top: 0;
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.75), transparent);
}

.hud-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
  font-weight: 600;
}

.chip.streak.hot {
  border-color: rgba(251, 146, 60, 0.55);
  box-shadow: 0 0 20px rgba(251, 146, 60, 0.25);
  color: #fdba74;
  animation: flicker 0.9s ease-in-out infinite alternate;
}

@keyframes flicker {
  from {
    filter: brightness(1);
  }

  to {
    filter: brightness(1.15);
  }
}

.hud-actions {
  display: flex;
  gap: 0.4rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
}

.prompt-card {
  justify-self: center;
  width: min(640px, 100%);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  text-align: center;
  box-shadow: var(--shadow);
}

.prompt-card small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  margin-bottom: 0.25rem;
}

.prompt-main {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 750;
}

.prompt-flag {
  font-size: clamp(2.8rem, 8vw, 4rem);
  line-height: 1;
}

.prompt-clue {
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  font-weight: 600;
  line-height: 1.35;
}

.progress-wrap {
  width: min(640px, 100%);
  justify-self: center;
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.progress-text {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.timer-wrap {
  position: fixed;
  z-index: 12;
  right: 0.85rem;
  bottom: 5.5rem;
  width: 64px;
  height: 64px;
}

.timer-ring {
  --p: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1turn), rgba(255, 255, 255, 0.08) 0);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.timer-ring::before {
  content: "";
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-elev);
}

.timer-ring span {
  position: absolute;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-ring.urgent {
  background: conic-gradient(var(--danger) calc(var(--p) * 1turn), rgba(255, 255, 255, 0.08) 0);
  animation: urgentPulse 0.6s ease infinite alternate;
}

@keyframes urgentPulse {
  to {
    transform: scale(1.05);
  }
}

/* Type panel */
.type-panel {
  position: fixed;
  z-index: 13;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(480px, calc(100% - 1.5rem));
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.type-row {
  display: flex;
  gap: 0.5rem;
}

.type-row input {
  flex: 1;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  outline: none;
}

.type-suggest {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.25rem;
}

.suggest-item {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.suggest-item:hover {
  border-color: rgba(45, 212, 191, 0.4);
}

/* Feedback */
.feedback-card {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%) translateY(20px);
  width: min(440px, calc(100% - 1.5rem));
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}

.feedback-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.feedback-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(148, 163, 184, 0.4);
}

.feedback-card.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.feedback-card.ok {
  border-color: rgba(52, 211, 153, 0.45);
}

.feedback-card.bad {
  border-color: rgba(248, 113, 113, 0.45);
}

.fb-emoji {
  font-size: 1.8rem;
}

.feedback-card h3 {
  margin: 0.25rem 0;
  font-family: var(--font-display);
}

.fb-points {
  color: var(--ok);
  font-weight: 700;
  margin: 0.2rem 0;
}

.fb-answer {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  text-align: left;
  margin: 0.75rem 0;
}

.fb-flag {
  font-size: 2.2rem;
}

.fb-cap,
.fb-fact,
.fb-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.2rem 0 0;
}

.fb-fact {
  font-style: italic;
}

.feedback-card.explore {
  border-color: rgba(45, 212, 191, 0.45);
  text-align: left;
}

.explore-flag {
  font-size: 3rem;
  line-height: 1;
  text-align: center;
}

.feedback-card.explore h3 {
  text-align: center;
  margin: 0.4rem 0 0.6rem;
}

.explore-capital {
  margin: 0.2rem 0;
  font-size: 1.05rem;
}

.explore-continent {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.explore-landmark {
  margin: 0.65rem 0 0;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.explore-prompt {
  font-size: clamp(1.05rem, 2.8vw, 1.35rem) !important;
}

body[data-play-mode="explore"] .timer-wrap {
  display: none;
}

/* End screen */
.end-panel {
  max-height: min(90vh, 820px);
  overflow: auto;
}

.end-score {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  margin: 0;
  background: linear-gradient(120deg, var(--warn), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.end-stars {
  font-size: 1.6rem;
  color: var(--warn);
  letter-spacing: 0.15em;
  margin: 0.25rem 0 1rem;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.end-stats .stat {
  padding: 0.7rem;
  border-radius: 12px;
  background: var(--stat-bg);
  border: 1px solid var(--line);
  text-align: center;
}

.end-stats .stat span {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.end-stats .stat label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.end-unlock {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--accent);
  text-align: center;
  font-weight: 600;
}

.end-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.end-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.end-list li:last-child {
  border-bottom: none;
}

.end-list li.ok {
  color: var(--ok-soft);
}

.end-list li.bad {
  color: var(--bad-soft);
}

/* Toast */
.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -8px);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(45, 212, 191, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.help-keys {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.btn-show-stats {
  margin-top: 1rem;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px);
}

.stats-modal {
  z-index: 85;
  align-items: start;
  padding-top: 4vh;
  overflow-y: auto;
}

.stats-dialog {
  width: min(560px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.25rem 1rem;
}

.stats-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.stats-dialog-head h2 {
  margin: 0;
}

.stats-modal-body {
  overflow-y: auto;
  flex: 1;
  display: grid;
  gap: 1.1rem;
  padding-right: 0.15rem;
}

.stats-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.stats-section p,
.stats-section li {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.stats-kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.stats-kpi .kpi-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.stats-kpi strong {
  display: block;
  font-size: 1.35rem;
  font-family: var(--display, inherit);
  color: var(--text);
  margin-bottom: 0.15rem;
}

.stats-kpi span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  padding: 0.28rem 0;
}

.stats-list .val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.stats-continent-block {
  margin-top: 0.55rem;
}

.stats-continent-block h4 {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: var(--text);
}

.stats-empty {
  font-style: italic;
}

.stats-io {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.95rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

body[data-theme="light"] .stats-kpi .kpi-card {
  background: rgba(15, 23, 42, 0.03);
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(400px, 100%);
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.confirm-dialog p {
  margin: 0 0 1.15rem;
  color: var(--muted);
  line-height: 1.45;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border: 1px solid #b91c1c;
}

.btn-danger:hover {
  background: #ef4444;
}

body[data-theme="light"] .confirm-dialog {
  background: #fff;
}

.kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .overlay-panel {
    padding: 1.25rem;
    width: calc(100% - 1rem);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .end-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timer-wrap {
    right: 0.6rem;
    bottom: auto;
    top: 7.5rem;
  }

  .hud {
    padding: 0.55rem;
  }

  .prompt-card {
    padding: 0.7rem 0.85rem;
  }

  .mapboxgl-ctrl-bottom-right {
    bottom: 70px !important;
  }
}

/* Dim map under menus */
body[data-screen="home"] #map,
body[data-screen="settings"] #map,
body[data-screen="loading"] #map,
body[data-screen="end"] #map {
  filter: var(--map-dim);
}

body[data-theme="light"] .btn-primary {
  color: #fff;
}

body[data-theme="light"] .btn-ghost {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(15, 23, 42, 0.35);
  color: #0f172a;
}

body[data-theme="light"] .btn-ghost:hover {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.5);
}

body[data-theme="light"] .brand {
  background: linear-gradient(120deg, #0f172a 8%, #0f766e 55%, #1d4ed8);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="light"] .end-score {
  background: linear-gradient(120deg, #b45309, #0f766e);
  -webkit-background-clip: text;
  background-clip: text;
}

body[data-theme="light"] .mode-card {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(15, 23, 42, 0.18);
}

body[data-theme="light"] .mode-card:hover {
  background: rgba(13, 148, 136, 0.12);
  border-color: rgba(15, 118, 110, 0.45);
}

body[data-theme="light"] .mode-blurb,
body[data-theme="light"] .mode-meta,
body[data-theme="light"] .tagline,
body[data-theme="light"] .help-keys,
body[data-theme="light"] .meta-row,
body[data-theme="light"] .field label,
body[data-theme="light"] .fb-cap,
body[data-theme="light"] .fb-fact,
body[data-theme="light"] .fb-sub,
body[data-theme="light"] .progress-text {
  color: #334155;
}

body[data-theme="light"] .mode-high {
  color: #0f766e;
  font-weight: 700;
}

body[data-theme="light"] .chip,
body[data-theme="light"] .icon-btn,
body[data-theme="light"] .theme-toggle,
body[data-theme="light"] .prompt-card,
body[data-theme="light"] .type-panel,
body[data-theme="light"] .feedback-card {
  background: var(--chip-bg);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.2);
}

body[data-theme="light"] .feedback-close {
  border: none;
  color: #0f172a;
}

body[data-theme="light"] .feedback-close:hover {
  background: rgba(15, 23, 42, 0.1);
}

body[data-theme="light"] .prompt-card small {
  color: #475569;
  font-weight: 700;
}

body[data-theme="light"] .field select,
body[data-theme="light"] .type-row input {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.28);
}

body[data-theme="light"] .kbd {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.28);
  color: #0f172a;
}

body[data-theme="light"] .end-list {
  background: rgba(255, 255, 255, 0.7);
}

body[data-theme="light"] .end-list li {
  font-weight: 600;
}

body[data-theme="light"] .streak-pill {
  background: rgba(194, 65, 12, 0.1);
  border-color: rgba(194, 65, 12, 0.4);
  color: #9a3412;
}

body[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border-color: rgba(15, 118, 110, 0.45);
}

body[data-theme="light"] .timer-ring::before {
  background: #eef4f9;
}

body[data-theme="light"] .mapboxgl-ctrl-group {
  background: rgba(255, 255, 255, 0.95);
}

body[data-theme="light"] .mapboxgl-ctrl-group button+button {
  border-top-color: rgba(15, 23, 42, 0.16);
}

body[data-theme="light"] .mapboxgl-ctrl button {
  filter: invert(0.85);
}