/* Globle Game — Forest Botanical Cartographic Atlas Theme */
:root {
  --bg: #f3f6f1;
  --surface: #ffffff;
  --surface-soft: #eaf0e6;
  --ink: #1d2a1f;
  --muted: #5d6e60;
  --primary: #2f7d4f;
  --primary-dark: #1f5937;
  --accent: #d9a441;
  --accent-soft: #fdf6e2;
  --border: #d5dfd1;
  --ocean: #122e3d;
  --hot: #b92b1d;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}
h1 { font-size: 40px; letter-spacing: -0.01em; margin-bottom: 8px; }
h2 { font-size: 28px; margin-bottom: 12px; }
h3 { font-size: 18px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; color: var(--ink); }

a { color: var(--primary-dark); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--primary);
  color: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand:hover { color: var(--primary-dark); }
.brand-mark { display: inline-flex; flex-shrink: 0; }
.brand-title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  font-weight: 600;
}
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 4px;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--primary-dark); }

/* Eyebrow & Buttons */
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-primary {
  background: var(--primary);
  color: var(--surface);
  border: 1px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--surface); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-soft); border-color: var(--primary); color: var(--ink); }

.btn-text, .btn-text-muted {
  background: transparent;
  border: 0;
  padding: 4px 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-text { color: var(--primary-dark); }
.btn-text-muted { color: var(--muted); }
.btn-text-muted:hover { color: var(--ink); }

/* Hero Play Stage */
.hero-stage { padding-top: 24px; padding-bottom: 24px; }
.stage-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.stage-lead { color: var(--muted); font-size: 16px; margin-bottom: 0; max-width: 60ch; }
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-soft);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.mode-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.mode-pill:hover { color: var(--ink); }
.mode-pill.is-active { background: var(--primary); color: var(--surface); box-shadow: var(--shadow-sm); }

/* Atlas Frame */
.atlas-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}
html.gg-expanded { overflow: hidden; }
.atlas-frame.is-expanded,
.atlas-frame:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  border-radius: 0;
  border: 0;
  background: var(--bg);
  padding: 20px;
}
.close-expanded {
  position: sticky;
  top: 0;
  float: right;
  z-index: 20;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--surface);
  border: 0;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.challenge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 14px;
}
.challenge-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.badge-gold {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.challenge-actions { display: flex; align-items: center; gap: 12px; }
.btn-link { font-weight: 600; font-size: 14px; }

/* Continent Filter Bar */
.continent-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.chip:hover { border-color: var(--primary); color: var(--ink); }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--surface); }

/* Stage Two-Column Grid */
.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}
.globe-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* Guess Input */
.guess-form { display: flex; gap: 8px; align-items: stretch; }
.input-field-wrap { position: relative; flex: 1; min-width: 0; }
.guess-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  color: var(--ink);
}
.guess-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(47, 125, 79, 0.16); }
.guess-submit { flex-shrink: 0; padding-left: 22px; padding-right: 22px; }

.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
}
.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 14px;
}
.suggest-item:hover, .suggest-item.is-selected { background: var(--surface-soft); }
.suggest-main { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.suggest-sub { font-size: 12px; color: var(--muted); }

.status-line { margin: 8px 0 0; min-height: 24px; font-size: 14px; font-weight: 600; color: var(--muted); }
.status-line.is-warm { color: var(--hot); }
.status-line.is-win { color: var(--primary-dark); }

/* Mobile Pill Strip */
.mobile-strip { display: none; margin-top: 8px; }
.mobile-closest { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.pill-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  list-style: none;
  margin: 0;
  padding: 2px 0 6px;
  scrollbar-width: none;
}
.pill-strip::-webkit-scrollbar { display: none; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
}
.pill-btn.is-latest { border-color: var(--primary); background: var(--surface-soft); }

/* Result Card */
.result-card {
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  border: 1px solid var(--primary);
}
.result-top { display: flex; align-items: center; gap: 14px; }
.result-flag { font-size: 36px; line-height: 1; }
.result-kicker {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
}
.result-title { margin: 0; font-size: 26px; }
.result-summary { margin: 10px 0 14px; font-size: 15px; color: var(--ink); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-countdown { margin: 12px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Interactive 3D Globe Viewport */
.globe-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  min-height: 360px;
  max-height: 540px;
  border-radius: var(--radius);
  background: var(--ocean);
  overflow: hidden;
  border: 1px solid var(--ocean);
  box-shadow: var(--shadow-sm);
}
.globe-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.globe-canvas:active { cursor: grabbing; }

.globe-tooltip {
  position: absolute;
  z-index: 12;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--ocean);
  color: var(--surface);
  border: 1px solid var(--accent);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -125%);
}

.globe-hud-top {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.puzzle-tag {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(18, 46, 61, 0.85);
  color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
}
.hud-toggles { display: flex; gap: 6px; pointer-events: auto; flex-shrink: 0; }
.hud-btn {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(18, 46, 61, 0.85);
  color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.hud-btn:hover { background: var(--primary-dark); }
.hud-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--accent); color: var(--surface); }

.globe-hud-bottom {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.zoom-group { display: inline-flex; gap: 6px; pointer-events: auto; }
.hud-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(18, 46, 61, 0.85);
  color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 16px;
  font-weight: 700;
}
.hud-icon-btn:hover { background: var(--primary); }
.drag-hint {
  font-size: 12px;
  color: var(--surface);
  background: rgba(18, 46, 61, 0.78);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Right Column: Logbook Panels */
.logbook-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title-wrap { display: flex; align-items: center; gap: 8px; }
.panel-title { font-family: var(--font-body); font-size: 16px; font-weight: 700; margin: 0; }
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.closest-readout { margin: 8px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.guess-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 270px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.guess-empty { font-size: 14px; color: var(--muted); line-height: 1.5; }
.guess-row-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface);
  text-align: left;
  font-size: 14px;
}
.guess-row-btn:hover { border-color: var(--primary); }
.heat-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0, 0, 0, 0.16); }
.guess-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.guess-sub { font-weight: 400; color: var(--muted); font-size: 12px; }
.guess-km { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.guess-km.is-found { color: var(--primary-dark); font-weight: 700; }

/* Hints & Heat Bar */
.hints-list { margin: 10px 0 0; display: grid; gap: 6px; font-size: 14px; }
.hints-list:empty { margin: 0; }
.hint-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; background: var(--surface); border-radius: 8px; }
.hint-row dt { color: var(--muted); }
.hint-row dd { margin: 0; font-weight: 700; }
.btn-hint {
  width: 100%;
  margin-top: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.btn-hint:hover:not(:disabled) { background: var(--surface); border-color: var(--primary); }
.btn-hint:disabled { opacity: 0.65; cursor: not-allowed; }

.heat-bar {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hot) 0%, var(--accent) 55%, var(--accent-soft) 100%);
  border: 1px solid var(--border);
}
.heat-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }

/* Daily Leaderboard */
.board-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.board-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.board-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}
.board-item.is-me { border: 1px solid var(--primary); background: var(--surface-soft); font-weight: 700; }
.board-rank { width: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-variant-numeric: tabular-nums; color: var(--primary-dark); font-weight: 700; }

/* Game Tools Bar */
.game-tools-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.tool-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.tool-btn:hover,
.tool-btn[data-gf-liked] {
  background: var(--surface-soft);
  border-color: var(--primary-dark);
  color: var(--primary-dark);
}
.share-status { font-size: 13px; color: var(--primary-dark); font-weight: 600; }
.jump-rules { margin-left: auto; font-size: 14px; font-weight: 600; }
.ios-install-note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
}

/* Telemetry Strip */
.atlas-metrics {
  margin-top: 16px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.metrics-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.metric-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.15;
  color: var(--primary-dark);
}
.metric-item span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }

/* Content Two-Column Layout */
.content-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 64px;
}
.toc-sticky { position: sticky; top: 84px; }
.toc-rail h2 { font-size: 22px; margin-bottom: 12px; }
.toc-links { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.toc-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.toc-links a:hover { color: var(--primary-dark); }
.rail-callout {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
}
.rail-callout-title { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.rail-callout p:last-child { margin-bottom: 0; color: var(--muted); }

/* Editorial Prose */
.prose-article { min-width: 0; max-width: 70ch; }
.prose-article h2 { margin-top: 40px; margin-bottom: 14px; padding-top: 8px; }
.prose-article > h2:first-child { margin-top: 0; padding-top: 0; }
.prose-article h3 { margin-top: 24px; margin-bottom: 8px; }
.prose-article p { margin-bottom: 16px; color: var(--ink); }
.prose-article ul, .prose-article ol { margin: 0 0 18px; padding-left: 22px; color: var(--ink); }
.prose-article li { margin-bottom: 8px; }
.prose-article blockquote {
  margin: 20px 0;
  padding: 14px 18px;
  border-left: 4px solid var(--primary);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose-article figure {
  margin: 24px 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.prose-article figure img { display: block; width: 100%; height: auto; border-radius: 8px; }
.prose-article figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* Responsive Tables */
.prose-article table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 20px 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.prose-article th, .prose-article td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.prose-article th { background: var(--surface-soft); font-weight: 700; color: var(--ink); }
.prose-article tr:last-child td { border-bottom: 0; }

/* Worked Example */
.example-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 24px; }
.example-step {
  padding: 14px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.example-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin: 0 auto 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
}
.example-step strong { display: block; font-size: 14px; }
.example-step span { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* FAQ */
.faq-section { margin-top: 48px; }
.faq-list {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary {
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 20px; color: var(--primary-dark); flex-shrink: 0; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 20px 18px; margin: 0; font-size: 15px; color: var(--muted); }

/* Community Comments */
.discussion-section { margin-top: 48px; }
.discussion-intro { color: var(--muted); font-size: 15px; }
.comment-form {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 14px; font-weight: 600; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 16px;
}
.comment-form-actions { display: flex; align-items: center; gap: 12px; }
.comment-msg { margin: 0; font-size: 14px; color: var(--primary-dark); }
.comments-wrap { margin-top: 20px; }
.empty-comments { display: none; color: var(--muted); font-size: 14px; }
[data-gf-comments][data-gf-empty] .empty-comments { display: block; }
.comment-card { padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.comment-meta time { font-size: 12px; color: var(--muted); }
.owner-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
}
.comment-body { margin: 8px 0 6px; font-size: 15px; }
.comment-replies { padding-left: 20px; border-left: 2px solid var(--border); margin-top: 10px; }

/* Standalone Doc / Legal Pages */
.doc-layout { padding-top: 32px; padding-bottom: 64px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary-dark); }
.doc-article { max-width: 72ch; }
.doc-lead { font-size: 18px; color: var(--muted); margin-bottom: 24px; }
.doc-meta { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.cta-band {
  margin-top: 40px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cta-band h2 { margin: 0 0 6px; font-size: 24px; }
.cta-band p { margin: 0; color: var(--muted); }
.cta-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.not-found-box { padding-top: 64px; padding-bottom: 80px; max-width: 64ch; }

/* Dialogs */
.atlas-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.atlas-dialog::backdrop { background: rgba(18, 46, 61, 0.55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; font-size: 24px; }
.dialog-close { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.dialog-intro { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.stat-box { padding: 12px 8px; border-radius: 8px; background: var(--bg); text-align: center; }
.stat-box strong { display: block; font-size: 24px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stat-box span { font-size: 12px; color: var(--muted); }
.dist-wrap h3 { font-size: 15px; margin-bottom: 10px; }
.dist-bars { display: grid; gap: 8px; }
.dist-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.dist-bar-track { background: var(--bg); border-radius: 6px; overflow: hidden; height: 24px; }
.dist-bar-fill {
  height: 100%;
  min-width: 24px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: var(--primary);
  color: var(--surface);
  font-weight: 700;
  font-size: 12px;
}
.challenge-form { display: grid; gap: 10px; }
.challenge-form label { font-size: 13px; font-weight: 600; }
.challenge-form input, .challenge-form select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.dialog-status { margin: 4px 0 0; font-size: 13px; color: var(--primary-dark); }
.challenge-link-box { display: flex; gap: 8px; margin-top: 14px; }
.challenge-link-box input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13px;
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 40px 0 48px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 32px; }
.footer-brand p { margin-top: 10px; font-size: 14px; color: var(--muted); max-width: 38ch; }
.footer-col { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.footer-heading { font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.footer-col a { color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--primary-dark); }
.footer-legal {
  grid-column: 1 / -1;
  margin: 16px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

/* Tablet & Mobile */
@media (max-width: 920px) {
  .stage-header { flex-direction: column; align-items: flex-start; }
  .stage-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; gap: 32px; }
  .toc-sticky { position: static; }
  .metrics-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .header-inner { min-height: 56px; gap: 10px; }
  .brand-title { font-size: 18px; }
  .main-nav { gap: 12px; font-size: 13px; }
  .main-nav a:nth-child(n+3) { display: none; }
  .hero-stage { padding-top: 14px; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
  .stage-lead { font-size: 14px; }
  .mode-switch { width: 100%; overflow-x: auto; justify-content: space-between; }
  .mode-pill { flex: 1; text-align: center; padding: 7px 6px; font-size: 13px; }
  .atlas-frame { padding: 12px; }
  .guess-form { flex-direction: row; }
  .guess-submit { width: auto; padding-left: 16px; padding-right: 16px; }
  .mobile-strip { display: block; }
  .globe-viewport { aspect-ratio: 1 / 1.04; min-height: 320px; max-height: 410px; }
  .globe-hud-top { justify-content: flex-end; gap: 6px; }
  .puzzle-tag { display: none; }
  .hud-toggles { gap: 5px; }
  .hud-btn { padding: 4px 8px; font-size: 12px; }
  .drag-hint { display: none; }
  .tool-actions { width: 100%; }
  .tool-btn { flex: 1 1 auto; text-align: center; min-height: 44px; font-size: 13px; }
  .jump-rules { margin-left: 0; }
  .prose-article th, .prose-article td { padding: 8px 10px; font-size: 13px; }
  .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .cta-buttons a { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}