:root {
  font-family: "Source Sans 3", system-ui, sans-serif;
  --layout-max: 1280px;
  --layout-width: min(var(--layout-max), 94%);
}

/* Cursor-style dark (default) */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #1e1e1e;
  --bg-surface: #252526;
  --bg-elevated: #2d2d2d;
  --bg-inset: #181818;
  --border: #3c3c3c;
  --border-strong: #4a4a4a;
  --text: #cccccc;
  --text-muted: #9d9d9d;
  --text-heading: #e5e5e5;
  --accent: #3794ff;
  --accent-subtle: rgba(55, 148, 255, 0.18);
  --nav-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
  --btn-primary-bg: #0e639c;
  --btn-primary-fg: #ffffff;
  --btn-secondary-bg: #3c3c3c;
  --btn-secondary-fg: #cccccc;
  --btn-edit-bg: #c45c2a;
  --btn-edit-fg: #ffffff;
  --btn-edit-hover: #d96a35;
  --dropdown-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  --map-chrome-border: #cbd5e1;
  --map-chrome-bg: #f8fafc;
  --map-chrome-text: #333333;
  --map-chrome-text-muted: #555555;
  --map-chrome-text-heading: #1a1a1a;
  --map-chrome-input-bg: #ffffff;
  --map-placeholder: #9d9d9d;
  --map-hint: #6e6e6e;
  --overlay-revealed: #3794ff;
  --overlay-revealed-stroke: #1e1e1e;
  --reference-dot: #1e1e1e;
  --map-label-fill: #333333;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-page: #ffffff;
  --bg-surface: #f3f3f3;
  --bg-elevated: #ffffff;
  --bg-inset: #e8e8e8;
  --bg-header: #00212d;
  --bg-section: #edf0f1;
  --header-fg: #ffffff;
  --accent-hover: #9ccabf;
  --border: #9ea9ad;
  --border-strong: #9fc3b9;
  --text: #333333;
  --text-muted: #6e6e6e;
  --text-heading: #1a1a1a;
  --accent: #74b0a2;
  --accent-subtle: rgba(116, 176, 162, 0.18);
  --nav-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --btn-primary-bg: #74b0a2;
  --btn-primary-fg: #ffffff;
  --btn-secondary-bg: #9ea9ad;
  --btn-secondary-fg: #333333;
  --btn-edit-bg: #c2410c;
  --btn-edit-fg: #ffffff;
  --btn-edit-hover: #9a3412;
  --dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --map-chrome-border: #9fc3b9;
  --map-chrome-bg: #ffffff;
  --map-chrome-text: #333333;
  --map-chrome-text-muted: #555555;
  --map-chrome-text-heading: #1a1a1a;
  --map-chrome-input-bg: #f3f3f3;
  --map-placeholder: #6e6e6e;
  --map-hint: #6e6e6e;
  --overlay-revealed: #74b0a2;
  --overlay-revealed-stroke: #333333;
  --reference-dot: #333333;
  --map-label-fill: #333333;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-top: var(--site-nav-height, 3.5rem);
  background: var(--bg-page);
  color: var(--text);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.site-main {
  width: var(--layout-width);
  margin: 0 auto;
  padding: 1.25rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-card {
  --quiz-panel-max: 380px;
  --map-viewport-max: 580px;
  --map-viewport-height: min(60vh, var(--map-viewport-max));
}

/* —— Top banner / site navigation —— */
.site-nav {
  --site-nav-height: 3.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  width: 100%;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--nav-shadow);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.site-nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  width: var(--layout-width);
  margin: 0 auto;
  padding: 0.45rem 0;
  min-height: var(--site-nav-height);
}

.site-nav-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
}

.site-brand {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--text-heading);
  text-decoration: none;
  white-space: nowrap;
}

.site-brand:hover {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-icon {
  display: block;
}

[data-theme="dark"] .theme-icon-moon,
[data-theme="light"] .theme-icon-sun {
  display: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.nav-toggle-label {
  font-weight: 600;
}

.nav-toggle-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 1.1rem;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 1px;
}

.site-nav-menu {
  flex: 0 1 auto;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--bg-elevated);
  color: var(--text-heading);
  outline: none;
}

.nav-link.is-active {
  color: var(--accent);
  background: var(--accent-subtle);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger::after {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  margin-left: 0.15rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}

.nav-dropdown.is-open .nav-dropdown-trigger::after {
  transform: rotate(-135deg) translateY(2px);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 10rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--dropdown-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
  z-index: 210;
}

.nav-dropdown.is-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
  background: var(--bg-inset);
  color: var(--text-heading);
  outline: none;
}

@media (min-width: 769px) {
  .nav-toggle {
    display: none !important;
  }

  .site-nav-menu {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .site-nav {
    --site-nav-height: 3.25rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav-end {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .site-nav-menu {
    position: static;
    display: none;
    flex: 1 1 100%;
    justify-content: stretch;
    width: 100%;
    padding: 0.5rem 0 0.85rem;
    background: transparent;
    border-bottom: 0;
    box-shadow: none;
  }

  .site-nav.is-menu-open {
    --site-nav-height: auto;
  }

  .site-nav.is-menu-open .site-nav-menu {
    display: flex;
    position: static;
    padding-top: 0;
    border-bottom: 0;
    box-shadow: none;
  }

  .site-nav.is-menu-open .site-nav-inner {
    padding-bottom: 0.85rem;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.25rem;
  }

  .nav-link {
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    background: var(--bg-inset);
    padding: 0.25rem;
    margin-top: 0.25rem;
    border-radius: 8px;
    display: none;
  }

  .nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.home-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.home-hero {
  margin: 0;
}

.home-hero-title {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-heading);
}

.home-hero-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.home-columns {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-column {
  display: flex;
  flex-direction: column;
  min-height: 12rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-inset);
}

.home-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.9rem;
}

.home-column .map-list {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.map-list-unified {
  grid-template-columns: 1fr;
}

.map-panel-unified-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.map-panel-unified .map-preview {
  flex: 0 0 48%;
  width: 48%;
  max-width: 48%;
  height: auto;
  min-height: 180px;
  max-height: 220px;
  object-fit: cover;
}

.map-panel-viewports {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem;
  min-width: 0;
}

.map-panel-viewport-btn {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

@media (max-width: 640px) {
  .map-panel-unified-layout {
    flex-direction: column;
  }

  .map-panel-unified .map-preview {
    flex: none;
    width: 100%;
    max-width: none;
    height: 200px;
    max-height: none;
  }

  .map-panel-viewports {
    padding: 0.75rem;
  }
}

.map-item {
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-inset);
}

.map-preview {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: var(--map-chrome-bg);
}

.map-item-body {
  padding: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.map-item-body h3 {
  margin: 0;
  font-size: 1rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 0.8rem;
  margin-bottom: 0.75rem;
}

.map-viewport-select-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.map-viewport-select-text {
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
}

.map-viewport-select {
  min-width: 9rem;
  max-width: 16rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-inset);
  color: var(--text-heading);
  cursor: pointer;
}

.map-viewport-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-left: auto;
}

.quiz-card[data-app-mode="edit"] #btn-mode-quiz {
  display: none !important;
}

.quiz-card[data-app-mode="edit"] #quiz-meta,
.quiz-card[data-app-mode="edit"] #quiz-feedback,
.quiz-card[data-app-mode="edit"] #btn-next {
  display: none !important;
}

.quiz-card[data-app-mode="edit"] .quiz-svg {
  /* Match Map_Lines river/coast stroke (SVGs/map.svg stroke-width="0.316") */
  --map-line-stroke: 0.316;
  --edit-line-stroke: var(--map-line-stroke);
  --edit-line-stroke-selected: 0.4;
  --edit-border-stroke: var(--map-line-stroke);
  --edit-border-stroke-selected: 0.4;
}

#otgeo-edit-handles {
  pointer-events: none;
}

#otgeo-edit-handles .edit-handle-dot,
#otgeo-edit-handles .edit-handle-label {
  pointer-events: all;
  cursor: grab;
  stroke-width: var(--edit-border-stroke);
  opacity: 0.92;
}

#otgeo-edit-handles .edit-handle-dot {
  fill: rgba(255, 120, 40, 0.35);
  stroke: rgb(255, 120, 40);
}

#otgeo-edit-handles .edit-handle-label-glyph {
  fill: rgba(80, 160, 255, 0.85);
  stroke: rgb(60, 130, 210);
  stroke-width: 0.15;
}

#otgeo-edit-handles .edit-handle-label.is-selected .edit-handle-label-glyph {
  fill: rgba(80, 160, 255, 1);
  stroke: rgb(40, 100, 180);
}

#otgeo-edit-handles .edit-handle-dot.is-selected,
#otgeo-edit-handles .edit-handle-label.is-selected {
  stroke-width: var(--edit-border-stroke-selected);
  opacity: 1;
}

#otgeo-edit-handles .edit-handle-dot:active,
#otgeo-edit-handles .edit-handle-label:active {
  cursor: grabbing;
}

.edit-region-overlay path {
  fill: rgba(80, 160, 255, 0.15);
  stroke: rgba(80, 160, 255, 0.75);
  stroke-width: var(--edit-border-stroke);
  pointer-events: all;
  cursor: pointer;
}

.edit-region-overlay path.is-selected {
  fill: rgba(80, 160, 255, 0.28);
  stroke: rgb(80, 160, 255);
  stroke-width: var(--edit-border-stroke-selected);
}

#otgeo-edit-handles .edit-handle-vertex,
#otgeo-edit-handles .edit-handle-midpoint {
  pointer-events: all;
  cursor: grab;
  stroke-width: var(--edit-border-stroke);
  opacity: 0.92;
}

#otgeo-edit-handles .edit-handle-vertex {
  fill: rgba(120, 220, 120, 0.45);
  stroke: rgb(80, 200, 80);
}

#otgeo-edit-handles .edit-handle-midpoint {
  fill: rgba(180, 180, 180, 0.4);
  stroke: rgb(160, 160, 160);
}

#otgeo-edit-handles .edit-handle-vertex.is-selected,
#otgeo-edit-handles .edit-handle-midpoint.is-selected {
  stroke-width: var(--edit-border-stroke-selected);
  opacity: 1;
}

#otgeo-edit-handles .edit-handle-vertex:active,
#otgeo-edit-handles .edit-handle-midpoint:active {
  cursor: grabbing;
}

#toggle-show-regions {
  margin: 0;
}

.edit-accumulated-json {
  margin: 0;
  padding: 0.65rem 0.75rem;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-raised, rgba(0, 0, 0, 0.06));
  border: 1px solid var(--border);
  border-radius: 6px;
  user-select: all;
}

.quiz-card[data-app-mode="learn"] #quiz-meta,
.quiz-card[data-app-mode="learn"] #quiz-feedback,
.quiz-card[data-app-mode="learn"] #btn-next {
  display: none !important;
}

.quiz-card[data-app-mode="learn"][data-quiz-phase="resultsInPanel"] #quiz-meta,
.quiz-card[data-app-mode="learn"][data-quiz-phase="resultsInPanel"] #quiz-feedback,
.quiz-card[data-app-mode="learn"][data-quiz-phase="resultsInPanel"] #btn-next {
  display: none !important;
}

.quiz-card[data-quiz-phase="awaitingScore"] #btn-next {
  display: none !important;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.map-labels-layer {
  pointer-events: none;
}

.map-labels-layer .map-place-label {
  fill: var(--map-label-fill);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: var(--label-font-size, 2.44px);
  font-weight: var(--label-font-weight, 500);
  opacity: var(--label-opacity, 1);
}

.map-labels-layer .map-region-label {
  fill: var(--map-label-fill);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: var(--label-font-size, 15px);
  font-weight: var(--label-font-weight, 700);
  opacity: var(--label-opacity, 0.35);
  letter-spacing: var(--label-letter-spacing, 0.05em);
}

#otgeo-app-dots .app-dot,
#otgeo-app-dots .reference-dot {
  fill: var(--reference-dot);
  stroke: none;
}

.quiz-results-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  white-space: pre-wrap;
}

.quiz-results-score {
  margin: 0;
  font-weight: 600;
  color: var(--text-heading);
}

.quiz-results-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.quiz-results-list li {
  margin: 0.15rem 0;
}

.dots-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
}

.dots-toggle input {
  margin: 0;
}

.quiz-head {
  margin-bottom: 0.75rem;
}

.quiz-head-titles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

#quiz-panel[data-app-mode="edit"] .quiz-head-titles {
  flex-wrap: nowrap;
}

#quiz-panel[data-app-mode="edit"] .quiz-prompt {
  width: auto;
  flex: 0 1 auto;
}

.edit-add-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-left: auto;
}

.edit-add-name {
  width: 9rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.edit-add-options {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.btn-edit-add {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.quiz-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.quiz-prompt {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  flex: 0 0 auto;
  width: min(100%, calc(100% - var(--quiz-panel-max, 380px) - 1rem));
  min-width: 0;
}

.quiz-map-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1rem;
  margin-top: 0.5rem;
}

.map-info-panel {
  flex: 0 0 var(--quiz-panel-max, 380px);
  max-width: 100%;
  height: var(--map-viewport-height);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  overflow: visible;
  padding: 0;
  color: var(--text);
}

.map-info-heading {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-heading);
  flex: 0 0 auto;
}

.map-info-scroll {
  flex: 1 1 0%;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.map-info-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
  user-select: text;
}

.map-info-summary {
  margin: 0 0 0.75rem;
}

.map-info-read-more {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.map-info-read-more:hover,
.map-info-read-more:focus-visible {
  text-decoration: underline;
  outline: none;
}

.map-stage {
  flex: 1 1 0%;
  width: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

@media (max-width: 900px) {
  .quiz-prompt {
    width: 100%;
    max-width: none;
  }

  .edit-add-controls {
    margin-left: 0;
    width: 100%;
  }

  .quiz-map-row {
    flex-direction: column;
    align-items: stretch;
  }

  .map-info-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    height: auto;
  }

  .map-info-scroll {
    max-height: var(--map-viewport-height);
    flex: 0 1 auto;
  }

  .map-stage {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
  }
}

.map-wrap {
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--map-chrome-border);
  background: var(--map-chrome-bg);
  color-scheme: only light;
  overflow: hidden;
  max-height: none;
  user-select: none;
  -webkit-user-select: none;
}

.map-placeholder {
  margin: 0;
  padding: 1.5rem;
  color: var(--map-placeholder);
}

.map-host {
  line-height: 0;
}

.map-viewport {
  position: relative;
  width: 100%;
  height: var(--map-viewport-height);
  max-height: var(--map-viewport-max, 580px);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.map-viewport.is-panning {
  cursor: grabbing;
}

.map-pan-zoom {
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-select: none;
}

.edit-label-panel {
  margin: 0.65rem 0 0;
  padding: 0.5rem 0.75rem 0.65rem;
  border: 1px solid var(--map-chrome-border);
  border-radius: 8px;
  background: var(--map-chrome-bg);
  color: var(--map-chrome-text);
  color-scheme: only light;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.edit-label-panel[hidden] {
  display: none !important;
}

.edit-label-text-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.35rem;
}

.edit-label-text-head .edit-label-field-label {
  min-width: 0;
}

.edit-label-text-head .edit-label-field-select {
  flex: 0 1 auto;
}

.edit-label-text-head .edit-label-field-select .edit-label-select {
  width: 9.5rem;
  flex: 0 1 9.5rem;
}

.edit-label-text-head .edit-label-field-style {
  flex: 0 1 auto;
}

.edit-label-text-head .edit-label-field-style .edit-label-select {
  width: 6.5rem;
  flex: 0 1 6.5rem;
}

.edit-label-text-head .edit-label-field-display {
  flex: 0 1 auto;
  min-width: 0;
}

.edit-label-text-head .edit-label-field-display .edit-label-text {
  width: 10rem;
  flex: 0 0 auto;
}

.edit-label-text-head .edit-label-check {
  flex: 0 0 auto;
}

.edit-label-position-row .edit-label-field {
  flex: 1 1 8rem;
}

.edit-label-group {
  margin: 0;
  padding: 0.45rem 0.55rem 0.55rem;
  border: 1px solid var(--map-chrome-border);
  border-radius: 6px;
  min-width: 0;
}

.edit-label-group legend {
  padding: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--map-chrome-text-heading);
}

.edit-label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.edit-label-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.edit-label-field-full {
  flex: 1 1 100%;
}

.edit-label-field-label {
  flex: 0 0 auto;
  min-width: 3.5rem;
  color: var(--map-chrome-text-muted);
  font-size: 0.78rem;
}

.edit-label-field input[type="range"] {
  flex: 1 1 6rem;
  min-width: 4rem;
  accent-color: var(--accent);
}

.edit-label-num {
  width: 4.5rem;
  flex: 0 0 auto;
  padding: 0.2rem 0.35rem;
  font-size: 0.78rem;
  border: 1px solid var(--map-chrome-border);
  border-radius: 4px;
  background: var(--map-chrome-input-bg);
  color: var(--map-chrome-text);
}

.edit-label-select,
.edit-label-text {
  flex: 1 1 8rem;
  min-width: 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.82rem;
  border: 1px solid var(--map-chrome-border);
  border-radius: 4px;
  background: var(--map-chrome-input-bg);
  color: var(--map-chrome-text);
}

.edit-label-textarea {
  width: 100%;
  min-height: 3.5rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.82rem;
  font-family: inherit;
  border: 1px solid var(--map-chrome-border);
  border-radius: 4px;
  background: var(--map-chrome-input-bg);
  color: var(--map-chrome-text);
  resize: vertical;
}

.edit-label-check {
  flex: 0 0 auto;
  font-size: 0.8rem;
  gap: 0.35rem;
  color: var(--map-chrome-text);
}

.edit-label-check input[type="checkbox"] {
  accent-color: var(--accent);
}

@media (max-width: 900px) {
  .edit-label-text-head .edit-label-field {
    flex: 1 1 100%;
  }

  .edit-label-text-head .edit-label-field-select .edit-label-select,
  .edit-label-text-head .edit-label-field-style .edit-label-select {
    width: 100%;
    flex: 1 1 auto;
  }

  .edit-label-text-head .edit-label-field-display .edit-label-text {
    width: 100%;
    flex: 1 1 auto;
  }

  .edit-label-field {
    flex: 1 1 100%;
  }

  .edit-label-num {
    width: 100%;
    max-width: 5.5rem;
  }
}

.map-view-hint {
  margin: 0.5rem 0 0;
  padding: 0 0.25rem;
  font-size: 0.82rem;
  color: var(--map-hint);
}

.edit-mode-hint {
  margin: 0;
  padding: 0.6rem 0.7rem;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--text-heading);
  background: var(--accent-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  flex: 0 0 auto;
}

.quiz-svg {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
  cursor: crosshair;
  touch-action: none;
  forced-color-adjust: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.quiz-svg:focus {
  outline: none;
}

.feedback {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  font-size: 0.98rem;
}

.feedback:empty {
  min-height: 0;
  margin-top: 0;
}

.btn {
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
}

.btn-edit {
  background: var(--btn-edit-bg);
  color: var(--btn-edit-fg);
}

.btn-edit:hover:not(:disabled) {
  background: var(--btn-edit-hover);
  filter: none;
}

#otgeo-quiz-overlay circle {
  pointer-events: none;
}

/* Edit-mode accept area look; pulses on quiz miss (see .accept-area-pulse). */
#otgeo-quiz-overlay-transient .accept-area-pulse {
  fill: rgba(255, 120, 40, 0.35);
  stroke: rgb(255, 120, 40);
  stroke-width: 0.316;
  fill-rule: nonzero;
  animation: accept-area-pulse-fade 1s ease-in-out infinite;
  pointer-events: none;
}

#otgeo-quiz-overlay-revealed .revealed-dot {
  fill: var(--overlay-revealed);
  stroke: none;
  stroke-width: 0;
}

#otgeo-quiz-overlay-revealed .revealed-place-label {
  fill: var(--map-label-fill);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: var(--label-font-size, 2.44px);
  font-weight: var(--label-font-weight, 500);
  opacity: var(--label-opacity, 1);
}

#otgeo-quiz-overlay-revealed .revealed-place-label.map-region-label {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: var(--label-font-size, 15px);
  font-weight: var(--label-font-weight, 700);
  opacity: var(--label-opacity, 0.35);
  letter-spacing: var(--label-letter-spacing, 0.05em);
}

#otgeo-quiz-overlay-revealed .revealed-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#otgeo-quiz-overlay-revealed .revealed-line-casing {
  stroke: var(--overlay-revealed-stroke);
  stroke-width: 1.25;
}

#otgeo-quiz-overlay-revealed .revealed-line-core {
  stroke: var(--overlay-revealed);
  stroke-width: 0.5;
}

@keyframes accept-area-pulse-fade {
  0% {
    opacity: 0.15;
  }
  50% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.15;
  }
}

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

.home-place-list {
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
}

.home-places-column .places-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.home-place-list li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.home-place-list li:last-child {
  border-bottom: 0;
}

.home-place-list a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.home-place-list a:hover,
.home-place-list a:focus-visible {
  background: var(--accent-subtle);
  color: var(--accent);
  outline: none;
}

.ot-resource-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}

@media (max-width: 600px) {
  .ot-resource-list {
    grid-template-columns: 1fr;
  }
}

.ot-resource-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease;
}

.ot-resource-card:hover,
.ot-resource-card:focus-visible {
  border-color: var(--accent);
  background: var(--accent-subtle);
  outline: none;
}

.ot-resource-preview {
  display: block;
  flex: 0 0 7.5rem;
  width: 7.5rem;
  max-height: 7.5rem;
  margin: auto 0;
  padding: 0.5rem 0.35rem 0.5rem 0.8rem;
  box-sizing: border-box;
  align-self: center;
  object-fit: contain;
  object-position: center;
}

.ot-resource-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0.35rem;
  padding: 0.8rem;
}

.ot-resource-body h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-heading);
}

.ot-resource-body p {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.ot-resource-cta {
  margin-top: 0.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.places-header {
  margin-bottom: 0.75rem;
}

.places-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.places-filters-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
}

.places-list-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}

.places-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.places-filter-heading {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.places-filter-scroll {
  display: none;
}

.filter-combobox {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.filter-combobox-input-wrap {
  position: relative;
}

.filter-combobox-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-inset);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.filter-combobox-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.filter-combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  max-height: 11rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated, var(--bg-inset));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.filter-combobox-option {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}

.filter-combobox-option.is-active,
.filter-combobox-option:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}

.filter-combobox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 0;
}

.filter-combobox-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.3;
}

.filter-combobox-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.filter-combobox-chip-remove:hover,
.filter-combobox-chip-remove:focus-visible {
  color: var(--accent);
  background: var(--accent-subtle);
  outline: none;
}

.places-filter-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  line-height: 1.35;
}

.places-filter-check input {
  flex-shrink: 0;
  accent-color: var(--accent);
}

@media (min-width: 768px) {
  .places-layout {
    flex-direction: row;
    align-items: stretch;
  }

  .places-filters-panel {
    flex: 0 0 38%;
    max-width: 22rem;
  }

  .places-list-panel {
    flex: 1 1 62%;
    min-width: 0;
    min-height: 0;
  }

  .places-list-panel .home-place-list,
  .places-list-panel .places-accordion {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  /* Home "Select a Place" only: filters set row height; list scrolls within it */
  .home-places-column .places-layout {
    display: grid;
    grid-template-columns: min(38%, 22rem) 1fr;
    gap: 1rem;
    align-items: start;
  }

  .home-places-column .places-filters-panel {
    flex: unset;
    max-width: none;
  }

  .home-places-column .places-list-panel {
    flex: unset;
    height: 0;
    min-height: 100%;
    overflow: hidden;
  }

  .home-places-column .home-place-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
}

.places-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.places-search-wrap {
  display: block;
}

.places-search {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-inset);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.places-search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.places-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.places-filter-chip {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.places-filter-chip.is-active,
.places-filter-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}

.places-filter-chip:hover,
.places-filter-chip:focus-visible {
  border-color: var(--border-strong);
  outline: none;
}

.places-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.places-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-inset);
  overflow: hidden;
}

.places-item-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--text-heading);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.places-item-trigger:hover,
.places-item-trigger:focus-visible {
  background: var(--bg-surface);
  outline: none;
}

.places-item-trigger::after {
  content: "";
  margin-left: auto;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.places-item.is-open .places-item-trigger::after {
  transform: rotate(-135deg) translateY(2px);
}

.places-item-panel {
  border-top: 1px solid var(--border);
}

.places-item-body {
  padding: 0.85rem 0.95rem 1rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.places-markdown p {
  margin: 0 0 0.75rem;
}

.places-markdown p:last-child {
  margin-bottom: 0;
}

.places-markdown ul {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.places-markdown li {
  margin: 0.2rem 0;
}

.places-verses-footer {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.places-empty {
  margin: 0.75rem 0 0;
}

/* —— Light theme: header, home sections, solid accent highlights —— */
[data-theme="light"] .site-nav {
  background: var(--bg-header);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .site-brand {
  color: var(--header-fg);
}

[data-theme="light"] .site-brand:hover {
  color: var(--header-fg);
  opacity: 0.88;
}

[data-theme="light"] .nav-link {
  color: var(--header-fg);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: var(--header-fg);
}

[data-theme="light"] .nav-link.is-active {
  background: var(--accent);
  color: var(--btn-primary-fg);
}

[data-theme="light"] .theme-toggle,
[data-theme="light"] .nav-toggle {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--header-fg);
}

[data-theme="light"] .theme-toggle:hover {
  border-color: var(--border-strong);
  color: var(--header-fg);
}

[data-theme="light"] .home-column {
  background: var(--bg-section);
}

[data-theme="light"] .map-item {
  background: var(--bg-header);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .map-item-body h3 {
  color: var(--header-fg);
}

[data-theme="light"] .home-place-list a:hover,
[data-theme="light"] .home-place-list a:focus-visible,
[data-theme="light"] .places-item-trigger:hover,
[data-theme="light"] .filter-combobox-option:hover,
[data-theme="light"] .filter-combobox-option.is-active {
  background: var(--accent-hover);
  color: var(--text-heading);
}

[data-theme="light"] .places-filter-chip.is-active,
[data-theme="light"] .places-filter-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--btn-primary-fg);
}

@media (max-width: 768px) {
  [data-theme="light"] .nav-dropdown-menu {
    background: rgba(255, 255, 255, 0.08);
  }

  [data-theme="light"] .nav-dropdown-menu a {
    color: var(--header-fg);
  }

  [data-theme="light"] .nav-dropdown-menu a:hover,
  [data-theme="light"] .nav-dropdown-menu a:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: var(--header-fg);
  }
}
