/* ==========================================================================
   KARTJAKT - NORSK GEOGRAFI- OG KARTSPILL
   Designsystem: Skandinavisk lyst, rent og moderne nettdesign
   Målgruppe: Ungdomstrinnet, videregående og voksne
   ========================================================================== */

:root {
  /* Farger - Lys, frisk og kontrastrik palett */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  /* Frisk, tydelig havfarge med god kontrast mot hvitt land */
  --bg-ocean: #dbeafe; 
  --ocean-border: #bfdbfe;

  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: #64748b;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;

  --success: #10b981;
  --success-hover: #059669;
  --success-light: #d1fae5;
  --success-text: #065f46;

  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-text: #92400e;

  --danger: #ef4444;
  --danger-light: #fee2e2;
  --danger-text: #991b1b;

  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  /* Harmonisk 5-fargers palett for knapper, kort og merker (uten tivoli-effekt) */
  --palette-blue-bg: #eff6ff;
  --palette-blue-border: #bfdbfe;
  --palette-blue-text: #0284c7;
  --palette-blue-dark: #0369a1;

  --palette-green-bg: #f0fdf4;
  --palette-green-border: #bbf7d0;
  --palette-green-text: #059669;
  --palette-green-dark: #047857;

  --palette-amber-bg: #fefce8;
  --palette-amber-border: #fde68a;
  --palette-amber-text: #d97706;
  --palette-amber-dark: #92400e;

  --palette-rose-bg: #fff1f2;
  --palette-rose-border: #fecdd3;
  --palette-rose-text: #e11d48;
  --palette-rose-dark: #be123c;

  --palette-violet-bg: #f5f3ff;
  --palette-violet-border: #ddd6fe;
  --palette-violet-text: #7c3aed;
  --palette-violet-dark: #6d28d9;

  /* Kartfarger med HØY KONTRAST */
  --map-land-default: #ffffff;         /* Hvit/kremfarget land som popper fra havet */
  --map-land-stroke: #475569;          /* Skifergrå (Slate-600) tydelig synlig grenselinje */
  --map-land-hover: #bae6fd;           /* Frisk lys blå ved hover */
  --map-land-hover-stroke: #0284c7;
  --map-land-correct: #10b981;         /* Smaragdgrønn ved riktig svar */
  --map-land-correct-stroke: #047857;
  --map-land-missed: #f43f5e;          /* Frisk korallrød ved fasit */
  --map-land-missed-stroke: #be123c;
  --map-land-selected: #f59e0b;

  /* Skygger */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Fonter */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Layout & header */
  --header-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Forhindrer vertikal scrolling under aktivt spill og maksimerer kartets skjermareal */
body.in-game {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

body.in-game .site-header {
  display: none !important;
}

body.in-game .game-viewport {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
}

/* Sømløs integrering når spillet er bygget inn i Ordkongen.no */
html.is-embedded .site-header {
  display: none !important;
}
html.is-embedded body {
  background: transparent !important;
}

/* ==========================================================================
   HEADER OG TOPPNAVIGASJON
   ========================================================================== */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.brand-info h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-info p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: -3px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* KNAPPER */
.btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-medium);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-white);
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

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

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-white);
}

.btn-success:hover {
  background: var(--success-hover);
}

.btn-outline-danger {
  color: var(--palette-rose-dark);
  border: 1.5px solid var(--palette-rose-border);
  background: var(--palette-rose-bg);
  font-weight: 700;
}

.btn-outline-danger:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.12);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   HOVEDSIDE / LOBBY (VIEW-LOBBY)
   ========================================================================== */
.view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.lobby-hero {
  max-width: 1200px;
  margin: 32px auto 0;
  padding: 0 24px;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}

.lobby-hero h2 {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 12px;
}

.lobby-hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}

/* STATISTIKK-KORT (I BUNNSEKSJON) */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 900px;
  margin: 0 auto 32px;
}

.stat-pill {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stat-pill-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.stat-pill-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}

/* Harmonisk fargekoding for lobby-statistikk */
.stats-strip .stat-pill:nth-child(1) {
  background: linear-gradient(135deg, var(--palette-green-bg), #ffffff);
  border-color: var(--palette-green-border);
}
.stats-strip .stat-pill:nth-child(1) .stat-pill-val {
  color: var(--palette-green-dark);
}
.stats-strip .stat-pill:nth-child(1) .stat-pill-label {
  color: var(--palette-green-text);
}

.stats-strip .stat-pill:nth-child(2) {
  background: linear-gradient(135deg, var(--palette-blue-bg), #ffffff);
  border-color: var(--palette-blue-border);
}
.stats-strip .stat-pill:nth-child(2) .stat-pill-val {
  color: var(--palette-blue-dark);
}
.stats-strip .stat-pill:nth-child(2) .stat-pill-label {
  color: var(--palette-blue-text);
}

.stats-strip .stat-pill:nth-child(3) {
  background: linear-gradient(135deg, var(--palette-amber-bg), #ffffff);
  border-color: var(--palette-amber-border);
}
.stats-strip .stat-pill:nth-child(3) .stat-pill-val {
  color: var(--palette-amber-dark);
}
.stats-strip .stat-pill:nth-child(3) .stat-pill-label {
  color: var(--palette-amber-text);
}

.stats-strip .stat-pill:nth-child(4) {
  background: linear-gradient(135deg, var(--palette-violet-bg), #ffffff);
  border-color: var(--palette-violet-border);
}
.stats-strip .stat-pill:nth-child(4) .stat-pill-val {
  color: var(--palette-violet-dark);
}
.stats-strip .stat-pill:nth-child(4) .stat-pill-label {
  color: var(--palette-violet-text);
}

/* SPILLMODUS-SEKSJONER */
.lobby-section {
  max-width: 1200px;
  margin: 0 auto 32px;
  padding: 0 24px;
}

.section-title-wrap {
  margin: 0 0 12px 0;
  padding: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* BUNNSEKSJON I LOBBY (STATISTIKK & OM VERDENSLAND) */
.lobby-footer-section {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  padding: 36px 24px 44px;
  margin-top: 48px;
  text-align: center;
}

.lobby-footer-hero {
  margin: 0 auto;
  max-width: 700px;
}

.lobby-footer-hero h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 8px;
}

.lobby-footer-hero p {
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

.keyboard-shortcuts-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-body);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* KATEGORI / FANEVELGER */
.category-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 960px;
  margin: 18px auto 22px;
  padding: 0 16px;
}

.cat-tab {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  color: var(--text-body);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cat-tab:hover {
  color: var(--primary);
  border-color: #7dd3fc;
  background: var(--palette-blue-bg);
  transform: translateY(-1px);
}

.cat-tab.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
}

.game-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.game-card-clean {
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-light);
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 48px;
}

.game-card-clean:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  border-color: var(--primary);
}

.card-icon-simple {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.card-icon-simple .card-flag-icon {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Modusfarger på lobbykort */
.game-card-clean[data-launch-mode="click-map"] .card-icon-simple {
  background: var(--palette-blue-bg);
  border-color: var(--palette-blue-border);
  color: var(--palette-blue-text);
}
.game-card-clean[data-launch-mode="click-map"]:hover {
  border-color: #38bdf8;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.12);
}
.game-card-clean[data-launch-mode="click-map"]:hover .card-arrow {
  color: var(--palette-blue-text);
}

.game-card-clean[data-launch-mode="type-and-fill"] .card-icon-simple {
  background: var(--palette-green-bg);
  border-color: var(--palette-green-border);
  color: var(--palette-green-text);
}
.game-card-clean[data-launch-mode="type-and-fill"]:hover {
  border-color: #34d399;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.12);
}
.game-card-clean[data-launch-mode="type-and-fill"]:hover .card-arrow {
  color: var(--palette-green-text);
}

.game-card-clean[data-launch-mode="capitals"] .card-icon-simple {
  background: var(--palette-amber-bg);
  border-color: var(--palette-amber-border);
  color: var(--palette-amber-text);
}
.game-card-clean[data-launch-mode="capitals"]:hover {
  border-color: #fbbf24;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.12);
}
.game-card-clean[data-launch-mode="capitals"]:hover .card-arrow {
  color: var(--palette-amber-text);
}

.game-card-clean[data-launch-mode="minefield"] .card-icon-simple {
  background: var(--palette-rose-bg);
  border-color: var(--palette-rose-border);
  color: var(--palette-rose-text);
}
.game-card-clean[data-launch-mode="minefield"]:hover {
  border-color: #fb7185;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.12);
}
.game-card-clean[data-launch-mode="minefield"]:hover .card-arrow {
  color: var(--palette-rose-text);
}

.game-card-clean[data-launch-mode="border-trail"] .card-icon-simple {
  background: var(--palette-violet-bg);
  border-color: var(--palette-violet-border);
  color: var(--palette-violet-text);
}
.game-card-clean[data-launch-mode="border-trail"]:hover {
  border-color: #a78bfa;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.12);
}
.game-card-clean[data-launch-mode="border-trail"]:hover .card-arrow {
  color: var(--palette-violet-text);
}

.game-card-clean[data-launch-mode="daily-globle"] .card-icon-simple {
  background: #ffedd5;
  border-color: #fed7aa;
  color: #ea580c;
}
.game-card-clean[data-launch-mode="daily-globle"]:hover {
  border-color: #fb923c;
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.12);
}
.game-card-clean[data-launch-mode="daily-globle"]:hover .card-arrow {
  color: #ea580c;
}

.game-card-clean[data-launch-mode="flags"] .card-icon-simple {
  background: #ffe4e6;
  border-color: #fecdd3;
  color: #e11d48;
}
.game-card-clean[data-launch-mode="flags"]:hover {
  border-color: #fb7185;
  box-shadow: 0 8px 24px rgba(225, 29, 72, 0.12);
}
.game-card-clean[data-launch-mode="flags"]:hover .card-arrow {
  color: #e11d48;
}

.card-title-simple {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-arrow {
  font-size: 16px;
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.game-card-clean:hover .card-arrow {
  transform: translateX(3px);
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.game-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.game-card p {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 20px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--bg-subtle);
  padding-top: 16px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   SPILLARENA (VIEW-GAME)
   ========================================================================== */
body.in-game .site-header {
  display: none !important;
}

.game-viewport {
  flex: 1;
  min-height: 0; /* Hindrer at kartets naturlige aspect-ratio sprenger høyden */
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  max-height: calc(100dvh - var(--header-height));
  overflow: hidden;
  background: var(--bg-page);
}

body.in-game .game-viewport {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
}

/* SPILLKONTROLLINJE (TOPP I SPILLET) */
.game-top-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.game-info-cluster {
  display: flex;
  align-items: center;
  gap: 16px;
}

.game-mode-title {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* REGIONVELGER */
.region-select {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

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

/* SPILLMETRIKKER: TIMER OG SCORE */
#btn-back-to-lobby {
  background: #ffffff;
  border: 1.5px solid var(--border-medium);
  color: var(--text-body);
  font-weight: 700;
  transition: all 0.15s ease;
}

#btn-back-to-lobby:hover {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
  color: var(--text-main);
  transform: translateY(-1px);
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid var(--border-light);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}

.metric-badge.timer-badge {
  background: var(--palette-blue-bg);
  border-color: var(--palette-blue-border);
  color: var(--palette-blue-dark);
}

.metric-badge.highlight {
  background: var(--palette-amber-bg);
  border-color: var(--palette-amber-border);
  color: var(--palette-amber-dark);
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.1);
}

.metric-badge.timer-running {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  animation: timerPulse 1s infinite alternate;
}

@keyframes timerPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); box-shadow: 0 0 10px rgba(239, 68, 68, 0.35); }
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

/* ==========================================================================
   SPILLETS HOVEDOMRÅDE: KARTSTAGE + LISTER
   ========================================================================== */
.game-main-area {
  flex: 1;
  min-height: 0; /* Kritisk: forhindrer flex-ekspansjon ut av vinduet */
  display: flex;
  position: relative;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

/* SOLID FUNDAMENTERT KARTBOKS (RAMME) */
.map-stage {
  flex: 1;
  min-height: 0; /* Kritisk: holder rammen forankret innenfor vinduet */
  background: var(--bg-ocean);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.06), var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Selve det flyttbare kart-laget inni rammen */
.map-svg-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px 48px 20px; /* Generøs sikkerhetsmargin i bunn slik at det alltid er plass til kartet */
  box-sizing: border-box;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.1s ease-out;
}

.map-svg-wrap svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
  user-select: none;
}

/* ==========================================================================
   SVG PATHS: TYDELIGE, SKARPE GRENSER OG KONTRAST
   ========================================================================== */
.map-svg-wrap path {
  fill: var(--map-land-default) !important;
  stroke: var(--map-land-stroke) !important;
  stroke-width: 0.85px !important;
  stroke-linejoin: round !important;
  stroke-linecap: round !important;
  vector-effect: non-scaling-stroke !important; /* Holder grensene like skarpe ved zoom */
  transition: fill 0.2s ease, stroke 0.15s ease, filter 0.15s ease;
  cursor: pointer;
}

/* Hover over et land */
.map-svg-wrap path:hover {
  fill: var(--map-land-hover) !important;
  stroke: var(--map-land-hover-stroke) !important;
  stroke-width: 1.5px !important;
  filter: drop-shadow(0 0 4px rgba(2, 132, 199, 0.4));
}

/* Riktig gjettet land (Avdekket i grønt) */
.map-svg-wrap path.revealed {
  fill: var(--map-land-correct) !important;
  stroke: var(--map-land-correct-stroke) !important;
  stroke-width: 0.95px !important;
}

/* Bommet/ugjettet land ved spillslutt (Fasit i korallrødt) */
.map-svg-wrap path.missed {
  fill: var(--map-land-missed) !important;
  stroke: var(--map-land-missed-stroke) !important;
  stroke-width: 0.95px !important;
}

/* Målland eller hint */
.map-svg-wrap path.target-hint {
  fill: var(--map-land-selected) !important;
  stroke: #b45309 !important;
  stroke-width: 1.5px !important;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.7));
}

/* Grenseland-reisen stier */
.map-svg-wrap path.trail-active {
  fill: #0284c7 !important;
  stroke: #0369a1 !important;
  stroke-width: 1px !important;
}

.map-svg-wrap path.trail-neighbor {
  fill: #bae6fd !important;
  stroke: #0284c7 !important;
  stroke-width: 1.2px !important;
}

/* ==========================================================================
   ZOOM OG PAN KONTROLLER
   ========================================================================== */
.map-zoom-dock {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 20;
}

.zoom-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

.zoom-btn:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.zoom-btn + .zoom-btn {
  border-top: 1px solid var(--border-light);
}

.zoom-level-badge {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 5px 2px;
  color: var(--text-muted);
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  user-select: none;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.1;
}

.zoom-level-badge.is-zoomed {
  color: var(--primary);
  background: rgba(14, 165, 233, 0.12);
  font-weight: 800;
}

.zoom-level-badge:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

/* Lås / Kartstatus-merke */
.map-lock-badge {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  z-index: 20;
}

/* ==========================================================================
   INPUT BAR (TAST & FYLL)
   ========================================================================== */
.game-input-dock {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 500px;
  z-index: 25;
  pointer-events: none;
}

.input-box-wrapper {
  background: var(--bg-surface);
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-full);
  padding: 4px 8px 4px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s ease;
  pointer-events: auto;
}

.input-box-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light), var(--shadow-lg);
}

.input-box-wrapper.flash-correct {
  border-color: var(--success);
  background: var(--success-light);
}

.type-input {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.type-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* ==========================================================================
   KLIKK-MODUS INSTRUKSSKILT
   ========================================================================== */
.click-prompt-card {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 25;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.prompt-flag {
  font-size: 32px;
}

.prompt-text-group h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.prompt-text-group p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   SIDEBAR (LANDLISTE & FREMDRIFT)
   ========================================================================== */
.game-sidebar {
  width: 360px;
  min-height: 0; /* Sikrer at sidebar ikke hindrer flex fra å krympe */
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-bar-bg {
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
  width: 0%;
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.country-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.country-grid-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  border-bottom: 1px solid var(--bg-subtle);
  transition: background 0.15s;
}

.country-grid-item.found {
  background: var(--success-light);
  color: var(--success-text);
  font-weight: 700;
}

.country-grid-item.missed-reveal {
  background: var(--danger-light);
  color: var(--danger-text);
  font-weight: 700;
}

.country-item-flag {
  font-size: 16px;
  margin-right: 8px;
}

/* ==========================================================================
   DAGENS HEMMELIGE LAND (GLOBLE MODUS)
   ========================================================================== */
.globle-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.globle-guess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 600;
}

.globle-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ==========================================================================
   MODAL (RESULTATSKJERM)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: translateY(0);
}

.modal-trophy {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-trophy.trophy-win {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2.5px solid #f59e0b;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

.modal-trophy.trophy-review {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2.5px solid #38bdf8;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.25);
}

.modal-card h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--text-main);
}

.modal-card p {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.45;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.modal-stats .stat-pill {
  padding: 14px 12px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.modal-stats .stat-pill:first-child {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.12);
}

.modal-stats .stat-pill:first-child .stat-pill-val {
  color: #047857;
  font-size: 26px;
  font-weight: 800;
}

.modal-stats .stat-pill:first-child .stat-pill-label {
  color: #059669;
  font-weight: 700;
}

.modal-stats .stat-pill:last-child {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #93c5fd;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.12);
}

.modal-stats .stat-pill:last-child .stat-pill-val {
  color: #0369a1;
  font-size: 26px;
  font-weight: 800;
}

.modal-stats .stat-pill:last-child .stat-pill-label {
  color: #0284c7;
  font-weight: 700;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.btn-modal-lobby {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-weight: 700;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-modal-lobby:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.btn-modal-fasit {
  background: var(--palette-violet-bg);
  border: 1.5px solid var(--palette-violet-border);
  color: var(--palette-violet-dark);
  font-weight: 700;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-modal-fasit:hover {
  background: #ede9fe;
  border-color: #a78bfa;
  color: #5b21b6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.15);
}

.btn-modal-share {
  background: var(--palette-green-bg);
  border: 1.5px solid var(--palette-green-border);
  color: var(--palette-green-dark);
  font-weight: 700;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-modal-share:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #065f46;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.btn-modal-again {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
  border: 1.5px solid #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  padding: 12px 24px !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.btn-modal-again:hover {
  background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45) !important;
}

/* ==========================================================================
   TOOLTIP
   ========================================================================== */
#map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  z-index: 150;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}

#map-tooltip.show {
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVITET
   ========================================================================== */
/* ==========================================================================
   CHROMEBOOK & MINDRE SKJERMHØYDER (OPTIMALISERING FOR 768px OG SKOLEMASKINER)
   ========================================================================== */
@media (max-height: 820px) {
  :root {
    --header-height: 48px;
  }

  .site-header {
    height: 48px;
    padding: 0 16px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .brand-info h1 {
    font-size: 15px;
  }

  .brand-info p {
    display: none;
  }

  .btn-icon {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .game-top-bar {
    padding: 6px 16px;
    gap: 10px;
  }

  .game-info-cluster {
    gap: 10px;
  }

  .game-mode-title {
    font-size: 14px;
  }

  .region-select {
    font-size: 13px;
    padding: 4px 10px;
  }

  .metric-badge {
    padding: 4px 10px;
    font-size: 12px;
    gap: 6px;
  }

  .btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .game-main-area {
    padding: 8px 12px;
    gap: 12px;
  }

  .game-sidebar {
    width: 320px;
  }

  .sidebar-header {
    padding: 10px 14px;
  }

  .progress-header {
    font-size: 12px;
    margin-bottom: 4px;
  }

  .country-list-scroll {
    padding: 6px 8px;
  }

  .country-grid-item {
    padding: 6px 10px;
    font-size: 12px;
  }

  .map-svg-wrap {
    padding: 12px 16px 44px 16px; /* Dedikert sikkerhetsmargin i bunn for Chromebooks */
  }

  .game-input-dock {
    top: 8px;
    max-width: 440px;
  }

  .input-box-wrapper {
    padding: 2px 6px 2px 14px;
  }

  .type-input {
    height: 36px;
    font-size: 14px;
  }

  .click-prompt-card {
    top: 8px;
    padding: 6px 16px;
    gap: 12px;
  }

  .prompt-flag {
    font-size: 24px;
  }

  .prompt-flag-img {
    width: 36px;
    height: 24px;
  }

  .prompt-text-group h3 {
    font-size: 15px;
  }

  .prompt-text-group p {
    font-size: 11px;
  }

  .map-zoom-dock {
    bottom: 10px;
    left: 10px;
  }

  .zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .zoom-level-badge {
    font-size: 10px;
    padding: 3px 1px;
  }

  .lobby-hero {
    margin: 16px auto 0;
  }

  .lobby-hero h2 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .lobby-hero p {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .stats-strip {
    margin-bottom: 28px;
    gap: 12px;
  }

  .stat-pill {
    padding: 10px;
  }

  .stat-pill-val {
    font-size: 20px;
  }

  .games-grid {
    gap: 14px;
    margin-bottom: 32px;
  }

  .game-card-clean {
    padding: 14px 18px;
  }

  .modal-card {
    padding: 24px 24px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-trophy {
    width: 62px;
    height: 62px;
    font-size: 32px;
    margin: 0 auto 10px;
  }

  .modal-card h2 {
    font-size: 22px;
    margin-bottom: 6px;
  }

  .modal-card p {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .modal-stats {
    margin-bottom: 18px;
  }

  .stat-pill-val {
    font-size: 20px;
  }
}

/* Ekstra kompakt for skjermer under 620px (Chromebooks med 125% zoom / touchtastatur) */
@media (max-height: 620px) {
  .game-main-area {
    padding: 6px 8px;
    gap: 8px;
  }

  .game-sidebar {
    width: 275px;
  }

  .map-svg-wrap {
    padding: 8px 12px 38px 12px;
  }

  .game-input-dock {
    top: 6px;
    max-width: 380px;
  }

  .input-box-wrapper {
    padding: 0 4px 0 12px;
  }

  .type-input {
    height: 32px;
    font-size: 13px;
  }

  .map-zoom-dock {
    bottom: 8px;
    left: 8px;
  }

  .zoom-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .zoom-level-badge {
    font-size: 9px;
    padding: 2px 1px;
  }

  .modal-card {
    padding: 16px 20px;
    max-height: 92vh;
  }

  .modal-trophy {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin: 0 auto 6px;
  }

  .modal-card h2 {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .modal-card p {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .modal-stats {
    gap: 8px;
    margin-bottom: 12px;
  }

  .modal-stats .stat-pill {
    padding: 8px 6px;
  }

  .stat-pill-val {
    font-size: 18px;
  }

  .modal-actions {
    gap: 6px;
  }

  .btn-modal-lobby, .btn-modal-share, .btn-modal-fasit {
    padding: 6px 6px;
    font-size: 12px;
  }
}

@media (max-width: 900px) {
  .game-main-area {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
  }
  .game-sidebar {
    width: 100%;
    height: 220px;
  }
  .stats-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .modal-actions {
    grid-template-columns: 1fr;
  }
  .modal-card {
    padding: 24px 16px;
  }
}

/* ==========================================================================
   SVG FLAGG
   ========================================================================== */
.country-flag-img {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.prompt-flag-img {
  width: 48px;
  height: 32px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: block;
}

.click-prompt-card.prompt-mode-flags {
  padding: 10px 24px;
  gap: 18px;
}

.click-prompt-card.prompt-mode-flags .prompt-flag-img {
  width: 80px;
  height: 52px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  border: 1.5px solid rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   MIKROSTATER & SMÅ ØYER (INDIKATOR-SIRKLER)
   ========================================================================== */
/* Mikrostater - Erstattet av 20x presisjonszoom for 100% naturlig, uforstyrret kartflate */
.microstate-marker {
  display: none !important;
  pointer-events: none !important;
}

.microstate-hit {
  fill: transparent !important;
  stroke: transparent !important;
  pointer-events: none !important;
}

.microstate-dot {
  fill: #3b82f6;
  stroke: #ffffff;
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  opacity: 0.65;
  pointer-events: none;
  transition: all 0.25s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.microstate-core {
  fill: #ffffff;
  pointer-events: none;
  opacity: 0.85;
}

/* Inaktive stater har ingen forstyrrende permanent radar */
.microstate-pulse {
  display: none !important;
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* KUN AKTIVT MÅL: Nå og kun nå aktiveres radaren og klikksonen! */
.microstate-marker.is-current-target {
  cursor: pointer !important;
  pointer-events: all !important;
}

.microstate-marker.is-current-target .microstate-hit {
  cursor: pointer !important;
  pointer-events: all !important;
  fill: #ffffff !important;
  fill-opacity: 0.001 !important;
}

.microstate-marker.is-current-target .microstate-dot {
  fill: #f59e0b !important;
  stroke: #ffffff !important;
  stroke-width: 2.2px !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.95)) !important;
  animation: microstateTargetBounce 1.4s infinite ease-in-out;
  cursor: pointer !important;
  pointer-events: all !important;
}

.microstate-marker.is-current-target .microstate-pulse {
  display: block !important;
  stroke: #f59e0b !important;
  stroke-width: 2px !important;
  animation: microstateTargetPulse 1.4s infinite cubic-bezier(0, 0.2, 0.8, 1) !important;
}

.microstate-marker.is-current-target .microstate-core {
  fill: #fffbeb !important;
  opacity: 1 !important;
}

/* Funnet / Løst tilstand */
.microstate-marker.revealed .microstate-dot {
  fill: #10b981 !important;
  stroke: #ffffff !important;
  stroke-width: 1.2px !important;
  opacity: 0.85 !important;
  filter: drop-shadow(0 1px 2px rgba(16, 185, 129, 0.4));
  pointer-events: none;
}

.microstate-marker.revealed .microstate-core {
  fill: #ecfdf5 !important;
}

.microstate-marker.revealed .microstate-pulse {
  display: none !important;
}

/* Avslørt ved tap / ubesvart */
.microstate-marker.missed .microstate-dot {
  fill: #f43f5e !important;
  stroke: #ffffff !important;
  stroke-width: 1.2px !important;
  opacity: 0.85 !important;
  pointer-events: none;
}

.microstate-marker.missed .microstate-pulse {
  display: none !important;
}

/* Fasit-modus når spillet er over: gjør markører hoverbare for å se navn */
.game-over-active .microstate-marker,
.game-over-active .microstate-marker .microstate-dot {
  pointer-events: all !important;
  cursor: pointer !important;
}

@keyframes microstatePulseAnim {
  0% {
    r: 3.5;
    opacity: 0.95;
  }
  100% {
    r: 12;
    opacity: 0;
  }
}

@keyframes microstateTargetPulse {
  0% {
    r: 5;
    opacity: 1;
    stroke-width: 2.5px;
  }
  100% {
    r: 22;
    opacity: 0;
    stroke-width: 0.5px;
  }
}

@keyframes microstateTargetBounce {
  0%, 100% {
    transform: scale(1.1);
    transform-origin: center;
  }
  50% {
    transform: scale(1.35);
    transform-origin: center;
  }
}

/* ==========================================================================
   JUICY FEEDBACK TOAST & SUKSESS-ANIMASJON
   ========================================================================== */
.feedback-toast {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%) translateY(12px) scale(0.85);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  padding: 6px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  pointer-events: none;
  opacity: 0;
  z-index: 120;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.feedback-toast.streak-fire {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.5);
}

.feedback-toast.show {
  animation: popFeedbackToast 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popFeedbackToast {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(12px) scale(0.75);
  }
  16% {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px) scale(1.08);
  }
  28% {
    transform: translateX(-50%) translateY(0) scale(1);
  }
  75% {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px) scale(0.95);
  }
}

@keyframes countryFoundGlow {
  0% {
    filter: drop-shadow(0 0 18px #10b981) brightness(1.35);
  }
  50% {
    filter: drop-shadow(0 0 10px #34d399) brightness(1.2);
  }
  100% {
    filter: none;
  }
}

.revealed.just-found {
  animation: countryFoundGlow 1.2s ease-out;
}

/* ==========================================================================
   PEDAGOGISK RETTSKRIVINGSBOBLE (SKRIVEFEIL-TOLERANSE)
   ========================================================================== */
.spelling-tip-bubble {
  position: absolute;
  bottom: -44px;
  left: 50%;
  transform: translateX(-50%);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 110;
  white-space: nowrap;
}

.spelling-tip-bubble strong {
  font-weight: 700;
  color: #78350f;
  text-decoration: underline;
  text-decoration-color: #f59e0b;
}

.spelling-tip-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(4px);
}

/* ==========================================================================
   FASIT-BANNER & FOKUS-EFFEKT PÅ KARTET
   ========================================================================== */
.fasit-stage-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 500;
  z-index: 90;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  animation: slideDown 0.25s ease-out;
}

.fasit-stage-banner strong {
  color: #38bdf8;
}

@keyframes pulseGlowHighlight {
  0% {
    filter: drop-shadow(0 0 4px #f59e0b) brightness(1.2);
  }
  50% {
    filter: drop-shadow(0 0 16px #ef4444) brightness(1.5);
  }
  100% {
    filter: drop-shadow(0 0 4px #f59e0b) brightness(1.2);
  }
}

.focused-country-highlight {
  animation: pulseGlowHighlight 0.7s ease-in-out infinite alternate !important;
  stroke: #b91c1c !important;
  stroke-width: 2.5px !important;
}

/* ==========================================================================
   LOBBY KORT: PERSONLIGE REKORDER & MESTRINGS-STJERNER
   ========================================================================== */
.card-score-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  margin-left: auto;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-score-pill.perfect {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.tab-flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  display: inline-block;
}

.card-flag-icon {
  width: 28px;
  height: 19px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: block;
}

/* ==========================================================================
   KARTNÅLER & PUNKT-QUIZER (CITY PINS & POINT QUIZZES)
   ========================================================================== */
.city-pin {
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.city-pin:hover .city-pin-dot {
  fill: #38bdf8;
  stroke: #ffffff;
  stroke-width: 1.8px;
}

.city-pin-hit {
  fill: transparent;
  stroke: none;
  cursor: pointer;
}

.city-pin-pulse {
  fill: rgba(14, 165, 233, 0.25);
  animation: cityPinPulse 2.2s infinite ease-out;
  transform-origin: center;
  pointer-events: none;
}

@keyframes cityPinPulse {
  0% {
    r: 4.5px;
    opacity: 0.8;
  }
  100% {
    r: 18px;
    opacity: 0;
  }
}

.city-pin-dot {
  fill: #0ea5e9;
  stroke: #ffffff;
  stroke-width: 1.4px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45));
  transition: all 0.3s ease;
}

.city-pin-core {
  fill: #ffffff;
  pointer-events: none;
}

.city-pin-label {
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke fill;
  stroke: rgba(15, 23, 42, 0.95);
  stroke-width: 2.8px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Funnet tilstand (Grønn) */
.city-pin.found .city-pin-dot {
  fill: #10b981;
  stroke: #ffffff;
  stroke-width: 1.5px;
}

.city-pin.found .city-pin-pulse {
  animation: none;
  opacity: 0;
}

.city-pin.found .city-pin-label {
  opacity: 1;
}

/* Nyoppdaget animasjon */
.city-pin.just-found {
  animation: pinBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pinBounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.6); }
  100% { transform: scale(1); }
}

/* Manglet tilstand i Fasit (Korallrød) */
.city-pin.missed .city-pin-dot {
  fill: #ef4444;
  stroke: #ffffff;
}

.city-pin.missed .city-pin-pulse {
  fill: rgba(239, 68, 68, 0.35);
  animation: cityPinPulse 1.6s infinite ease-out;
}

.city-pin.missed .city-pin-label {
  opacity: 1;
  fill: #fca5a5;
}

/* Feilklikk risting */
.city-pin.wrong-click .city-pin-dot {
  fill: #ef4444;
  animation: pinShake 0.4s ease;
}

@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Fokus i fasit */
.focused-pin-highlight .city-pin-dot {
  fill: #f59e0b !important;
  stroke: #ffffff !important;
  stroke-width: 2px !important;
  animation: pinGlow 0.8s ease-in-out infinite alternate !important;
}

@keyframes pinGlow {
  0% { filter: drop-shadow(0 0 4px #f59e0b); }
  100% { filter: drop-shadow(0 0 14px #ef4444); }
}

/* Bakgrunnskart under punktquiz: dempede fylker for maksimal kontrast */
.point-quiz-active .country-path {
  fill: #ffffff !important;
  stroke: #94a3b8 !important;
  stroke-width: 1px !important;
  cursor: default !important;
}

.point-quiz-active .country-path:hover {
  fill: #ffffff !important;
  stroke: #94a3b8 !important;
}

/* ==========================================================================
   TIDTAKER & ØVINGSMODUS (UTEN TIDSPRESS)
   ========================================================================== */
.metric-badge.timer-badge {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.metric-badge.timer-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: #93c5fd;
}

.metric-badge.timer-practice {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.metric-badge.timer-practice #game-timer {
  color: #047857;
}

.btn-timer-toggle.active-practice {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

.feedback-toast.wrong-toast {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}


