/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #3b82f6;
  --primary-dark:  #2563eb;
  --correct:       #16a34a;
  --incorrect:     #dc2626;
  --bg:            #f1f5f9;
  --card:          #ffffff;
  --border:        #cbd5e1;
  --text:          #1e293b;
  --text-muted:    #64748b;

  /* 帝国書院スタイル地図色 */
  --water:         #c8dff0;   /* 薄青（海・湖） */
  --land:          #ffffff;   /* 白（陸地） */
  --land-stroke:   #777777;   /* 濃いグレー（国境線） */
  --highlight:     #4472c4;   /* 青（問題の国） */
  --highlight-dark:#2c5282;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ===== SCREEN SWITCHER ===== */
.screen { display: none; }
.screen.active { display: flex; }

/* ===== MENU SCREEN ===== */
#menu-screen {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  gap: 1.6rem;
  padding: 2rem 2rem 2.5rem;
  background: linear-gradient(160deg, #f0f6ff 0%, #f8fafc 60%, #f0fdf4 100%);
  overflow-y: auto;
  padding-top: max(2rem, calc(50vh - 340px));
}

.menu-hero { text-align: center; }
.menu-hero h1 {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.menu-hero p  { margin-top: 0.4rem; color: var(--text-muted); font-size: 1rem; }

/* セクション共通 */
.menu-section {
  width: 100%;
  max-width: 560px;
}
.menu-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.55rem;
  padding-left: 2px;
}

/* モード選択トグル */
.mode-toggle {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.mode-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.mode-btn .mode-icon { font-size: 1.5rem; line-height: 1; }
.mode-btn .mode-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.mode-btn .mode-desc { font-size: 0.65rem; color: var(--text-muted); }
.mode-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15), 0 2px 8px rgba(59,130,246,0.2);
  transform: translateY(-1px);
}
.mode-btn.selected .mode-name { color: var(--primary); }
.mode-btn:hover:not(.selected) { background: #f8fafc; transform: translateY(-1px); }

/* 試験モード ヘッダーバッジ */
.header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.exam-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #7c3aed;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  border-radius: 8px;
  padding: 1px 8px;
  white-space: nowrap;
}
.exam-badge.hard {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fca5a5;
}
.exam-badge.hidden { display: none; }

/* 試験モード 進捗バー */
.exam-progress-wrap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(0,0,0,0.08);
  z-index: 20;
  pointer-events: none;
}
.exam-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  transition: width 0.4s ease;
}

/* 試験モード クリア／リセット オーバーレイ */
.exam-clear,
.exam-reset {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.exam-clear.hidden,
.exam-reset.hidden { display: none; }

.exam-clear-box,
.exam-reset-box {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: min(90vw, 360px);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modal-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.exam-clear-trophy { font-size: 4rem; line-height: 1; margin-bottom: 0.5rem; animation: trophy-bounce 0.6s 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes trophy-bounce {
  from { transform: scale(0) rotate(-20deg); }
  to   { transform: scale(1) rotate(0deg); }
}
.exam-clear-title  { font-size: 1.8rem; font-weight: 900; color: #7c3aed; margin-bottom: 0.3rem; }
.exam-clear-region { font-size: 1rem;   font-weight: 700; color: var(--text-muted); margin-bottom: 0.75rem; }
.exam-clear-stats  { font-size: 0.9rem; color: var(--text); background: #f8fafc; border-radius: 10px; padding: 0.6rem 1rem; margin-bottom: 1.2rem; line-height: 1.7; }

.exam-reset-icon  { font-size: 3.5rem; line-height: 1; margin-bottom: 0.4rem; }
.exam-reset-title { font-size: 1.6rem; font-weight: 900; color: var(--incorrect); margin-bottom: 0.3rem; }
.exam-reset-msg   { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.2rem; line-height: 1.5; }

.exam-retry-btn {
  display: block;
  width: 100%;
  padding: 0.7rem;
  margin-bottom: 0.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.exam-retry-btn:hover { background: var(--primary-dark); }

.exam-menu-btn {
  display: block;
  width: 100%;
  padding: 0.65rem;
  background: none;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.exam-menu-btn:hover { background: var(--bg); }

.region-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.region-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem 0.6rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.region-btn .icon { font-size: 1.6rem; line-height: 1; }
.region-btn .sub  { font-size: 0.65rem; font-weight: 400; color: var(--text-muted); }

.region-btn.available {
  color: var(--text);
}
.region-btn.available:hover:not(.selected) {
  background: #f0f6ff;
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(59,130,246,0.15);
}
.region-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15), 0 2px 8px rgba(59,130,246,0.2);
  transform: translateY(-1px);
}
.region-btn.selected .sub { color: #93c5fd; }
.region-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

/* START ボタン */
.start-btn {
  width: 100%;
  max-width: 560px;
  padding: 1rem;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(59,130,246,0.4);
  position: relative;
  overflow: hidden;
}
.start-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  pointer-events: none;
}
.start-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(59,130,246,0.5);
}
.start-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(59,130,246,0.3);
}
.start-btn:disabled {
  background: linear-gradient(135deg, #94a3b8, #b0bec5);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ===== QUIZ SCREEN ===== */
#quiz-screen {
  flex-direction: column;
  height: 100vh;
}

/* Header */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.back-btn:hover { background: var(--bg); }

.region-label { font-size: 1rem; font-weight: 700; }

/* header spacer (keeps region-label centered) */
.header-spacer { width: 72px; }

/* ===== FLOATING SCORE HUD ===== */
.score-hud {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(203, 213, 225, 0.75);
  border-radius: 16px;
  padding: 10px 16px 12px;
  text-align: center;
  min-width: 100px;
  z-index: 15;
  pointer-events: none;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.12);
}

.score-hud-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.score-pct {
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1;
  color: #94a3b8;
  transition: color 0.4s;
}
.score-pct.great { color: #16a34a; }
.score-pct.good  { color: #2563eb; }
.score-pct.try   { color: #ea580c; }

.score-fraction {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.streak-badge {
  margin-top: 6px;
  display: block;
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  border: none;
  border-radius: 12px;
  padding: 3px 10px;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 2px 10px rgba(239,68,68,0.5);
  position: relative;
  overflow: visible;
}
.streak-badge.hidden { display: none; }

/* コンボ数が増えるたびにバッジがポンと弾む */
.streak-badge.combo-bump {
  animation: combo-bump 0.28s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes combo-bump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.55) rotate(-4deg); }
  65%  { transform: scale(0.92) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* コンボ数ごとに色が変わる */
.streak-badge.level-5  { background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 2px 14px rgba(249,115,22,0.6); }
.streak-badge.level-10 { background: linear-gradient(135deg, #ef4444, #ec4899); box-shadow: 0 2px 18px rgba(236,72,153,0.65); }
.streak-badge.level-20 { background: linear-gradient(135deg, #8b5cf6, #ec4899); box-shadow: 0 2px 22px rgba(139,92,246,0.7); animation: rainbow-badge 1.2s linear infinite; }

@keyframes rainbow-badge {
  0%   { filter: hue-rotate(0deg)   brightness(1.1); }
  50%  { filter: hue-rotate(180deg) brightness(1.3); }
  100% { filter: hue-rotate(360deg) brightness(1.1); }
}

.streak-fire {
  display: inline-block;
  animation: fire-dance 0.6s ease-in-out infinite alternate;
}
@keyframes fire-dance {
  from { transform: rotate(-12deg) scale(1.0); }
  to   { transform: rotate(12deg)  scale(1.2); }
}

/* Milestone toast */
.milestone-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 0.7rem 1.8rem;
  border-radius: 30px;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  letter-spacing: 0.5px;
  border: 2px solid transparent;
}
.milestone-toast.hidden { display: none; }
.milestone-toast.toast-show {
  display: block;
  animation: toast-anim 2.4s ease-out forwards;
}
/* コンボレベルで色が変わる */
.milestone-toast.lv3  { border-color: #f97316; text-shadow: 0 0 12px #f97316; }
.milestone-toast.lv5  { border-color: #f59e0b; text-shadow: 0 0 16px #f59e0b; }
.milestone-toast.lv10 { border-color: #ec4899; text-shadow: 0 0 20px #ec4899; background: rgba(30, 10, 30, 0.95); }
.milestone-toast.lv20 { border-color: #8b5cf6; text-shadow: 0 0 24px #8b5cf6; background: rgba(20, 0, 40, 0.97); animation: toast-anim 2.4s ease-out forwards, rainbow-badge 0.8s linear infinite; }

/* 紙吹雪・爆発canvas */
.burst-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1500;
}

/* コンボ破壊エフェクト */
.combo-break {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.combo-break.hidden { display: none; }
.combo-break.show {
  display: flex;
  animation: combo-break-fade 1.6s ease-out forwards;
}
.combo-break::before {
  content: attr(data-msg);
  font-size: 2.6rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 30px rgba(239,68,68,0.8), 0 4px 20px rgba(0,0,0,0.5);
  animation: combo-break-text 1.6s ease-out forwards;
  letter-spacing: 1px;
}
.combo-break::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(239,68,68,0.18) 0%, transparent 70%);
  animation: combo-break-flash 0.4s ease-out;
}
@keyframes combo-break-text {
  0%   { opacity: 0; transform: scale(0.5)  translateY(20px); }
  18%  { opacity: 1; transform: scale(1.25) translateY(-8px); }
  35%  { transform: scale(0.95) translateY(0); }
  60%  { opacity: 1; }
  100% { opacity: 0; transform: scale(0.8)  translateY(-30px); }
}
@keyframes combo-break-flash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes combo-break-fade {
  100% { opacity: 0; }
}

/* Milestone toast */
.milestone-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0.65rem 1.5rem;
  border-radius: 30px;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
}
.milestone-toast.hidden { display: none; }
.milestone-toast.toast-show {
  display: block;
  animation: toast-anim 2.4s ease-out forwards;
}

/* ===== ANIMATIONS ===== */
@keyframes toast-anim {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.88); }
  14%  { opacity: 1; transform: translateX(-50%) translateY(0)     scale(1.06); }
  22%  { transform: translateX(-50%) translateY(0) scale(1); }
  78%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-9px); }
  35% { transform: translateX(9px); }
  55% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
  90% { transform: translateX(-3px); }
}
.shake { animation: shake 0.45s ease-in-out; }

@keyframes score-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.28); }
  70%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.pop { animation: score-pop 0.38s ease-out; }

@keyframes highlight-pulse {
  0%, 100% {
    fill: var(--highlight);
    filter: drop-shadow(0 0 4px rgba(68, 114, 196, 0.6));
  }
  50% {
    fill: #7aaee8;
    filter: drop-shadow(0 0 16px rgba(68, 114, 196, 1)) drop-shadow(0 0 6px rgba(68, 114, 196, 0.8));
  }
}

@keyframes correct-pulse {
  0%   { fill: var(--highlight); }
  45%  { fill: #22c55e; filter: drop-shadow(0 0 14px rgba(34,197,94,0.85)); }
  100% { fill: var(--highlight); filter: drop-shadow(0 0 4px rgba(68,114,196,0.55)); }
}
.country.correct-pulse { animation: correct-pulse 0.75s ease-out; }

/* Map wrapper */
.map-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--water);
}

#map-svg {
  width: 100%;
  height: 100%;
  display: none;
}

/* 帝国書院スタイル 国境・陸地 */
.country {
  fill: var(--land);
  stroke: var(--land-stroke);
  stroke-width: 0.55px;
  stroke-linejoin: round;
}
.country.highlighted {
  fill: var(--highlight);
  stroke: var(--highlight-dark);
  stroke-width: 1.5px;
  animation: highlight-pulse 1.6s ease-in-out infinite;
}
/* correct-pulseはhighlightedより高い詳細度で上書き */
.country.highlighted.correct-pulse {
  animation: correct-pulse 0.75s ease-out;
}

/* ===== SONAR OVERLAY ===== */
.sonar-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 30;
  transform: translate(-50%, -50%);
}
.sonar-overlay.hidden { display: none; }

.sonar-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  border: 2.5px solid rgba(68, 114, 196, 0.85);
  transform: translate(-50%, -50%);
  animation: sonar-pulse 2s ease-out infinite;
}
.sonar-ring:nth-child(1) { animation-delay: 0s; }
.sonar-ring:nth-child(2) { animation-delay: 0.55s; }
.sonar-ring:nth-child(3) { animation-delay: 1.1s; }

.sonar-dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  background: var(--highlight);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.85), 0 0 12px rgba(68,114,196,0.9);
  animation: sonar-dot-pulse 1.6s ease-in-out infinite;
}

@keyframes sonar-pulse {
  0%   { width: 0; height: 0; opacity: 0.9; border-width: 2.5px; }
  80%  { width: 120px; height: 120px; opacity: 0; border-width: 1px; }
  100% { width: 120px; height: 120px; opacity: 0; }
}

@keyframes sonar-dot-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);   box-shadow: 0 0 0 3px rgba(255,255,255,0.85), 0 0 12px rgba(68,114,196,0.9); }
  50%       { transform: translate(-50%, -50%) scale(1.4); box-shadow: 0 0 0 4px rgba(255,255,255,0.9),  0 0 22px rgba(68,114,196,1); }
}

/* ===== ZOOM CONTROLS ===== */
.zoom-controls {
  position: absolute;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 25;
  pointer-events: none;
}

.zoom-ctrl-btn {
  pointer-events: auto;
  padding: 0.42rem 0.9rem;
  background: rgba(255,255,255,0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(59,130,246,0.22);
  transition: background 0.15s, transform 0.12s;
}
.zoom-ctrl-btn:hover { background: #eff6ff; transform: translateY(-1px); }
.zoom-ctrl-btn.hidden { display: none; }

/* Question badge */
.q-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ANSWER FOOTER ===== */
.quiz-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
  flex-shrink: 0;
}

.answer-prompt {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.answer-row {
  display: flex;
  gap: 0.6rem;
  max-width: 520px;
  margin: 0 auto;
}

.answer-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 9px;
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
}
.answer-input:focus  { border-color: var(--primary); }
.answer-input.ok     { border-color: var(--correct);   background: #f0fdf4; }
.answer-input.ng     { border-color: var(--incorrect);  background: #fef2f2; }
.answer-input:disabled { opacity: 0.75; }

.btn-submit {
  padding: 0.65rem 1.3rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-submit:hover:not(:disabled) { background: var(--primary-dark); }
.btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* Result overlay (inside map-wrap, position:absolute so footer never shifts) */
.result-panel {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 540px;
  z-index: 35;
  border-radius: 12px;
  border: 2px solid transparent;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
}
.result-panel.hidden { display: none; }
.result-panel.ok { border-color: var(--correct);   background: rgba(240,253,244,0.97); }
.result-panel.ng { border-color: #ea580c;           background: rgba(255,247,237,0.97); }

.result-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.result-info { flex: 1; min-width: 0; }

.result-verdict {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}
.result-verdict.ok { color: var(--correct); }
.result-verdict.ng { color: #ea580c; }

.result-name    { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.15rem; }
.result-capital { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.1rem; }
.result-fact    { font-size: 0.8rem;  color: var(--text-muted); line-height: 1.45; }

.btn-next {
  flex-shrink: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0.55rem 1.1rem;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-next:hover { background: #334155; }

.key-hint {
  font-size: 0.62rem;
  font-weight: 400;
  opacity: 0.65;
  background: rgba(255,255,255,0.18);
  border-radius: 4px;
  padding: 0 5px;
  letter-spacing: 0.3px;
}
