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

:root {
  --bg: #0e0e0e;
  --surface: #161616;
  --ink: #e8e4dc;
  --muted: #555550;
  --accent: #7fff6e;
  --accent-dim: #3a6e35;
  --line: #242420;
  --red: #ff5555;
  --red-dim: #4a2020;
  --gold: #d4a820;
  --gold-dim: #2a2210;
  --sidebar-w: 48px;
  --sidebar-exp: 200px;
  --panel-w: 200px;
}

html { height: 100%; background: #090907; }

body {
  background: transparent;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  height: 100%;
  overflow: hidden;
  zoom: 1.25;
}

::selection { background: var(--accent-dim); color: var(--ink); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); }

.app { display: flex; height: 100%; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  height: 100%; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: width 0.18s ease, min-width 0.18s ease;
  overflow: hidden; z-index: 100;
}
.sidebar:hover {
  width: var(--sidebar-exp); min-width: var(--sidebar-exp);
}

.sidebar-brand {
  height: 48px; display: flex; align-items: center;
  padding: 0 12px; border-bottom: 1px solid var(--line);
  flex-shrink: 0; overflow: hidden; white-space: nowrap; gap: 10px;
}
.brand-mark {
  width: 22px; min-width: 22px; height: 22px;
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.brand-mark::after {
  content: ''; width: 8px; height: 8px; background: var(--accent);
  animation: brandPulse 3s ease-in-out infinite;
}
@keyframes brandPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(127,255,110,0.3); }
  50% { box-shadow: 0 0 12px rgba(127,255,110,0.6); }
}
.brand-text {
  font-weight: 600; font-size: 0.7rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent);
  opacity: 0; transition: opacity 0.18s ease;
}
.sidebar:hover .brand-text { opacity: 1; }

.sidebar-nav { flex: 1; padding: 4px 0; overflow-y: auto; overflow-x: hidden; }

.sidebar-label {
  padding: 12px 12px 4px; font-size: 0.6rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
  opacity: 0; transition: opacity 0.18s ease; white-space: nowrap;
}
.sidebar:hover .sidebar-label { opacity: 1; }

.sidebar-sep { height: 1px; background: var(--line); margin: 4px 8px; }

.sb-item {
  width: 100%; height: 36px; display: flex; align-items: center;
  padding: 0 13px; background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem; text-align: left;
  transition: all 0.12s ease;
  white-space: nowrap; overflow: hidden; position: relative; gap: 10px;
}
.sb-item::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%); width: 2px; height: 0;
  background: var(--accent);
  transition: height 0.12s ease;
}
.sb-item:hover { color: var(--ink); background: rgba(255,255,255,0.03); }
.sb-item.active { color: var(--accent); }
.sb-item.active::before { height: 18px; }

.sb-icon {
  width: 22px; min-width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 600;
  color: var(--muted); border: 1px solid var(--line);
  transition: all 0.12s ease;
}
.sb-item.active .sb-icon { color: var(--accent); border-color: var(--accent-dim); }

.sb-text { opacity: 0; transition: opacity 0.18s ease; }
.sidebar:hover .sb-text { opacity: 1; }

.sb-count {
  margin-left: auto; font-size: 0.6rem;
  color: var(--muted); opacity: 0; transition: opacity 0.18s ease;
}
.sidebar:hover .sb-count { opacity: 1; }

/* ── Sidebar folders ── */
.sb-folder {
  width: 100%; overflow: hidden;
}

.sb-folder-head {
  width: 100%; height: 36px; display: flex; align-items: center;
  padding: 0 13px; background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; font-weight: 600; text-align: left;
  transition: all 0.12s ease;
  white-space: nowrap; overflow: hidden; gap: 10px;
  letter-spacing: 0.05em;
}
.sb-folder-head:hover { color: var(--ink); background: rgba(255,255,255,0.03); }
.sb-folder-head.open { color: var(--ink); }

.sb-folder-arrow {
  width: 22px; min-width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.55rem; color: var(--muted);
  transition: transform 0.15s ease, color 0.12s ease;
}
.sb-folder-head.open .sb-folder-arrow {
  transform: rotate(90deg); color: var(--accent);
}

.sb-folder-name { opacity: 0; transition: opacity 0.18s ease; }
.sidebar:hover .sb-folder-name { opacity: 1; }

.sb-folder-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.2s ease;
}
.sb-folder-body.open {
  max-height: 400px;
}

.sb-folder-body .sb-item {
  padding-left: 13px;
}
.sidebar:hover .sb-folder-body .sb-item {
  padding-left: 24px;
}

.sb-coming-soon {
  padding: 8px 22px; font-size: 0.65rem;
  color: var(--muted); font-style: italic;
  opacity: 0; transition: opacity 0.18s ease;
  white-space: nowrap;
}
.sidebar:hover .sb-coming-soon { opacity: 1; }

/* ── FLAG PANEL ── */
.flag-panel {
  width: var(--panel-w); min-width: var(--panel-w);
  height: 100%;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1rem;
  gap: 0.8rem;
}
.flag-panel.hidden { display: none; }

.flag-panel-img {
  width: 100%; max-width: 170px;
  border: 1.5px solid var(--accent);
  overflow: hidden; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 3/2;
  transition: all 0.15s ease;
}
.flag-panel-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.flag-panel-img.idle { border-color: var(--line); opacity: 0.3; }

.flag-panel-hint {
  font-size: 0.6rem; color: var(--muted);
  text-align: center; letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── MAIN ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; transition: all .18s ease; }

/* ── TOPBAR ── */
.topbar {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(36,36,32,0.4);
  background: rgba(10,10,8,0.5);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
}

.topbar-head {
  display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 0.8rem;
}
.topbar-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.topbar-count { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; }

.topbar-row { display: flex; align-items: center; gap: 0.8rem; }

.controls { display: flex; align-items: center; gap: 0.5rem; flex: 1; }

button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45rem 1rem;
  border: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.2s;
}
button:active { transform: scale(0.96); }

.btn-go {
  background: var(--accent); color: var(--bg);
  font-weight: 600;
  position: relative;
}
.btn-go:hover {
  background: #a0ff90;
  box-shadow: 0 0 20px rgba(127,255,110,0.3), 0 2px 12px rgba(0,0,0,0.3);
}

.btn-skip {
  background: rgba(22,22,20,0.55); color: var(--muted);
  border: 1px solid rgba(36,36,32,0.6);
  backdrop-filter: blur(8px);
}
.btn-skip:hover {
  border-color: var(--muted); color: var(--ink);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.btn-stop {
  background: rgba(22,22,20,0.55); color: var(--red);
  border: 1px solid var(--red-dim);
  backdrop-filter: blur(8px);
}
.btn-stop:hover {
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(255,85,85,0.15);
}

#guessInput {
  height: 32px; flex: 1; max-width: 280px; padding: 0 0.7rem;
  border: 1px solid rgba(36,36,32,0.6);
  border-left: 2px solid var(--accent-dim);
  background: rgba(14,14,12,0.55); color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem; outline: none;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, box-shadow 0.2s, border-left-color 0.15s;
}
#guessInput:focus {
  border-color: var(--accent-dim);
  border-left-color: var(--accent);
  box-shadow: 0 0 16px rgba(127,255,110,0.1);
}
#guessInput::placeholder { color: var(--muted); }

.timer {
  font-size: 1.1rem; font-weight: 600;
  color: var(--accent); letter-spacing: 0.02em;
  min-width: 110px; text-align: right;
  transition: color 0.2s ease;
}
.timer:not(.off) {
  animation: timerGlow 2s ease-in-out infinite;
}
@keyframes timerGlow {
  0%, 100% { text-shadow: 0 0 8px rgba(127,255,110,0.2); }
  50% { text-shadow: 0 0 20px rgba(127,255,110,0.45), 0 0 4px rgba(127,255,110,0.2); }
}
.timer.off { color: var(--muted); }

.result-banner {
  display: none; align-items: center; gap: 0.8rem; margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(36,36,32,0.5);
  border-left: 2px solid var(--accent);
  background: rgba(10,10,8,0.55);
  backdrop-filter: blur(10px);
  font-size: 0.75rem;
}
.result-banner.show {
  display: flex;
  animation: bannerSlide 0.3s ease;
}
@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-text { color: var(--muted); }
.result-text strong { color: var(--ink); font-weight: 600; }
.record-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  background: var(--gold-dim); border: 1px solid var(--gold);
  color: var(--gold); font-weight: 600; font-size: 0.65rem;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ── FLAG GRID ── */
.grid-wrap { flex: 1; overflow-y: auto; padding: 1.2rem 1.5rem; }

.flag-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-width: 1000px;
}
@media (max-width: 1100px) { .flag-grid { grid-template-columns: repeat(7, 1fr); } }
@media (max-width: 900px) { .flag-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 700px) { .flag-grid { grid-template-columns: repeat(5, 1fr); } }

.fc {
  position: relative;
  border: 1px solid rgba(36,36,32,0.6); overflow: hidden;
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.25s ease;
}
.fc:hover {
  border-color: rgba(80,80,72,0.7);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  z-index: 2;
}

.fc-img {
  width: 100%; aspect-ratio: 3/2;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  overflow: hidden;
}
.fc-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity 0.15s ease, transform 0.3s ease;
}
.fc:hover .fc-img img { transform: scale(1.04); }

.fc.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(127,255,110,0.15);
  transform: translateY(-1px);
}

.fc.solved { opacity: 0.65; }
.fc.solved:hover { opacity: 0.9; }
.fc.solved .fc-img img { opacity: 0.3; filter: grayscale(0.5); }
.fc.solved::after {
  content: ''; position: absolute; top: 4px; right: 5px;
  width: 10px; height: 10px;
  border: 1.5px solid var(--accent);
  background: rgba(127,255,110,0.15);
}

.fc-label {
  padding: 3px 4px; font-size: 0.5rem;
  text-align: center; overflow: hidden;
  min-height: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: normal; word-break: break-word;
  line-height: 1.25;
  max-height: 32px;
  background: rgba(0,0,0,0.2);
}
.fc-label.hide { color: transparent; }
.fc:hover .fc-label.hide { color: rgba(85,85,80,0.45); }
.fc-label.ok { color: var(--muted); background: rgba(127,255,110,0.04); }
.fc-label.miss { color: var(--red); font-weight: 600; background: rgba(255,85,85,0.06); }

@keyframes solvedPop {
  0% { box-shadow: 0 0 0 0 rgba(127,255,110,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(127,255,110,0); }
  100% { box-shadow: none; }
}
.fc.pop { animation: solvedPop 0.4s ease; }

/* ── STATISTICS ── */
.stats-wrap { flex: 1; overflow-y: auto; padding: 2rem 1.5rem; }
.stats-wrap h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.5rem; letter-spacing: -0.02em; }

.stats-card {
  border: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: var(--surface);
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, border-left-color 0.2s ease;
}
.stats-card:hover { border-color: var(--muted); }
.stats-card.open { border-left-color: var(--accent); }

.stats-card-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer; user-select: none;
  transition: background 0.12s ease;
}
.stats-card-head:hover { background: rgba(255,255,255,0.02); }

.stats-card-arrow {
  font-size: 0.5rem; color: var(--muted);
  transition: transform 0.2s ease, color 0.15s ease;
  display: inline-block; flex-shrink: 0;
}
.stats-card.open .stats-card-arrow {
  transform: rotate(90deg); color: var(--accent);
}

.stats-card-label {
  font-size: 0.7rem; font-weight: 600; color: var(--ink);
  letter-spacing: -0.01em;
}

.stats-card-count {
  font-size: 0.6rem; color: var(--muted); margin-left: auto;
}

.stats-card-best {
  font-size: 0.6rem; color: var(--gold);
}

.stats-card-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.stats-card.open .stats-card-body {
  max-height: 2000px;
}

.stats-card-content {
  padding: 0 0.8rem 0.8rem;
  border-top: 1px solid var(--line);
}

.stats-entry {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
  opacity: 0; transform: translateX(-8px);
}
.stats-entry:last-child { border-bottom: none; }

.stats-entry.animate {
  animation: clSlideIn 0.2s ease forwards;
}

.stats-card:not(.open) .stats-entry {
  opacity: 0; transform: translateX(-8px); animation: none;
}

.stats-entry.best-entry { background: var(--gold-dim); padding: 0.4rem 0.3rem; margin: 0 -0.3rem; }

.se-rank {
  font-size: 0.55rem; color: var(--muted); min-width: 1.8rem;
}
.se-rank-best { color: var(--gold); }

.se-errors { color: var(--muted); min-width: 72px; }
.se-time { color: var(--accent); font-weight: 600; min-width: 80px; }
.se-date { color: var(--muted); font-size: 0.6rem; margin-left: auto; }
.se-pct { color: var(--ink); font-weight: 600; min-width: 40px; }

.stats-empty-msg {
  font-size: 0.7rem; color: var(--muted); font-style: italic;
  padding: 0.5rem 0;
}

.stats-clear {
  margin-top: 1rem;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.65rem; padding: 0.35rem 0.8rem;
}
.stats-clear:hover { border-color: var(--muted); color: var(--ink); }

/* ── Changelog ── */
.cl-section {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}

.cl-title {
  font-size: 0.65rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 0.8rem;
}

.cl-card {
  border: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: var(--surface);
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, border-left-color 0.2s ease;
}
.cl-card:hover { border-color: var(--muted); }
.cl-card.open { border-left-color: var(--accent); }

.cl-card-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer; user-select: none;
  transition: background 0.12s ease;
}
.cl-card-head:hover { background: rgba(255,255,255,0.02); }

.cl-card-arrow {
  font-size: 0.5rem; color: var(--muted);
  transition: transform 0.2s ease, color 0.15s ease;
  display: inline-block; flex-shrink: 0;
}
.cl-card.open .cl-card-arrow {
  transform: rotate(90deg); color: var(--accent);
}

.cl-card-version {
  font-size: 0.7rem; font-weight: 600; color: var(--ink);
  letter-spacing: -0.01em;
}

.cl-card-date {
  font-size: 0.6rem; color: var(--muted); margin-left: auto;
}

.cl-card-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.cl-card.open .cl-card-body {
  max-height: 600px;
}

.cl-card-content {
  padding: 0 0.8rem 0.8rem;
  border-top: 1px solid var(--line);
}

.cl-item {
  padding: 0.35rem 0;
  font-size: 0.7rem;
  color: var(--ink);
  display: flex; gap: 0.5rem; align-items: baseline;
  opacity: 0; transform: translateX(-8px);
}

.cl-item.animate {
  animation: clSlideIn 0.2s ease forwards;
}

.cl-card:not(.open) .cl-item {
  opacity: 0; transform: translateX(-8px); animation: none;
}

.cl-item-dot {
  color: var(--accent); font-size: 0.55rem; flex-shrink: 0;
  margin-top: 0.1rem;
}

.cl-item-tag {
  font-size: 0.55rem; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.1rem 0.35rem;
  font-weight: 600; flex-shrink: 0;
}
.cl-tag-new { color: var(--accent); background: rgba(127,255,110,0.1); border: 1px solid var(--accent-dim); }
.cl-tag-fix { color: #5bc0de; background: rgba(91,192,222,0.1); border: 1px solid rgba(91,192,222,0.25); }
.cl-tag-design { color: #c8a0ff; background: rgba(200,160,255,0.08); border: 1px solid rgba(200,160,255,0.2); }

@keyframes clSlideIn {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes statsFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Coming soon page ── */
.soon-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.6rem;
  padding: 2rem;
}
.soon-title {
  font-size: 1rem; font-weight: 600; color: var(--ink);
  letter-spacing: -0.02em;
}
.soon-sub {
  font-size: 0.75rem; color: var(--muted);
}

/* ── Login / Auth Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; animation: modalFadeIn 0.2s ease forwards;
}
@keyframes modalFadeIn { to { opacity: 1; } }

.modal-box {
  background: var(--surface); border: 1px solid var(--line);
  padding: 2rem; width: 340px; max-width: 90vw;
  display: flex; flex-direction: column; gap: 1rem;
}

.modal-title {
  font-size: 0.85rem; font-weight: 600; letter-spacing: -0.01em;
}

.modal-field { display: flex; flex-direction: column; gap: 0.3rem; }

.modal-field label {
  font-size: 0.6rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--muted);
}

.modal-field input {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem; padding: 0.5rem 0.7rem;
  outline: none; transition: border-color 0.12s;
}
.modal-field input:focus { border-color: var(--muted); }
.modal-field input::placeholder { color: var(--muted); }

.modal-actions { display: flex; gap: 0.5rem; }

.modal-error {
  font-size: 0.7rem; color: var(--red); min-height: 1.2em;
}

.modal-switch {
  font-size: 0.65rem; color: var(--muted); cursor: pointer;
}
.modal-switch:hover { color: var(--ink); }
.modal-switch span { color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ── User status in sidebar ── */
.sb-user {
  padding: 8px 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; overflow: hidden; white-space: nowrap;
}

.sb-user-dot {
  width: 8px; min-width: 8px; height: 8px; background: var(--accent);
}
.sb-user-dot.offline { background: var(--muted); }

.sb-user-name {
  font-size: 0.7rem; font-weight: 600; color: var(--ink);
  opacity: 0; transition: opacity 0.18s ease;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar:hover .sb-user-name { opacity: 1; }

.sb-user-actions {
  margin-left: auto; display: flex; gap: 4px;
  opacity: 0; transition: opacity 0.18s ease;
}
.sidebar:hover .sb-user-actions { opacity: 1; }

.sb-user-btn {
  background: none; border: none; color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; padding: 2px 4px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.sb-user-btn:hover { color: var(--ink); }

/* ── Leaderboard ── */
.lb-wrap { flex: 1; overflow-y: auto; padding: 2rem 1.5rem; }
.lb-wrap h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.5rem; letter-spacing: -0.02em; }

.lb-card {
  border: 1px solid var(--line);
  border-left: 2px solid transparent;
  background: var(--surface);
  margin-bottom: 4px;
  overflow: hidden;
  transition: border-color 0.15s ease, border-left-color 0.2s ease;
}
.lb-card:hover { border-color: var(--muted); }
.lb-card.open { border-left-color: var(--accent); }

.lb-card-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer; user-select: none;
  transition: background 0.12s ease;
}
.lb-card-head:hover { background: rgba(255,255,255,0.02); }

.lb-card-arrow {
  font-size: 0.5rem; color: var(--muted);
  transition: transform 0.2s ease, color 0.15s ease;
  display: inline-block; flex-shrink: 0;
}
.lb-card.open .lb-card-arrow {
  transform: rotate(90deg); color: var(--accent);
}

.lb-card-label {
  font-size: 0.7rem; font-weight: 600; color: var(--ink);
}

.lb-card-players {
  font-size: 0.6rem; color: var(--muted); margin-left: auto;
}

.lb-card-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.lb-card.open .lb-card-body {
  max-height: 3000px;
}

.lb-card-content {
  padding: 0 0.8rem 0.8rem;
  border-top: 1px solid var(--line);
}

.lb-entry {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
  opacity: 0; transform: translateX(-8px);
}
.lb-entry:last-child { border-bottom: none; }

.lb-entry.animate {
  animation: clSlideIn 0.2s ease forwards;
}

.lb-card:not(.open) .lb-entry {
  opacity: 0; transform: translateX(-8px); animation: none;
}

.lb-rank {
  font-size: 0.65rem; font-weight: 600; min-width: 2rem;
  color: var(--muted);
}
.lb-rank-1 { color: var(--gold); }
.lb-rank-2 { color: #c0c0c0; }
.lb-rank-3 { color: #cd7f32; }

.lb-nick {
  font-weight: 600; color: var(--ink); min-width: 80px;
}

.lb-pct { color: var(--ink); font-weight: 600; min-width: 40px; }
.lb-errors { color: var(--muted); min-width: 65px; }
.lb-time { color: var(--accent); font-weight: 600; min-width: 80px; }
.lb-date { color: var(--muted); font-size: 0.6rem; margin-left: auto; }

.lb-empty {
  font-size: 0.7rem; color: var(--muted); font-style: italic;
  padding: 0.5rem 0;
}

.lb-login-hint {
  font-size: 0.7rem; color: var(--muted);
  margin-bottom: 1rem; padding: 0.6rem 0.8rem;
  border: 1px solid var(--line); background: var(--surface);
}
.lb-login-hint span {
  color: var(--accent); cursor: pointer; text-decoration: underline;
}

/* ── MAP GAME ── */
.map-wrap {
  flex: 1; overflow: hidden; position: relative;
  background: var(--bg); cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.map-wrap:active { cursor: grabbing; }

.map-wrap svg {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
}

.map-wrap svg path.country {
  fill: #1a1a18; stroke: var(--line); stroke-width: 0.3;
  transition: fill 0.2s ease;
  pointer-events: none;
}

.map-wrap svg path.country.highlight {
  fill: #ffffff; stroke: #ffffff; stroke-width: 0.5;
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.3));
}

.map-wrap svg path.country.solved-map {
  fill: var(--accent-dim); stroke: var(--accent-dim); stroke-width: 0.3;
}

.map-wrap svg path.country.solved-map.flash {
  fill: var(--accent); stroke: var(--accent); stroke-width: 0.5;
}

.map-zoom-controls {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 2px; z-index: 10;
}

.map-zoom-btn {
  width: 28px; height: 28px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-family: 'JetBrains Mono', monospace;
  transition: border-color 0.12s;
}
.map-zoom-btn:hover { border-color: var(--muted); }

.map-hint {
  position: absolute; bottom: 12px; left: 12px;
  font-size: 0.6rem; color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase; z-index: 10;
}

/* ── Mode Select Cards ── */
.select-wrap { flex:1; overflow-y:auto; padding:2.5rem 1.5rem; }
.select-header { margin-bottom:2rem; }
.select-title { font-size:1.2rem; font-weight:600; letter-spacing:-.02em; margin-bottom:.3rem; }
.select-sub { font-size:.7rem; color:var(--muted); }

.select-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(160px, 1fr));
  gap:8px; max-width:800px;
}

.select-card {
  background:var(--surface); border:1px solid var(--line);
  padding:1.2rem 1rem; cursor:pointer;
  transition:border-color .15s ease, transform .1s ease;
  display:flex; flex-direction:column; gap:.4rem;
  opacity:0; transform:translateY(10px);
  animation:statsFadeIn .3s ease forwards;
  overflow:hidden;
}
.select-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.select-card:active { transform:scale(.98); }

.select-card-icon {
  font-size:1.5rem; font-weight:600; color:var(--accent);
  letter-spacing:.05em; margin-bottom:.2rem;
}
.select-card-label { font-size:.8rem; font-weight:600; color:var(--ink); }
.select-card-count { font-size:.6rem; color:var(--muted); letter-spacing:.1em; text-transform:uppercase; }
.select-card-best { font-size:.6rem; color:var(--gold); margin-top:.3rem; }

/* ── Section Labels (stats/leaderboard) ── */
.section-label {
  font-size:.6rem; letter-spacing:.15em; text-transform:uppercase;
  color:var(--muted); margin:1.2rem 0 .5rem; padding-bottom:.3rem;
  border-bottom:1px solid var(--line);
}

/* ── MAP GAME ── */
.map-wrap {
  flex:1; overflow:hidden; position:relative;
  background:var(--bg); cursor:grab; user-select:none; -webkit-user-select:none;
}
.map-wrap:active { cursor:grabbing; }
.map-wrap svg { position:absolute; top:0; left:0; width:100%; height:100%; }
.map-wrap svg path.country {
  fill:transparent; stroke:transparent; stroke-width:0; pointer-events:none;
}
.map-wrap svg path.country.in-mode {
  fill:#1c1c1a; stroke:#484840; stroke-width:0.4;
  transition:fill .2s ease, stroke .2s ease;
}
.map-wrap svg path.country.highlight {
  fill:#ffffff; stroke:#ffffff; stroke-width:0.5;
  filter:drop-shadow(0 0 6px rgba(255,255,255,0.4));
}
.map-wrap svg path.country.solved-map {
  fill:var(--accent-dim); stroke:var(--accent); stroke-width:0.3;
}
.map-wrap svg path.country.solved-map.flash {
  fill:var(--accent); stroke:var(--accent); stroke-width:0.6;
  filter:drop-shadow(0 0 6px rgba(127,255,110,0.5));
}
.map-zoom-controls {
  position:absolute; bottom:12px; right:12px;
  display:flex; flex-direction:column; gap:2px; z-index:10;
}
.map-zoom-btn {
  width:28px; height:28px; background:var(--surface); border:1px solid var(--line);
  color:var(--ink); font-size:1rem; font-weight:600;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  font-family:'JetBrains Mono',monospace; transition:border-color .12s;
}
.map-zoom-btn:hover { border-color:var(--muted); }
.map-hint {
  position:absolute; bottom:12px; left:12px; font-size:.6rem; color:var(--muted);
  letter-spacing:.1em; text-transform:uppercase; z-index:10;
}

/* ── Nested Accordion Groups (Stats/Leaderboard) ── */
.nested-group {
  border:1px solid var(--line); border-left:2px solid transparent;
  background:var(--surface);
  margin-bottom:4px; overflow:hidden;
  transition:border-color .15s ease, border-left-color .2s ease;
}
.nested-group:hover { border-color:var(--muted); }
.nested-group.open { border-left-color:var(--accent); }

.nested-group-head {
  display:flex; align-items:center; gap:.6rem;
  padding:.7rem .8rem; cursor:pointer; user-select:none;
  transition:background .12s ease;
}
.nested-group-head:hover { background:rgba(255,255,255,.02); }

.nested-group-arrow {
  font-size:.55rem; color:var(--muted);
  transition:transform .2s ease, color .15s ease;
  display:inline-block; flex-shrink:0;
}
.nested-group.open .nested-group-arrow {
  transform:rotate(90deg); color:var(--accent);
}

.nested-group-label {
  font-size:.75rem; font-weight:600; color:var(--ink);
  letter-spacing:.02em;
}

.nested-group-count {
  font-size:.6rem; color:var(--muted); margin-left:auto;
}

.nested-group-body {
  max-height:0; overflow:hidden;
  transition:max-height .3s ease;
  padding:0 .5rem;
}
.nested-group.open .nested-group-body {
  max-height:3000px;
  padding:.3rem .5rem .5rem;
}

/* Cards inside nested groups need less margin */
.nested-group-body .stats-card,
.nested-group-body .lb-card {
  margin-bottom:3px;
}

/* ── Sidebar NEW Badge ── */
.sb-badge {
  display:inline-block; margin-left:.4rem;
  font-size:.45rem; font-weight:600;
  letter-spacing:.1em; text-transform:uppercase;
  padding:1px 4px; color:var(--gold);
  border:1px solid var(--gold); background:var(--gold-dim);
  vertical-align:middle; line-height:1.4;
}

/* ── GeoGuessr Category Cards ── */
.geo-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
  gap:8px; max-width:100%;
}

.geo-card {
  background:var(--surface); border:1px solid var(--line);
  border-left:2px solid transparent;
  padding:1.1rem; display:flex; flex-direction:column; gap:.8rem;
  transition:border-color .2s ease, border-left-color .2s ease, box-shadow .25s ease, transform .15s ease;
  opacity:0; transform:translateY(10px);
  animation:statsFadeIn .3s ease forwards;
  overflow:hidden;
}
.geo-card[data-cat] {
  background-repeat:no-repeat;
  background-position:right -10px bottom -10px;
  background-size:120px 120px;
}
.geo-card[data-cat='bollards'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect x='18' y='18' width='14' height='48' rx='7' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cline x1='18' y1='30' x2='32' y2='30' stroke='%232e2e2b' stroke-width='3'/%3E%3Crect x='48' y='22' width='14' height='48' rx='7' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cline x1='48' y1='34' x2='62' y2='34' stroke='%232e2e2b' stroke-width='3'/%3E%3C/svg%3E");
}
.geo-card[data-cat='buildings'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect x='15' y='20' width='50' height='55' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Crect x='22' y='28' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='36' y='28' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='50' y='28' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='22' y='44' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='36' y='44' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='50' y='44' width='10' height='10' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Crect x='30' y='58' width='20' height='17' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}
.geo-card[data-cat='cars'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M8 52 L8 44 L24 32 L56 32 L72 44 L72 52 Z' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cpath d='M24 32 L28 20 L52 20 L56 32' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='22' cy='53' r='8' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='58' cy='53' r='8' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3C/svg%3E");
}
.geo-card[data-cat='chevrons'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpolyline points='10,20 30,40 10,60' stroke='%232e2e2b' stroke-width='3.5' fill='none' stroke-linejoin='round'/%3E%3Cpolyline points='28,20 48,40 28,60' stroke='%232e2e2b' stroke-width='3.5' fill='none' stroke-linejoin='round'/%3E%3Cpolyline points='46,20 66,40 46,60' stroke='%232e2e2b' stroke-width='3.5' fill='none' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.geo-card[data-cat='coverage'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect x='8' y='28' width='45' height='30' rx='4' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='30' cy='43' r='10' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='30' cy='43' r='4' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Cpolyline points='53,34 70,24 70,58 53,50' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.geo-card[data-cat='driving'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M5 76 L32 10 L48 10 L75 76' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cline x1='40' y1='62' x2='40' y2='22' stroke='%232e2e2b' stroke-width='2' stroke-dasharray='5,4'/%3E%3Cpolyline points='34,30 40,18 46,30' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.geo-card[data-cat='flora'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpolygon points='40,10 62,48 18,48' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cpolygon points='40,26 60,58 20,58' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Crect x='35' y='58' width='10' height='15' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3C/svg%3E");
}
.geo-card[data-cat='googlecar'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M8 55 L8 47 L24 35 L56 35 L72 47 L72 55 Z' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cpath d='M24 35 L28 23 L52 23 L56 35' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='22' cy='56' r='7' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Ccircle cx='58' cy='56' r='7' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Crect x='32' y='15' width='16' height='8' rx='2' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Ccircle cx='40' cy='19' r='2' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}
.geo-card[data-cat='guardrails'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='5' y1='32' x2='75' y2='32' stroke='%232e2e2b' stroke-width='4'/%3E%3Cline x1='5' y1='42' x2='75' y2='42' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='15' y1='28' x2='15' y2='70' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='35' y1='28' x2='35' y2='70' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='55' y1='28' x2='55' y2='70' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='75' y1='28' x2='75' y2='70' stroke='%232e2e2b' stroke-width='3'/%3E%3C/svg%3E");
}
.geo-card[data-cat='language'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpolyline points='40,12 62,68 54,68 40,30 26,68 18,68 40,12' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cline x1='28' y1='50' x2='52' y2='50' stroke='%232e2e2b' stroke-width='3'/%3E%3C/svg%3E");
}
.geo-card[data-cat='plates'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect x='8' y='24' width='64' height='37' rx='4' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Crect x='12' y='28' width='56' height='29' rx='2' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Cline x1='18' y1='38' x2='28' y2='38' stroke='%232e2e2b' stroke-width='4'/%3E%3Cline x1='18' y1='46' x2='28' y2='46' stroke='%232e2e2b' stroke-width='4'/%3E%3Cline x1='33' y1='33' x2='33' y2='52' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='36' y1='38' x2='48' y2='38' stroke='%232e2e2b' stroke-width='4'/%3E%3Cline x1='36' y1='33' x2='48' y2='33' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='36' y1='52' x2='48' y2='52' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='52' y1='33' x2='62' y2='33' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='62' y1='33' x2='62' y2='52' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='52' y1='52' x2='62' y2='52' stroke='%232e2e2b' stroke-width='3.5'/%3E%3C/svg%3E");
}
.geo-card[data-cat='milestones'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M24 75 L24 35 Q24 15 40 15 Q56 15 56 35 L56 75 Z' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cline x1='30' y1='46' x2='50' y2='46' stroke='%232e2e2b' stroke-width='2'/%3E%3Cline x1='30' y1='54' x2='50' y2='54' stroke='%232e2e2b' stroke-width='2'/%3E%3Cline x1='30' y1='62' x2='50' y2='62' stroke='%232e2e2b' stroke-width='2'/%3E%3C/svg%3E");
}
.geo-card[data-cat='other'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='28' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cpolygon points='40,16 43,36 40,33 37,36' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Cpolygon points='64,40 44,43 47,40 44,37' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Cpolygon points='40,64 37,44 40,47 43,44' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Cpolygon points='16,40 36,37 33,40 36,43' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3Ccircle cx='40' cy='40' r='3' stroke='%232e2e2b' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}
.geo-card[data-cat='poles'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='40' y1='8' x2='40' y2='76' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='16' y1='20' x2='64' y2='20' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='22' y1='32' x2='58' y2='32' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='16' y1='20' x2='12' y2='38' stroke='%232e2e2b' stroke-width='2' stroke-dasharray='2,3'/%3E%3Cline x1='64' y1='20' x2='68' y2='38' stroke='%232e2e2b' stroke-width='2' stroke-dasharray='2,3'/%3E%3Cline x1='22' y1='32' x2='18' y2='50' stroke='%232e2e2b' stroke-width='2' stroke-dasharray='2,3'/%3E%3Cline x1='58' y1='32' x2='62' y2='50' stroke='%232e2e2b' stroke-width='2' stroke-dasharray='2,3'/%3E%3C/svg%3E");
}
.geo-card[data-cat='signposts'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='40' y1='8' x2='40' y2='76' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cpath d='M40 22 L63 22 L71 31 L63 40 L40 40 Z' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cpath d='M40 46 L17 46 L9 54 L17 62 L40 62 Z' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.geo-card[data-cat='streetmarkings'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='5' y1='28' x2='75' y2='28' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='5' y1='52' x2='75' y2='52' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='8' y1='40' x2='20' y2='40' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='28' y1='40' x2='40' y2='40' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='48' y1='40' x2='60' y2='40' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cline x1='68' y1='40' x2='76' y2='40' stroke='%232e2e2b' stroke-width='3.5'/%3E%3C/svg%3E");
}
.geo-card[data-cat='streetname'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='40' y1='52' x2='40' y2='76' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Crect x='8' y='18' width='64' height='32' rx='3' stroke='%232e2e2b' stroke-width='3' fill='none'/%3E%3Cline x1='16' y1='29' x2='64' y2='29' stroke='%232e2e2b' stroke-width='3'/%3E%3Cline x1='16' y1='38' x2='52' y2='38' stroke='%232e2e2b' stroke-width='3'/%3E%3C/svg%3E");
}
.geo-card[data-cat='streetsign'] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cline x1='40' y1='62' x2='40' y2='76' stroke='%232e2e2b' stroke-width='3.5'/%3E%3Cpolygon points='40,12 68,60 12,60' stroke='%232e2e2b' stroke-width='3' fill='none' stroke-linejoin='round'/%3E%3Cpolygon points='40,22 62,58 18,58' stroke='%232e2e2b' stroke-width='2' fill='none' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.geo-card:hover {
  border-color:rgba(80,80,72,0.6); border-left-color:var(--accent);
  transform:translateY(-2px);
  box-shadow:0 6px 24px rgba(0,0,0,0.3);
}

.geo-card-top {
  display:flex; gap:.8rem; align-items:flex-start;
}

.geo-card-icon {
  width:36px; min-width:36px; height:36px;
  border:1px solid var(--line); background:var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-size:.6rem; font-weight:600; color:var(--accent);
  letter-spacing:.05em;
  transition:border-color .2s ease, box-shadow .2s ease;
}
.geo-card:hover .geo-card-icon {
  border-color:var(--accent-dim);
  box-shadow:0 0 12px rgba(127,255,110,0.12);
}

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

.geo-card-label {
  font-size:.75rem; font-weight:600; color:var(--ink);
  margin-bottom:.2rem;
}

.geo-card-desc {
  font-size:.6rem; color:var(--muted); line-height:1.5;
}

.geo-card-actions {
  display:flex; gap:4px;
}

.geo-btn {
  flex:1; padding:.4rem .6rem;
  font-family:'JetBrains Mono',monospace;
  font-size:.6rem; font-weight:600;
  letter-spacing:.1em; text-transform:uppercase;
  cursor:pointer; transition:all .12s ease; border:none;
}
.geo-btn:active { transform:scale(.97); }

.geo-btn-quiz {
  background:var(--accent); color:var(--bg);
}
.geo-btn-quiz:hover { background:#a0ff90; }

.geo-btn-info {
  background:var(--bg); color:var(--muted);
  border:1px solid var(--line);
}
.geo-btn-info:hover { border-color:var(--muted); color:var(--ink); }

/* ── Mode Select Centered Grid ── */
.select-grid-center {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:10px; max-width:900px; margin:0 auto;
}

/* Override old select-grid if still referenced */
.select-wrap {
  flex:1; overflow-y:auto; padding:3rem 2rem;
  display:flex; flex-direction:column; align-items:center;
}
.select-header { margin-bottom:2rem; text-align:center; }
.select-title { font-size:1.4rem; font-weight:600; letter-spacing:-.03em; margin-bottom:.4rem; }
.select-sub { font-size:.7rem; color:var(--muted); }

.select-card {
  background:var(--surface); border:1px solid var(--line);
  border-left:2px solid transparent;
  padding:1.6rem 1.2rem; cursor:pointer;
  transition:border-color .2s ease, border-left-color .2s ease, transform .15s ease, box-shadow .3s ease;
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:.5rem;
  opacity:0; transform:translateY(10px);
  animation:statsFadeIn .3s ease forwards;
  overflow:hidden;
  position:relative;
}
.select-card::before {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse at 50% 0%, rgba(127,255,110,0.04) 0%, transparent 70%);
  opacity:0; transition:opacity .3s ease;
  pointer-events:none;
}
.select-card:hover::before { opacity:1; }
.select-card:hover {
  border-color:var(--accent); border-left-color:var(--accent);
  transform:translateY(-3px);
  box-shadow:0 8px 28px rgba(0,0,0,0.35), 0 0 20px rgba(127,255,110,0.06);
}
.select-card:active { transform:scale(.98); }
.select-card-icon {
  font-size:1.8rem; font-weight:600; color:var(--accent);
  letter-spacing:.05em; margin-bottom:.3rem;
  text-shadow:0 0 30px rgba(127,255,110,0.2);
}

/* ── Continent Card Background Patterns (generated via makeContBg in app.js) ── */
.select-card[data-continent] {
  background-repeat:no-repeat;
  background-position:right -15px bottom -15px;
  background-size:140px 140px;
}
.select-card-label { font-size:.8rem; font-weight:600; color:var(--ink); }
.select-card-count { font-size:.6rem; color:var(--muted); letter-spacing:.1em; text-transform:uppercase; }
.select-card-best { font-size:.6rem; color:var(--gold); margin-top:.2rem; }

/* ── Compact Stat/LB Entries (uses cl-item base) ── */
.stat-rank { font-size:.6rem; color:var(--muted); min-width:1.8rem; flex-shrink:0; }
.stat-rank-best { color:var(--gold); }
.stat-pct { font-size:.7rem; font-weight:600; color:var(--ink); min-width:2.5rem; }
.stat-detail { font-size:.65rem; color:var(--muted); flex:1; }
.stat-date { font-size:.6rem; color:var(--muted); margin-left:auto; }
.stat-best-item { background:var(--gold-dim); padding:.35rem .4rem; margin:0 -.4rem; }
.lb-nick { font-size:.7rem; font-weight:600; color:var(--ink); min-width:5rem; }
.lb-rank-1 { color:var(--gold); }
.lb-rank-2 { color:#c0c0c0; }
.lb-rank-3 { color:#cd7f32; }

/* ── GeoGuessr Info Modal ── */
.geo-info-modal {
  background:var(--surface); border:1px solid var(--line);
  width:460px; max-width:90vw; max-height:80vh;
  display:flex; flex-direction:column;
  animation:modalSlideIn .2s ease forwards;
}
@keyframes modalSlideIn {
  from { opacity:0; transform:translateY(12px) scale(.97); }
  to { opacity:1; transform:translateY(0) scale(1); }
}

.geo-info-header {
  display:flex; align-items:center; gap:.8rem;
  padding:1rem 1.2rem; border-bottom:1px solid var(--line);
}
.geo-info-icon {
  width:32px; height:32px; border:1px solid var(--line); background:var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-size:.6rem; font-weight:600; color:var(--accent); flex-shrink:0;
}
.geo-info-title { font-size:.85rem; font-weight:600; color:var(--ink); flex:1; }
.geo-info-close {
  width:28px; height:28px; background:none; border:1px solid var(--line);
  color:var(--muted); font-size:1.1rem; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  font-family:'JetBrains Mono',monospace;
  transition:border-color .12s, color .12s;
}
.geo-info-close:hover { border-color:var(--muted); color:var(--ink); }

.geo-info-body {
  padding:1.2rem; overflow-y:auto; flex:1;
}
.geo-info-wip {
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:.8rem; padding:1.5rem 0;
}
.geo-info-wip-tag {
  font-size:.55rem; font-weight:600; letter-spacing:.15em; text-transform:uppercase;
  padding:.2rem .6rem; border:1px solid var(--gold); color:var(--gold); background:var(--gold-dim);
}
.geo-info-wip p {
  font-size:.7rem; color:var(--muted); line-height:1.6; max-width:320px;
}
.geo-info-wip p strong { color:var(--ink); }

/* ── Run Cards (Stats + Leaderboard entries) ── */
.run-card-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
  gap:6px; padding-top:.5rem;
  transition:all .18s ease;
}

.run-card {
  background:var(--bg); border:1px solid var(--line);
  border-left:2px solid transparent;
  display:flex; gap:.6rem; padding:.6rem .7rem;
  opacity:0; transform:translateX(-8px);
  transition:border-color .15s, box-shadow .2s, transform .15s, border-left-color .15s;
}
.run-card:hover {
  border-color:var(--muted);
  transform:translateY(-1px);
  box-shadow:0 4px 14px rgba(0,0,0,0.25);
}
.run-card.animate { animation:clSlideIn .2s ease forwards; }
.run-card:not(.animate) { opacity:0; transform:translateX(-8px); }

.run-card-best { border-color:var(--gold); border-left-color:var(--gold); background:var(--gold-dim); }
.run-card-top { border-color:var(--accent-dim); border-left-color:var(--accent); }

.run-card-rank {
  font-size:.65rem; font-weight:600; color:var(--muted);
  min-width:2rem; display:flex; align-items:center;
}
.run-card-rank-top { color:var(--accent); }

.run-card-body { flex:1; display:flex; flex-direction:column; gap:.2rem; }

.run-card-row { display:flex; justify-content:space-between; align-items:baseline; }

.run-card-pct { font-size:.8rem; font-weight:600; color:var(--ink); }
.run-card-score { font-size:.6rem; color:var(--muted); }
.run-card-nick { font-size:.75rem; font-weight:600; color:var(--ink); }
.run-card-time { font-size:.7rem; font-weight:600; color:var(--accent); }
.run-card-errors { font-size:.6rem; color:var(--muted); }
.run-card-date { font-size:.55rem; color:var(--muted); }

/* ── Smooth grid resize when sidebar opens ── */
.run-card-grid, .select-grid-center, .geo-grid, .flag-grid {
  transition: all .18s ease;
}

/* ── GeoGuessr Info Modal — Carousel ── */
.geo-info-modal {
  width:520px; max-width:92vw; max-height:85vh;
}

.geo-carousel {
  margin-bottom:1rem;
}

.geo-carousel-view {
  display:flex; align-items:center; gap:0;
  background:var(--bg); border:1px solid var(--line);
  position:relative;
}

.geo-carousel-img {
  flex:1; display:flex; align-items:center; justify-content:center;
  min-height:240px; overflow:hidden;
}
.geo-carousel-img img {
  max-width:100%; max-height:300px; object-fit:contain;
  display:block;
}

.geo-carousel-placeholder {
  font-size:.7rem; color:var(--muted); font-style:italic;
  padding:3rem 1rem; text-align:center;
}

.geo-carousel-arrow {
  width:36px; min-width:36px; height:100%; min-height:240px;
  background:var(--surface); border:none;
  color:var(--ink); font-size:.8rem;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:background .12s, color .12s;
  font-family:'JetBrains Mono',monospace;
}
.geo-carousel-arrow:hover { background:rgba(255,255,255,.05); }
.geo-carousel-arrow.disabled {
  color:var(--line); cursor:default;
  pointer-events:none;
}

.geo-carousel-dots {
  display:flex; justify-content:center; gap:5px;
  padding:.5rem 0;
}
.geo-dot {
  width:6px; height:6px; background:var(--line);
  display:inline-block; transition:background .15s;
}
.geo-dot.active { background:var(--accent); }

/* ── Info Text ── */
.geo-info-text {
  font-size:.75rem; line-height:1.7; color:var(--ink);
}
.geo-info-text p { margin-bottom:.6rem; }
.geo-info-text strong { color:var(--accent); font-weight:600; }
.geo-info-text .geo-info-wip-tag {
  display:inline-block; margin-bottom:.8rem;
  font-size:.55rem; font-weight:600; letter-spacing:.15em; text-transform:uppercase;
  padding:.2rem .6rem; border:1px solid var(--gold); color:var(--gold); background:var(--gold-dim);
}

/* ── GeoGuessr Carousel + Info Text ── */
.geo-carousel { margin-bottom:1rem; }

.geo-carousel-view {
  display:flex; align-items:center; gap:0;
  background:var(--bg); border:1px solid var(--line);
  position:relative;
}

.geo-carousel-img {
  flex:1; display:flex; align-items:center; justify-content:center;
  min-height:240px; max-height:360px; overflow:hidden;
}
.geo-carousel-img img {
  max-width:100%; max-height:340px; object-fit:contain;
  display:block;
}

.geo-carousel-placeholder {
  font-size:.7rem; color:var(--muted); font-style:italic;
  padding:2rem;
}

.geo-carousel-arrow {
  width:36px; min-width:36px; height:100%; min-height:240px;
  background:var(--surface); border:none;
  color:var(--ink); font-size:.8rem;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:background .12s, color .12s;
  font-family:'JetBrains Mono',monospace;
}
.geo-carousel-arrow:hover { background:rgba(255,255,255,.05); }
.geo-carousel-arrow.disabled {
  color:var(--line); cursor:default;
  pointer-events:none;
}
.geo-arrow-left { border-right:1px solid var(--line); }
.geo-arrow-right { border-left:1px solid var(--line); }

.geo-carousel-dots {
  display:flex; justify-content:center; gap:6px;
  padding:.6rem 0;
}
.geo-dot {
  width:6px; height:6px; background:var(--line);
  display:inline-block; transition:background .15s;
}
.geo-dot.active { background:var(--accent); }

.geo-info-text {
  font-size:.75rem; color:var(--ink); line-height:1.7;
  padding:.5rem 0;
}
.geo-info-text p { margin-bottom:.6rem; }
.geo-info-text strong { color:var(--accent); font-weight:600; }

/* Wider modal for carousel */
.geo-info-modal { width:560px; max-width:92vw; }

/* ── GeoGuessr Entry List ── */
.geo-info-count {
  font-size:.6rem; color:var(--muted); margin-left:auto; margin-right:.5rem;
}

.geo-info-empty {
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:.8rem; padding:2rem 0;
}
.geo-info-empty p { font-size:.7rem; color:var(--muted); line-height:1.6; }
.geo-info-empty p strong { color:var(--ink); }

.geo-entry-list {
  display:flex; flex-direction:column; gap:2px;
}

.geo-entry-item {
  display:flex; align-items:center; gap:.7rem;
  padding:.5rem .6rem; cursor:pointer;
  border:1px solid var(--line); background:var(--bg);
  transition:border-color .12s, background .12s;
  opacity:0; transform:translateX(-8px);
  animation:clSlideIn .2s ease forwards;
}
.geo-entry-item:hover { border-color:var(--muted); background:var(--surface); }

.geo-entry-thumb {
  width:36px; height:24px; min-width:36px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.geo-entry-thumb img { max-width:100%; max-height:100%; object-fit:contain; }
.geo-entry-no-img { font-size:.6rem; color:var(--muted); }

.geo-entry-name {
  font-size:.7rem; font-weight:600; color:var(--ink); flex:1;
}

.geo-entry-arrow {
  font-size:.5rem; color:var(--muted);
  transition:color .12s;
}
.geo-entry-item:hover .geo-entry-arrow { color:var(--accent); }

/* ── GeoGuessr Detail View ── */
.geo-back-btn {
  background:none; border:1px solid var(--line); color:var(--muted);
  font-family:'JetBrains Mono',monospace;
  font-size:.6rem; letter-spacing:.1em; text-transform:uppercase;
  padding:.3rem .7rem; cursor:pointer; margin-bottom:.8rem;
  transition:border-color .12s, color .12s;
}
.geo-back-btn:hover { border-color:var(--muted); color:var(--ink); }

.geo-detail-title {
  font-size:.85rem; font-weight:600; color:var(--ink);
  margin-bottom:.8rem; letter-spacing:-.01em;
}

/* ── GeoGuessr Split Modal ── */
.geo-modal-split {
  background:var(--surface); border:1px solid var(--line);
  width:820px; max-width:92vw; height:520px; max-height:85vh;
  display:flex; flex-direction:column;
  animation:modalSlideIn .2s ease forwards;
}

.geo-modal-header {
  display:flex; align-items:center; gap:.6rem;
  padding:.7rem 1rem; border-bottom:1px solid var(--line);
  flex-shrink:0;
}

.geo-modal-content {
  display:flex; flex:1; overflow:hidden;
}

/* ── Left Panel: Search + List ── */
.geo-modal-left {
  width:220px; min-width:220px; border-right:1px solid var(--line);
  display:flex; flex-direction:column;
}

.geo-search {
  width:100%; padding:.5rem .7rem; border:none;
  border-bottom:1px solid var(--line);
  background:var(--bg); color:var(--ink);
  font-family:'JetBrains Mono',monospace;
  font-size:.7rem; outline:none;
}
.geo-search::placeholder { color:var(--muted); }
.geo-search:focus { background:var(--surface); }

.geo-list-scroll {
  flex:1; overflow-y:auto; overflow-x:hidden;
}

.geo-list-item {
  display:flex; align-items:center; gap:.6rem;
  padding:.45rem .7rem; cursor:pointer;
  border-bottom:1px solid var(--line);
  transition:background .1s;
  opacity:0; animation:clSlideIn .15s ease forwards;
}
.geo-list-item:hover { background:rgba(255,255,255,.03); }
.geo-list-item.active {
  background:var(--bg); border-left:2px solid var(--accent);
}

.geo-list-flag {
  width:28px; min-width:28px; height:18px;
  display:flex; align-items:center; justify-content:center;
}
.geo-list-flag img { max-width:100%; max-height:100%; object-fit:contain; }

.geo-list-name {
  font-size:.7rem; color:var(--ink); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis;
}

/* ── Right Panel: Info Card ── */
.geo-modal-right {
  flex:1; display:flex; flex-direction:column;
  padding:1rem; overflow-y:auto;
}

.geo-right-empty {
  flex:1; display:flex; align-items:center; justify-content:center;
  font-size:.7rem; color:var(--muted); font-style:italic;
  flex-direction:column; gap:.5rem;
}

.geo-right-title {
  font-size:.85rem; font-weight:600; color:var(--ink);
  margin-bottom:.8rem; letter-spacing:-.01em;
}

.geo-right-card {
  flex:1; display:flex; flex-direction:column; gap:.7rem;
}

.geo-right-imgbox {
  background:var(--bg); border:1px solid var(--line);
  display:flex; align-items:center; justify-content:center;
  min-height:180px; max-height:260px; overflow:hidden;
}
.geo-right-imgbox img {
  max-width:100%; max-height:260px; object-fit:contain; display:block;
}

.geo-right-text {
  font-size:.75rem; line-height:1.7; color:var(--ink);
  border:1px solid var(--line); background:var(--bg);
  padding:.8rem; flex:1; min-height:60px;
}
.geo-right-text strong { color:var(--accent); }

/* ── Slide Navigation ── */
.geo-right-nav {
  display:flex; align-items:center; justify-content:center;
  gap:1rem; padding:.6rem 0 .2rem;
}

.geo-nav-arrow {
  width:36px; height:36px; background:var(--bg);
  border:1px solid var(--line); color:var(--ink);
  font-size:1rem; display:flex; align-items:center;
  justify-content:center; cursor:pointer;
  font-family:'JetBrains Mono',monospace;
  transition:border-color .12s, color .12s;
}
.geo-nav-arrow:hover { border-color:var(--accent); color:var(--accent); }
.geo-nav-arrow.disabled {
  color:var(--line); cursor:default; pointer-events:none;
}

.geo-nav-counter {
  font-size:.65rem; color:var(--muted); min-width:3rem; text-align:center;
}

/* ═══════════ GEOQUIZ ═══════════ */
.gq-wrap {
  flex:1; overflow-y:auto; display:flex; flex-direction:column; align-items:center;
  padding:1.5rem 1rem; gap:1rem;
}
.gq-ready { display:flex; flex-direction:column; align-items:center; gap:1rem; padding:3rem 1rem; opacity:.6; }
.gq-ready-icon { font-size:2.5rem; font-weight:700; color:var(--accent); font-family:'JetBrains Mono',monospace; }
.gq-ready-text { font-size:.75rem; color:var(--muted); }
.gq-progress { width:100%; max-width:560px; display:flex; align-items:center; gap:.7rem; }
.gq-progress-text { font-size:.7rem; color:var(--muted); font-family:'JetBrains Mono',monospace; white-space:nowrap; min-width:4rem; }
.gq-progress-bar { flex:1; height:4px; background:var(--line); border-radius:2px; overflow:hidden; }
.gq-progress-fill { height:100%; background:var(--accent); border-radius:2px; transition:width .3s ease; }
.gq-image-box { width:100%; max-width:560px; aspect-ratio:16/10; background:var(--bg); border:1px solid var(--line); border-radius:0; overflow:hidden; display:flex; align-items:center; justify-content:center; transition:border-color .15s ease, box-shadow .15s ease; }
.gq-image-box img { width:100%; height:100%; object-fit:contain; }
.gq-image-box.gq-flash-correct { border-color:var(--accent); box-shadow:0 0 20px rgba(180,255,160,.25); animation:gqFlash .35s ease; }
@keyframes gqFlash { 0%{border-color:var(--accent);box-shadow:0 0 30px rgba(180,255,160,.4)} 100%{border-color:var(--line);box-shadow:none} }
.gq-hint { font-size:.6rem; color:var(--muted); letter-spacing:.08em; text-transform:uppercase; }
.gq-summary { width:100%; max-width:600px; }
.gq-summary-title { font-size:.7rem; color:var(--muted); text-transform:uppercase; letter-spacing:.1em; margin-bottom:.8rem; }
.gq-summary-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:.5rem; }
.gq-summary-item { display:flex; align-items:center; gap:.6rem; padding:.45rem .6rem; border-radius:0; border-left:3px solid transparent; background:var(--surface); animation:statsFadeIn .25s ease backwards; cursor:pointer; transition:background .15s ease, transform .1s ease; }
.gq-summary-item:hover { background:var(--line); transform:translateX(3px); }
.gq-summary-item.correct { border-left-color:var(--accent); }
.gq-summary-item.missed { border-left-color:var(--red,#f66); }
.gq-summary-img { width:48px; height:32px; border-radius:0; overflow:hidden; flex-shrink:0; background:var(--bg); }
.gq-summary-img img { width:100%; height:100%; object-fit:cover; }
.gq-summary-info { display:flex; align-items:center; gap:.4rem; flex:1; min-width:0; }
.gq-summary-info img { width:20px; height:14px; object-fit:cover; border-radius:0; }
.gq-summary-info span { font-size:.72rem; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ── Info modal image hover + lightbox ── */
.geo-img-clickable {
  cursor:pointer; transition:transform .2s ease, filter .2s ease;
}
.geo-img-clickable:hover {
  transform:scale(1.03);
  filter:brightness(1.15);
}
.geo-right-imgbox { position:relative; overflow:hidden; }
.geo-right-imgbox::after {
  content:'⤢'; position:absolute; top:6px; right:8px;
  font-size:.8rem; color:rgba(255,255,255,.5); pointer-events:none;
  opacity:0; transition:opacity .2s ease;
}
.geo-right-imgbox:hover::after { opacity:1; }

.geo-lightbox {
  position:fixed; inset:0; z-index:10000;
  background:rgba(0,0,0,.9); display:flex; flex-direction:column;
  align-items:center; justify-content:center; cursor:pointer;
  animation:geoLbIn .2s ease;
}
@keyframes geoLbIn { from{opacity:0} to{opacity:1} }
.geo-lightbox img {
  max-width:90vw; max-height:82vh; object-fit:contain;
  border:1px solid var(--line); transition:transform .1s ease;
}
.geo-lightbox-caption {
  margin-top:.8rem; font-size:.75rem; color:var(--muted);
  letter-spacing:.05em; font-family:'JetBrains Mono',monospace;
}

/* ── Capitalrush ── */
.cap-country-label { font-size:.85rem; font-weight:600; color:var(--accent); white-space:nowrap; letter-spacing:-.01em; }
.fc-name { font-size:.5rem; color:var(--muted); text-align:center; padding:0 2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ═══════════════════════════════════════════
   DESIGN POLISH — Glass, Glows, Animations
   ═══════════════════════════════════════════ */

/* ── Glass variables ── */
:root {
  --glass: rgba(18,18,16,0.55);
  --glass-strong: rgba(14,14,12,0.75);
  --glass-border: rgba(44,44,38,0.45);
  --blur: blur(16px);
  --blur-strong: blur(24px);
}

/* ── Sidebar glass ── */
.sidebar {
  background: var(--glass-strong);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border-right-color: var(--glass-border);
}

/* ── Flag panel glass ── */
.flag-panel {
  background: var(--glass-strong);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border-right-color: var(--glass-border);
}
.flag-panel-img {
  background: rgba(8,8,7,0.8);
}

/* ── Topbar polish ── */
.topbar-title {
  text-shadow: 0 1px 20px rgba(232,228,220,0.06);
}

/* ── All cards → glass ── */
.stats-card,
.cl-card,
.lb-card,
.nested-group,
.lb-login-hint {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: var(--glass-border);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.stats-card:hover,
.cl-card:hover,
.lb-card:hover,
.nested-group:hover {
  border-color: rgba(80,80,72,0.5);
  box-shadow: 0 0 18px rgba(0,0,0,0.3);
}

/* Select + geo cards glass (use background-color to keep bg-image) */
.select-card {
  background-color: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: var(--glass-border);
  transition: border-color .2s ease, transform .15s ease, box-shadow .25s ease;
}
.select-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(127,255,110,0.08), 0 4px 20px rgba(0,0,0,0.3);
}

.geo-card {
  background-color: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: var(--glass-border);
  transition: border-color .2s ease, box-shadow .25s ease;
}
.geo-card:hover {
  border-color: rgba(80,80,72,0.6);
  box-shadow: 0 0 18px rgba(0,0,0,0.3);
}

/* ── Run cards glass ── */
.run-card {
  background: rgba(10,10,8,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--glass-border);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.run-card:hover {
  box-shadow: 0 0 14px rgba(0,0,0,0.3);
}
.run-card-best {
  background: rgba(42,34,16,0.5);
  border-color: var(--gold);
}

/* ── Modals glass ── */
.modal-overlay {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-box {
  background: var(--glass-strong);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border-color: var(--glass-border);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.geo-info-modal {
  background: var(--glass-strong);
  backdrop-filter: var(--blur-strong);
  -webkit-backdrop-filter: var(--blur-strong);
  border-color: var(--glass-border);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.modal-field input {
  background: rgba(8,8,7,0.6);
  border-color: var(--glass-border);
}

/* ── Map game transparent ── */
.map-wrap {
  background: transparent;
}
.map-zoom-btn {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: var(--glass-border);
}

/* ── Accent glow effects ── */

/* brand-mark glow moved to main section */

.sb-item.active .sb-icon {
  box-shadow: 0 0 10px rgba(127,255,110,0.18);
}

.record-badge {
  box-shadow: 0 0 12px rgba(212,168,32,0.2);
}

/* fc.active glow moved to main section */

/* ── Geo quiz button glow ── */
.geo-btn-quiz {
  transition: background .12s, box-shadow .2s, transform .08s;
}
.geo-btn-quiz:hover {
  box-shadow: 0 0 14px rgba(127,255,110,0.25);
}

/* ── Modal input focus ── */
.modal-field input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 14px rgba(127,255,110,0.12);
}

/* ── Scrollbar polish ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb {
  background: rgba(80,80,72,0.45);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(127,255,110,0.25);
}

/* ── Section headings ── */
.stats-wrap h2,
.lb-wrap h2 {
  font-size: 1.1rem;
  text-shadow: 0 0 30px rgba(232,228,220,0.05);
}

/* ── Stats clear button glass ── */
.stats-clear {
  background: rgba(22,22,20,0.4);
  border-color: var(--glass-border);
  backdrop-filter: blur(6px);
}

/* ── Geo card icon polish ── */
.geo-card-icon {
  background: rgba(8,8,7,0.7);
  border-color: var(--glass-border);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.geo-card:hover .geo-card-icon {
  border-color: rgba(80,80,72,0.6);
}

/* ── Select card icon scale animation ── */
.select-card-icon {
  transition: transform .2s ease, text-shadow .2s ease;
}
.select-card:hover .select-card-icon {
  transform: scale(1.08);
  text-shadow: 0 0 20px rgba(127,255,110,0.35);
}

/* ── Solved flag animation (uses solvedPop from flag grid section) ── */

/* ── Geo info body glass context ── */
.geo-info-header {
  border-bottom-color: var(--glass-border);
  background: rgba(10,10,8,0.3);
}

/* ── Changelog tags subtle glow ── */
.cl-tag-new { box-shadow: 0 0 8px rgba(127,255,110,0.1); }
.cl-tag-fix { box-shadow: 0 0 8px rgba(91,192,222,0.1); }
.cl-tag-design { box-shadow: 0 0 8px rgba(200,160,255,0.08); }

/* ── Gold best-entry glow ── */
.stats-entry.best-entry,
.run-card-best {
  box-shadow: inset 0 0 20px rgba(212,168,32,0.06);
}

/* ── Sidebar separator fade ── */
.sidebar-sep {
  background: var(--glass-border);
}

/* ── Coming soon page ── */
.soon-title {
  text-shadow: 0 0 30px rgba(232,228,220,0.08);
}

/* ── Lightbox glass ── */
.geo-lightbox {
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Select page title ── */
.select-title {
  text-shadow: 0 0 30px rgba(232,228,220,0.06);
}

/* ── Smooth scroll containers ── */
.grid-wrap, .select-wrap, .stats-wrap, .lb-wrap, .gq-wrap {
  scroll-behavior: smooth;
}

/* ── Focus visible (keyboard nav) ── */
*:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
#guessInput:focus-visible, .geo-search:focus-visible, .modal-field input:focus-visible {
  outline: none;
}

/* ── Record badge glow ── */
.record-badge {
  animation: recordGlow 1.5s ease-in-out infinite alternate;
}
@keyframes recordGlow {
  from { box-shadow: 0 0 8px rgba(212,168,32,0.15); }
  to { box-shadow: 0 0 18px rgba(212,168,32,0.35); }
}

/* ── Geo quiz image box polish ── */
.gq-image-box {
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gq-image-box:hover {
  border-color: rgba(80,80,72,0.6);
}

/* ── Geo quiz summary items ── */
.gq-summary-item {
  transition: background .15s ease, transform .12s ease, box-shadow .2s ease;
}
.gq-summary-item:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

/* ── Nested group hover accent ── */
.nested-group-head { transition: background .12s ease; }
.nested-group.open .nested-group-head {
  background: rgba(127,255,110,0.02);
}

/* ── Sidebar item hover line ── */
.sb-item { transition: all 0.15s ease; }
.sb-item:hover::before { height: 10px; background: rgba(127,255,110,0.3); }

/* ── Page title entrance ── */
.select-title, .stats-wrap h2, .lb-wrap h2 {
  opacity: 0; animation: titleFade 0.4s ease 0.1s forwards;
}
@keyframes titleFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Topbar glass border ── */
.topbar {
  border-bottom: 1px solid rgba(44,44,38,0.35);
  position: relative;
}
.topbar::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127,255,110,0.08) 30%, rgba(127,255,110,0.08) 70%, transparent);
  pointer-events: none;
}
