@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f8f9fa;
  --text: #1a202c;
  --hover: #f1f3f5;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;

  --t-color: #f59e0b;
  --ct-color: #3b82f6;

  /* Links + tooltip tokens */
  --link: #2563eb;          /* blue-600 */
  --link-hover: #1d4ed8;    /* blue-700 */
  --tooltip-bg: rgba(17, 24, 39, 0.95); /* near-black */
  --tooltip-fg: #ffffff;
  --tooltip-underline: #2563eb; /* default squiggle color */
  --link-soft: rgba(37, 99, 235, 0.12);
  --link-soft-hover: rgba(37, 99, 235, 0.18);
  --link-border: rgba(37, 99, 235, 0.28);
  /* Inline code tokens */
  --code-bg: rgba(0,0,0,0.05);
  --code-border: rgba(0,0,0,0.08);
  /* Tooltip accent tokens (overridden per page via JS) */
  --tip-border: rgba(59,130,246,0.40);
  --tip-glow: rgba(59,130,246,0.30);
  --divider: rgba(0,0,0,0.12);

  /* Modern design tokens */
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --ease: cubic-bezier(.2,.8,.2,1);

  /* Subtle active backgrounds for tabs */
  --t-bg-soft: rgba(245, 158, 11, 0.12);
  --ct-bg-soft: rgba(59, 130, 246, 0.12);

  /* Subtle glow colors + base tab shadow */
  --t-glow: rgba(245, 158, 11, 0.28);
  --ct-glow: rgba(59, 130, 246, 0.28);
  --tab-shadow-base: var(--shadow);
  --tab-glow-blur: 12px;
}

/* Ensure root paints the theme color to avoid white gaps */
html { background: var(--bg); }

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

/* Dark mode tokens */
body.dark {
  --link: #93c5fd;       /* blue-300 */
  --link-hover: #bfdbfe; /* blue-200 */
  --tooltip-bg: rgba(24, 24, 32, 0.95);
  --tooltip-fg: #ffffff;
  --tooltip-underline: #bfdbfe; /* brighter squiggle for contrast */
  --link-soft: rgba(147, 197, 253, 0.14);
  --link-soft-hover: rgba(191, 219, 254, 0.20);
  --link-border: rgba(191, 219, 254, 0.35);
  /* Lighter yet still subtle for dark mode */
  --code-bg: rgba(255,255,255,0.24);
  --code-border: rgba(255,255,255,0.38);
  /* Tooltip accent defaults for dark */
  --tip-border: rgba(96,165,250,0.45);
  --tip-glow: rgba(96,165,250,0.35);
  --divider: rgba(255,255,255,0.14);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh; /* cover full viewport height to avoid bottom white area */
  /* Gentle depth tint */
  background-image:
    radial-gradient(900px 420px at 18% -10%, rgba(59,130,246,0.08), rgba(0,0,0,0) 60%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Modern, accessible link styling */
a {
  font-size: inherit;
  font-weight: inherit;
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: color .15s var(--ease), text-decoration-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.35);
  border-radius: 6px;
}
/* Do not underline tile-style nav anchors */
header .map-nav a, .welcome .map-grid a { text-decoration: none; }

/* Tooltip: semantic, CSS-only using data attribute */
.has-tooltip {
  position: relative;
  cursor: help;
  display: inline-block; /* prevent line-box clipping of underline */
  text-decoration-line: underline;
  text-decoration-style: wavy; /* squiggly underline */
  text-decoration-color: var(--tooltip-underline);
  text-decoration-thickness: 1.1px; /* slimmer */
  text-underline-offset: 3.25px; /* slightly lower to avoid clipping */
  text-decoration-skip-ink: none; /* avoid chopped segments around glyphs */
  padding-bottom: 1px; /* add a tiny buffer for the wave */
}
.has-tooltip:hover { text-decoration-color: var(--link-hover); }
.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(6px);
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  padding: .45rem .6rem;
  border-radius: 8px;
  white-space: normal;
  max-width: 280px;
  font-size: .85rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--tip-border);
  box-shadow: 0 10px 24px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.12), 0 0 0 1px var(--tip-border), 0 0 18px var(--tip-glow);
  transition: opacity .15s var(--ease), transform .15s var(--ease);
  z-index: 30;
}
.has-tooltip.tooltip-bottom::after { bottom: auto; top: calc(100% + 8px); transform: translateX(-50%) translateY(-6px); }
.has-tooltip.tooltip-bottom:hover::after, .has-tooltip.tooltip-bottom:focus-visible::after { transform: translateX(-50%) translateY(0); }

/* Disabled map icon styling (applies across pages) */
header .map-nav a.disabled { pointer-events: auto; cursor: not-allowed; }
header .map-nav a.disabled:hover { box-shadow: none !important; transform: none !important; }
header .map-nav a.disabled img { filter: saturate(0) grayscale(100%) opacity(.5) !important; opacity: .5 !important; }
header .map-nav a.has-tooltip { text-decoration: none !important; text-decoration-line: none !important; }

/* Ensure header tooltips can be placed below the icon */
header .map-nav a.has-tooltip.tooltip-bottom::after { bottom: auto !important; top: calc(100% + 8px) !important; transform: translateX(-50%) translateY(-6px) !important; }
header .map-nav a.has-tooltip.tooltip-bottom:hover::after, header .map-nav a.has-tooltip.tooltip-bottom:focus-visible::after { transform: translateX(-50%) translateY(0) !important; }

/* Disable hover effects on disabled tiles in callout landing grid */
.map-grid a.disabled { cursor: not-allowed; }
.welcome .map-grid a.disabled img { filter: saturate(0) grayscale(100%) opacity(.5) !important; opacity: .5 !important; }
.welcome .map-grid a.disabled:hover { transform: none !important; box-shadow: var(--shadow) !important; }
@media (prefers-color-scheme: dark) {
  .welcome .map-grid a.disabled,
  .welcome .map-grid a.disabled:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.06) !important; }
}

/* Keep header disabled tile static on hover but preserve base border */
header .map-nav a.disabled:hover { transform: none !important; }
@media (prefers-color-scheme: dark) {
  header .map-nav a.disabled,
  header .map-nav a.disabled:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.06) !important; }
}
.has-tooltip.location-tooltip::after {
  /* Widen only the FAQ “location” tooltip to fit its text exactly */
  white-space: nowrap !important;   /* keep full path on one line */
  width: max-content !important;    /* size box to content width */
  max-width: none !important;       /* remove base 280px cap */
  display: inline-block;            /* ensure intrinsic sizing */
}
.has-tooltip:hover::after, .has-tooltip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Generic tooltip (no underline) for icons like note emoji */
.tooltip { cursor: help; }

/* Global tooltip bubble (managed by JS) */
.ui-tooltip {
  position: fixed;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  padding: .45rem .6rem;
  border-radius: 8px;
  white-space: normal;
  max-width: min(320px, 90vw);
  font-size: .85rem;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--tip-border);
  box-shadow: 0 10px 24px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.12), 0 0 0 1px var(--tip-border), 0 0 18px var(--tip-glow);
  transition: opacity .12s var(--ease), transform .12s var(--ease);
  transform: translate(-50%, 6px);
  z-index: 940; /* below FAQ backdrop (950) */
}
body.dark .ui-tooltip { box-shadow: 0 10px 24px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.25); }

/* Inline code normalization: match regular text size */
code, kbd, samp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1em;        /* same as surrounding text */
  line-height: inherit;  /* align with text line box */
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: .08em .35em; /* subtle chip */
}

/* Increase specificity for FAQ content to ensure dark mode chips take effect */
.faq-modal__content code,
.faq-modal__content kbd,
.faq-modal__content samp {
  background: var(--code-bg);
  border-color: var(--code-border);
}

/* Dark mode: slightly lighter inline code specifically inside FAQ modal */
body.dark .faq-modal__content code,
body.dark .faq-modal__content kbd,
body.dark .faq-modal__content samp,
.dark .faq-modal__content code,
.dark .faq-modal__content kbd,
.dark .faq-modal__content samp {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.36);
}

/* (Removed pill styling for download links to keep it vanilla) */

.page-wrapper {
  width: 100%;
  max-width: 1100px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =========================
   HEADER WITH MAP ICONS
   ========================= */
header {
  background: none;
  border-bottom: none;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem; /* equal top/bottom padding */
}

header .map-nav {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

  header .map-nav a img {
    height: 72px;
    width: 72px;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
  }
  header .map-nav a:hover img { opacity: 1; transform: scale(1.1); }
  header .map-nav a.active img { opacity: 1; }

/* =========================
   COMPACT HAMBURGER MENU
   ========================= */
/* Make wrapper a positioning context so the menu aligns to its left padding */
.page-wrapper { position: relative; }

.site-menu {
  position: fixed;      /* top-left placement */
  top: calc(2rem - 1px);
  left: 1rem;
  z-index: 920;         /* above header tiles, below FAQ modal (950) */
  font-size: 14px;
}

.site-menu__trigger {
  appearance: none;
  border: none;
  background: transparent;
  padding: 9px;         /* 1.5x size */
  border-radius: 10px;
  cursor: pointer;
  line-height: 0;
  /* near-invisible (but visible) icon color for light mode */
  color: rgba(0,0,0,0.12);
  transition: transform .12s var(--ease);
}
.site-menu__trigger:hover { transform: translateY(-1px); }

/* 3 bars icon built with spans so color inherits */
.site-menu__trigger .bars { display: inline-grid; gap: 4px; }
.site-menu__trigger .bar {
  display: block; width: 27px; height: 3px; border-radius: 3px; /* 1.5x bars */
  background: currentColor;
}

/* Panel base */
.site-menu__panel {
  position: absolute;
  top: 0;                          /* align with trigger top */
  left: calc(100% + 10px);         /* add breathing room between icon and panel */
  min-width: 160px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(120%) blur(6px);
  padding: 6px;
  opacity: 0; pointer-events: none; transform: translateX(-6px) scale(.98);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}

.site-menu.is-open .site-menu__panel { opacity: 1; pointer-events: auto; transform: translateX(0) scale(1); }

/* Force-close state to override :hover visibility (used after selection) */
.site-menu.closing .site-menu__panel { opacity: 0 !important; pointer-events: none !important; transform: translateX(-6px) scale(.98) !important; }

/* Temporarily disable hover interactions after selection */
.site-menu.nohover { pointer-events: none; }

.site-menu__list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.site-menu__item {
  display: grid;
  grid-template-columns: 1fr auto; /* label left, chevron right */
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px; color: inherit; text-decoration: none;
  transition: background-color .12s var(--ease), box-shadow .12s var(--ease), transform .12s var(--ease);
  column-gap: .6rem;
}
.site-menu__item:hover { background: var(--hover); transform: none; color: inherit; }
.site-menu__item .label { font-weight: 500; text-align: left; }
.site-menu__item .chev { opacity: .6; font-size: 16px; justify-self: end; }
.site-menu__item.is-active .label { font-weight: 700; }

/* Submenu: maps for Lineups */
.site-menu__submenu {
  position: absolute;
  top: 0;
  left: calc(100% - 2px); /* overlap slightly; no hover gap */
  min-width: 220px;
  max-height: 70vh;
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(120%) blur(6px);
  opacity: 0; pointer-events: none; transform: translateX(6px) scale(.98);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.site-menu__maps { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.site-menu__map {
  display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 10px; color: inherit; text-decoration: none;
  transition: background-color .12s var(--ease), transform .12s var(--ease);
}
.site-menu__map.is-active { pointer-events: none; cursor: default; }
.site-menu__map.is-active .name { font-weight: 700; color: inherit; }
.site-menu__map.is-active { background: var(--map-bg, var(--hover)); }
.site-menu__map img { width: 24px; height: 24px; opacity: .85; }
.site-menu__map .name { font-size: 14px; text-align: left; }
/* Map hover/active: subtle background tint derived from --map-bg; no text color change */
.site-menu__map:hover { background: var(--map-bg, var(--hover)); color: inherit; }
/* Disabled map entry (e.g., Overpass callouts) */
.site-menu__map.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; text-decoration: none; }

/* Submenu display when hovering Lineups list item or submenu itself */
.site-menu__li--lineups { position: relative; }
.site-menu__li--lineups:hover .site-menu__submenu,
.site-menu__submenu:hover { opacity: 1; pointer-events: auto; transform: translateX(0) scale(1); }

/* Mirror behavior for Callouts submenu */
.site-menu__li--callouts { position: relative; }
.site-menu__li--callouts:hover .site-menu__submenu,
.site-menu__submenu:hover { opacity: 1; pointer-events: auto; transform: translateX(0) scale(1); }

/* Dark mode surfaces */
@media (prefers-color-scheme: dark) {
  /* make even subtler in dark mode */
  .site-menu__trigger { color: rgba(255,255,255,0.12); }
  .site-menu__panel,
  .site-menu__submenu { background: var(--bg); color: var(--text); border-color: rgba(255,255,255,0.08); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 10px 28px rgba(0,0,0,0.45); backdrop-filter: none; }
}

/* Small screens: place panel under icon, and open on tap */
@media (max-width: 640px) {
  /* On small screens, drop the panel below the icon for reachability */
  .site-menu__panel { left: 0; top: calc(100% + 8px); transform: translateY(-6px) scale(.98); }
  .site-menu__submenu { position: static; left: auto; top: auto; margin-top: 4px; }
}

/* =========================
   TOP-LEFT HOT-CORNER DEMO MENU
   ========================= */
.site-demo-menu { position: fixed; top: 0; left: 0; z-index: 930; }
.site-demo-menu__hot { position: absolute; top: 0; left: 0; width: 16px; height: 16px; opacity: 0; }
/* Subtle ripple cue from the top-left corner */
.site-demo-menu__hot::after {
  content: "";
  position: absolute; top: 0; left: 0;
  width: 28px; height: 28px; border-radius: 9999px;
  border: 2px solid rgba(0,0,0,0.12);
  transform-origin: 0 0; /* grow down-right from the corner */
  transform: scale(0.65);
  opacity: .35;
  pointer-events: none;
  animation: demo-ripple 2.4s ease-out infinite;
}
@keyframes demo-ripple {
  0%   { transform: scale(0.65); opacity: .35; }
  60%  { opacity: .08; }
  100% { transform: scale(1.6); opacity: 0; }
}
.site-demo-menu:hover .site-demo-menu__hot::after { opacity: 0; animation-play-state: paused; }
.site-demo-menu__panel {
  position: absolute;
  top: 8px; left: 8px;
  min-width: 160px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(120%) blur(6px);
  padding: 6px;
  opacity: 0; pointer-events: none; transform: translateY(-6px) scale(.98);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.site-demo-menu__hint {
  position: absolute; top: 12px; left: 16px;
  font-size: 12px; line-height: 1;
  padding: .25rem .45rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-4px);
  pointer-events: none;
  animation: hint-cycle 4s var(--ease) 1.2s 1 forwards;
}
@keyframes hint-cycle { 0%{opacity:0; transform: translateY(-4px);} 15%{opacity:1; transform: translateY(0);} 85%{opacity:1; transform: translateY(0);} 100%{opacity:0; transform: translateY(-4px);} }
.site-demo-menu:hover .site-demo-menu__panel,
.site-demo-menu__panel:hover { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.site-demo-menu__list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; }
.site-demo-menu__item { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.site-demo-menu__item .label { font-weight: 500; }
.site-demo-menu__item .chev { opacity: .6; font-size: 16px; }
.site-demo-menu__item:hover .label { color: var(--link-hover); }
@media (prefers-color-scheme: dark) {
  .site-demo-menu__panel { background: var(--bg); color: var(--text); border-color: rgba(255,255,255,0.08); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 10px 28px rgba(0,0,0,0.45); backdrop-filter: none; }
  .site-demo-menu__hot::after { border-color: rgba(255,255,255,0.16); opacity: .28; }
  .site-demo-menu__hint { background: var(--bg); border-color: rgba(255,255,255,0.08); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 10px 28px rgba(0,0,0,0.45); }
}

/* (Reverted: callouts viewer styles are defined inline per page) */

/* Modern header tiles */
header .map-nav { gap: 1.25rem; }
header .map-nav a,
.welcome .map-grid a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(120%) blur(4px);
  transform: translateZ(0);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
header .map-nav a:hover,
.welcome .map-grid a:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08); }
header .map-nav a img,
.welcome .map-grid a img { filter: grayscale(30%) saturate(90%); opacity: .85; transition: filter .2s var(--ease), opacity .2s var(--ease), transform .2s var(--ease); }
header .map-nav a:hover img, header .map-nav a.active img,
.welcome .map-grid a:hover img { filter: none; opacity: 1; transform: scale(1.05); }

/* Map-specific active backgrounds + glow (light mode), and hover */
header .map-nav a.active[href*="ancient"], header .map-nav a[href*="ancient"]:hover, .welcome .map-grid a[href*="ancient"]:hover { background: rgba(107,142,35,0.18); transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #6b8e23, 0 0 16px rgba(107,142,35,0.55) !important; }
header .map-nav a.active[href*="dust2"],   header .map-nav a[href*="dust2"]:hover,   .welcome .map-grid a[href*="dust2"]:hover   { background: rgba(212,184,106,0.18); transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #d4b86a, 0 0 16px rgba(212,184,106,0.55) !important; }
header .map-nav a.active[href*="mirage"],  header .map-nav a[href*="mirage"]:hover,  .welcome .map-grid a[href*="mirage"]:hover  { background: rgba(217,165,102,0.18); transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #d9a566, 0 0 16px rgba(217,165,102,0.55) !important; }
header .map-nav a.active[href*="inferno"], header .map-nav a[href*="inferno"]:hover, .welcome .map-grid a[href*="inferno"]:hover { background: rgba(201,79,79,0.18);  transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #c94f4f, 0 0 16px rgba(201,79,79,0.55) !important; }
header .map-nav a.active[href*="nuke"],    header .map-nav a[href*="nuke"]:hover,    .welcome .map-grid a[href*="nuke"]:hover    { background: rgba(77,166,255,0.18);  transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #4da6ff, 0 0 16px rgba(77,166,255,0.58) !important; }
header .map-nav a.active[href*="overpass"],header .map-nav a[href*="overpass"]:hover,.welcome .map-grid a[href*="overpass"]:hover{ background: rgba(139,109,70,0.18);  transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #8b6d46, 0 0 16px rgba(139,109,70,0.55) !important; }
header .map-nav a.active[href*="train"],   header .map-nav a[href*="train"]:hover,   .welcome .map-grid a[href*="train"]:hover   { background: rgba(128,128,128,0.18); transform: translateY(-3px); box-shadow: 0 12px 34px rgba(0,0,0,.14), 0 5px 14px rgba(0,0,0,.10), 0 0 0 3px #808080, 0 0 16px rgba(128,128,128,0.55) !important; }

/* Keep lift on hover while preserving glow */
header .map-nav a.active[href*="ancient"]:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #6b8e23, 0 0 12px rgba(107,142,35,0.40); }
header .map-nav a.active[href*="dust2"]:hover   { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #d4b86a, 0 0 12px rgba(212,184,106,0.40); }
header .map-nav a.active[href*="mirage"]:hover  { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #d9a566, 0 0 12px rgba(217,165,102,0.40); }
header .map-nav a.active[href*="inferno"]:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #c94f4f, 0 0 12px rgba(201,79,79,0.40); }
header .map-nav a.active[href*="nuke"]:hover    { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #4da6ff, 0 0 12px rgba(77,166,255,0.45); }
header .map-nav a.active[href*="overpass"]:hover{ transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #8b6d46, 0 0 12px rgba(139,109,70,0.40); }
header .map-nav a.active[href*="train"]:hover   { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08), 0 0 0 2px #808080, 0 0 12px rgba(128,128,128,0.40); }

/* Map-specific active styles for dark mode */
body.dark header .map-nav a.active[href*="ancient"] { background: rgba(107,142,35,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #6b8e23, 0 0 20px rgba(107,142,35,0.65) !important; }
body.dark header .map-nav a.active[href*="dust2"]   { background: rgba(212,184,106,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #d4b86a, 0 0 20px rgba(212,184,106,0.65) !important; }
body.dark header .map-nav a.active[href*="mirage"]  { background: rgba(217,165,102,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #d9a566, 0 0 20px rgba(217,165,102,0.65) !important; }
body.dark header .map-nav a.active[href*="inferno"] { background: rgba(201,79,79,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #c94f4f, 0 0 20px rgba(201,79,79,0.65) !important; }
body.dark header .map-nav a.active[href*="nuke"]    { background: rgba(77,166,255,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #4da6ff, 0 0 20px rgba(77,166,255,0.70) !important; }
body.dark header .map-nav a.active[href*="overpass"]{ background: rgba(139,109,70,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #8b6d46, 0 0 20px rgba(139,109,70,0.65) !important; }
body.dark header .map-nav a.active[href*="train"]   { background: rgba(128,128,128,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #808080, 0 0 20px rgba(128,128,128,0.65) !important; }

body.dark header .map-nav a.active[href*="ancient"]:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #6b8e23, 0 0 14px rgba(107,142,35,0.55); }
body.dark header .map-nav a.active[href*="dust2"]:hover   { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #d4b86a, 0 0 14px rgba(212,184,106,0.55); }
body.dark header .map-nav a.active[href*="mirage"]:hover  { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #d9a566, 0 0 14px rgba(217,165,102,0.55); }
body.dark header .map-nav a.active[href*="inferno"]:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #c94f4f, 0 0 14px rgba(201,79,79,0.55); }
body.dark header .map-nav a.active[href*="nuke"]:hover    { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #4da6ff, 0 0 14px rgba(77,166,255,0.60); }
body.dark header .map-nav a.active[href*="overpass"]:hover{ transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #8b6d46, 0 0 14px rgba(139,109,70,0.55); }
body.dark header .map-nav a.active[href*="train"]:hover   { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.35), 0 0 0 2px #808080, 0 0 14px rgba(128,128,128,0.55); }

/* =========================
   MAIN CONTENT
   ========================= */
main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  color: var(--text);
}

/* Welcome grid layout */
.welcome {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.welcome .map-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  width: min(700px, 90vw); /* fits 4 tiles + 3 gaps */
}
.welcome .map-grid a { width: 160px; }
.welcome .map-grid a img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1; /* always square */
  object-fit: contain;  /* preserve image without cropping */
  display: block;
}

/* =========================
   LEVEL 1 TABS (T / CT)
   ========================= */
.tabs {
  display: flex;
  border-bottom: none; /* remove full-width line under tabs */
  margin-bottom: 1.25rem; /* increased spacing above level 2 tabs */
  gap: 0.75rem; /* more separation between tabs */
}

.tabs button {
  flex: 1;
  text-align: center;
  background: none;
  border: 1px solid transparent; /* show full border incl. bottom */
  padding: 0.8rem 1rem;
  font-size: 1.1rem;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease), color 0.15s var(--ease);
  box-shadow: var(--tab-shadow-base); /* elevated effect */
}

.tabs button img { height: 20px; width: 20px; }

/* Team-tinted hover backgrounds */
.tabs button.t-tab:hover { background: var(--t-bg-soft); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--t-glow), 0 0 var(--tab-glow-blur) var(--t-glow); }
.tabs button.ct-tab:hover { background: var(--ct-bg-soft); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--ct-glow), 0 0 var(--tab-glow-blur) var(--ct-glow); }

/* Subtle borders for inactive tabs */
/* Removed inactive tab borders; keep transparent base border */

/* Active tabs: subtle team tint + elevation (no border) */
.tabs button.active.t-tab { background: none; color: var(--text); border-color: var(--t-color); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--t-glow), 0 0 var(--tab-glow-blur) var(--t-glow); font-weight: 500; }
.tabs button.active.ct-tab { background: none; color: var(--text); border-color: var(--ct-color); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--ct-glow), 0 0 var(--tab-glow-blur) var(--ct-glow); font-weight: 500; }

/* =========================
   LEVEL 2 TABS (Grenades)
   ========================= */
.subtabs {
  display: flex;
  border-bottom: none; /* remove full-width line under subtabs */
  margin-bottom: 1rem;
  gap: 0.75rem; /* more separation between subtabs */
}

.subtabs button {
  flex: 1;
  text-align: center;
  background: none;
  border: 1px solid transparent; /* show full border incl. bottom */
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius);
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease), color 0.15s var(--ease);
  box-shadow: var(--tab-shadow-base); /* elevated effect */
}

/* Subtle borders for inactive subtabs */
/* Removed inactive subtab borders; keep transparent base border */

/* Team-tinted hover backgrounds for subtabs */
#T-subtabs .subtabs button:hover { background: var(--t-bg-soft); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--t-glow), 0 0 var(--tab-glow-blur) var(--t-glow); }
#CT-subtabs .subtabs button:hover { background: var(--ct-bg-soft); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--ct-glow), 0 0 var(--tab-glow-blur) var(--ct-glow); }

/* Active subtabs: subtle team tint + elevation (no border) */
#T-subtabs .subtabs button.active { background: none; color: var(--text); border-color: var(--t-color); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--t-glow), 0 0 var(--tab-glow-blur) var(--t-glow); font-weight: 500; }
#CT-subtabs .subtabs button.active { background: none; color: var(--text); border-color: var(--ct-color); box-shadow: var(--tab-shadow-base), 0 0 0 2px var(--ct-glow), 0 0 var(--tab-glow-blur) var(--ct-glow); font-weight: 500; }

/* =========================
   SUBCONTENT
   ========================= */
.subcontent {
  padding: 1rem 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
  margin-bottom: 1rem;
  color: var(--text);
}

/* Search bar */
.search-bar { margin: .5rem 0 1rem; }
.search-bar .lineup-search {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.search-bar .lineup-search:focus { box-shadow: 0 0 0 3px rgba(96,165,250,.25); border-color: #93c5fd; }

@media (prefers-color-scheme: dark) {
  .search-bar .lineup-search { background: #111; border-color: rgba(255,255,255,.08); color: var(--text); }
  .search-bar .lineup-search:focus { box-shadow: 0 0 0 3px rgba(96,165,250,.35); border-color: rgba(96,165,250,.5); }
}

/* =========================
   COMMAND BLOCKS
   ========================= */
.command-block {
  margin: 1.5rem 0; /* increased spacing between blocks by ~50% */
  border: 1px solid #eaecef;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.command-header {
  background: #e5e7eb; /* slightly darker modern gray for light mode */
  color: #111827;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
  border-bottom: 1px solid #dfe3e8;
}

.command-header .command-extra {
  font-weight: 400;
  font-size: 0.85rem;
  color: #6b7280; /* modern neutral gray */
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem .45rem;
}
.command-header .command-extra .sep { display: none; }
.command-header .command-extra strong {
  background: #fff;
  color: inherit;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  padding: .15rem .5rem;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.command-header .command-extra .airtime .airtime-number { font-weight: 700; }

.command-title { position: relative; cursor: pointer; display: inline-flex; align-items: center; overflow: visible; }

.anchor-link {
  margin-left: 0.5rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s;
  text-decoration: none;
  color: #8b949e;
}
.command-title:hover .anchor-link { opacity: 1; }

/* Note icon next to titles */
.command-title .note-icon { margin-left: .4rem; cursor: help; display: inline-block; width: 1em; height: 1em; line-height: 1; vertical-align: middle; font-size: 1em; }
.command-title .note-icon.note-icon--empty { cursor: default; }
.command-title .note-icon.note-icon--empty::after { content: ""; }
/* Default (light) note icon: 📜; switch to 📃 in dark mode */
.command-title .note-icon::after { content: "\01F4DC"; }
@media (prefers-color-scheme: dark) {
  /* FAQ dark styles */
  .faq-button { background: rgba(255,255,255,0.10); color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.06); }
  .faq-button:hover { box-shadow: 0 12px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,0.08); }
  .faq-backdrop { background: rgba(0,0,0,0.35); }
  /* Match dark theme surface exactly */
  .faq-modal { background: var(--bg); color: #fff; box-shadow: 0 24px 72px rgba(0,0,0,.6), 0 8px 28px rgba(0,0,0,.5); }
  .faq-close:hover { background: rgba(255,255,255,.06); }
  .command-title .note-icon::after { content: "\01F4C3"; }
}

/* Also support explicit dark mode via body.dark */
body.dark .faq-button { background: rgba(255,255,255,0.10); color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.06); }
body.dark .faq-button:hover { box-shadow: 0 12px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,0.08); }
body.dark .faq-backdrop { background: rgba(0,0,0,0.35); }
/* Match dark theme surface exactly */
body.dark .faq-modal { background: var(--bg); color: #fff; box-shadow: 0 24px 72px rgba(0,0,0,.6), 0 8px 28px rgba(0,0,0,.5); }

/* Difficulty gauge coloring */
.command-extra .difficulty { font-weight: inherit; }
.command-extra strong { font-weight: 700; }
.command-extra .difficulty.level-1 { color: #16a34a; /* green */ }
.command-extra .difficulty.level-2 { color: #ca8a04; /* yellow with better contrast */ }
.command-extra .difficulty.level-3 { color: #ef4444; /* red */ }

.command-code {
  background: #f6f8fa;
  font-family: monospace;
  font-size: 0.9rem;
  padding: 1rem;
  margin: 0;
  cursor: pointer;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
  transition: background-color 0.4s ease; /* smooth fade for copy feedback */
  /* Ensure copied highlight respects rounded corners */
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  background-clip: padding-box;
}
.command-code:hover { background: #ebedf0; }

/* Copy success highlight */
.command-code.copied { background-color: #d1fae5 !important; /* light mode green */ }
body.dark .command-code.copied { background-color: #0f5132 !important; /* fallback for older browsers */ }

/* =========================
   FAQ FLOATING BUTTON + MODAL
   ========================= */
.faq-button {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  height: 48px;
  width: 48px;
  border-radius: 9999px;
  border: none;
  background: rgba(255,255,255,0.9); /* light mode surface */
  color: #000; /* black question mark in light mode */
  box-shadow: 0 10px 30px rgba(0,0,0,.16), 0 4px 12px rgba(0,0,0,.10);
  backdrop-filter: saturate(120%) blur(6px);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
  z-index: 900;
}
.faq-button:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,0,0,.20), 0 6px 16px rgba(0,0,0,.12); }

.faq-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.25); /* translucent */
  backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  z-index: 950;
}
.faq-backdrop.open { opacity: 1; pointer-events: auto; }

.faq-modal {
  width: min(680px, 92vw);
  border-radius: 14px;
  background: rgba(255,255,255,0.88); /* light mode surface */
  color: #000; /* solid black text in light mode */
  box-shadow: 0 24px 72px rgba(0,0,0,.25), 0 8px 28px rgba(0,0,0,.18);
  backdrop-filter: saturate(140%) blur(14px);
  transform: translateY(10px) scale(.98);
  opacity: 0;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.faq-backdrop.open .faq-modal { transform: translateY(0) scale(1); opacity: 1; }

.faq-modal__inner { padding: 1rem; }
.faq-modal__header { display: flex; align-items: center; justify-content: space-between; padding: .25rem .25rem .5rem; }
.faq-modal__title { font-size: 1.2rem; }
.faq-close {
  border: none; background: transparent; cursor: pointer; font-size: 1.2rem; color: inherit;
  border-radius: 8px; padding: .25rem .5rem; line-height: 1; opacity: .8; transition: opacity .15s var(--ease), background-color .15s var(--ease);
}
.faq-close:hover { opacity: 1; background: rgba(0,0,0,.06); }
.faq-modal__content { padding: .5rem .25rem 1rem; display: grid; gap: .9rem; }
.faq-modal__content p { margin: 0; line-height: 1.45; }

/* FAQ content hooks for quick styling */
.faq-modal__content .faq-item { margin-bottom: .75rem; }
.faq-modal__content .faq-q strong { font-weight: 700; }
.faq-modal__content .faq-a { font-weight: 400; }
.faq-modal__content .em { font-weight: 700; }
.faq-modal__content .accent { color: var(--ct-color); font-weight: 600; }
.faq-modal__content .accent-2 { color: var(--t-color); font-weight: 600; }
.faq-modal__content .muted { color: #6b7280; }
@media (prefers-color-scheme: dark) {
  .faq-modal__content .muted { color: #8b949e; }
}
body.dark .faq-modal__content .muted { color: #8b949e; }

/* Distinguish questions and answers (subtle) */
.faq-modal__content .faq-q { display: block; margin-bottom: .2rem; }
.faq-modal__content .faq-q strong { font-size: 1.05rem; color: var(--ct-color); }
/* Remove the dot marker */
.faq-modal__content .faq-q::before { content: none; display: none; }
.faq-modal__content .faq-a { margin-top: .25rem; }

/* Dark mode: use T color for question text */
@media (prefers-color-scheme: dark) {
  .faq-modal__content .faq-q strong { color: var(--t-color); }
}
body.dark .faq-modal__content .faq-q strong,
.dark .faq-modal__content .faq-q strong { color: var(--t-color); }

/* =========================
   TOAST (copy feedback)
   ========================= */
.toast-container { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 1000; display: grid; gap: .5rem; }
.toast { background: rgba(17,24,39,.92); color: #fff; padding: .5rem .75rem; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
@media (prefers-color-scheme: light) { .toast { background: rgba(255,255,255,.95); color: #111827; border: 1px solid #e5e7eb; } }

/* =========================
   STICKY TABS
   ========================= */
.tabs { position: sticky; top: 0; z-index: 800; background: var(--bg); }
.subtabs { position: sticky; top: 52px; z-index: 800; background: var(--bg); }
@media (max-width: 640px) { .subtabs { top: 56px; } }

/* Prevent background scroll when modal open */
.modal-open { overflow: hidden; }

/* Ensure dark-mode overrides come after base styles */
@media (prefers-color-scheme: dark) {
  .faq-button { background: rgba(255,255,255,0.10); color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.06); }
  .faq-button:hover { box-shadow: 0 12px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,0.08); }
  .faq-backdrop { background: rgba(0,0,0,0.35); }
  /* Match dark theme surface exactly */
  .faq-modal { background: var(--bg); color: #fff; box-shadow: 0 24px 72px rgba(0,0,0,.6), 0 8px 28px rgba(0,0,0,.5); backdrop-filter: none; }
  .faq-close:hover { background: rgba(255,255,255,.06); }
}

/* Explicit class-based dark theme support */
body.dark .faq-button { background: rgba(255,255,255,0.10); color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,0.06); }
body.dark .faq-button:hover { box-shadow: 0 12px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,0.08); }
body.dark .faq-backdrop { background: rgba(0,0,0,0.35); }
/* Match dark theme surface exactly */
body.dark .faq-modal { background: var(--bg); color: #fff; box-shadow: 0 24px 72px rgba(0,0,0,.6), 0 8px 28px rgba(0,0,0,.5); backdrop-filter: none; }
/* =========================
   DARK MODE (via prefers-color-scheme)
   ========================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181817;
    --text: #e6e6e3;
    --hover: #0f0f0e;
    --t-color: #fbbf24;
    --ct-color: #60a5fa;
    --t-bg-soft: rgba(251, 191, 36, 0.10);
    --ct-bg-soft: rgba(96, 165, 250, 0.10);
  }

  .command-block { border-color: rgba(255,255,255,0.06); box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.28); }
  .command-header { background: #20201f; color: var(--text); border-bottom: none; }
  .command-header .command-extra { color: #9a9a93; }
  .command-header .command-extra strong { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.10); box-shadow: none; }
  .command-code { background: #121211; color: var(--text); }
  .command-code:hover { background: #161615; }
  .command-code.copied {
    /* higher-contrast success highlight on dark */
    background-color: rgba(34, 197, 94, 0.22) !important; /* vivid green overlay */
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
  }

  .tabs { border-bottom: none; }
  .subtabs { border-bottom: none; }
  .tabs button:hover:not(.t-tab):not(.ct-tab) { background: #111111; }
  .subtabs button:hover { background: #111111; }

  /* Make inactive tabs more distinct in dark mode */
  .tabs button:not(.active),
  .subtabs button:not(.active) {
    box-shadow: 0 0 0 1.5px rgba(255,255,255,0.14), 0 8px 20px rgba(0,0,0,0.45);
  }
  .tabs button:not(.active):hover,
  .subtabs button:not(.active):hover {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 10px 24px rgba(0,0,0,0.5);
  }

  body { background-image: radial-gradient(900px 420px at 18% -10%, rgba(255,255,255,0.03), rgba(0,0,0,0) 60%); }
  header .map-nav a, .welcome .map-grid a { background: rgba(255,255,255,.04); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
  header .map-nav a:hover, .welcome .map-grid a:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.4); }
  header .map-nav a img { opacity: 0.5; }
  header .map-nav a.active img { opacity: 0.8; }

  /* Map-specific active + hover glows (welcome only for hover) */
  header .map-nav a.active[href*="ancient"], .welcome .map-grid a[href*="ancient"]:hover { background: rgba(107,142,35,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #6b8e23, 0 0 20px rgba(107,142,35,0.65) !important; }
  header .map-nav a.active[href*="dust2"],   .welcome .map-grid a[href*="dust2"]:hover   { background: rgba(212,184,106,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #d4b86a, 0 0 20px rgba(212,184,106,0.65) !important; }
  header .map-nav a.active[href*="mirage"],  .welcome .map-grid a[href*="mirage"]:hover  { background: rgba(217,165,102,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #d9a566, 0 0 20px rgba(217,165,102,0.65) !important; }
  header .map-nav a.active[href*="inferno"], .welcome .map-grid a[href*="inferno"]:hover { background: rgba(201,79,79,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #c94f4f, 0 0 20px rgba(201,79,79,0.65) !important; }
  header .map-nav a.active[href*="nuke"],    .welcome .map-grid a[href*="nuke"]:hover    { background: rgba(77,166,255,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #4da6ff, 0 0 20px rgba(77,166,255,0.70) !important; }
  header .map-nav a.active[href*="overpass"],.welcome .map-grid a[href*="overpass"]:hover{ background: rgba(139,109,70,0.22);  transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #8b6d46, 0 0 20px rgba(139,109,70,0.65) !important; }
  header .map-nav a.active[href*="train"],   .welcome .map-grid a[href*="train"]:hover   { background: rgba(128,128,128,0.22); transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 28px rgba(0,0,0,0.42), 0 0 0 3px #808080, 0 0 20px rgba(128,128,128,0.65) !important; }

  /* Dark focus ring */
  :focus-visible { box-shadow: 0 0 0 3px rgba(96,165,250,.35); }
}
body.dark {
  /* Custom dark palette based on #181817 */
  --bg: #181817;
  --text: #e6e6e3;
  --hover: #0f0f0e;

  --t-color: #fbbf24;
  --ct-color: #60a5fa;

  /* Softer active tints in dark */
  --t-bg-soft: rgba(251, 191, 36, 0.10);
  --ct-bg-soft: rgba(96, 165, 250, 0.10);

  /* Stronger glow accents + dark base shadow */
  --t-glow: rgba(251, 191, 36, 0.35);
  --ct-glow: rgba(96, 165, 250, 0.35);
  --tab-shadow-base: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.28);
  --tab-glow-blur: 14px;
}

/* Also support html.dark for early, no-flash boot */
.dark {
  --bg: #181817;
  --text: #e6e6e3;
  --hover: #0f0f0e;

  --t-color: #fbbf24;
  --ct-color: #60a5fa;

  --t-bg-soft: rgba(251, 191, 36, 0.10);
  --ct-bg-soft: rgba(96, 165, 250, 0.10);

  --t-glow: rgba(251, 191, 36, 0.35);
  --ct-glow: rgba(96, 165, 250, 0.35);
  --tab-shadow-base: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.28);
  --tab-glow-blur: 14px;
}

body.dark .command-block {
  /* Subtle dual shadow for dark surfaces: faint ring + soft drop */
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.28);
}
.dark .command-block {
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.28);
}

body.dark .command-header { background: #20201f; color: var(--text); }
body.dark .command-header { border-bottom: none; }
body.dark .command-header .command-extra { color: #8b949e; }
.dark .command-header { background: #20201f; color: var(--text); }
.dark .command-header .command-extra { color: #8b949e; }

body.dark .command-code { background: #121211; color: var(--text); }
body.dark .command-code:hover { background: #161615; }
.dark .command-code { background: #121211; color: var(--text); }
.dark .command-code:hover { background: #161615; }

body.dark .tabs { border-bottom: none; }
body.dark .subtabs { border-bottom: none; }

/* In dark mode, keep team-tinted hover for tabs; fallback neutral only for non-team buttons */
body.dark .tabs button:hover:not(.t-tab):not(.ct-tab) { background: #111111; }
body.dark .subtabs button:hover { background: #111111; }

/* Dark mode elevated effect ring for tab buttons */
body.dark .tabs button,
.dark .tabs button {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.28);
}
body.dark .subtabs button,
.dark .subtabs button {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.28);
}
.dark .tabs { border-bottom: none; }
.dark .subtabs { border-bottom: none; }
.dark .tabs button:hover:not(.t-tab):not(.ct-tab) { background: #111111; }
.dark .subtabs button:hover { background: #111111; }
.dark .tabs button.t-tab:hover { background: var(--t-bg-soft); }
.dark .tabs button.ct-tab:hover { background: var(--ct-bg-soft); }
.dark #T-subtabs .subtabs button:hover { background: var(--t-bg-soft); }
.dark #CT-subtabs .subtabs button:hover { background: var(--ct-bg-soft); }

/* Dark mode adjustments for header tiles and background tint */
body.dark {
  background-image:
    radial-gradient(900px 420px at 18% -10%, rgba(255,255,255,0.03), rgba(0,0,0,0) 60%);
}
body.dark header .map-nav a { background: rgba(255,255,255,.04); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
body.dark header .map-nav a:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.4); }
body.dark header .map-nav a img { opacity: 0.5; }
body.dark header .map-nav a.active img { opacity: 0.8; }
.dark {
  background-image:
    radial-gradient(900px 420px at 18% -10%, rgba(255,255,255,0.03), rgba(0,0,0,0) 60%);
}
.dark header .map-nav a { background: rgba(255,255,255,.04); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.dark header .map-nav a:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 8px 24px rgba(0,0,0,.4); }
.dark header .map-nav a img { opacity: 0.5; }
.dark header .map-nav a.active img { opacity: 0.8; }

/* Focus ring */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.28);
  border-radius: 8px;
  transition: box-shadow .15s var(--ease);
}
body.dark :focus-visible { box-shadow: 0 0 0 3px rgba(96,165,250,.35); }

/* Disable transitions briefly during theme switch to avoid flashing */
.theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition: none !important;
  animation: none !important;
}

/* Theme toggle removed */

/* --- Strong override: FAQ inline code in dark mode --- */
body.dark .faq-modal__content code,
body.dark .faq-modal__content kbd,
body.dark .faq-modal__content samp,
.dark .faq-modal__content code,
.dark .faq-modal__content kbd,
.dark .faq-modal__content samp {
  background: rgba(255,255,255,0.22) !important; /* darker for subtle look */
  border-color: rgba(255,255,255,0.36) !important;
}
