:root {
  --bg: #0b0720;
  --surface: rgba(20, 15, 48, 0.92);
  --surface-2: rgba(34, 26, 78, 0.9);
  --surface-solid: #151033;
  --surface-glass: rgba(15, 11, 38, 0.84);
  --border: rgba(139, 92, 246, 0.28);
  --border-strong: rgba(167, 139, 250, 0.55);
  --text: #f8fafc;
  --text-muted: #a5b4fc;
  --accent: #a78bfa;
  --accent-solid: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.22);
  --gg-green: #22c55e;
  --gg-green-hover: #16a34a;
  --map-bg: #120d2e;
  --map-dim: #1e293b;
  --map-dim-stroke: #334155;
  --map-stroke: #0f172a;
  --shadow: 0 10px 30px rgba(4, 2, 16, 0.48);
  --nav-width: 74px;
  --sheet-width: 368px;
}

[data-theme="light"] {
  --bg: #f1f5fb;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-2: #f8fafc;
  --surface-solid: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --border: #dce3ee;
  --border-strong: #94a3b8;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #6d28d9;
  --accent-solid: #6d28d9;
  --accent-soft: #f3e8ff;
  --gg-green: #16a34a;
  --gg-green-hover: #15803d;
  --map-bg: #e2ecf5;
  --map-dim: #e8edf4;
  --map-dim-stroke: #cbd5e1;
  --map-stroke: #ffffff;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: row;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* Left Navigation Rail (Desktop) */
.app-nav {
  width: var(--nav-width);
  flex-shrink: 0;
  height: 100dvh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px;
  background: var(--surface-solid);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text);
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #f43f5e 0%, #8b5cf6 52%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.14s, box-shadow 0.14s;
}

.brand:hover .brand-badge {
  transform: scale(1.05);
}

.brand-svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.35));
}

.brand-name {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: none;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 9px 4px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.4);
}

.nav-ico {
  font-size: 17px;
  line-height: 1;
}

.nav-lbl {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.nav-utilities {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.nav-utility-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-utility-btn:hover {
  border-color: var(--border-strong);
}

.nav-creator-btn {
  height: auto;
  padding: 6px 4px;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}

.nav-creator-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.nav-creator-ico {
  font-size: 15px;
  line-height: 1;
}

.nav-creator-lbl {
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.creator-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.creator-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.creator-link:hover {
  text-decoration: underline;
}

.credits-note {
  margin-top: 6px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.85;
}

.credits-open-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.credits-open-btn:hover {
  color: var(--text);
}

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.credits-modal.hidden {
  display: none;
}

.credits-card {
  max-width: 520px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.credits-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.credits-modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.credits-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.credits-section {
  margin-bottom: 12px;
}

.credits-section h3 {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.credits-section p {
  margin: 0 0 5px;
  font-size: 12.5px;
  line-height: 1.45;
}

.credits-section a {
  color: var(--accent);
  font-weight: 700;
}

.credits-list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.credits-disclaimer {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}

/* Main Content Area */
.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

.split-view {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.map-viewport {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  background: #e2ecf5;
  overflow: hidden;
}

[data-theme="dark"] .map-viewport {
  background: #0f172a;
}

.map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-canvas.no-basemap {
  background: var(--map-bg);
}

/* Floating Search & Breadcrumb (Top Left) */
.map-float-top-left {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(350px, calc(100% - 240px));
  pointer-events: none;
}

.search-box-wrap {
  position: relative;
  pointer-events: auto;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.search-ico {
  font-size: 14px;
  opacity: 0.78;
  flex-shrink: 0;
}

#globalSearchInput {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

#globalSearchInput::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
  font-weight: 500;
}

#globalSearchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-clear {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 310px;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 25;
}

.search-result-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.search-result-item:hover,
.search-result-item.is-highlighted {
  background: var(--accent-soft);
}

.search-result-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.search-result-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
}

.search-result-meta {
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.explore-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  pointer-events: auto;
  font-size: 12px;
  font-weight: 700;
}

.crumb-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 6px;
}

.crumb-btn:hover {
  background: var(--accent-soft);
}

.crumb-sep {
  color: var(--text-muted);
  opacity: 0.7;
  user-select: none;
}

.crumb-current {
  color: var(--text);
  padding: 1px 4px;
}

/* Floating Controls (Top Right) */
.map-float-top-right {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 6px;
}

.float-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}

.float-btn:hover {
  border-color: var(--accent);
}

.float-btn.is-active {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-color: transparent;
  color: #ffffff;
}

.popover-anchor {
  position: relative;
}

.view-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.popover-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}

.popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.popover-row select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.popover-row input[type="range"] {
  width: 116px;
  accent-color: var(--accent);
  cursor: pointer;
}

.popover-pattern {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-pattern-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
}

.pattern-btns {
  display: flex;
  gap: 4px;
}

.pattern-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 28px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pattern-ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.popover-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.popover-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

.popover-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
}

.desktop-panel-toggle {
  position: absolute;
  right: 12px;
  bottom: 36px;
  z-index: 15;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.desktop-panel-toggle:hover {
  border-color: var(--accent);
}

/* Unified Inspector Sheet (Right Rail on Desktop) */
.inspector-sheet {
  width: var(--sheet-width);
  flex-shrink: 0;
  height: 100%;
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  transition: width 0.2s ease;
}

body.panel-collapsed #exploreView .inspector-sheet {
  width: 0;
  border-left: none;
}

.sheet-handle {
  display: none;
}

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}

/* Hover Pill */
.float-hover-pill {
  position: absolute;
  bottom: 24px;
  left: 54px;
  z-index: 14;
  pointer-events: none;
}

.hover-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: min(320px, calc(100vw - 120px));
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--shadow);
}

.hover-pill .wcb-flag {
  font-size: 24px;
  line-height: 1;
}

/* Shared Buttons & Badges */
.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, transform 0.1s;
}

.btn:hover {
  border-color: var(--border-strong);
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  opacity: 0.94;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 4px;
}

.muted {
  color: var(--text-muted);
}

.small-text {
  font-size: 12px;
}

.opacity-val {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Inspector Content */
.panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-title-wrap h1,
.panel-title-wrap h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.calling-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sidebar-flag-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: 30px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.continent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 10px;
}

.continent-pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.continent-pill.active {
  background: var(--accent-solid);
  color: #ffffff;
  border-color: transparent;
}

.world-country-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.world-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s, transform 0.1s;
}

.world-list-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.world-list-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.world-list-flag {
  font-size: 26px;
  line-height: 1;
}

.world-list-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.world-list-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
}

.country-meta-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.meta-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 11.5px;
}

.meta-pill.tier-1 {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
}

.meta-pill.tier-2 {
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.14);
}

.meta-pill.tier-3 {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.14);
}

[data-theme="light"] .meta-pill.tier-1 {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

[data-theme="light"] .meta-pill.tier-2 {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

[data-theme="light"] .meta-pill.tier-3 {
  color: #b45309;
  border-color: #fde68a;
  background: #fffbeb;
}

.meta-ignore {
  color: var(--text-muted);
  line-height: 1.38;
}

.meta-ignore strong {
  color: #f87171;
}

[data-theme="light"] .meta-ignore strong {
  color: #dc2626;
}

.level-toggle {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 10px;
}

.level-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.level-btn.active {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #ffffff;
}

.prefix-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.prefix-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.prefix-pill:hover {
  border-color: var(--accent);
}

.prefix-pill.active {
  background: #f8fafc;
  color: #0f172a;
  border-color: #f8fafc;
}

[data-theme="light"] .prefix-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-count {
  font-size: 11px;
  opacity: 0.72;
  font-weight: 500;
}

.inspector-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.inspector-actions-row .btn {
  flex: 1;
  font-size: 12.5px;
  padding: 8px 10px;
}

.sidebar-section h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.sidebar-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.group-overview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.group-overview-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: border-color 0.14s, transform 0.1s;
}

.group-overview-item:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.group-overview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
}

.group-overview-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-overview-region {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-overview-codes {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.group-region-subtitle {
  margin: -2px 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.35;
}

.code-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.code-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-weight: 800;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
  color: var(--text);
}

.code-chip-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.code-chip-code {
  flex-shrink: 0;
}

.code-chip-place {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-chip:hover,
.code-chip.highlighted {
  border-color: var(--text);
}

.code-chip.pattern-active,
.group-overview-item.pattern-active {
  border-color: var(--pattern-accent, #f97316);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.35);
}

.code-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ev-pill {
  font-size: 10px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 5px;
  line-height: 1.25;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.ev-pill.ev-s {
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fbbf24;
}

.ev-pill.ev-a {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #34d399;
}

.eselsbruecke-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eselsbruecke-box label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.eselsbruecke-box textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

/* Map Labels, World Badges & Pattern Overlay */
.map-code-label {
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  font-weight: 900;
  color: #0f172a;
  text-shadow:
    -1.5px -1.5px 0 #ffffff,
     1.5px -1.5px 0 #ffffff,
    -1.5px  1.5px 0 #ffffff,
     1.5px  1.5px 0 #ffffff,
     0px    2px   4px rgba(0, 0, 0, 0.28);
  white-space: nowrap;
  user-select: none;
}

.map-code-label.quiz-flash-wrong {
  color: #dc2626;
}

.map-code-label.quiz-correct {
  color: #15803d;
}

.map-zone-label span {
  letter-spacing: -0.02em;
  font-weight: 900;
}

.world-country-badge {
  pointer-events: auto;
  cursor: pointer;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(129, 140, 248, 0.55);
  background: rgba(15, 23, 42, 0.84);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
  user-select: none;
}

.world-country-badge:hover,
.world-country-badge.is-hovered {
  transform: scale(1.08);
  background: rgba(99, 102, 241, 0.94);
  border-color: #ffffff;
  z-index: 7;
}

.world-country-badge.is-current {
  border-color: #22c55e;
  background: rgba(21, 128, 61, 0.9);
}

.world-country-badge .wcb-flag {
  font-size: 15px;
  line-height: 1;
}

.world-country-badge.is-compact {
  font-size: 10px;
  padding: 1px 5px;
  gap: 3px;
}

.world-country-badge.is-compact .wcb-flag {
  font-size: 13px;
}

.pattern-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.pattern-hud {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: calc(100% - 32px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
}

.pattern-hud-step {
  border: none;
  background: transparent;
  color: rgba(248, 250, 252, 0.52);
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
}

.pattern-hud-step:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.pattern-hud-step.is-visited {
  color: rgba(248, 250, 252, 0.88);
}

.pattern-hud-step.is-active {
  background: var(--pattern-accent, #f97316);
  color: #ffffff;
  transform: scale(1.08);
}

.pattern-hud-sep {
  color: rgba(248, 250, 252, 0.3);
  font-size: 11px;
  user-select: none;
}

/* MapLibre Controls Position */
.maplibregl-ctrl-bottom-left {
  bottom: 16px;
  left: 8px;
}

.maplibregl-ctrl-bottom-right {
  bottom: 4px;
  right: 6px;
}

button.maplibregl-ctrl-fit {
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: #1e293b;
}

button.maplibregl-ctrl-fit svg {
  display: block;
}

/* Learn / Quiz View */
.quiz-float-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 15;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}

.quiz-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quiz-prompt-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-flag-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  font-size: 27px;
  line-height: 1;
  flex-shrink: 0;
}

.quiz-prompt-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.quiz-target-code {
  font-size: 26px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 12px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.quiz-target-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.quiz-stats {
  display: flex;
  gap: 14px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-size: 15px;
  font-weight: 800;
}

.stat-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
}

.quiz-controls {
  display: flex;
  gap: 6px;
}

.quiz-progress-track {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #22c55e);
  transition: width 0.25s ease;
}

.quiz-feedback {
  min-height: 18px;
  font-size: 12.5px;
  font-weight: 700;
}

.quiz-feedback.ok {
  color: #4ade80;
}

.quiz-feedback.err {
  color: #f87171;
}

[data-theme="light"] .quiz-feedback.ok {
  color: #16a34a;
}

[data-theme="light"] .quiz-feedback.err {
  color: #dc2626;
}

.quiz-summary {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.learn-country-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.learn-country-picker select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.quiz-group-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.quiz-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.quiz-group-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-links {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.milestone-note-card {
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
}

.milestone-note-card p {
  margin: 4px 0 0;
}

/* Play Campaign Episodes & Levels */
.quiz-level-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
}

.learn-mode-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.learn-mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.learn-mode-tab.active {
  background: var(--accent-solid);
  color: #ffffff;
}

.episode-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.episode-tab {
  flex: 1;
  min-width: 44px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 4px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.episode-tab.active {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border-color: transparent;
  color: #ffffff;
}

.campaign-search-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  margin-bottom: 8px;
}

.campaign-search-input:focus {
  border-color: var(--accent);
}

.campaign-episode-summary {
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 12px;
}

.campaign-episode-summary strong {
  display: block;
  font-size: 12.5px;
}

.campaign-level-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.level-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s, transform 0.1s;
}

.level-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.level-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.level-card.is-cleared {
  border-color: rgba(34, 197, 94, 0.4);
}

.level-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.level-num-badge {
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.level-card.is-cleared .level-num-badge {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.45);
}

.level-card-titles {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.level-card-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.level-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.level-stars {
  font-size: 12px;
  letter-spacing: 1px;
  color: #64748b;
}

.level-stars .star-on {
  color: #facc15;
}

.level-time {
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
}

.episode-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.ep-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.ep-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #facc15);
  transition: width 0.25s ease;
}

/* Progress View */
.progress-view {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 24px;
}

.progress-container {
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.progress-hero {
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.progress-hero h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.progress-stats-row {
  display: flex;
  gap: 16px;
}

.progress-stat-pill {
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-stat-pill strong {
  font-size: 18px;
  color: var(--accent);
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.progress-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.progress-card-actions {
  display: flex;
  gap: 6px;
}

.progress-card-actions .btn {
  flex: 1;
}

/* Mobile Responsive Layout (< 900px) */
@media (max-width: 899px) {
  .desktop-only,
  .desktop-panel-toggle,
  .brand {
    display: none !important;
  }

  .app-shell {
    flex-direction: column;
  }

  .app-main {
    order: 1;
    flex: 1;
    min-height: 0;
    height: auto;
  }

  .app-nav {
    order: 2;
    width: 100%;
    height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 8px env(safe-area-inset-bottom);
    flex-direction: row;
    justify-content: center;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .nav-tabs {
    flex-direction: row;
    justify-content: space-around;
    gap: 6px;
  }

  .nav-tab {
    flex: 1;
    padding: 6px 4px;
    border-radius: 10px;
  }

  .split-view {
    position: relative;
    display: block;
  }

  .map-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .map-float-top-left {
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    gap: 8px;
  }

  .explore-breadcrumb {
    max-width: calc(100% - 196px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 5px 8px;
  }

  .map-float-top-right {
    top: 56px;
    right: 10px;
    gap: 5px;
  }

  .float-btn {
    height: 32px;
    padding: 0 9px;
    font-size: 11.5px;
    border-radius: 9px;
  }

  .view-popover {
    width: min(290px, calc(100vw - 24px));
  }

  #exploreView .inspector-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    transition: height 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #exploreView .inspector-sheet[data-snap="peek"] {
    height: 112px;
  }

  #exploreView .inspector-sheet[data-snap="half"] {
    height: 46dvh;
  }

  #exploreView .inspector-sheet[data-snap="full"] {
    height: 78dvh;
  }

  #exploreView .inspector-sheet.is-dragging {
    transition: none;
  }

  .sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    cursor: grab;
    touch-action: none;
    padding: 0;
  }

  .sheet-grab-bar {
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  .sheet-body {
    padding: 4px 14px 16px;
  }

  #learnView .learn-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    max-height: 36dvh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
  }

  .quiz-float-hud {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 8px 10px;
  }

  .quiz-target-code {
    font-size: 20px;
  }

  .pattern-hud {
    bottom: 122px;
  }

  .float-hover-pill {
    bottom: 122px;
    left: 52px;
  }

  .maplibregl-ctrl-bottom-left {
    bottom: 146px;
    left: 8px;
  }

  .maplibregl-ctrl-bottom-right {
    bottom: 112px;
    right: 8px;
  }

  .progress-view {
    padding: 14px;
  }
}

/* Milestone 3: Speedrun, Two-Way Choices, Study Peek & Fading Stars */
.nav-tab {
  position: relative;
}

.nav-due-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 10px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.speedrun-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.24), rgba(245, 158, 11, 0.16));
  border: 1px solid rgba(251, 146, 60, 0.55);
}

.speedrun-bar-left,
.speedrun-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speedrun-tag {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #fb923c;
}

.speedrun-hearts {
  font-size: 13px;
  letter-spacing: 1px;
}

.speedrun-clock {
  font-size: 13px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fbbf24;
  min-width: 48px;
  text-align: right;
}

.quiz-direction-toggle {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  margin-bottom: 8px;
}

.quiz-direction-toggle .level-btn {
  flex: 1;
  font-size: 11.5px;
  padding: 5px 6px;
}

.campaign-action-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.campaign-action-row .btn {
  flex: 1;
}

.btn-speedrun {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-color: transparent;
  color: #ffffff;
  font-weight: 800;
}

.btn-speedrun:hover {
  opacity: 0.94;
}

.quiz-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.quiz-choice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
}

.quiz-choice-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quiz-choice-btn kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  font-size: 10px;
  border-radius: 4px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.quiz-choice-btn.is-wrong {
  background: rgba(220, 38, 38, 0.25);
  border-color: #ef4444;
  color: #fca5a5;
}

.quiz-choice-btn.is-revealed,
.quiz-choice-btn.is-correct {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fde68a;
}

.quiz-choice-btn.is-correct {
  background: rgba(22, 163, 74, 0.25);
  border-color: #22c55e;
  color: #86efac;
}

.map-question-marker {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #f59e0b;
  color: #0f172a;
  border: 2px solid #ffffff;
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.level-card.is-fading .level-stars {
  opacity: 0.6;
}

.map-choice-pin {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #4f46e5;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
  transition: transform 0.1s, background 0.1s;
}

.map-choice-pin:hover,
.map-choice-pin.is-linked {
  background: #f59e0b;
  color: #0f172a;
  transform: scale(1.25);
  z-index: 5;
}

.map-choice-pin.is-correct {
  background: #16a34a;
}

.map-choice-pin.is-wrong {
  background: #dc2626;
}

.mill-choice-btn.is-linked:not(:disabled) {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
}

.due-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.speedrun-splits {
  max-height: 130px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 6px 0 8px;
  padding-right: 4px;
}

.speedrun-split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface-solid);
}

.explore-nav-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
}

.float-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s;
}

.float-back-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 899px) {
  .explore-nav-row {
    max-width: calc(100% - 196px);
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .explore-nav-row .explore-breadcrumb {
    max-width: none;
    flex: 1;
    min-width: 0;
  }
}


/* ============================================================
   Goiás Cow Millionaire Mode & 80s Arcade Highscore Board
   ============================================================ */

.btn-millionaire {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: transparent;
  color: #111827;
  font-weight: 900;
}

.btn-millionaire:hover {
  filter: brightness(1.06);
}

.millionaire-float-hud {
  position: absolute;
  bottom: 34px;
  left: 52px;
  right: 52px;
  max-width: 740px;
  margin: 0 auto;
  z-index: 16;
  padding: 12px 15px;
  border-radius: 16px;
  background: rgba(10, 14, 28, 0.88);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(245, 158, 11, 0.15);
  color: #f8fafc;
}

[data-theme="light"] .millionaire-float-hud {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
}

.mill-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.mill-top-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mill-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mill-rung-badge,
.mill-stake-badge,
.mill-bank-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mill-rung-badge {
  background: rgba(99, 102, 241, 0.25);
  border: 1px solid rgba(129, 140, 248, 0.5);
  color: #c7d2fe;
}

.mill-stake-badge {
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

.mill-bank-badge {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
}

.mill-question-box {
  margin-bottom: 10px;
}

.mill-question-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mill-question-copy {
  min-width: 0;
  flex: 1;
}

.mill-flag-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 42px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  font-size: 34px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
}

.mill-flag-hero.is-mystery {
  border-color: rgba(148, 163, 184, 0.38);
  font-size: 26px;
}

.mill-flag-hero.is-revealed {
  border-color: #4ade80;
}

.mill-country-tag {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fbbf24;
  margin-bottom: 3px;
}

.mill-prompt-text {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  color: #ffffff;
}

.mill-hint-banner {
  margin-top: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 600;
}

.mill-choices-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mill-choice-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s, border-color 0.14s, background 0.14s, opacity 0.14s;
}

.mill-choice-btn:hover:not(:disabled) {
  border-color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
  transform: translateY(-1px);
}

.mill-choice-btn:disabled {
  cursor: default;
}

.mill-choice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
}

.mill-choice-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  white-space: normal;
  line-height: 1.24;
  overflow-wrap: anywhere;
}

.mill-choice-flag {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.mill-choice-btn.is-eliminated {
  opacity: 0.24;
  text-decoration: line-through;
}

.mill-choice-btn.is-correct {
  background: rgba(22, 163, 74, 0.38);
  border-color: #22c55e;
  color: #dcfce7;
}

.mill-choice-btn.is-correct .mill-choice-letter {
  background: #22c55e;
  color: #052e16;
}

.mill-choice-btn.is-wrong {
  background: rgba(220, 38, 38, 0.35);
  border-color: #ef4444;
  color: #fee2e2;
}

.mill-choice-btn.is-wrong .mill-choice-letter {
  background: #ef4444;
  color: #ffffff;
}

.mill-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  min-height: 24px;
}

.mill-feedback {
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
}

.mill-feedback.ok {
  color: #4ade80;
}

.mill-feedback.err {
  color: #f87171;
}

.mill-lifelines-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 12px;
}

.mill-lifeline-btn {
  padding: 7px 6px;
  border-radius: 9px;
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.14s, background 0.14s;
}

.mill-lifeline-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

.mill-lifeline-btn.is-used,
.mill-lifeline-btn:disabled {
  opacity: 0.35;
  text-decoration: line-through;
  cursor: default;
  transform: none;
}

.mill-ladder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.mill-ladder-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 2px;
}

.mill-ladder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid transparent;
}

.mill-ladder-row.is-safe {
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.28);
}

[data-theme="light"] .mill-ladder-row.is-safe {
  color: #b45309;
}

.mill-ladder-row.is-cleared {
  background: rgba(22, 163, 74, 0.14);
  color: #4ade80;
}

[data-theme="light"] .mill-ladder-row.is-cleared {
  color: #15803d;
}

.mill-ladder-row.is-current {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.32), rgba(245, 158, 11, 0.12));
  border-color: #f59e0b;
  color: #fef3c7;
  font-weight: 900;
}

[data-theme="light"] .mill-ladder-row.is-current {
  color: #78350f;
}

/* 80s CRT Arcade Highscore Cabinet Overlay */
.mill-arcade-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 5, 14, 0.78);
  backdrop-filter: blur(8px);
}

.arcade-cabinet {
  width: 100%;
  max-width: 520px;
  max-height: 92%;
  overflow-y: auto;
  padding: 18px 20px;
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.025) 0px,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 4px
    ),
    linear-gradient(180deg, #070b1a 0%, #0d1229 100%);
  border: 2px solid #22d3ee;
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.3), inset 0 0 24px rgba(168, 85, 247, 0.18);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.arcade-header {
  text-align: center;
  margin-bottom: 12px;
}

.arcade-marquee {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fde047;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
}

.arcade-sub {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #22d3ee;
  margin-top: 3px;
}

.arcade-run-summary {
  text-align: center;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px dashed rgba(251, 191, 36, 0.6);
  color: #fef08a;
  font-size: 13px;
  font-weight: 800;
}

.arcade-name-form {
  margin-bottom: 12px;
}

.arcade-name-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #f472b6;
  margin-bottom: 5px;
}

.arcade-name-row {
  display: flex;
  gap: 8px;
}

.arcade-name-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1.5px solid #f472b6;
  background: #020617;
  color: #fde047;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.arcade-saved-rank {
  text-align: center;
  padding: 7px 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid #4ade80;
  color: #86efac;
  font-size: 12.5px;
  font-weight: 900;
}

.arcade-board-wrap {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.72);
  margin-bottom: 14px;
}

.arcade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.arcade-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #22d3ee;
  text-align: left;
  padding: 6px 8px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(34, 211, 238, 0.35);
}

.arcade-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.arcade-table tr.is-player-row {
  background: rgba(244, 114, 182, 0.24);
  color: #fde047;
  font-weight: 900;
}

.arcade-table tr.is-cpu-row {
  color: #94a3b8;
}

.arcade-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.arcade-btn {
  padding: 8px 14px;
  border-radius: 7px;
  border: 1.5px solid #22d3ee;
  background: rgba(34, 211, 238, 0.12);
  color: #cffafe;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.arcade-btn:hover {
  background: rgba(34, 211, 238, 0.25);
}

.arcade-btn-save {
  border-color: #f472b6;
  background: rgba(244, 114, 182, 0.2);
  color: #fbcfe8;
}

.arcade-btn-play {
  border-color: #fde047;
  background: rgba(250, 204, 21, 0.2);
  color: #fef08a;
}

@media (max-width: 899px) {
  .quiz-flag-hero {
    width: 36px;
    height: 28px;
    font-size: 22px;
  }

  .millionaire-float-hud {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 10px 12px;
  }

  .mill-flag-hero {
    width: 44px;
    height: 34px;
    font-size: 28px;
  }

  .mill-flag-hero.is-mystery {
    font-size: 22px;
  }

  .mill-prompt-text {
    font-size: 14px;
  }

  .mill-choices-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .mill-ladder-list {
    max-height: 220px;
  }
}
