:root{
  font-family:"DM Sans",system-ui,-apple-system,sans-serif;

  /* Color palette - Dark mode (default) */
  --bg-primary: #0b1020;
  --text-primary: #e8ecff;
  --text-muted: rgba(232,236,255,.72);
  --card-bg: rgba(255,255,255,.06);
  --card-border: rgba(255,255,255,.12);
  --card-shadow: rgba(0,0,0,.25);
  --input-bg: rgba(0,0,0,.22);
  --input-border: rgba(255,255,255,.18);
  --input-color: #e8ecff;
  --button-bg: rgba(255,255,255,.1);
  --button-hover: rgba(255,255,255,.14);
  --button-border: rgba(255,255,255,.16);
  --button-color: #e8ecff;
  --map-bg: rgba(255,255,255,.04);
  --map-border: rgba(255,255,255,.12);
  --hr-color: rgba(255,255,255,.12);
  --pill-bg: rgba(255,255,255,.08);
  --pill-border: rgba(255,255,255,.12);
  --overlay-bg: rgba(0,0,0,.6);
  --panel-bg: rgba(15,20,40,.96);
  --panel-border: rgba(255,255,255,.14);
  --good-color: #6ee7b7;
  --bad-color: #fda4af;
  --star-color: #ffd54a;
  --star-shadow: rgba(255,213,74,.25);
  --country-hover-color: #ffffff;
  --country-hover-shadow: rgba(165,180,252,.35);
  --correct-border: rgba(110,231,183,.65);
  --correct-bg: rgba(110,231,183,.14);
  --wrong-border: rgba(253,164,175,.65);
  --wrong-bg: rgba(253,164,175,.14);
  --init-overlay-bg: radial-gradient(ellipse at center, #0f1220 0%, #070816 70%);
  --init-overlay-color: rgba(232,236,255,.9);
  --bonus-bg: rgba(255,255,255,.06);
  --bonus-color: rgba(232,236,255,.9);

  /* Map SVG colors */
  --map-country-stroke: rgba(232,236,255,.3);
  --map-country-stroke-neighbor: rgba(232,236,255,.5);
  --map-country-stroke-highlight: rgba(232,236,255,.95);
  --map-country-fill: rgba(165,180,252,.08);
  --map-country-fill-dim: rgba(165,180,252,.03);
  --map-country-stroke-dim: rgba(232,236,255,.10);
  --map-country-fill-highlight: rgba(165,180,252,.25);
  --map-selected-fill: rgba(165, 180, 252, 0.35);
  --map-selected-stroke: rgba(165, 180, 252, 0.95);
  --map-correct-fill: rgba(110, 231, 183, 0.5);
  --map-correct-stroke: rgba(110, 231, 183, 0.95);
  --map-wrong-fill: rgba(252, 165, 161, 0.5);
  --map-wrong-stroke: rgba(252, 165, 161, 0.95);
  --map-missed-fill: rgba(251, 191, 36, 0.4);
  --map-missed-stroke: rgba(251, 191, 36, 0.9);
  --map-dot-fill: #6ee7b7;
  --map-dot-stroke: rgba(232,236,255,.9);

  /* Route game colors */
  --color-green: rgba(34, 197, 94, 0.8);
  --color-orange: rgba(249, 115, 22, 0.8);
  --color-blue: rgba(59, 130, 246, 0.8);
  --color-gold: rgba(250, 204, 21, 0.9);
}

body.light-mode,
html.light-mode {
  /* Color palette - Light mode */
  --bg-primary: #f5f7fa;
  --text-primary: #1a202c;
  --text-muted: rgba(26,32,44,.65);
  --card-bg: #ffffff;
  --card-border: rgba(0,0,0,.12);
  --card-shadow: rgba(0,0,0,.08);
  --input-bg: #ffffff;
  --input-border: rgba(0,0,0,.20);
  --input-color: #1a202c;
  --button-bg: rgba(0,0,0,.04);
  --button-hover: rgba(0,0,0,.08);
  --button-border: rgba(0,0,0,.14);
  --button-color: #1a202c;
  --map-bg: rgba(0,0,0,.02);
  --map-border: rgba(0,0,0,.15);
  --hr-color: rgba(0,0,0,.12);
  --pill-bg: rgba(0,0,0,.04);
  --pill-border: rgba(0,0,0,.12);
  --overlay-bg: rgba(0,0,0,.5);
  --panel-bg: #ffffff;
  --panel-border: rgba(0,0,0,.15);
  --good-color: #059669;
  --bad-color: #dc2626;
  --star-color: #f59e0b;
  --star-shadow: rgba(245,158,11,.25);
  --country-hover-color: #000000;
  --country-hover-shadow: rgba(99,102,241,.35);
  --correct-border: rgba(5,150,105,.65);
  --correct-bg: rgba(5,150,105,.14);
  --wrong-border: rgba(220,38,38,.65);
  --wrong-bg: rgba(220,38,38,.14);
  --init-overlay-bg: radial-gradient(ellipse at center, #e5e7eb 0%, #d1d5db 70%);
  --init-overlay-color: rgba(26,32,44,.9);
  --bonus-bg: rgba(0,0,0,.04);
  --bonus-color: rgba(26,32,44,.9);

  /* Map SVG colors - black strokes for light mode (mirror of white strokes in dark mode) */
  --map-country-stroke: rgba(0,0,0,.35);
  --map-country-stroke-neighbor: rgba(0,0,0,.5);
  --map-country-stroke-highlight: rgba(0,0,0,.85);
  --map-country-fill: rgba(99,102,241,.08);
  --map-country-fill-dim: rgba(99,102,241,.05);
  --map-country-stroke-dim: rgba(0,0,0,.15);
  --map-country-fill-highlight: rgba(99,102,241,.25);
  --map-selected-fill: rgba(99, 102, 241, 0.3);
  --map-selected-stroke: rgba(99, 102, 241, 0.95);
  --map-correct-fill: rgba(5, 150, 105, 0.35);
  --map-correct-stroke: rgba(5, 150, 105, 0.95);
  --map-wrong-fill: rgba(220, 38, 38, 0.35);
  --map-wrong-stroke: rgba(220, 38, 38, 0.95);
  --map-missed-fill: rgba(234, 179, 8, 0.35);
  --map-missed-stroke: rgba(234, 179, 8, 0.9);
  --map-dot-fill: #059669;
  --map-dot-stroke: rgba(0,0,0,.85);
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body{
  margin:0;
  background:var(--bg-primary);
  color:var(--text-primary);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
.wrap{max-width:980px;margin:0 auto;padding:24px}
.card{background:var(--card-bg);border:1px solid var(--card-border);border-radius:16px;padding:18px;box-shadow:0 12px 40px var(--card-shadow)}

/* Game page header with icon */
.game-header-icon {
  width: 36px;
  height: 36px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
}

/* Inline icon for buttons */
.btn-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

h1{margin:0 0 6px;font-size:22px}
h1 a {display: inline-flex; align-items: center;}
.muted{color:var(--text-muted);font-size:14px}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.row-space-between{justify-content:space-between}
.pill{display:inline-flex;gap:8px;padding:8px 12px;border-radius:999px;background:var(--pill-bg);border:1px solid var(--pill-border);font-size:14px}
.star{font-size:16px;line-height:1}
.starArms{margin-left:6px;opacity:.9;font-size:12px;letter-spacing:1px}
.hr{height:1px;background:var(--hr-color);margin:14px 0}
.country{font-size:30px;font-weight:750;margin:10px 0}

/* Keep input + Submit always on same row (mobile too) */
.answerRow{
  display:flex;
  gap:12px;
  align-items:stretch;
  flex-wrap:nowrap;
  width:100%;
  position:relative; /* For autocomplete dropdown positioning */
}
.answerRow input{
  flex:1 1 auto;
  min-width:0; /* important for small screens */
}
.answerRow button{
  flex:0 0 auto;
  white-space:nowrap;
}

input{
  width:min(560px,100%);
  padding:12px 14px;border-radius:12px;border:1px solid var(--input-border);
  background:var(--input-bg);color:var(--input-color);font-size:16px
}
button{padding:12px 14px;border-radius:12px;border:1px solid var(--button-border);background:var(--button-bg);color:var(--button-color);font-weight:650;cursor:pointer}
button:hover{background:var(--button-hover)}
button:disabled{opacity:.55;cursor:not-allowed}

.status{margin-top:20px;font-size:14px}
.good{color:var(--good-color)}
.bad{color:var(--bad-color)}

.choices{margin-top:24px;display:grid;gap:10px}
@media (min-width:640px){ .choices{grid-template-columns:1fr 1fr} }
.footer{margin-top:14px;display:flex;gap:10px;flex-wrap:wrap}

/* Make choice feedback clear */
.choices button{
  text-align:left;
}

/* Keep disabled buttons fully visible so colors show */
.choices button:disabled{
  opacity: 1;
  cursor: default;
}

.choices button.correct{
  border-color: var(--correct-border);
  background: var(--correct-bg);
}

.choices button.wrong{
  border-color: var(--wrong-border);
  background: var(--wrong-bg);
}

/* Geography Trivia — more breathing room on larger screens */
@media (min-width: 640px) {
  .trivia-page .card { padding: 28px 32px; }
  .trivia-page .choices { margin-top: 32px; gap: 14px; }
  .trivia-page .choices button { padding: 14px 18px; }
  .trivia-page #explanation { margin-top: 28px; }
}

@media (min-width: 1024px) {
  .trivia-page .card { padding: 36px 48px; }
  .trivia-page .hr { margin: 22px 0; }
  .trivia-page #questionText { margin: 16px 0; }
  .trivia-page .choices { margin-top: 40px; gap: 16px; }
  .trivia-page .choices button { padding: 16px 20px; }
  .trivia-page #explanation { margin-top: 32px; }
}

.mapwrap{margin:10px 0;position:relative}

#map{
  border-radius:14px;
  background:var(--map-bg);
  border:1px solid var(--map-border);
  touch-action:none;
  will-change:transform;
  transform:translateZ(0);
  height:clamp(320px, 50vh, 560px);
}

.country{
  cursor: pointer;
  text-decoration: none;
  transition: color .15s ease, text-shadow .15s ease;
}

.country:hover{
  color: var(--country-hover-color);
  text-shadow: 0 0 12px var(--country-hover-shadow);
}

.country:active{
  opacity: 0.85;
}

/* Feature name in Rivers / Mountains — clickable Wikipedia link */
.feature-name {
  cursor: pointer;
  transition: color 0.15s ease;
}
.feature-name:hover {
  color: var(--country-hover-color);
}
.feature-name:active {
  opacity: 0.85;
}

/* Final screen overlay */
.overlay{
  position:fixed; inset:0;
  background:var(--overlay-bg);
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:2000;
}
.overlay .panel{
  width:min(720px, 100%);
  background:var(--panel-bg);
  border:1px solid var(--panel-border);
  border-radius:16px;
  padding:18px;
  box-shadow:0 18px 60px rgba(0,0,0,.45);
}
.overlay h2{margin:0 0 8px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:520px){ .grid2{grid-template-columns:1fr} }

/* ── Finish screen (standalone games) ───────────────────────── */
@keyframes finishSlideIn{
  from{opacity:0;transform:translateY(20px)}
  to{opacity:1;transform:translateY(0)}
}
@keyframes finishBounce{
  0%,100%{transform:scale(1)}
  50%{transform:scale(1.15)}
}

.finish-panel{
  text-align:center;max-width:480px;margin:0 auto;
  padding:2rem 2.5rem;
}
.finish-header{margin-bottom:2rem;animation:finishSlideIn 0.4s ease-out both}
.finish-emoji{font-size:3.5rem;margin-bottom:0.5rem;animation:finishBounce 0.6s ease 0.2s both}
.finish-title{font-size:1.8rem;margin:0 0 0.25rem;letter-spacing:-0.02em}
.finish-subtitle{color:var(--text-muted);font-size:1.15rem;margin:0}

.finish-stats{
  display:grid;grid-template-columns:1fr 1fr;gap:16px;
  margin-bottom:1.25rem;
  animation:finishSlideIn 0.4s ease-out 0.15s both;
}
.finish-stat{
  background:var(--pill-bg);border:1px solid var(--pill-border);
  border-top:3px solid var(--button-border);
  border-radius:14px;padding:16px 12px;min-height:100px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
}
.finish-stat-value{font-size:1.8rem;font-weight:700;line-height:1.2;letter-spacing:-0.03em}
.finish-stat-label{font-size:0.85rem;color:var(--text-muted);margin-top:2px}
.finish-record{
  display:inline-block;margin-top:6px;padding:3px 10px;
  border-radius:999px;font-size:0.75rem;font-weight:700;
  background:linear-gradient(135deg,#fbbf24,#f59e0b);color:#1a202c;
}
.finish-best{font-size:0.8rem;color:var(--text-muted);margin-top:4px}

/* Score ring */
.finish-ring-wrap{position:relative;width:90px;height:90px;margin:0 auto 4px}
.finish-ring{width:100%;height:100%;transform:rotate(-90deg)}
.finish-ring-bg{fill:none;stroke:var(--pill-border);stroke-width:5}
.finish-ring-fill{fill:none;stroke-width:5;stroke-linecap:round;
  transition:stroke-dashoffset 0.8s ease-out}
.finish-ring-fill.ring-green{stroke:var(--good-color)}
.finish-ring-fill.ring-gold{stroke:var(--star-color)}
.finish-ring-fill.ring-muted{stroke:var(--text-muted)}
.finish-ring-text{position:absolute;inset:0;display:flex;
  align-items:center;justify-content:center;
  font-size:1.1rem;font-weight:700}

.finish-extra-stats{
  display:flex;justify-content:center;gap:24px;
  margin-bottom:1.25rem;color:var(--text-muted);font-size:0.9rem;
  animation:finishSlideIn 0.4s ease-out 0.25s both;
}
.finish-extra-value{font-weight:700;color:var(--text-primary)}

.finish-explanation{
  background:var(--card-bg);border-radius:12px;padding:1rem 1.25rem;
  margin-bottom:1.25rem;text-align:left;
  border-left:3px solid var(--good-color);
  animation:finishSlideIn 0.4s ease-out 0.3s both;
}
.finish-explanation-label{
  font-size:0.8rem;text-transform:uppercase;letter-spacing:0.05em;
  color:var(--text-muted);margin-bottom:0.35rem;font-weight:600;
}
.finish-explanation-text{
  font-size:1rem;color:var(--text-primary);line-height:1.5;
}

.finish-actions{display:flex;gap:12px;justify-content:center;margin-top:0.5rem;
  animation:finishSlideIn 0.4s ease-out 0.4s both}
.finish-btn{
  flex:1;max-width:200px;padding:12px 20px;font-size:1rem;font-weight:600;
  border-radius:12px;border:1px solid var(--button-border);cursor:pointer;
  transition:background .15s,transform .15s;
}
.finish-btn:hover{transform:scale(1.02)}
.finish-btn-primary{background:var(--button-bg);color:var(--button-color)}
.finish-btn-primary:hover{background:var(--button-hover)}
.finish-btn-secondary{
  background:var(--pill-bg);color:var(--text-muted);
  border-color:var(--pill-border);
}
.finish-btn-secondary:hover{background:var(--button-hover)}
.finish-btn-share{
  background:var(--correct-bg);color:var(--good-color);
  border-color:var(--correct-border);
}
.finish-btn-share:hover{background:rgba(110,231,183,.22)}

@media(max-width:420px){
  .finish-panel{padding:1.25rem}
  .finish-stat-value{font-size:1.5rem}
  .finish-ring-wrap{width:72px;height:72px}
  .finish-ring-text{font-size:0.95rem}
  .finish-actions{flex-direction:column;align-items:center}
  .finish-btn{max-width:100%;width:100%}
}

/* Share notification toast */
.share-notification{
  position:fixed;top:-100px;left:50%;transform:translateX(-50%);
  background:var(--good-color,#22c55e);color:#fff;
  padding:1rem 2rem;border-radius:8px;
  box-shadow:0 4px 12px rgba(0,0,0,.2);
  font-weight:600;transition:top .3s ease-in-out;z-index:10000;
  white-space:nowrap;
}
.share-notification.show{top:2rem}
.share-notification-error{background:#ef4444}
.share-notification-info{background:var(--button-bg)}

/* Copy fallback modal */
.copy-modal{
  position:fixed;inset:0;z-index:10000;
  display:flex;align-items:center;justify-content:center;padding:1rem;
}
.modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5)}
.modal-content{
  position:relative;background:var(--card-bg);border-radius:16px;
  padding:2rem;max-width:500px;width:100%;
  box-shadow:0 8px 24px rgba(0,0,0,.2);
  border:1px solid var(--card-border);
}
.modal-content h3{margin:0 0 1rem;color:var(--text-primary)}
.modal-content p{margin:0 0 1rem;color:var(--text-muted)}
.share-textarea{
  width:100%;min-height:160px;padding:1rem;box-sizing:border-box;
  border:1px solid var(--input-border);border-radius:8px;
  font-family:monospace;font-size:.9rem;resize:vertical;
  background:var(--input-bg);color:var(--text-primary);margin-bottom:1rem;
}
.modal-buttons{display:flex;gap:1rem}
.modal-buttons .btn{flex:1}

.starStack{
  display:inline-block;
  position:relative;
  margin-left:4px;
  height:18px;
  vertical-align:middle;
}

.starStack .starIcon{
  position:absolute;
  left:0;
  top:0;
  font-size:16px;
  line-height:18px;
  color:var(--star-color);
  text-shadow: 0 0 6px var(--star-shadow);
  user-select:none;
  pointer-events:none;
}

#confetti{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

#init-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  background: var(--init-overlay-bg);
  color: var(--init-overlay-color);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  z-index: 9999;
  transition: opacity .35s ease;
}

#init-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--init-overlay-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success/Failure Feedback Animations */
@keyframes flash-correct {
  0%, 100% { background-color: transparent; }
  50% { background-color: rgba(110, 231, 183, 0.3); }
}

@keyframes shake-wrong {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.flash-correct {
  animation: flash-correct 600ms ease-out;
  border-radius: 12px;
}

.shake-wrong {
  animation: shake-wrong 500ms ease-in-out;
}

.star { color: var(--star-color); text-shadow: 0 0 10px var(--star-shadow); }
.bonusLabel { flex: 1; padding: 10px 12px; border-radius: 12px; background: var(--bonus-bg); color: var(--bonus-color); }
.hidden { display: none; }

/* Theme toggle button - fixed position (for game pages) */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

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

/* Theme toggle button - inline version (for index page) */
.theme-toggle-inline {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 0;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.theme-toggle-inline:hover {
  background: var(--button-hover);
  transform: scale(1.05);
}

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

.theme-icon {
  display: block;
  line-height: 1;
  pointer-events: none;
}

/* Route Game Specific Styles */

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes borderFlash {
  0%, 100% { border-color: var(--pill-border); }
  50% { border-color: var(--color-green); }
}

/* Map SVG path animations */
#map path {
  /* Removed fadeIn animation - it was distracting */
  transition: fill 0.3s ease, stroke 0.3s ease;
}

.route-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  flex-wrap: wrap;
  transition: all 0.3s ease;
}

.route-country {
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid transparent;
  white-space: nowrap;
  animation: slideIn 0.3s ease-out;
  transition: all 0.2s ease;
}

.route-country:hover {
  transform: translateY(-2px);
}

.route-country.start {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--color-green);
  color: var(--color-green);
}

.route-country.end {
  background: rgba(249, 115, 22, 0.2);
  border-color: var(--color-orange);
  color: var(--color-orange);
}

.route-country.path {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--color-blue);
  color: var(--color-blue);
}

.route-country.optimal-display {
  background: rgba(250, 204, 21, 0.2);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.route-arrow {
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.route-placeholder {
  color: var(--text-muted);
  font-size: 24px;
  padding: 0 10px;
  animation: pulse 2s ease-in-out infinite;
}

.hint-message {
  padding: 12px 16px;
  margin: 16px 0;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  color: #fbbf24;
  font-size: 14px;
  text-align: center;
  animation: slideIn 0.3s ease-out;
}

/* Status message animations */
.status {
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease-out;
}

.status.correct {
  animation: pulse 0.5s ease-out;
}

.status.wrong {
  animation: shake 0.5s ease-out;
}

/* Continue button — shown after wrong answer in outlines game */
button.continue-btn {
  font-weight: 700;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-color);
  cursor: pointer;
}
button.continue-btn:hover {
  background: var(--button-hover);
}

/* Input animations */
.answerRow input {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.answerRow input.correct-flash {
  animation: borderFlash 0.6s ease-out;
}

.answerRow input.shake {
  animation: shake 0.5s ease-out;
}

/* Button hover effects */
button {
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255,255,255,.04) !important;
  border-color: rgba(255,255,255,.08) !important;
  color: var(--text-muted) !important;
}

.btn-secondary:hover {
  background: rgba(255,255,255,.08) !important;
  border-color: rgba(255,255,255,.12) !important;
}

/* Difficulty selector styling */
#difficulty {
  cursor: pointer;
  transition: all 0.2s ease;
}

#difficulty:hover {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#difficulty:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

select option {
  background: var(--card-bg);
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .theme-toggle-inline {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  /* Fill the visual viewport so there is no gap below the game card when the
     keyboard is open. --vvh is set by JS (mobile-autocomplete.js) and tracks
     window.visualViewport.height, which shrinks when keyboard opens. */
  .wrap:not(.find-country-page):not(.rivers-page):not(.mountains-page):not(.study-page):not(.heritage-locate-page) {
    height: var(--vvh, 100svh);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }

  .wrap:not(.find-country-page):not(.rivers-page):not(.mountains-page):not(.study-page):not(.heritage-locate-page) > .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
  }

  /* Map grows to fill space between header and input row */
  .wrap:not(.find-country-page):not(.rivers-page):not(.mountains-page):not(.study-page):not(.heritage-locate-page) .mapwrap {
    flex: 1;
    height: auto;
    min-height: 150px;
    max-height: 350px;
  }

  .wrap:not(.find-country-page):not(.rivers-page):not(.mountains-page):not(.study-page):not(.heritage-locate-page) #map {
    height: 100%;
    width: 100%;
  }

  /* Compact mobile layout for input and buttons */
  .answerRow {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "input submit"
      "buttons buttons";
    gap: 8px;
    width: 100%;
    align-items: center; /* Vertically align input and button */
  }

  .answerRow input {
    grid-area: input;
    font-size: 16px; /* Prevent iOS auto-zoom */
    height: 44px; /* Fixed height */
    padding: 10px 12px;
    box-sizing: border-box; /* Include padding in height calculation */
    line-height: 1.5; /* Explicit line height for consistency */
  }

  .answerRow .status {
    grid-area: input;
    font-size: 14px;
  }

  #submit {
    grid-area: submit;
    height: 44px; /* Match input exactly */
    min-width: 60px; /* Enough for "Add" */
    padding: 10px 16px;
    box-sizing: border-box; /* Include padding in height calculation */
    font-size: 15px;
    white-space: nowrap;
  }

  /* Change "Add to Route" to just "Add" on mobile - ONLY for route game */
  .route-display ~ .answerRow #submit::before {
    content: "Add";
  }

  .route-display ~ .answerRow #submit {
    font-size: 0; /* Hide original text */
  }

  .route-display ~ .answerRow #submit::before {
    font-size: 15px; /* Show replacement text */
    font-weight: 650;
  }

  /* Secondary buttons container - create flex wrapper */
  .secondary-buttons {
    grid-area: buttons;
    display: flex;
    gap: 12px; /* Use flex gap instead of margins */
    width: 100%;
  }

  /* ===============================================
   Picture Guess (UNESCO) - make Hint match Connect icon button
   =============================================== */

  .picture-answerRow #pg-input { grid-area: input; }
  .picture-answerRow #pg-submit-btn { grid-area: submit; }
  .picture-answerRow .secondary-buttons { grid-area: buttons; }

  /* Make the picture hint button look like Connect's #showHint icon button */
  #pg-hint-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 44px;
    padding: 10px;
    box-sizing: border-box;
    font-size: 0;            /* hide text */
    border: 2px solid;
    transition: all 0.2s ease;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
  }

  #pg-hint-btn:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.6);
  }

  #pg-hint-btn::before {
    content: "💡";
    font-size: 22px;
    line-height: 1;
    filter: brightness(1.2) contrast(1.1);
  }

  /* Make sure picture submit matches input height on all sizes */
  #pg-submit-btn,
  #pg-input {
    height: 44px;
    box-sizing: border-box;
  }

  /* Group secondary buttons on one row with icons */
  #undo,
  #showHint,
  #giveUp {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px; /* Fixed height */
    min-width: 44px;
    flex: 1 1 0; /* Equal width distribution */
    padding: 10px;
    box-sizing: border-box; /* Include padding in height */
    font-size: 0; /* Hide text */
    border: 2px solid; /* Thicker border for emphasis */
    transition: all 0.2s ease; /* Smooth hover effect */
  }

  /* Individual button colors and styling */
  #undo {
    background: rgba(59, 130, 246, 0.15); /* Blue background */
    border-color: rgba(59, 130, 246, 0.4);
  }

  #undo:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
  }

  #showHint {
    background: rgba(251, 191, 36, 0.15); /* Gold/yellow background */
    border-color: rgba(251, 191, 36, 0.4);
  }

  #showHint:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.6);
  }

  #giveUp {
    background: rgba(239, 68, 68, 0.15); /* Red background */
    border-color: rgba(239, 68, 68, 0.4);
  }

  #giveUp:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
  }

  /* No margin needed - using flex gap on parent */

  /* Add icons to secondary buttons using ::before */
  #undo::before {
    content: "↶";
    font-size: 24px; /* Larger icon */
    font-weight: 700; /* Bolder */
    line-height: 1;
    color: rgb(59, 130, 246); /* Blue color */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */
  }

  #showHint::before {
    content: "💡";
    font-size: 22px; /* Larger icon */
    line-height: 1;
    filter: brightness(1.2) contrast(1.1); /* Enhance emoji brightness */
  }

  #giveUp::before {
    content: "🏳";
    font-size: 22px; /* Larger icon */
    line-height: 1;
    filter: brightness(1.3) contrast(1.2) drop-shadow(0 0 1px rgba(0,0,0,0.8)); /* Enhanced with dark outline */
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.3); /* Dark outline for white flag */
  }

  /* Alternative: use unicode symbols if emojis don't work well */
  /* Uncomment these if you prefer symbols over emojis
  #showHint::before {
    content: "?";
    font-size: 20px;
    font-weight: 700;
  }

  #giveUp::before {
    content: "✕";
    font-size: 20px;
    font-weight: 400;
  }
  */

  /* Optimize route display for mobile */
  .route-display {
    font-size: 14px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .route-country {
    font-size: 14px;
    padding: 6px 10px;
  }

  .route-arrow {
    font-size: 14px;
  }

  /* Add safe area insets for notched phones */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .wrap {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  /* Mobile autocomplete dropdown — JS positions via fixed; see shared rule below */

  .autocomplete-item {
    padding: 12px 14px;
    color: var(--input-color);
    font-size: 16px;
    border-bottom: 1px solid var(--input-border);
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .autocomplete-item:last-child {
    border-bottom: none;
  }

  .autocomplete-item:active {
    background: var(--button-hover);
  }

  .autocomplete-item mark {
    background: rgba(251, 191, 36, 0.3);
    color: var(--input-color);
    font-weight: 650;
    padding: 2px 0;
  }

  /* Ensure parent container has position: relative */
  .answerRow {
    position: relative;
  }
}

/* Custom autocomplete dropdown - available on all devices */
/* Positioned via position:fixed; JS sets top/left/width/maxHeight dynamically */
.mobile-autocomplete-dropdown {
  position: fixed;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--input-border);
  border-radius: 12px;
  max-height: 40vh; /* CSS fallback; JS overrides */
  min-width: 220px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  -webkit-overflow-scrolling: touch;
}

.autocomplete-item {
  padding: 8px 12px;
  color: var(--input-color);
  font-size: 15px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--input-border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item:active,
.autocomplete-item.highlighted {
  background: var(--button-hover);
}

.autocomplete-item mark {
  background: rgba(251, 191, 36, 0.3);
  color: var(--input-color);
  font-weight: 650;
  padding: 2px 0;
}

/* Mobile specific adjustments */
@media (max-width: 640px) {
  .autocomplete-item {
    padding: 8px 12px;
    font-size: 16px; /* Prevent iOS zoom */
  }
}

/* Desktop Layout Improvements (641px and up) */
@media (min-width: 641px) {
  /* Route game - consistent button heights and compact icon layout */

  /* Fix input and button heights on desktop */
  .answerRow input {
    height: 44px;
    padding: 10px 14px;
    box-sizing: border-box;
    line-height: 1.5;
  }

  .answerRow button {
    height: 44px;
    padding: 10px 16px;
    box-sizing: border-box;
  }

  /* Layout: input, Add button, then icon buttons inline */
  .answerRow {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
  }

  .answerRow input {
    flex: 1 1 300px; /* Grow but maintain min-width */
    min-width: 200px;
  }

  #submit {
    flex: 0 0 auto;
    min-width: 120px; /* Room for "Add to Route" */
  }

  .secondary-buttons {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
  }

  /* Convert secondary buttons to icons on desktop too */
  #undo,
  #showHint,
  #giveUp {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    min-width: 44px;
    width: 44px; /* Fixed square buttons */
    padding: 10px;
    box-sizing: border-box;
    font-size: 0; /* Hide text */
    border: 2px solid;
    transition: all 0.2s ease;
  }

  /* Same color scheme as mobile */
  #undo {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
  }

  #undo:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
    transform: scale(1.05);
  }

  #showHint {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.4);
  }

  #showHint:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.6);
    transform: scale(1.05);
  }

  #giveUp {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
  }

  #giveUp:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    transform: scale(1.05);
  }

  /* Add icons using ::before */
  #undo::before {
    content: "↶";
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: rgb(59, 130, 246);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  }

  #showHint::before {
    content: "💡";
    font-size: 22px;
    line-height: 1;
    filter: brightness(1.2) contrast(1.1);
  }

  #giveUp::before {
    content: "🏳";
    font-size: 22px;
    line-height: 1;
    filter: brightness(1.3) contrast(1.2) drop-shadow(0 0 1px rgba(0,0,0,0.8));
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.3);
  }

  /* Disabled state */
  #undo:disabled,
  #showHint:disabled,
  #giveUp:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
  }

  #undo:disabled:hover,
  #showHint:disabled:hover,
  #giveUp:disabled:hover {
    transform: none;
  }
}

/* Find the Country game - expanded layout with flexbox */
.find-country-page {
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box; /* Include padding in height calculation */
}

.find-country-page .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Important for flexbox overflow */
  box-sizing: border-box; /* Include padding in height calculation */
}

.find-country-page .mapwrap {
  position: relative;
  flex: 1;
  margin: 10px 0;
  min-height: 0; /* Important for flexbox overflow */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.find-country-page #map,
.daily-game-container #dc-map {
  flex: 1;
  max-width: 100%;
  max-height: 100%;
  -webkit-tap-highlight-color: transparent; /* Remove flash on mobile tap */
}


/* Mobile breakpoint */
@media (max-width: 640px) {
  /* No min-height override needed - aspect ratio is preserved by JS */
}

/* Country name overlaid on map — top-left */
.find-country-page .country {
  position: absolute;
  top: 12px;
  left: 12px;
  transform: none;
  z-index: 5;
  white-space: nowrap;
  max-width: calc(100% - 24px);
  text-align: left;
  margin: 0;
  text-shadow: 0 0 4px var(--card-bg), 0 0 8px var(--card-bg), 0 0 12px var(--card-bg);
}

html.light-mode .find-country-page .country {
  color: #1a1a1a;
  text-shadow: 0 0 4px #fff, 0 0 8px #fff, 0 0 12px #fff, 0 0 16px #fff, 0 0 20px #fff;
}

/* ── Heritage Locate page — full-height flex layout (same as find-country) ── */

.heritage-locate-page {
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
}

.heritage-locate-page .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.heritage-locate-page .mapwrap {
  position: relative;
  flex: 1;
  margin: 10px 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
}

.heritage-locate-page #map {
  flex: 1;
  max-width: 100%;
  min-height: 0;
  -webkit-tap-highlight-color: transparent;
}


/* Image overlay panel — clickable, toggles between expanded and collapsed */
.heritage-locate-image-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  max-width: 250px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: max-width 0.25s ease, border-radius 0.25s ease;
}
.heritage-locate-image-panel img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 170px;
  object-fit: cover;
  transition: max-height 0.25s ease;
}
.heritage-locate-image-name {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: padding 0.25s ease, font-size 0.25s ease;
}

/* Expanded state — larger image */
.heritage-locate-image-panel.expanded {
  max-width: 800px;
}
.heritage-locate-image-panel.expanded img {
  max-height: 600px;
}

/* Collapsed state — small thumbnail button */
.heritage-locate-image-panel.collapsed {
  max-width: 48px;
  border-radius: 50%;
}
.heritage-locate-image-panel.collapsed img {
  max-height: 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}
.heritage-locate-image-panel.collapsed .heritage-locate-image-name {
  display: none;
}

/* Result banner */
.heritage-locate-result {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 8px 16px;
  border-radius: 10px;
  border-left: 4px solid #22c55e;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .heritage-locate-image-panel {
    max-width: 170px;
  }
  .heritage-locate-image-panel img {
    max-height: 110px;
  }
  .heritage-locate-image-name {
    font-size: 11px;
    padding: 4px 6px;
  }
  .heritage-locate-image-panel.expanded {
    max-width: 280px;
  }
  .heritage-locate-image-panel.expanded img {
    max-height: 200px;
  }
  .heritage-locate-image-panel.collapsed {
    max-width: 40px;
  }
  .heritage-locate-image-panel.collapsed img {
    max-height: 40px;
    width: 40px;
    height: 40px;
  }
}

/* Find country hint panel */
.find-hint-panel {
  display: none;
  position: absolute;
  bottom: 64px;
  right: 12px;
  width: 240px;
  max-width: calc(100% - 24px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.find-hint-panel.visible { display: block; }

.find-hint-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.find-hint-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.find-hint-close:hover { color: var(--text-primary); }

.find-hint-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.find-hint-list li {
  padding: 4px 0;
  border-bottom: 1px solid var(--card-border);
}
.find-hint-list li:last-child { border-bottom: none; }

/* Rivers / Mountains games - same expanded layout as Find the Country */
.rivers-page,
.mountains-page {
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.rivers-page .card,
.mountains-page .card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.rivers-page .mapwrap,
.mountains-page .mapwrap {
  position: relative;
  flex: 1;
  margin: 10px 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.rivers-page #map,
.mountains-page #map {
  flex: 1;
  max-width: 100%;
  max-height: 100%;
  -webkit-tap-highlight-color: transparent;
}


@media (max-width: 640px) {
  .rivers-page,
  .mountains-page {
    height: 100dvh;
  }
}

/* Geo-features game buttons (Submit / Next) — theme-aware text color */
.geo-submit-btn {
  background: rgba(59,130,246,0.25);
  border-color: rgba(59,130,246,0.6);
  color: #93c5fd;
}
html.light-mode .geo-submit-btn {
  color: #1d4ed8;
}

.geo-next-btn {
  background: rgba(110,231,183,0.2);
  border-color: rgba(110,231,183,0.6);
  color: #6ee7b7;
}
html.light-mode .geo-next-btn {
  color: #047857;
}

.geo-bonus-btn {
  background: rgba(180, 120, 60, 0.2);
  border-color: rgba(180, 120, 60, 0.6);
  color: #cd853f;
}
html.light-mode .geo-bonus-btn {
  color: #92400e;
}

/* Mountains bonus round peak prompt */
.geo-bonus-overlay {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  background: rgba(180, 120, 60, 0.25);
  border: 1.5px solid rgba(180, 120, 60, 0.6);
  border-radius: 12px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 16px;
  color: #cd853f;
  white-space: nowrap;
}
html.light-mode .geo-bonus-overlay {
  background: rgba(146, 64, 14, 0.12);
  border-color: rgba(146, 64, 14, 0.5);
  color: #92400e;
}
.geo-bonus-overlay.correct {
  background: rgba(110, 231, 183, 0.28);
  border-color: rgba(110, 231, 183, 0.8);
  color: #6ee7b7;
}
.geo-bonus-overlay.wrong {
  background: rgba(252, 165, 161, 0.28);
  border-color: rgba(252, 165, 161, 0.8);
  color: #fda4af;
}
html.light-mode .geo-bonus-overlay.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.6);
  color: #047857;
}
html.light-mode .geo-bonus-overlay.wrong {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.55);
  color: #be123c;
}

/* ===============================================
   Picture Guess Game Styles
   =============================================== */

/* Generic picture UI component styles (work in both standalone and Daily Challenge) */
.picture-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--map-bg);
  border: 1px solid var(--map-border);
  box-shadow: 0 4px 16px var(--card-shadow);
}

.picture-container img {
  width: 100%;
  height: auto;
  min-height: 400px;
  max-height: 500px;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.picture-hint-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 2;
}

.picture-hint-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.1);
}

.picture-hint-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.image-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--map-bg);
  z-index: 10;
}

.multiple-choice-section {
  margin: 24px 0;
}

.hint-text {
  font-size: 15px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bonus-bg);
  border-radius: 8px;
}

.status {
  margin: 20px 0;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  font-weight: 500;
}

.answerRow .status {
  flex: 1;
  margin: 0;
  padding: 10px 16px;
  display: none;
  text-align: left;
}

.status.good {
  background: var(--correct-bg);
  border: 1px solid var(--correct-border);
  color: var(--good-color);
}

.status.bad {
  background: var(--wrong-bg);
  border: 1px solid var(--wrong-border);
  color: var(--bad-color);
}

/* Page-specific overrides for standalone picture-guess page */
.picture-guess-page .picture-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--map-bg);
  border: 1px solid var(--map-border);
  box-shadow: 0 4px 16px var(--card-shadow);
}

.picture-guess-page .picture-container img {
  width: 100%;
  height: auto;
  min-height: 400px;
  max-height: 500px;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.picture-guess-page .image-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--map-bg);
  z-index: 10;
}


.picture-guess-page .multiple-choice-section {
  margin: 24px 0;
}

.picture-guess-page .hint-text {
  font-size: 15px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--bonus-bg);
  border-radius: 8px;
}

.picture-guess-page .status {
  margin: 20px 0;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  font-weight: 500;
}

.picture-guess-page .status.good {
  background: var(--correct-bg);
  border: 1px solid var(--correct-border);
  color: var(--good-color);
}

.picture-guess-page .status.bad {
  background: var(--wrong-bg);
  border: 1px solid var(--wrong-border);
  color: var(--bad-color);
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .picture-guess-page .picture-container img {
    min-height: 250px;
    max-height: 350px;
  }

  .picture-guess-page .input-label {
    font-size: 16px;
  }

  .picture-guess-page .country-input {
    font-size: 15px;
    padding: 12px 16px;
  }

  .picture-guess-page .btn-primary {
    font-size: 15px;
    padding: 10px 24px;
  }

  .picture-guess-page .hint-text {
    font-size: 14px;
  }

  .picture-guess-page .status {
    font-size: 14px;
    padding: 12px 16px;
  }
}

/* Update Picture Guess input styling to match other games */
.picture-guess-page .answerRow {
  position: relative; /* For autocomplete dropdown positioning */
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 24px auto;
  max-width: 600px;
}

.picture-guess-page .answerRow input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--input-color);
  transition: all 0.3s;
}

.picture-guess-page .answerRow input:focus {
  outline: none;
  border-color: rgba(165, 180, 252, 0.6);
  background: rgba(165, 180, 252, 0.08);
}

.picture-guess-page .answerRow button {
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 8px;
  color: var(--button-color);
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.picture-guess-page .answerRow button:hover:not(:disabled) {
  background: var(--button-hover);
  transform: translateY(-1px);
}

.picture-guess-page .answerRow button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .picture-guess-page .answerRow {
    gap: 8px;
  }

  .picture-guess-page .answerRow input {
    font-size: 16px; /* Prevent iOS zoom */
    min-width: 0; /* Allow shrinking */
  }

  .picture-guess-page .answerRow button {
    padding: 12px 16px; /* Slightly smaller padding on mobile */
    flex-shrink: 0; /* Don't shrink button */
  }
}

/* ── Place the Cities ──────────────────────────────────────── */

.city-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  justify-content: center;
}

.city-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  color: var(--button-color);
  font-size: 14px;
  font-weight: 500;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: opacity .15s, background .15s, border-color .15s;
}

.city-label:active { cursor: grabbing; }

.city-label.dragging {
  opacity: 0.35;
}

.city-label.placed {
  background: var(--pill-bg);
  border-color: var(--map-selected-stroke);
  opacity: 0.7;
}

.city-label.label-correct {
  border-color: var(--good-color);
  background: var(--correct-bg);
  opacity: 1;
}

.city-label.label-wrong {
  border-color: var(--bad-color);
  background: var(--wrong-bg);
  opacity: 1;
}

.city-label-ghost {
  position: fixed;
  z-index: 9999;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--panel-bg);
  border: 2px solid var(--map-selected-stroke);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  white-space: nowrap;
}

.city-dot {
  fill: var(--map-dot-fill);
  stroke: var(--map-dot-stroke);
  transition: fill .2s;
}

.city-dot-capital {
  fill: var(--star-color);
}

.city-dot.assigned {
  fill: var(--map-selected-fill);
  stroke: var(--map-selected-stroke);
}

.city-dot.nearest {
  fill: #fff;
  stroke: var(--map-selected-stroke);
  stroke-width: 2;
  filter: drop-shadow(0 0 4px var(--map-selected-stroke));
}

.city-dot.correct {
  fill: var(--map-correct-fill);
  stroke: var(--map-correct-stroke);
  stroke-width: 1;
}

.city-dot.wrong {
  fill: var(--map-wrong-fill);
  stroke: var(--map-wrong-stroke);
  stroke-width: 1;
}
