:root {
  --bg: #070b16;
  --bg-2: #0b1020;
  --surface: #111a2e;
  --surface-2: #0f172a;
  --border: #1e2a44;
  --text: #f4f1ea;
  --text-dim: #9fb0c9;
  --gold: #e6b566;
  --gold-soft: #f1cd8e;
  --sky: #8fb8ff;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: #f5f5f5;
}

header {
  padding: 1rem 2rem;
  background: #0b1020;
  border-bottom: 1px solid #222;
}

header h1 {
  margin: 0;
}

header p {
  margin: 0.25rem 0 0;
  color: #aaa;
}

.layout {
  display: flex;
  height: calc(100vh - 64px);
}

#map {
  flex: 2;
  position: relative;
}

.leaflet-container {
  background: #b8d8ea;
}

.leaflet-container.plain2d-mode {
  background: #b8d8ea !important;
}

.river-label {
  color: #11507f;
  font-size: 11px;
  font-style: italic;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 1px 2px #fff;
  pointer-events: none;
}

.river-tip {
  font-style: italic;
}

.side-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border-left: 1px solid #222;
}

.slider-container {
  padding: 1rem;
  border-bottom: 1px solid #222;
}

.playback-controls {
  padding: 1rem;
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #222;
  align-items: center;
}

.map-toggles {
  padding: 1rem;
  border-bottom: 1px solid #222;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.toggle-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-toggles label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
}

.playback-controls button {
  padding: 0.5rem 1rem;
  background: #38bdf8;
  border: none;
  border-radius: 4px;
  color: #020617;
  font-weight: bold;
  cursor: pointer;
  flex: 1;
}

.playback-controls select {
  padding: 0.5rem;
  background: #111827;
  color: #f5f5f5;
  border: 1px solid #374151;
  border-radius: 4px;
  cursor: pointer;
}

.culture-label-wrapper {
  position: relative;
  display: inline-block;
  isolation: auto;
}

.culture-label-wrapper:hover {
  z-index: 10000 !important;
  isolation: isolate;
}

.leaflet-marker-icon.culture-label:has(.culture-label-wrapper:hover) {
  z-index: 10001 !important;
}

.culture-name-text {
  background: rgba(10, 18, 36, 0.88);
  color: #e2f0ff;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  border: 1.5px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.3);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.culture-label-wrapper:hover .culture-name-text {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.6);
  filter: brightness(1.5);
  text-shadow: 0 0 8px currentColor;
}

/* During the Rome cinematic, dim the surrounding labels so the eye lands on the
   culture(s) the current chapter is about (tagged .culture-active in script.js). */
body.rome-cine-on .culture-name-text,
body.rome-cine-on .rome-client-text {
  opacity: 0.5;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
body.rome-cine-on .culture-name-text.culture-active {
  opacity: 1;
  transform: scale(1.14);
  border-color: rgba(230, 181, 102, 0.95);
  box-shadow: 0 0 0 2px rgba(230, 181, 102, 0.9), 0 0 16px rgba(230, 181, 102, 0.7);
  text-shadow: 0 0 10px currentColor, 0 1px 3px rgba(0,0,0,0.85);
  z-index: 10002;
}
/* A hovered label always returns to full visibility, even when dimmed. */
body.rome-cine-on .culture-label-wrapper:hover .culture-name-text { opacity: 1; }

.culture-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  overflow: hidden;
  z-index: 10000;
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  min-width: 100px;
}

.culture-dropdown.visible {
  display: block;
}

.dropdown-item {
  padding: 8px 14px;
  color: #e2e8f0;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
  text-align: center;
  border-bottom: 1px solid #1e293b;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: #1e293b;
  color: #38bdf8;
}

.exit-isolate-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b !important;
  padding: 0.5rem 0.75rem !important;
  margin-bottom: 0.5rem !important;
  border-left: 3px solid #38bdf8;
}

.exit-isolate-item span {
  color: #38bdf8;
  font-size: 0.85rem;
  font-weight: 600;
}

.exit-isolate-item button {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

.exit-isolate-item button:hover {
  background: #dc2626;
}

.exit-isolate-btn {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  letter-spacing: 0.02em;
}

.exit-isolate-btn:hover {
  background: #dc2626;
}

.exit-isolate-btn.hidden {
  display: none;
}

.culture-search-container {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #222;
  position: relative;
}

.culture-search-container input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

.culture-search-container input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.culture-search-container input::placeholder {
  color: #6b7280;
}

.culture-search-results {
  position: absolute;
  top: calc(100% - 4px);
  left: 1rem;
  right: 1rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 0 0 6px 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.culture-search-results.hidden {
  display: none;
}

.culture-search-result-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #111827;
  font-size: 0.85rem;
}

.culture-search-result-item:last-child {
  border-bottom: none;
}

.culture-search-result-item:hover {
  background: #374151;
}

.culture-search-result-item .search-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.culture-search-result-item .search-culture-name {
  color: #e5e7eb;
  flex: 1;
}

.culture-search-result-item .search-culture-dates {
  color: #6b7280;
  font-size: 0.75rem;
  white-space: nowrap;
}

.culture-search-no-results {
  padding: 0.75rem;
  color: #6b7280;
  font-size: 0.85rem;
  text-align: center;
}

.ai-ask-container {
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid #222;
}

.ai-ask-input-row {
  display: flex;
  gap: 0.4rem;
}

.ai-ask-input-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #e5e7eb;
  font-size: 0.85rem;
  outline: none;
  box-sizing: border-box;
}

.ai-ask-input-row input:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
}

.ai-ask-input-row input::placeholder {
  color: #6b7280;
}

.ai-ask-input-row button {
  padding: 0.5rem 0.75rem;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.ai-ask-input-row button:hover {
  opacity: 0.9;
}

.ai-ask-input-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-ask-response {
  margin-top: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: #1e1b4b;
  border: 1px solid #312e81;
  border-radius: 6px;
  color: #c4b5fd;
  font-size: 0.82rem;
  line-height: 1.5;
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.ai-ask-response.hidden {
  display: none;
}

.ai-ask-response .ai-loading {
  color: #8b5cf6;
  font-style: italic;
}

/* ---- AI Visual Assistant: tabs / tree / routes ---- */
.ai-result {
  white-space: normal;
}
.ai-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid #312e81;
  padding-bottom: 0.4rem;
}
.ai-tab-btn {
  background: #2e2a5e;
  color: #c4b5fd;
  border: 1px solid #3b3680;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-tab-btn:hover { background: #3b3680; }
.ai-tab-btn.active {
  background: #8b5cf6;
  color: #fff;
  border-color: #8b5cf6;
}
.ai-tab-panel.hidden { display: none; }
.ai-answer-text { margin: 0 0 0.4rem; color: #ddd6fe; }
.ai-disclaimer {
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.55rem;
  background: #3a2a1a;
  border: 1px solid #6b4f2a;
  border-radius: 5px;
  color: #fcd9a8;
  font-size: 0.76rem;
}
.ai-panel-hint {
  margin: 0 0 0.5rem;
  color: #a78bfa;
  font-size: 0.74rem;
  font-style: italic;
}

/* Family tree */
.ai-tree, .ai-tree-children {
  list-style: none;
  margin: 0;
  padding-left: 0.9rem;
}
.ai-tree { padding-left: 0; }
.ai-tree-children {
  border-left: 1px solid #3b3680;
  margin-left: 0.5rem;
}
.ai-tree-node { margin: 0.3rem 0; }
.ai-tree-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  background: #2a2658;
  border: 1px solid #3b3680;
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ai-tree-card:hover {
  background: #3b3680;
  border-color: #8b5cf6;
}
.ai-tree-name { font-weight: 600; color: #ede9fe; font-size: 0.82rem; }
.ai-tree-dates { color: #a5b4fc; font-size: 0.72rem; }
.ai-tree-region { color: #9ca3cf; font-size: 0.72rem; }
.ai-tree-rel {
  color: #c4b5fd;
  font-size: 0.68rem;
  background: #1e1b4b;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

/* Map / routes */
.ai-map-title { margin: 0 0 0.15rem; color: #ede9fe; font-size: 0.92rem; }
.ai-map-range { color: #a5b4fc; font-size: 0.75rem; margin-bottom: 0.3rem; }
.ai-map-summary { margin: 0 0 0.5rem; color: #ddd6fe; }
.ai-map-show-btn {
  background: #e6b566;
  color: #2a1c05;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 0.6rem;
}
.ai-map-show-btn:hover { background: #f0c87f; }
.ai-map-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.ai-map-btn-row .ai-map-show-btn { margin-bottom: 0; }
.ai-map-play-btn {
  background: #8b5cf6;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.ai-map-play-btn:hover { background: #a78bfa; }
.ai-map-play-btn:disabled { opacity: 0.6; cursor: default; }
.ai-anim-caption {
  margin-bottom: 0.6rem;
  padding: 0.4rem 0.55rem;
  background: #1e1b4b;
  border: 1px solid #3b3680;
  border-radius: 5px;
  color: #e6b566;
  font-size: 0.78rem;
}
.ai-list-row { cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.ai-list-row:hover { background: #3b3680; border-color: #8b5cf6; }
.ai-route-list { display: flex; flex-direction: column; gap: 0.4rem; }
.ai-route {
  background: #2a2658;
  border: 1px solid #3b3680;
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
}
.ai-route-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.ai-route-path { font-weight: 600; color: #ede9fe; font-size: 0.8rem; }
.ai-route-meta { color: #9ca3cf; font-size: 0.72rem; margin-top: 0.2rem; }
.ai-route-label { color: #c4b5fd; font-size: 0.74rem; margin-top: 0.15rem; }
.ai-conf {
  font-size: 0.66rem;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  white-space: nowrap;
}
.ai-conf-high { background: #14532d; color: #86efac; }
.ai-conf-medium { background: #4a3a10; color: #fcd34d; }
.ai-conf-low { background: #4a1f1f; color: #fca5a5; }

/* Sources */
.ai-sources-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.ai-sources-key { color: #a5b4fc; font-size: 0.76rem; font-weight: 600; }
.ai-sources-val { color: #ddd6fe; font-size: 0.78rem; }
.ai-evidence-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ai-evidence-tag {
  background: #1e1b4b;
  color: #c4b5fd;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.68rem;
}
.ai-sources-note { margin: 0.2rem 0 0; color: #b9b2e0; font-size: 0.76rem; }

.panel-block {
  padding: 1rem;
  border-bottom: 1px solid #222;
  overflow-y: auto;
}

#cultureItems {
  list-style: none;
  padding: 0;
  margin: 0;
}

#cultureItems li {
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  background: #111827;
  cursor: pointer;
  border-radius: 4px;
}

#cultureItems li:hover {
  background: #1f2937;
}

.genetic-term {
  color: #facc15;
  text-decoration: none;
  border-bottom: 1px dashed #facc15;
  cursor: pointer;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s;
}

.genetic-term:hover {
  background: rgba(250, 204, 21, 0.15);
  color: #fde047;
  border-bottom-style: solid;
}

.dna-section {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.dna-section h3 {
  color: #34d399;
  border-bottom-color: rgba(16, 185, 129, 0.3);
}

.lineage-section {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.lineage-section h3 {
  color: #a78bfa;
  border-bottom-color: rgba(139, 92, 246, 0.3);
}

.lineage-flow {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.lineage-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lineage-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  min-width: 90px;
  flex-shrink: 0;
}

.lineage-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.lineage-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.3;
}

.lineage-item.clickable {
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.lineage-item.clickable:active {
  transform: scale(0.97);
}

.lineage-predecessor {
  background: rgba(251, 146, 60, 0.07);
  border: 1px solid rgba(251, 146, 60, 0.2);
  color: rgba(253, 186, 116, 0.6);
}

.lineage-predecessor.clickable {
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid rgba(251, 146, 60, 0.3);
  color: #fdba74;
}

.lineage-predecessor.clickable:hover {
  background: rgba(251, 146, 60, 0.25);
  border-color: #fb923c;
}

.lineage-successor {
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: rgba(125, 211, 252, 0.6);
}

.lineage-successor.clickable {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}

.lineage-successor.clickable:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
}

.lineage-arrow {
  color: #475569;
  font-size: 1rem;
}

.lineage-region {
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
}

.lineage-relationship {
  font-size: 0.7rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.formation-text {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(139, 92, 246, 0.06);
  border-left: 3px solid rgba(139, 92, 246, 0.4);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.lineage-plus {
  color: #475569;
  font-weight: bold;
  font-size: 0.9rem;
}

/* Overlay Styles */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 6, 23, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  transition: opacity 0.3s ease;
}

.overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  background: #0f172a;
  padding: 2.5rem;
  border-radius: 12px;
  border: 1px solid #1e293b;
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover {
  color: #f1f5f9;
}

#overlayBody h2 {
  color: #38bdf8;
  margin-top: 0;
  font-size: 2rem;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 0.5rem;
}

.era-label {
  display: inline-block;
  margin: 0.6rem 0 0.2rem;
  padding: 0.25rem 0.7rem;
  background: #7c2d12;
  color: #fde68a;
  border: 1px solid #b45309;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.age-badge {
  display: inline-block;
  margin: 0.6rem 0 0.2rem 0.4rem;
  padding: 0.25rem 0.7rem;
  background: #1e3a5f;
  color: #bae6fd;
  border: 1px solid #38bdf8;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.age-badge-icon { margin-right: 0.35rem; }
.age-badge-sub { font-weight: 400; color: #7dd3fc; }
@media (max-width: 600px) {
  .age-badge-sub { display: none; }
}

.detail-images {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 1.5rem 0;
}

.detail-image {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #020617;
}

.detail-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.2s;
}

.detail-image img:hover {
  opacity: 0.9;
}

/* Image Modal Styles */
.image-modal {
  position: fixed;
  z-index: 3000;
  padding-top: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(2, 6, 23, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
  animation: zoom 0.3s;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

@keyframes zoom {
  from {transform: scale(0.7); opacity: 0;}
  to {transform: scale(1); opacity: 1;}
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f5f9;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
  z-index: 3001;
}

.modal-close:hover {
  color: #38bdf8;
}

#modalCaption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #cbd5e1;
  padding: 15px 0;
  font-size: 1.2rem;
  font-weight: 500;
}

.image-label {
  background: #1e293b;
  color: #38bdf8;
  padding: 4px 8px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #334155;
}

.detail-section {
  margin-top: 1.5rem;
}

.detail-section h3 {
  color: #94a3b8;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.detail-section p {
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.culture-profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1.2rem 0 1.4rem;
}

.culture-profile-card {
  min-width: 0;
  border: 1px solid #334155;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(15, 31, 52, 0.96), rgba(8, 18, 34, 0.98));
  overflow: hidden;
}

.culture-profile-card.is-open { grid-column: 1 / -1; }
.culture-profile-religion { border-top: 3px solid #d8a84e; }
.culture-profile-ancestry { border-top: 3px solid #45a6c8; }
.culture-profile-language { border-top: 3px solid #9b84d1; }

.culture-profile-trigger {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 0.7rem;
  border: 0;
  color: #e8edf5;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.culture-profile-trigger:hover { background: rgba(255, 255, 255, 0.045); }
.culture-profile-trigger:focus-visible {
  outline: 2px solid #f0c46e;
  outline-offset: -3px;
}

.culture-profile-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  color: #f0c46e;
  font: 700 0.85rem var(--font-display);
}

.culture-profile-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.15rem;
}

.culture-profile-heading strong {
  color: #f7fafc;
  font: 700 0.78rem var(--font-display);
  letter-spacing: 0.03em;
}

.culture-profile-heading span {
  overflow: hidden;
  color: #aebbd0;
  font-size: 0.68rem;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.culture-profile-chevron {
  color: #91a1b7;
  font-size: 1.05rem;
  transition: transform 0.18s ease;
}

.culture-profile-trigger[aria-expanded="true"] .culture-profile-chevron { transform: rotate(180deg); }

.culture-profile-detail {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid #2a3c54;
  color: #bac5d5;
  font-size: 0.78rem;
  line-height: 1.55;
}

.culture-profile-detail p { margin: 0.55rem 0 0; }

.culture-profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.culture-profile-tags span {
  padding: 0.35rem 0.58rem;
  border: 1px solid rgba(69, 166, 200, 0.48);
  border-radius: 999px;
  color: #c6f0ff;
  background: rgba(69, 166, 200, 0.12);
  font-size: 0.7rem;
  font-weight: 700;
}

.culture-profile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.2rem;
  margin: 0;
}

.culture-profile-facts div { display: grid; gap: 0.1rem; }
.culture-profile-facts dt {
  color: #8291a6;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.culture-profile-facts dd { margin: 0; color: #eef2f7; font-weight: 700; }

.culture-religion-entry + .culture-religion-entry {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #2a3c54;
}

.culture-religion-entry h4 {
  margin: 0;
  color: #f4d69a;
  font: 700 0.86rem var(--font-display);
}

.culture-religion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.culture-religion-meta span {
  padding: 0.15rem 0.38rem;
  border-radius: 4px;
  color: #d9e1ec;
  background: rgba(255,255,255,.07);
  font-size: 0.62rem;
}

.culture-profile-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: center;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid #2a3c54;
}

.culture-profile-sources strong {
  color: #91a1b7;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.culture-profile-sources a {
  color: #7dd3fc;
  font-weight: 700;
  text-underline-offset: 2px;
}

@media (max-width: 700px) {
  .culture-profile-grid { grid-template-columns: 1fr; gap: 0.55rem; }
  .culture-profile-card.is-open { grid-column: auto; }
  .culture-profile-trigger { min-height: 62px; }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.meta-item strong {
  color: #38bdf8;
  display: block;
  margin-bottom: 0.25rem;
}

.more-info-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
  text-align: center;
}

.more-info-btn {
  padding: 0.75rem 2rem;
  background: #38bdf8;
  color: #020617;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.more-info-btn:hover {
  background: #7dd3fc;
}

footer {
  padding: 0.5rem 1rem;
  background: #020617;
  border-top: 1px solid #222;
  text-align: right;
}

footer a {
  color: #38bdf8;
  text-decoration: none;
}

/* Auth */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.auth-card {
  background: #020617;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #1f2937;
  width: 320px;
}

.auth-card h1 {
  margin-top: 0;
}

.auth-card label {
  display: block;
  margin-bottom: 1rem;
}

.auth-card input {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.25rem;
  border-radius: 4px;
  border: 1px solid #374151;
  background: #020617;
  color: #f9fafb;
}

.auth-card button {
  width: 100%;
  padding: 0.75rem;
  border-radius: 4px;
  border: none;
  background: #38bdf8;
  color: #020617;
  font-weight: 600;
  cursor: pointer;
}

.error {
  color: #f97373;
  margin-top: 0.5rem;
}

/* Admin */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #020617;
  border-bottom: 1px solid #1f2937;
}
.admin-env-banner {
  padding: 9px 18px;
  border-bottom: 1px solid rgba(234, 179, 8, 0.45);
  background: #422006;
  color: #fef3c7;
  font: 600 0.84rem/1.4 Inter, sans-serif;
  text-align: center;
}
.admin-env-banner[hidden] { display: none; }
.admin-env-banner a {
  color: #fde68a;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1.6fr;
  gap: 1rem;
  padding: 1rem;
  height: calc(100vh - 80px);
  box-sizing: border-box;
}

.admin-panel {
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.admin-panel h2 {
  margin-top: 0;
}

.admin-panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.admin-panel li {
  padding: 0.5rem;
  margin-bottom: 0.25rem;
  background: #0b1120;
  border-radius: 4px;
  cursor: pointer;
}

.admin-panel li:hover {
  background: #111827;
}

.admin-panel button {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border-radius: 4px;
  border: none;
  background: #22c55e;
  color: #020617;
  font-weight: 600;
  cursor: pointer;
}

#logoutBtn {
  background: #f97316;
  color: #020617;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

#adminEditor {
  flex: 1;
  overflow-y: auto;
}

#adminEditor form label {
  display: block;
  margin-bottom: 0.5rem;
}

#adminEditor form input,
#adminEditor form textarea {
  width: 100%;
  padding: 0.4rem;
  margin-top: 0.25rem;
  border-radius: 4px;
  border: 1px solid #374151;
  background: #020617;
  color: #f9fafb;
}

#adminEditor form textarea {
  min-height: 80px;
}

#adminEditor form button {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  background: #38bdf8;
  color: #020617;
  font-weight: 600;
  cursor: pointer;
}

.expansion-section {
  border-top: 1px solid #1e293b;
  padding-top: 1.5rem;
}

.expansion-desc {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 1rem;
}

.expansion-btn-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.expansion-btn {
  padding: 0.75rem 1.25rem;
  background: #f97316;
  color: #020617;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  flex: 1;
}

.expansion-btn:hover {
  background: #fb923c;
}

.solo-view-btn {
  padding: 0.75rem 1.25rem;
  background: #7c3aed;
  color: #f5f3ff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  flex: 1;
}

.solo-view-btn:hover {
  background: #6d28d9;
}

.solo-view-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* ─── Tribe system ─── */

.tribes-btn-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #1e293b;
}

.show-tribes-btn {
  padding: 0.7rem 1.2rem;
  background: #0f766e;
  color: #ccfbf1;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.show-tribes-btn:hover {
  background: #115e59;
}

.tribes-btn-desc {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
}

/* Tribe HUD banner (below exit-isolate button on map) */
.tribe-hud {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 8, 22, 0.94);
  border: 1px solid #0f766e;
  border-radius: 8px;
  padding: 10px 18px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.30);
  pointer-events: auto;
}

.tribe-hud.hidden {
  display: none;
}

.tribe-hud span {
  color: #94a3b8;
  font-size: 0.88rem;
}

.tribe-hud strong {
  color: #5eead4;
}

.tribe-hud button {
  padding: 5px 14px;
  background: #0f766e;
  color: #ccfbf1;
  border: none;
  border-radius: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.tribe-hud button:hover {
  background: #115e59;
}

/* Tribe labels on map */
.tribe-label {
  background: rgba(5, 8, 22, 0.85);
  border: 1.5px solid currentColor;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  transform: translate(-50%, -50%);
  position: relative;
}

/* Tribe popup styling (inside Leaflet popup) */
.tribe-popup strong {
  font-size: 1rem;
  color: #f8fafc;
  display: block;
  margin-bottom: 4px;
}

.tribe-popup .tribe-capital {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

.tribe-popup .tribe-note {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.5;
  font-style: italic;
}

#expansionHUD {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 8, 22, 0.94);
  border: 1px solid #f97316;
  border-radius: 10px;
  padding: 14px 24px;
  z-index: 10001;
  min-width: 360px;
  max-width: 680px;
  width: clamp(360px, 50vw, 680px);
  text-align: center;
  box-shadow: 0 4px 24px rgba(249, 115, 22, 0.25);
  pointer-events: auto;
}

.expansion-hud-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f97316;
  margin-bottom: 4px;
}

.expansion-hud-year {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f5f5f5;
  margin-bottom: 6px;
}

.expansion-hud-status {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
  min-height: 2.5em;
  margin-bottom: 6px;
}

.expansion-hud-narrative {
  font-size: 0.82rem;
  color: #fde68a;
  line-height: 1.6;
  min-height: 3em;
  max-height: 9em;
  overflow-y: auto;
  background: rgba(249, 115, 22, 0.06);
  border-left: 2px solid #f97316;
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  text-align: left;
  opacity: 0;
  transition: none;
}

.expansion-hud-narrative:empty {
  background: none;
  border-left: none;
  padding: 0;
  min-height: 0;
}

@keyframes narrativeFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.narrative-fade-in {
  animation: narrativeFadeIn 0.6s ease forwards;
}

.expansion-hud-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 12em;
  overflow-y: auto;
  text-align: left;
}

.expansion-hud-cards:empty {
  display: none;
}

.rome-event-card {
  background: rgba(124, 45, 18, 0.18);
  border-left: 3px solid #b91c1c;
  border-radius: 5px;
  padding: 8px 11px;
  animation: narrativeFadeIn 0.5s ease forwards;
}

.rome-event-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.rome-event-card-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.rome-event-card-title {
  font-size: 0.92rem;
  font-weight: 700;
}

.rome-event-card-text {
  font-size: 0.8rem;
  color: #e7d8c8;
  line-height: 1.55;
}

.expansion-hud-slider {
  margin-bottom: 10px;
}

.expansion-hud-slider input[type="range"] {
  width: 100%;
  accent-color: #b91c1c;
  cursor: pointer;
}

.expansion-hud-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.expansion-hud-stop {
  padding: 6px 20px;
  background: transparent;
  color: #38bdf8;
  border: 1px solid #38bdf8;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.expansion-hud-stop:hover {
  background: #38bdf8;
  color: #020617;
}

.expansion-hud-voice {
  padding: 6px 14px;
  background: transparent;
  color: #a78bfa;
  border: 1px solid #a78bfa;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s;
}

.expansion-hud-voice:hover {
  background: #a78bfa;
  color: #020617;
}

.expansion-hud-close {
  padding: 6px 20px;
  background: transparent;
  color: #f97316;
  border: 1px solid #f97316;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.expansion-hud-close:hover {
  background: #f97316;
  color: #020617;
}

.migration-tooltip {
  background: rgba(15, 23, 42, 0.9);
  color: #f97316;
  border: 1px solid #f97316;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.ice-tooltip {
  background: rgba(180, 220, 245, 0.9);
  color: #1e3a5f;
  border: 1px solid #a8d4f0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ===== ADMIN V2 ===== */

.admin-layout-v2 {
  display: grid;
  grid-template-columns: 260px 400px 1fr;
  height: calc(100vh - 60px);
  overflow: hidden;
}

.admin-sidebar-v2 {
  background: #020b1a;
  border-right: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #1f2937;
}

.stab {
  flex: 1 1 25%;
  min-width: 25%;
  padding: 1rem 0.15rem;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.stab.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

.stab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 0.5rem;
  gap: 0.4rem;
}

.stab-content.hidden {
  display: none;
}

.sidebar-new-btn {
  width: 100%;
  padding: 0.5rem;
  background: #22c55e;
  color: #020617;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
}

.sidebar-new-btn:hover {
  background: #4ade80;
}

.sidebar-search {
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: #0b1120;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #f9fafb;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
}

.sidebar-item {
  padding: 0.45rem 0.5rem;
  margin-bottom: 2px;
  background: #0b1120;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.sidebar-item:hover {
  background: #111827;
  border-color: #374151;
}

.sidebar-item.active {
  background: #0f2040;
  border-color: #38bdf8;
}

.si-name {
  font-size: 0.82rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.si-sub {
  font-size: 0.7rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.si-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.si-actions button {
  flex: 1;
  padding: 2px 6px;
  font-size: 0.72rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  background: #374151;
  color: #f9fafb;
}

.si-actions button:hover { background: #4b5563; }
.btn-danger-sm { background: #7f1d1d !important; color: #fca5a5 !important; }
.btn-danger-sm:hover { background: #991b1b !important; }

/* Editor panel */
.admin-editor-v2 {
  background: #020b1a;
  border-right: 1px solid #1f2937;
  overflow-y: auto;
  padding: 1rem;
}

.admin-editor-inner {
  color: #94a3b8;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.admin-form h3 {
  margin: 0 0 0.5rem 0;
  color: #f1f5f9;
  font-size: 1rem;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.78rem;
  color: #94a3b8;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: #0b1120;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #f9fafb;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.admin-form textarea {
  min-height: 70px;
  resize: vertical;
  font-family: monospace;
}

.admin-form input[type="range"] {
  padding: 0;
  accent-color: #38bdf8;
}

.admin-form fieldset {
  display: grid;
  gap: 0.65rem;
  margin: 0.4rem 0;
  padding: 0.75rem;
  border: 1px solid #334155;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
}

.admin-form legend {
  padding: 0 0.4rem;
  color: #e2e8f0;
  font-weight: 700;
}

.admin-form input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: #38bdf8;
}

.admin-form label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  color: #d7e0ec;
}

.religion-row {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem;
  border: 1px solid #3d4d63;
  border-radius: 7px;
  background: #07101f;
}

.culture-sources {
  display: grid;
  gap: 0.45rem;
}

.culture-sources > strong {
  color: #cbd5e1;
  font-size: 0.75rem;
}

.culture-source-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1.2fr);
  padding: 0.5rem;
  border-left: 2px solid #334155;
}

.culture-source-row > button {
  grid-column: 1 / -1;
  justify-self: start;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-primary {
  padding: 0.5rem 1rem;
  background: #38bdf8;
  color: #020617;
  border: none;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primary:hover { background: #7dd3fc; }

.btn-secondary {
  padding: 0.4rem 0.8rem;
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #1d4ed8;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-secondary:hover { background: #1e40af; color: #bfdbfe; }

.btn-danger {
  padding: 0.5rem 1rem;
  background: #7f1d1d;
  color: #fca5a5;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-danger:hover { background: #991b1b; }

.boundary-info {
  font-size: 0.78rem;
  padding: 0.3rem 0.5rem;
  background: #0b1120;
  border-radius: 4px;
  border: 1px solid #1f2937;
}

.boundary-ok   { color: #4ade80; }
.boundary-none { color: #64748b; }

.phase-picker {
  display: block;
  margin-top: 0.6rem;
}
.phase-picker select { width: 100%; }
.phase-hint {
  margin: 0.3rem 0 0.2rem;
  font-size: 0.78rem;
  color: #8aa0c0;
  line-height: 1.4;
}

.bounds-fieldset {
  border: 1px solid #374151;
  border-radius: 4px;
  padding: 0.5rem;
  margin: 0;
}

.bounds-fieldset legend {
  font-size: 0.75rem;
  color: #64748b;
  padding: 0 0.25rem;
}

.bounds-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.4rem;
  align-items: end;
  margin-bottom: 0.4rem;
}

/* Map section */
.admin-map-section {
  display: flex;
  flex-direction: column;
  background: #020b1a;
  overflow: hidden;
}

.admin-map-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #020617;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.map-tool-btn {
  padding: 0.35rem 0.7rem;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #374151;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.map-tool-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

.date-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-left: 0.6rem;
  margin-left: 0.2rem;
  border-left: 1px solid #1f2937;
}
.date-jump label {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
}
.date-jump input,
.date-jump select {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #374151;
  border-radius: 4px;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
}
.date-jump input {
  width: 5.5rem;
}

.map-tool-status {
  font-size: 0.75rem;
  color: #64748b;
  flex: 1;
  min-width: 120px;
}

#adminMap {
  flex: 1;
  width: 100%;
}

/* Admin mobile layout. Keep the desktop three-column workspace above this
   breakpoint, but give each panel its own full-width section on phones. */
@media (max-width: 700px) {
  .admin-header {
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .admin-header h1 {
    min-width: 0;
    font-size: 1.15rem;
    line-height: 1.25;
  }

  #logoutBtn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.65rem 0.85rem;
  }

  .admin-layout-v2 {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 62px);
    overflow: visible;
  }

  .admin-sidebar-v2 {
    flex: 0 0 auto;
    width: 100%;
    height: min(46vh, 480px);
    min-height: 260px;
    max-height: 480px;
    border-right: none;
    border-bottom: 1px solid #1f2937;
  }

  .sidebar-tabs {
    flex: 0 0 auto;
  }

  .stab {
    min-height: 48px;
    padding: 0.7rem 0.2rem;
    font-size: 0.8rem;
  }

  .stab-content {
    min-height: 0;
    overflow-y: auto;
    padding: 0.65rem 0.75rem 0.75rem;
    gap: 0.55rem;
  }

  .sidebar-new-btn,
  .sidebar-search {
    min-height: 44px;
  }

  .sidebar-new-btn {
    padding: 0.65rem 0.5rem;
  }

  .sidebar-search {
    padding: 0.65rem 0.6rem;
    font-size: 16px;
  }

  .sidebar-list {
    min-height: 0;
  }

  .sidebar-item {
    min-height: 44px;
    justify-content: center;
    padding: 0.65rem 0.7rem;
  }

  .si-actions {
    gap: 0.5rem;
  }

  .si-actions button {
    min-height: 40px;
    padding: 0.5rem 0.65rem;
  }

  .admin-editor-v2 {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border-right: none;
    border-bottom: 1px solid #1f2937;
    overflow: visible;
    padding: 1rem 0.85rem 1.25rem;
  }

  .admin-editor-inner {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .admin-form {
    gap: 0.75rem;
  }

  .admin-form input:not([type="range"]),
  .admin-form textarea,
  .admin-form select,
  .traffic-gen input,
  .traffic-gen textarea,
  .traffic-gen select {
    min-height: 44px;
    padding: 0.65rem 0.6rem;
    font-size: 16px;
  }

  .admin-form textarea {
    min-height: 96px;
  }

  .admin-form input[type="range"] {
    min-height: 44px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .bounds-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .bounds-row > button {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-danger {
    min-height: 44px;
  }

  #adminEditor .btn-danger-sm,
  #adminEditor .awn-remove-btn {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
  }

  .admin-map-section {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 360px;
    overflow: visible;
  }

  .admin-map-toolbar {
    align-items: stretch;
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
  }

  .admin-map-toolbar > .map-tool-btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 44px;
    padding: 0.6rem 0.65rem;
  }

  .date-jump {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    margin: 0.15rem 0 0;
    padding: 0.65rem 0 0;
    border-left: none;
    border-top: 1px solid #1f2937;
  }

  .date-jump input,
  .date-jump select,
  .date-jump .map-tool-btn {
    min-height: 44px;
    box-sizing: border-box;
    padding: 0.6rem 0.5rem;
    font-size: 16px;
  }

  .date-jump .map-tool-btn {
    grid-column: 1 / -1;
  }

  .map-tool-status {
    flex: 1 1 100%;
    min-width: 0;
    line-height: 1.4;
  }

  #adminMap {
    flex: none;
    height: 52vh;
    min-height: 340px;
  }

  .traffic-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Toast */
#adminToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #22c55e;
  color: #020617;
  padding: 0.6rem 1.4rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
  z-index: 99999;
  pointer-events: none;
}

#adminToast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
/* Top navigation (Map / Languages) — absolutely positioned so it does not
   change the header height the map layout depends on. */
header {
  position: relative;
}

.top-nav {
  position: absolute;
  top: 1rem;
  right: 5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  max-width: 80%;
}

.top-nav a {
  color: #c4b5fd;
  text-decoration: none;
  font-size: 1.8rem;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  border: 1px solid #2a2350;
  border-radius: 6px;
  background: #161033;
}

.top-nav a:hover {
  background: #241a4d;
  color: #fff;
}

.top-nav a.active {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}

@media (max-width: 600px) {
  .top-nav {
    top: 0.75rem;
    right: 2.5rem;
    gap: 0.4rem;
  }
  .top-nav a {
    font-size: 1.56rem;
    padding: 0.6rem 1.1rem;
  }
}

/* ===== Rebrand: Your Human Story ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
  padding: 0 1.5rem;
  background: rgba(7, 11, 22, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-nav .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.site-nav .brand-mark { font-size: 1.4rem; }
.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-nav .nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.site-nav .nav-links a:hover,
.site-nav .nav-links a.active { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.site-nav .nav-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #5d6b85;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  cursor: default;
}
.site-nav .nav-soon em,
.btn .soon {
  font-style: normal;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a1304;
  background: var(--gold);
  padding: 0.12rem 0.36rem;
  border-radius: 5px;
}
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

/* Hero */
header.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(230, 181, 102, 0.16), transparent 60%),
    radial-gradient(900px 520px at 82% 115%, rgba(143, 184, 255, 0.12), transparent 60%),
    linear-gradient(180deg, #070b16 0%, #0a1122 100%);
  overflow: hidden;
}
.hero-inner { position: relative; max-width: 840px; }
.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 0.78rem;
  color: var(--gold-soft);
  margin: 0 0 1.3rem;
  font-weight: 600;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  line-height: 1.02;
  margin: 0;
  color: var(--text);
}
.hero-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 3vw, 2.1rem);
  color: var(--gold);
  margin: 0.7rem 0 0;
}
.hero-sub {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--text-dim);
  max-width: 640px;
  margin: 1.5rem auto 0;
  line-height: 1.65;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  margin-top: 2.3rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.15s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1304;
  box-shadow: 0 8px 24px rgba(230, 181, 102, 0.25);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(230, 181, 102, 0.42); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.13); }
.btn-ghost.is-soon { color: #6b7a96; border-color: var(--border); cursor: default; }
.hero-scroll {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 1.5rem;
  text-decoration: none;
  animation: yhs-bob 1.8s ease-in-out infinite;
}
@keyframes yhs-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); }
}

#explore { scroll-margin-top: 64px; }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem 1rem;
  }
  .site-nav.open .nav-links { display: flex; }
  .site-nav .nav-links a,
  .site-nav .nav-soon { width: 100%; }

  /* Stack the map and the controls panel vertically on phones/tablets.
     Without this the flex row crams the map into an unusable sliver. */
  .layout {
    flex-direction: column;
    height: auto;
  }
  #map {
    flex: none;
    width: 100%;
    height: 70vh;
    min-height: 360px;
  }
  .side-panel {
    flex: none;
    width: 100%;
    border-left: none;
    border-top: 1px solid #222;
  }
}

/* ============================================================
   AI Museum Guide: info card, story player, showcase
   ============================================================ */

/* ---- Info card ---- */
.ai-card { display: flex; flex-direction: column; gap: 0.55rem; }
.ai-card-head { display: flex; align-items: center; gap: 0.5rem; }
.ai-card-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }
.ai-card-title { margin: 0; font-family: var(--font-display); font-size: 1.35rem; color: var(--text); line-height: 1.15; }
.ai-card-status { font-size: 0.85rem; color: var(--gold-soft); font-style: italic; margin-top: -0.2rem; }
.ai-card-range { margin: 0.1rem 0; }
.ai-card-range-pill {
  display: inline-block; background: rgba(230,181,102,0.14); color: var(--gold-soft);
  border: 1px solid rgba(230,181,102,0.4); border-radius: 999px;
  padding: 0.2rem 0.7rem; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em;
}
.ai-card-summary { margin: 0.2rem 0; color: #dfe6f2; line-height: 1.55; font-size: 0.93rem; }

.ai-card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 0.1rem; }
.ai-card-btn {
  background: var(--gold); color: #1a1206; border: none; border-radius: 8px;
  padding: 0.45rem 0.8rem; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.ai-card-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ai-card-btn.ghost { background: transparent; color: var(--gold-soft); border: 1px solid rgba(230,181,102,0.5); }
.ai-card-btn.story { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.ai-card-btn.big { font-size: 0.95rem; padding: 0.6rem 1.1rem; margin-bottom: 0.6rem; }

.ai-card-section { border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,0.02); overflow: hidden; }
.ai-card-section + .ai-card-section { margin-top: 0.1rem; }
.ai-card-section-head {
  display: flex; align-items: center; gap: 0.45rem; cursor: pointer; list-style: none;
  padding: 0.55rem 0.7rem; font-weight: 600; font-size: 0.9rem; color: var(--text);
  user-select: none;
}
.ai-card-section-head::-webkit-details-marker { display: none; }
.ai-card-section-head::after { content: '▸'; margin-left: auto; color: var(--text-dim); transition: transform 0.15s ease; }
.ai-card-section[open] .ai-card-section-head::after { transform: rotate(90deg); }
.ai-card-section-icon { font-size: 1rem; }
.ai-card-section-body { padding: 0 0.7rem 0.6rem; display: flex; flex-direction: column; gap: 0.35rem; }
.ai-card-row { display: flex; gap: 0.5rem; font-size: 0.88rem; line-height: 1.4; }
.ai-card-row-label { flex: 0 0 33%; color: var(--text-dim); font-weight: 600; }
.ai-card-row-val { color: #e6ecf6; }

.ai-card-event {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.25rem 0; font-size: 0.88rem;
  border-radius: 6px;
}
.ai-card-event:hover { background: rgba(230,181,102,0.08); }
.ai-card-event-year {
  flex: 0 0 auto; border: 1px solid var(--gold); color: var(--gold-soft);
  border-radius: 6px; padding: 0.1rem 0.45rem; font-size: 0.78rem; font-weight: 700;
}
.ai-card-event-title { color: #e6ecf6; }

.ai-card-related { margin-top: 0.3rem; }
.ai-card-related-label { font-size: 0.8rem; color: var(--text-dim); font-weight: 600; margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.05em; }
.ai-card-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ai-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  background: rgba(255,255,255,0.04); border: 1px solid var(--chip-color, #555);
  border-left-width: 3px; border-radius: 8px; padding: 0.3rem 0.6rem;
  color: var(--text); font-size: 0.82rem; transition: background 0.12s ease, transform 0.12s ease;
}
.ai-chip:hover { background: rgba(255,255,255,0.09); transform: translateY(-1px); }
.ai-chip.disabled { cursor: default; opacity: 0.55; }
.ai-chip.disabled:hover { background: rgba(255,255,255,0.04); transform: none; }
.ai-chip-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ai-chip-name { font-weight: 600; }
.ai-chip-rel { color: var(--text-dim); font-size: 0.74rem; }

/* ---- Story tab panel ---- */
.ai-story-panel { display: flex; flex-direction: column; }
.ai-story-title { margin: 0 0 0.2rem; font-family: var(--font-display); font-size: 1.2rem; color: var(--text); }
.ai-story-sub { margin: 0 0 0.6rem; color: var(--text-dim); font-size: 0.86rem; }
.ai-story-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ai-story-li { display: flex; gap: 0.6rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; transition: background 0.12s ease; }
.ai-story-li:hover { background: rgba(124,58,237,0.1); border-color: rgba(168,85,247,0.5); }
.ai-story-li-year { flex: 0 0 auto; color: #c4b5fd; font-weight: 700; font-size: 0.8rem; padding-top: 0.1rem; }
.ai-story-li-title { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.ai-story-li-desc { color: var(--text-dim); font-size: 0.83rem; line-height: 1.45; margin-top: 0.15rem; }

/* ---- Homepage showcase ---- */
.showcase { background: linear-gradient(180deg, var(--bg-2), var(--bg)); padding: 3.5rem 1.25rem 3rem; border-top: 1px solid var(--border); }
.showcase-inner { max-width: 1040px; margin: 0 auto; text-align: center; }
.showcase-eyebrow { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; color: var(--gold); font-weight: 700; margin: 0 0 0.3rem; }
.showcase-title { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 0.4rem; color: var(--text); }
.showcase-sub { color: var(--text-dim); max-width: 620px; margin: 0 auto 2rem; line-height: 1.6; }
.showcase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.showcase-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.3rem 1.2rem; cursor: pointer; color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.showcase-card:hover { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 14px 36px rgba(0,0,0,0.45); }
.showcase-card-icon { font-size: 2rem; }
.showcase-card-name { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.showcase-card-desc { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; flex: 1; }
.showcase-card-go { color: var(--gold-soft); font-weight: 700; font-size: 0.88rem; margin-top: 0.3rem; }

@media (max-width: 640px) {
  .ai-card-row-label { flex: 0 0 40%; }
  .showcase { padding: 2.5rem 1rem; }
}

/* ============================================================================
   ROME CINEMATIC EXPERIENCE — documentary narration panel
   ========================================================================== */
.showcase-card.is-feature {
  border-color: rgba(230, 181, 102, 0.55);
  box-shadow: 0 0 0 1px rgba(230, 181, 102, 0.18), 0 18px 40px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(230, 181, 102, 0.12), transparent 55%),
    var(--surface, #111a2e);
}
.showcase-card.is-feature .showcase-card-go { color: var(--gold, #e6b566); }
.showcase-card.egypt-feature {
  border-color: rgba(69, 144, 184, 0.62);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(45, 115, 154, 0.2), transparent 54%),
    linear-gradient(145deg, rgba(210, 165, 53, 0.08), transparent 60%),
    var(--surface, #111a2e);
}
.showcase-card.egypt-feature .showcase-card-go { color: #e6c166; }

/* ---- Homepage journey entry: a compact bridge between the invitation and map ---- */
.journey-launch {
  position: relative;
  z-index: 2;
  padding: 0 1.25rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.journey-launch-inner {
  max-width: 1040px;
  min-height: 130px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem 0;
}
.journey-launch-copy { min-width: 0; }
.journey-kicker {
  margin: 0 0 .32rem;
  color: var(--gold);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.journey-launch h2 {
  margin: 0;
  color: var(--text);
  font: 700 clamp(1.55rem, 3.5vw, 2.35rem)/1 var(--font-display);
  letter-spacing: .015em;
}
.journey-launch p:not(.journey-kicker) {
  margin: .48rem 0 0;
  color: var(--text-dim);
  line-height: 1.45;
}
.journey-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  flex: 0 0 auto;
  min-height: 48px;
  padding: .7rem 1.05rem;
  color: #16100a;
  background: var(--gold);
  border: 1px solid var(--gold-soft);
  border-radius: 8px;
  box-sizing: border-box;
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-decoration: none;
}
.journey-start:hover { background: var(--gold-soft); }
.journey-start:focus-visible,
.showcase-card:focus-visible,
.journey-reward-close:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

.journey-utility {
  max-width: 520px;
  margin: 0 auto 1.4rem;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .3rem .8rem;
  padding: .72rem .9rem;
  text-align: left;
  border: 1px solid rgba(230,181,102,.28);
  border-radius: 9px;
  background: rgba(230,181,102,.055);
}
.journey-progress-label { font-size: .76rem; font-weight: 700; color: var(--text); }
.journey-progress-count { font-size: .76rem; color: var(--text-dim); text-align: right; }
.journey-progress-track { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 10px; background: rgba(244,241,234,.12); }
.journey-progress-track i { display: block; width: 0%; height: 100%; background: var(--gold); border-radius: inherit; transition: width .4s ease; }
.journey-feature-grid { align-items: stretch; }
.journey-card { position: relative; overflow: hidden; min-height: 255px; isolation: isolate; }
.journey-card-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .2;
  filter: saturate(.7) contrast(.95);
  transition: transform .4s ease, opacity .35s ease;
}
.journey-card::after {
  position: absolute;
  content: "";
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(11,16,32,.93) 18%, rgba(11,16,32,.56) 100%);
}
.journey-card:hover .journey-card-image { transform: scale(1.04); opacity: .3; }
.journey-card .showcase-card-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  color: var(--gold-soft);
  font: 700 1.1rem/1 var(--font-display);
  border: 1px solid rgba(230,181,102,.48);
  border-radius: 50%;
}
.hidden-journey-slot {
  min-height: 238px;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: .8rem;
  padding: 1rem 1.1rem;
  text-align: left;
  color: var(--text-dim);
  border: 1px dashed rgba(159,176,201,.35);
  border-radius: 16px;
  background:
    radial-gradient(circle at 90% 8%, rgba(230,181,102,.12), transparent 38%),
    linear-gradient(145deg, rgba(12,19,34,.96), rgba(7,12,23,.98));
}
.hidden-journey-copy { display: grid; gap: .42rem; min-width: 0; }
.hidden-journey-slot strong { display: block; color: var(--text); font: 700 1.05rem/1.25 var(--font-display); letter-spacing: .035em; }
.hidden-journey-slot small { display: block; margin-top: .2rem; line-height: 1.4; }
.hidden-journey-kicker { color: var(--gold-soft); font-weight: 800; letter-spacing: .12em; }
.hidden-journey-lock { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid currentColor; border-radius: 50%; color: var(--gold-soft); }
.hidden-journey-slot.is-unlocked { border-style: solid; border-color: rgba(230,181,102,.65); animation: journey-unlock .65s ease-out both; }
.hidden-journey-slot .journey-reward-primary {
  margin-top: auto;
  min-height: 46px;
  width: 100%;
  padding: .75rem 1rem;
  color: #17110a;
  font-weight: 800;
  letter-spacing: .035em;
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-soft), #d3a554);
  cursor: pointer;
}
.hidden-journey-slot .journey-reward-primary:hover,
.hidden-journey-slot .journey-reward-primary:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.megalith-journey-active #map,
.megalith-map-opening #map { filter: saturate(.55) brightness(.58) contrast(1.15); transition: filter .5s ease; }
.megalith-opening {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(3,7,14,.5);
}
.megalith-opening-card {
  width: min(620px, 100%);
  max-height: min(84vh, 760px);
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2.4rem);
  color: var(--text);
  border: 1px solid rgba(230,181,102,.58);
  border-radius: 18px;
  background: rgba(7,12,23,.96);
  box-shadow: 0 28px 80px rgba(0,0,0,.58);
}
.megalith-opening-card h2 { margin: .3rem 0 .4rem; font: 700 clamp(1.65rem, 5vw, 2.6rem)/1.08 var(--font-display); }
.megalith-opening-card .megalith-subtitle { color: var(--gold-soft); font-style: italic; }
.megalith-opening-card .megalith-opening-line { margin: 1rem 0 0; line-height: 1.65; }
.megalith-opening-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.35rem; }
.megalith-opening-actions button { min-height: 46px; }
.megalith-opening-close { position: absolute; top: .8rem; right: .8rem; width: 44px; height: 44px; }
.megalith-reference-note { margin-top: 1rem; color: var(--text-dim); font-size: .78rem; line-height: 1.45; }
.megalith-techniques { display: grid; gap: .5rem; grid-column: 1 / -1; }
.megalith-technique button { width: 100%; min-height: 44px; text-align: left; }
.megalith-technique p { margin: .25rem 0 .5rem; padding: .7rem; color: var(--text-dim); border-left: 2px solid var(--gold-soft); }
@media (max-width: 640px) {
  .megalith-opening { align-items: end; padding: .55rem; }
  .megalith-opening-card { max-height: 75vh; border-radius: 16px 16px 0 0; }
  .hidden-journey-slot { min-height: 250px; }
  .hidden-journey-slot .journey-reward-primary { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  .megalith-journey-active #map,
  .megalith-map-opening #map { transition: none; }
}
@keyframes journey-unlock { 0% { opacity: .45; transform: scale(.975); } 55% { opacity: 1; transform: scale(1.012); } 100% { transform: scale(1); } }
.signup-exclusive-card {
  position: relative;
  min-height: 260px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .65rem;
  overflow: hidden;
  padding: 1.5rem;
  color: var(--text);
  border: 1px solid rgba(230,181,102,.45);
  border-radius: 16px;
  background:
    radial-gradient(circle at 85% 12%, rgba(230,181,102,.16), transparent 38%),
    linear-gradient(145deg, rgba(23,32,57,.97), rgba(8,14,27,.98));
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
}
.signup-exclusive-card.is-locked { border-style: dashed; filter: saturate(.82); }
.signup-exclusive-card.is-unlocked {
  border-color: rgba(230,181,102,.78);
  box-shadow: 0 14px 42px rgba(0,0,0,.34), 0 0 0 1px rgba(230,181,102,.12);
}
.worlds-lost-card {
  border-color: rgba(100, 191, 199, .52);
  background:
    radial-gradient(circle at 86% 10%, rgba(100, 191, 199, .2), transparent 40%),
    linear-gradient(145deg, rgba(18, 47, 64, .98), rgba(7, 20, 33, .99));
}
.worlds-lost-card.is-unlocked {
  border-color: rgba(100, 191, 199, .88);
  box-shadow: 0 14px 42px rgba(0,0,0,.34), 0 0 0 1px rgba(100, 191, 199, .16);
}
.worlds-lost-card .signup-exclusive-kicker { color: #9ee3e6; }
.gobekli-card {
  border-color: rgba(190, 159, 105, .66);
  background:
    radial-gradient(circle at 86% 10%, rgba(190, 159, 105, .22), transparent 40%),
    linear-gradient(145deg, rgba(53, 47, 48, .98), rgba(19, 25, 35, .99));
}
.gobekli-card.is-unlocked {
  border-color: rgba(222, 188, 124, .92);
  box-shadow: 0 14px 42px rgba(0,0,0,.34), 0 0 0 1px rgba(222, 188, 124, .18);
}
.gobekli-card .signup-exclusive-kicker { color: #e4ca95; }
.signup-exclusive-mark {
  position: absolute;
  right: 1rem;
  top: .65rem;
  color: rgba(230,181,102,.15);
  font-size: 4.2rem;
  line-height: 1;
}
.signup-exclusive-kicker {
  position: relative;
  margin: 0;
  color: var(--gold-soft);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}
.signup-exclusive-card h3 {
  position: relative;
  margin: 0;
  max-width: 17ch;
  font: 600 clamp(1.35rem, 3vw, 1.75rem)/1.12 var(--font-display);
}
.signup-exclusive-subtitle {
  position: relative;
  margin: 0;
  color: #d9e0ea;
  font: italic 1rem/1.5 var(--font-display);
}
.signup-exclusive-copy {
  position: relative;
  margin: 0;
  color: var(--text-dim);
  font-size: .9rem;
  line-height: 1.5;
}
.signup-exclusive-cta,
.inventions-exclusive-primary {
  position: relative;
  align-self: flex-start;
  min-height: 44px;
  padding: .78rem 1rem;
  color: #111827;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  font-weight: 900;
  letter-spacing: .035em;
  cursor: pointer;
}
.signup-exclusive-cta:focus-visible,
.inventions-exclusive-primary:focus-visible,
.inventions-exclusive-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.inventions-exclusive-modal {
  position: fixed;
  z-index: 4050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.inventions-exclusive-modal[hidden] { display: none; }
.inventions-exclusive-backdrop { position: absolute; inset: 0; background: rgba(2,6,18,.82); backdrop-filter: blur(6px); }
.inventions-exclusive-panel {
  position: relative;
  width: min(100%, 560px);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 2.5rem clamp(1.25rem, 5vw, 2.5rem) 1.7rem;
  text-align: center;
  color: var(--text);
  border: 1px solid rgba(230,181,102,.62);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(230,181,102,.13), transparent 45%),
    linear-gradient(160deg, #172039, #090f1d);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.inventions-exclusive-panel h2 { margin: .65rem auto 1rem; max-width: 18ch; font: 600 clamp(1.75rem, 7vw, 2.6rem)/1.08 var(--font-display); }
.inventions-exclusive-panel p { margin: .75rem auto; max-width: 48ch; color: #d9e0ea; line-height: 1.65; }
.inventions-exclusive-panel .inventions-exclusive-kicker { color: var(--gold-soft); font-size: .75rem; font-weight: 900; letter-spacing: .12em; }
.inventions-exclusive-primary { align-self: auto; width: 100%; margin-top: 1rem; }
.inventions-exclusive-close { position: absolute; top: .4rem; right: .4rem; width: 44px; height: 44px; color: var(--text); border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; }
body.inventions-exclusive-open { overflow: hidden; }
.ds-resource-link {
  display: block;
  margin: .75rem 0 0;
  padding: .58rem .68rem;
  color: #111827;
  border-radius: 8px;
  background: var(--gold);
  font-weight: 800;
  font-size: .75rem;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.story-evidence-label {
  background: rgba(12, 22, 38, .94);
  border: 1px solid rgba(240, 201, 106, .72);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .35);
  color: #fff4cf;
  font: 700 11px/1.2 system-ui, sans-serif;
  white-space: nowrap;
}
.story-evidence-label::before { border-top-color: rgba(240, 201, 106, .72); }

/* Present-day geography labels used by the Çatalhöyük opening orientation.
   These are Leaflet labels, not ancient polity boundaries. */
.story-orientation-label-wrap {
  width: 10px !important;
  height: 10px !important;
  background: transparent;
  border: 0;
  pointer-events: none;
}
.story-orientation-label-wrap span {
  display: block;
  width: max-content;
  max-width: min(42vw, 300px);
  padding: .42rem .62rem;
  transform: translate(-50%, -50%);
  color: #fff5d8;
  background: rgba(10, 19, 34, .94);
  border: 1px solid rgba(240, 201, 106, .82);
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .46);
  font: 800 .78rem/1.15 var(--font-body, system-ui, sans-serif);
  letter-spacing: .01em;
  text-align: center;
  white-space: nowrap;
}
.story-orientation-label-wrap.wide span { font-size: .9rem; }
.story-orientation-label-wrap.site span {
  color: #fff7e8;
  border-color: rgba(255, 221, 137, .98);
  background: rgba(40, 24, 13, .96);
}

/* Four-second, muted evidence cutaways share the narration without taking over
   the guided-story controls. */
.story-cutaway {
  position: fixed;
  z-index: 5200;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  width: min(280px, 34vw);
  padding: .55rem;
  box-sizing: border-box;
  color: #fbf3e4;
  background: linear-gradient(160deg, rgba(14, 10, 7, .97), rgba(10, 14, 26, .97));
  border: 1px solid rgba(230, 181, 102, .7);
  border-radius: 12px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, .62);
  animation: storyCutawayIn .24s ease-out;
}
.story-cutaway-title {
  margin: 0 0 .35rem;
  font: 700 .76rem/1.2 var(--font-display, Georgia, serif);
  color: #f7d99b;
}
.story-cutaway-media {
  display: block;
  width: 100%;
  max-height: 48vh;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 7px;
  background: #080b14;
}
.story-cutaway-note,
.story-cutaway-credit {
  display: block;
  margin-top: .3rem;
  color: #d7c7a7;
  font: 500 .62rem/1.25 var(--font-body, system-ui, sans-serif);
}
.story-cutaway-credit a {
  color: #f1cd8e;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.story-cutaway-controls {
  display: flex;
  gap: .4rem;
  margin-top: .45rem;
}
.story-cutaway-controls button {
  flex: 1;
  min-height: 32px;
  border: 1px solid rgba(230, 181, 102, .48);
  border-radius: 7px;
  background: rgba(230, 181, 102, .13);
  color: #f7e7c4;
  cursor: pointer;
  font: 700 .68rem/1 var(--font-body, system-ui, sans-serif);
}
.story-cutaway-controls button:hover { background: rgba(230, 181, 102, .26); }
@keyframes storyCutawayIn {
  from { opacity: 0; transform: translateY(-5px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ds-process-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin: .75rem 0 0;
  padding: .75rem;
  color: #fff4cf;
  border: 1px solid rgba(240, 201, 106, .35);
  border-radius: 8px;
  background: rgba(12, 22, 38, .82);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-align: center;
}
.ds-process-steps b { color: var(--gold); font-size: 1rem; }
.ds-process-steps span {
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
  border-radius: 999px;
  padding: .28rem .48rem;
}
.ds-process-steps span.active {
  color: #111827;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 201, 106, .18);
}
.ds-story-action { width: 100%; border: 0; cursor: pointer; font: inherit; }
.more-journeys { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.more-journeys > p { margin: 0 0 .8rem; color: var(--text-dim); font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.journey-reward-modal { position: fixed; z-index: 4000; inset: 0; display: grid; place-items: center; padding: 1rem; }
.journey-reward-modal[hidden] { display: none; }
.journey-reward-backdrop { position: absolute; inset: 0; background: rgba(2,6,18,.75); }
.journey-reward-card {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  box-sizing: border-box;
  padding: 2.2rem 1.25rem 1.4rem;
  color: var(--text);
  background: linear-gradient(145deg, #172039, #0b1020);
  border: 1px solid rgba(230,181,102,.55);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(0,0,0,.5);
}
.journey-reward-card h2 { margin: 0; font: 600 clamp(1.45rem, 7vw, 2rem)/1.15 var(--font-display); }
.journey-reward-card > p:not(.journey-kicker) { color: var(--text-dim); line-height: 1.55; }
.journey-reward-close { position: absolute; top: .5rem; right: .5rem; width: 44px; height: 44px; color: var(--text); background: transparent; border: 0; font-size: 1.7rem; cursor: pointer; }

@media (max-width: 640px) {
  .journey-launch { padding: 0 1rem; }
  .journey-launch-inner { align-items: flex-start; flex-direction: column; gap: 1rem; padding: 1.35rem 0; }
  .journey-start { width: 100%; }
  .showcase-grid { grid-template-columns: minmax(0, 1fr); }
  .journey-card { min-height: 232px; }
  .signup-exclusive-card { min-height: 0; }
  .signup-exclusive-cta { width: 100%; }
  .playback-controls { flex-wrap: wrap; }
  .playback-controls button,
  .playback-controls select { min-width: 0; min-height: 44px; }
  .playback-controls button { flex: 1 1 84px; }
  .playback-controls #speedSelect { flex: 1 1 170px; }
  .playback-controls #playRate { flex: 1 1 118px; }
}
@media (max-width: 360px) {
  .journey-launch h2 { font-size: 1.38rem; }
  .journey-utility { grid-template-columns: 1fr; gap: .25rem; }
  .journey-progress-count { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .journey-card-image, .journey-progress-track i, .hidden-journey-slot { transition: none; animation: none; }
  .journey-card:hover .journey-card-image { transform: none; }
}

/* Egypt uses the shared documentary controls, with a distinct lapis-and-gold
   treatment so the journey feels bespoke without forking the player lifecycle. */
body.story-theme-egypt #aiStoryPanel {
  background: linear-gradient(180deg, rgba(7, 27, 42, 0.91), rgba(16, 30, 39, 0.94));
  border-color: rgba(218, 174, 66, 0.62);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.56), 0 0 0 1px rgba(43, 119, 160, 0.2);
}
body.story-theme-egypt #aiStoryPanel .rc-head {
  background: linear-gradient(90deg, rgba(22, 83, 116, 0.55), rgba(0, 0, 0, 0.24));
}
body.story-theme-egypt #aiStoryPanel .rc-head-title,
body.story-theme-egypt #aiStoryPanel .rc-date,
body.story-theme-egypt #aiStoryPanel .rc-icon {
  color: #e6c166;
}

/* Egypt chapter cities belong to the empire overlay and are rebuilt on every
   phase change. The label stays compact so it does not overpower territory. */
.egypt-city-marker-wrap {
  background: transparent;
  border: 0;
  overflow: visible;
}
.egypt-city-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  left: -4px;
  top: -4px;
  border-radius: 50%;
  background: #f0c75e;
  border: 2px solid #09253a;
  box-shadow: 0 0 0 2px rgba(240, 199, 94, 0.42), 0 2px 5px rgba(0, 0, 0, 0.55);
}
.egypt-city-label-anchor {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(var(--egypt-label-x, 9px), var(--egypt-label-y, -12px));
}
.egypt-city-label {
  display: block;
  white-space: nowrap;
  padding: 3px 6px 4px;
  border: 1px solid rgba(240, 199, 94, 0.58);
  border-radius: 5px;
  background: rgba(5, 24, 37, 0.88);
  color: #fff6d8;
  font: 700 11px/1.1 Inter, system-ui, sans-serif;
  text-shadow: 0 1px 2px #000;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
}
.egypt-city-label small {
  display: block;
  margin-top: 2px;
  color: #e4bd58;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
@media (max-width: 640px) {
  .egypt-city-label-anchor {
    transform: translate(var(--egypt-mobile-label-x, var(--egypt-label-x, 9px)), var(--egypt-mobile-label-y, var(--egypt-label-y, -12px)));
  }
  .egypt-city-label {
    max-width: min(230px, 62vw);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }
  .egypt-city-label small {
    display: none;
  }
}

/* --- Compact documentary overlay: small, semi-transparent, draggable -------- */
.rome-cine {
  position: fixed;
  left: 18px;
  bottom: 18px;
  right: auto;
  top: auto;
  width: min(250px, calc(100vw - 24px));
  z-index: 4000;
  background: linear-gradient(180deg, rgba(14, 10, 7, 0.55), rgba(20, 13, 8, 0.62));
  border: 1px solid rgba(230, 181, 102, 0.38);
  border-radius: 12px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  color: #f4ecdd;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  animation: romeCineRise 0.4s cubic-bezier(0.2, 0.8, 0.25, 1);
  transition: opacity 0.45s ease, width 0.3s ease, transform 0.45s ease;
}

/* Slide the narration panel down and out while a cinematic set piece (march /
   Alps dive / film) plays, so it never covers the action; restored on finish. */
.rome-cine.cine-away {
  opacity: 0;
  transform: translateY(34px) scale(0.96);
  pointer-events: none;
}
/* When the documentary wants the box out of the way — during narration, or after
   a few idle seconds in manual viewing — we SHRINK it down to just its header
   instead of making it see-through. It reopens (full size) between scenes; any
   hover/touch peeks it back open (see armRomeCineFade in script.js). */
.rome-cine.faded .rc-body { display: none; }
.rome-cine.faded { width: min(200px, calc(100vw - 24px)); }
.rome-cine.faded .rc-head { border-bottom: none; }
.rome-cine.faded:hover .rc-body { display: block; }
.rome-cine.faded:hover { width: min(250px, calc(100vw - 24px)); }
.rome-cine.faded:hover .rc-head { border-bottom: 1px solid rgba(230, 181, 102, 0.16); }
@keyframes romeCineRise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.55rem 0.5rem 0.85rem;
  cursor: grab;
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid rgba(230, 181, 102, 0.16);
  touch-action: none;
  user-select: none;
}
.rc-head:active { cursor: grabbing; }
.rc-head-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.74rem;
  font-weight: 700;
  color: #e6b566;
  letter-spacing: 0.02em;
}
.rc-head-btns { display: flex; gap: 4px; }
.rc-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(230, 181, 102, 0.28);
  background: rgba(0, 0, 0, 0.3);
  color: #e6b566;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.rc-icon:hover { background: rgba(230, 181, 102, 0.18); }
.rc-icon.rc-edit {
  width: auto;
  height: 26px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.rome-cine.min .rc-body { display: none; }
.rome-cine.min { width: min(200px, calc(100vw - 24px)); }
.rome-cine.min .rc-head { border-bottom: none; }

.rc-body { padding: 0.55rem 0.62rem 0.6rem; max-height: calc(100vh - 120px); overflow-y: auto; }
.rc-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.rc-date {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: #e6b566;
  background: rgba(230, 181, 102, 0.12);
  border: 1px solid rgba(230, 181, 102, 0.3);
  border-radius: 999px;
  padding: 0.06rem 0.5rem;
}
.rc-chapter { font-size: 0.62rem; letter-spacing: 0.1em; color: #b9a888; }
.rc-titlerow { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.22rem; }
.rc-bigicon { font-size: 1.05rem; line-height: 1; flex: 0 0 auto; }
.rc-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 0.92rem;
  line-height: 1.15;
  margin: 0;
  color: #fbf3e4;
}
.rc-text {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #e3d8c5;
  max-height: 19vh;
  overflow-y: auto;
}
.rc-more {
  background: none;
  border: none;
  color: #e6b566;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  margin-bottom: 0.55rem;
}
.rc-more:hover { text-decoration: underline; }
.ds-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.42rem;
  margin: 0.15rem 0 0.6rem;
}
.ds-gallery figure { margin: 0; min-width: 0; }
.ds-gallery img {
  display: block;
  width: 100%;
  height: 108px;
  object-fit: cover;
  border: 1px solid rgba(230, 193, 102, 0.48);
  border-radius: 7px;
  cursor: zoom-in;
}
.ds-gallery figcaption {
  margin-top: 0.2rem;
  color: #d7c7a7;
  font-size: 0.6rem;
  line-height: 1.25;
}
/* ---- Shared story-player progress dots (Yamnaya / Hittite / AI stories) ---- */
.rc-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 0.6rem; }
.rc-seg {
  flex: 1 1 0;
  min-width: 5px;
  height: 4px;
  border-radius: 2px;
  background: rgba(230, 181, 102, 0.18);
  cursor: pointer;
  transition: background 0.2s;
}
.rc-seg:hover { background: rgba(230, 181, 102, 0.45); }
.rc-seg.on { background: #e6b566; }

/* ---- Documentary timeline bar: milestone ticks, current auto-highlighted ---- */
.rc-timeline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  margin-bottom: 0.6rem;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(230, 181, 102, 0.18);
}
.rc-timeline::-webkit-scrollbar { display: none; }
.rc-tick {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.rc-tick-bar {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: rgba(230, 181, 102, 0.22);
  transition: background 0.2s, height 0.2s, box-shadow 0.2s;
}
.rc-tick.major .rc-tick-bar { height: 12px; width: 5px; background: rgba(230, 181, 102, 0.4); }
.rc-tick.past .rc-tick-bar { background: rgba(230, 181, 102, 0.55); }
.rc-tick:hover .rc-tick-bar { background: rgba(230, 181, 102, 0.7); }
.rc-tick.on .rc-tick-bar {
  height: 16px;
  width: 5px;
  background: #e6b566;
  box-shadow: 0 0 7px rgba(230, 181, 102, 0.85);
}
.rc-tick-year {
  font-size: 0.5rem;
  line-height: 1;
  color: #b9a888;
  white-space: nowrap;
}
.rc-tick.on .rc-tick-year { color: #fbf3e4; font-weight: 700; }
.rc-actions { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.rc-actions2 { display: flex; gap: 0.4rem; }
.rc-btn {
  border-radius: 8px;
  border: 1px solid rgba(230, 181, 102, 0.45);
  background: rgba(255, 255, 255, 0.05);
  color: #e6b566;
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.36rem 0.45rem;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s, opacity 0.15s;
}
.rc-btn:hover { background: rgba(230, 181, 102, 0.16); }
.rc-btn.primary {
  flex: 1;
  background: linear-gradient(180deg, #e6b566, #c9933f);
  color: #2a1a08;
  font-weight: 700;
}
.rc-btn.primary:hover { filter: brightness(1.08); background: linear-gradient(180deg, #e6b566, #c9933f); }
.rc-btn.ghost { flex: 0 0 auto; }
.rc-btn.small { flex: 1; font-size: 0.78rem; padding: 0.42rem 0.4rem; }
.rc-btn.small.on { background: rgba(230, 181, 102, 0.22); color: #fbf3e4; }
.rc-btn:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 640px) {
  .rome-cine { left: 8px; right: 8px; bottom: 8px; width: min(250px, calc(100vw - 16px)); }
  .rc-title { font-size: 0.92rem; }
  .rc-text { font-size: 0.76rem; max-height: 19vh; }
}

/* ---- Rome territory prominence: stronger border + warm glow ---- */
.rome-direct-path {
  filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.6))
          drop-shadow(0 0 2px rgba(139, 0, 0, 0.85));
}
/* Brief gold "acquisition" pulse when a new chapter settles (pulseRomeTerritory). */
.rome-direct-path.rome-acquire { animation: romeAcquire 1.3s ease-out; }
@keyframes romeAcquire {
  0%   { filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.4)); }
  35%  { filter: drop-shadow(0 0 16px rgba(240, 205, 90, 0.95)) drop-shadow(0 0 6px rgba(240, 205, 90, 0.8)); }
  100% { filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.6)) drop-shadow(0 0 2px rgba(139, 0, 0, 0.85)); }
}

/* ---- Rome map labels: semi-transparent + shorter (truncate, never sprawl) ---- */
.rome-event-text, .rome-client-text, .rome-breakaway-text, .rome-arrow-text {
  opacity: 0.8;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.35s ease;
}

/* ---- Map event emoji icon (dropped at conquest/invasion targets) ---- */
.rome-evt-emoji {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
  animation: romeEvtPop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.4);
  pointer-events: none;
}
@keyframes romeEvtPop {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- AI explainer panel + audio settings ---- */
.rc-ai {
  display: none;
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(230, 181, 102, 0.10);
  border: 1px solid rgba(230, 181, 102, 0.3);
  max-height: 26vh;
  overflow-y: auto;
}
.rc-ai-title { font-size: 0.72rem; font-weight: 700; color: #e6b566; margin-bottom: 0.25rem; }
.rc-ai-body { font-size: 0.78rem; line-height: 1.45; color: #f0e6d4; }
.rc-ai-load { font-style: italic; opacity: 0.8; }
.rc-actions3 { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.rc-actions3 .rc-btn.tiny { flex: 1; }
.rc-btn.tiny { flex: 0 0 auto; font-size: 0.68rem; padding: 0.3rem 0.42rem; }
.rc-btn.tiny.on { background: rgba(230, 181, 102, 0.22); color: #fbf3e4; }

/* AI history-teacher box shown when the documentary pauses on a major event */
.ds-ai {
  margin-top: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 9px;
  background: rgba(230, 181, 102, 0.10);
  border: 1px solid rgba(230, 181, 102, 0.32);
}
.ds-ai-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: #e6b566;
  margin-bottom: 0.45rem;
  letter-spacing: 0.01em;
}
.ds-ai-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ds-ai-chip {
  flex: 1 1 auto;
  text-align: left;
  font-size: 0.74rem;
  line-height: 1.25;
  color: #f0e6d4;
  background: rgba(230, 181, 102, 0.10);
  border: 1px solid rgba(230, 181, 102, 0.3);
  border-radius: 7px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ds-ai-chip:hover { background: rgba(230, 181, 102, 0.2); border-color: rgba(230, 181, 102, 0.55); }
.ds-ai-answer { margin-top: 0.5rem; }
.ds-ai-answer:empty { margin-top: 0; }
.ds-ai-q { font-size: 0.74rem; font-weight: 700; color: #e6b566; margin-bottom: 0.2rem; }
.ds-ai-a { font-size: 0.8rem; line-height: 1.5; color: #f0e6d4; white-space: pre-wrap; }
.ds-ai-load { font-style: italic; opacity: 0.8; }

/* ---- Cinematic scene image panel ---- */
.rc-scene {
  margin: 0 0 0.5rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(230, 181, 102, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.rc-scene-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  animation: rcSceneKen 12s ease-out both;
}
@keyframes rcSceneKen {
  0%   { transform: scale(1.0); }
  100% { transform: scale(1.08); }
}
.rc-scene-cap {
  font-size: 0.7rem;
  font-weight: 600;
  color: #f0e6d4;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.28rem 0.5rem;
  letter-spacing: 0.02em;
}

/* ---- Sound & Narration drawer ---- */
.rc-sound-toggle {
  width: 100%;
  margin-top: 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(230, 181, 102, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: #e6b566;
  font-weight: 700;
  font-size: 0.74rem;
  padding: 0.42rem;
  cursor: pointer;
}
.rc-sound-toggle:hover { background: rgba(230, 181, 102, 0.16); }
.rc-sound-toggle.on { background: rgba(230, 181, 102, 0.22); color: #fbf3e4; }
.rc-settings {
  margin-top: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(230, 181, 102, 0.22);
}
.rc-set-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b9a888;
  margin: 0.15rem 0 0.4rem;
}
.rc-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.rc-set-label { font-size: 0.76rem; color: #f0e6d4; font-weight: 600; }
.rc-set-val {
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 700;
  color: #e6b566;
  font-variant-numeric: tabular-nums;
}
.rc-switch {
  flex: 0 0 auto;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(230, 181, 102, 0.4);
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s;
}
.rc-switch .rc-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbb890;
  transition: transform 0.18s, background 0.18s;
}
.rc-switch.on { background: linear-gradient(180deg, #e6b566, #c9933f); }
.rc-switch.on .rc-knob { transform: translateX(18px); background: #2a1a08; }
.rc-set-slider { width: 100%; accent-color: #e6b566; }
.rc-set-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 70%;
  padding: 0.25rem 0.4rem;
  font-size: 0.74rem;
  color: #f0e6d4;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(230, 181, 102, 0.4);
  border-radius: 6px;
  cursor: pointer;
}
.rc-set-select option { background: #2a1a08; color: #f0e6d4; }
.rc-speed {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.55rem;
}
.rc-speed-btn {
  flex: 1 1 0;
  padding: 0.34rem 0.2rem;
  border-radius: 8px;
  border: 1px solid rgba(230, 181, 102, 0.32);
  background: rgba(255, 255, 255, 0.06);
  color: #e7ddca;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.rc-speed-btn:hover { background: rgba(230, 181, 102, 0.16); }
.rc-speed-btn.on {
  background: linear-gradient(180deg, #e6b566, #c9933f);
  border-color: #e6b566;
  color: #2a1a08;
}
#rcTestSound { width: 100%; margin: 0.2rem 0 0.5rem; }
.rc-sfx-examples { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.rc-sfx-chip {
  flex: 1 1 auto;
  border-radius: 999px;
  border: 1px solid rgba(230, 181, 102, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: #e6b566;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.rc-sfx-chip:hover { background: rgba(230, 181, 102, 0.18); color: #fbf3e4; }
/* While borders are morphing, fade map labels so the eye follows the movement.
   Restored automatically when the scene settles/pauses (class removed). */
body.rome-animating .rome-event-text,
body.rome-animating .rome-client-text,
body.rome-animating .rome-breakaway-text,
body.rome-animating .rome-arrow-text {
  opacity: 0.16 !important;
}

/* ---- Animated event layer: destination flash ---- */
.event-flash-wrap { background: transparent; border: none; }
.event-flash {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
  animation: eventFlashPulse 1.1s ease-out infinite;
}
@keyframes eventFlashPulse {
  0%   { transform: scale(0.4); opacity: 0.9; }
  70%  { opacity: 0.25; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ===================================================================
   Public launch: footer, donate, early-preview, email signup, docs
   =================================================================== */

/* Donate CTA in the top navigation */
.site-nav .nav-cta {
  color: #1a1304;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(230, 181, 102, 0.22);
}
.site-nav .nav-cta:hover,
.site-nav .nav-cta.active {
  color: #1a1304;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  filter: brightness(1.07);
}

/* Donate button variant (hero / sections) */
.btn-donate {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1304;
  font-weight: 700;
}
.btn-donate:hover { box-shadow: 0 12px 32px rgba(230, 181, 102, 0.42); filter: brightness(1.04); }

/* Early-preview badge + note on the hero */
.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(230, 181, 102, 0.5);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: rgba(230, 181, 102, 0.08);
  margin-bottom: 1rem;
}
.preview-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}
.hero-core {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--gold-soft);
}
.preview-note {
  margin: 1.1rem auto 0;
  max-width: 640px;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-dim);
}

/* Shared content section wrapper for support + signup */
.section-band {
  padding: 3.5rem 1.25rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
}
.section-band.alt { background: linear-gradient(180deg, var(--bg-2), var(--bg)); }
.section-inner {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 0.4rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  margin: 0 0 0.7rem;
  color: var(--text);
}
.section-text {
  color: var(--text-dim);
  line-height: 1.65;
  margin: 0 auto 1.6rem;
  max-width: 620px;
}

/* Email signup form */
.signup-form {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
}
.signup-form input[type="email"],
.signup-form input[name="firstName"] {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.signup-form input[type="email"]:focus,
.signup-form input[name="firstName"]:focus {
  outline: none;
  border-color: var(--gold);
}
.signup-note {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}
.signup-ok {
  margin-top: 1rem;
  color: var(--gold-soft);
  font-weight: 600;
}

/* ---- "Join the Project" recruitment form ---- */
.join-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.join-form {
  max-width: 560px;
  margin: 2rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.join-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.join-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.join-field .req { color: var(--gold-soft); }
.join-field input,
.join-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}
.join-field textarea { resize: vertical; min-height: 90px; }
.join-field input:focus,
.join-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.join-form .btn-primary {
  align-self: flex-start;
  margin-top: 0.3rem;
}
.join-error {
  color: #ff9a9a;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0;
}
.join-thanks {
  max-width: 560px;
  margin: 2rem 0 0;
  padding: 1.6rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.join-thanks h2 {
  font-family: var(--font-display);
  color: var(--gold-soft);
  margin: 0 0 0.4rem;
}
.join-thanks p { color: var(--text-dim); margin: 0; }
.join-field .opt { color: var(--text-dim); font-weight: 400; font-size: 0.85em; }
.join-qr {
  max-width: 560px;
  margin: 2.5rem 0 0;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}
.join-qr h2 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.25rem;
  margin: 0 0 0.3rem;
}
.join-qr-caption {
  color: var(--gold-soft);
  font-weight: 600;
  margin: 0 0 1.1rem;
}
.join-qr-img {
  width: 220px;
  height: 220px;
  max-width: 80%;
  height: auto;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.join-qr-links {
  margin: 1.1rem 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.join-qr-links a {
  color: var(--gold-soft);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin: 0 0.15rem;
}
.join-qr-links a:hover { color: var(--gold); }
@media (max-width: 560px) {
  .join-form .btn-primary { align-self: stretch; text-align: center; }
}

/* ---- Site footer (shared, dark theme pages) ---- */
.site-footer {
  background: #05080f;
  border-top: 1px solid var(--border);
  padding: 2.25rem 1.5rem 2rem;
  color: var(--text-dim);
}
.site-footer-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.footer-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.footer-tag {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--gold-soft);
  font-size: 0.95rem;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 0.4rem 1.1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }
.footer-links a.footer-donate {
  color: #1a1304;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  font-weight: 700;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
}
.footer-links a.footer-donate:hover { filter: brightness(1.07); color: #1a1304; }
.footer-legal {
  font-size: 0.8rem;
  color: #6b7a96;
  line-height: 1.6;
}
.footer-legal .footer-admin {
  color: #9fb0cc;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 0.6rem;
}
.footer-legal .footer-admin:hover { color: #fff; }

/* ---- Long-form document pages (About / Terms / Privacy / Donate) ---- */
.doc-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.doc-page h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  color: var(--text);
  margin: 0 0 0.4rem;
}
.doc-page .doc-lead {
  color: var(--gold-soft);
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 2rem;
}
.doc-page h2 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.3rem;
  margin: 2rem 0 0.6rem;
}
.doc-page p,
.doc-page li {
  color: var(--text-dim);
  line-height: 1.7;
}
.doc-page ul { padding-left: 1.2rem; }
.doc-page a { color: var(--gold-soft); }
.doc-page .doc-updated {
  margin-top: 2.5rem;
  font-size: 0.82rem;
  color: #6b7a96;
}
.doc-page .preview-badge { margin-bottom: 1.5rem; }

/* Donation provider buttons (placeholder, ready for future links) */
.donate-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin: 1.8rem 0 0.6rem;
}
.donate-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: not-allowed;
  opacity: 0.85;
}
.donate-opt.donate-live {
  cursor: pointer;
  opacity: 1;
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(230, 181, 102, 0.22), rgba(230, 181, 102, 0.12));
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.donate-opt.donate-live:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(230, 181, 102, 0.28);
  background: linear-gradient(180deg, rgba(230, 181, 102, 0.32), rgba(230, 181, 102, 0.18));
}
.donate-opt .soon {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1a1304;
  background: var(--gold);
  padding: 0.12rem 0.36rem;
  border-radius: 5px;
}

/* ---- "Fly into history": cinematic dive from the 2D map into the film -------
   As the army reaches the Alps we tilt + scale + blur the existing Leaflet map
   toward the mountains and wash the screen with an alpine haze, then dissolve
   into the film. On the way back the transform reverses, so it feels like flying
   off the map into the event and back out. Pure CSS over the real 2D map — no 3D
   engine or terrain data. Leaflet only ever transforms its inner panes, never
   the #map container, so this transition is safe and reverses cleanly. */
#map {
  transition: transform 1.15s cubic-bezier(0.55, 0.06, 0.2, 1), filter 1.15s ease;
  transform-origin: 50% 54%;
}
#map.map-diving {
  transform: perspective(1300px) rotateX(40deg) scale(1.7) translateY(-6%);
  filter: blur(3px) brightness(0.82) contrast(1.06) saturate(1.05);
}
.alps-dive-haze {
  position: fixed;
  inset: 0;
  z-index: 99980;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
  background:
    radial-gradient(120% 85% at 50% 125%, rgba(40, 54, 78, 0) 28%, rgba(26, 38, 58, 0.55) 74%, rgba(14, 22, 36, 0.88) 100%),
    linear-gradient(to bottom, rgba(176, 202, 228, 0.6) 0%, rgba(216, 230, 244, 0.3) 30%, rgba(255, 255, 255, 0) 56%);
}
.alps-dive-haze.on { opacity: 1; }

/* ---- Reusable cinematic event overlay (date/title -> film -> aftermath) ---- */
/* Dim/blur backdrop kept up for the whole sequence so the map stays present
   (just out of focus) instead of being replaced by a hard black box. */
.rome-cine-dim {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: radial-gradient(ellipse at center, rgba(8, 6, 3, 0.5), rgba(0, 0, 0, 0.82));
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.rome-cine-dim.on { opacity: 1; pointer-events: auto; }

/* While a cinematic plays, fade out the distracting map UI — labels, markers,
   controls and the narration box — leaving only the film + title + skip. */
body.rome-cine-immersive .leaflet-control-container,
body.rome-cine-immersive .leaflet-marker-pane,
body.rome-cine-immersive .leaflet-tooltip-pane,
body.rome-cine-immersive #romeCinematicPanel,
body.rome-cine-immersive #aiStoryPanel,
body.rome-cine-immersive .side-panel {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.45s ease;
}

/* Film frame */
.rome-cine-frame {
  position: fixed;
  inset: 0 auto 0 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.rome-cine-frame.on { opacity: 1; }
.rome-cine-frame.leaving { opacity: 0; }
.rcf-video-wrap {
  position: relative;
  width: min(96vw, calc(88vh * 16 / 9), 1600px);
  width: min(96vw, calc(88dvh * 16 / 9), 1600px);
  height: min(88vh, calc(96vw * 9 / 16));
  height: min(88dvh, calc(96vw * 9 / 16));
  aspect-ratio: 16 / 9;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rcf-video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(232, 214, 168, 0.16);
}
/* Date/title card — sits in the upper third so it clears the main action */
.rcf-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 12%;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  text-shadow: 0 3px 22px rgba(0, 0, 0, 0.95);
}
.rcf-title.show { opacity: 1; transform: translateY(0); }

/* Pre-film map intro: a big date/title card over the live (undimmed) map while
   the invasion arrow sweeps in. A soft top vignette keeps the text readable. */
.rome-cine-intro {
  position: fixed;
  inset: 0;
  z-index: 99995;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 42%);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.rome-cine-intro.show { opacity: 1; }
.rome-cine-intro .rci-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 11%;
  text-align: center;
  transform: translateY(12px);
  transition: transform 0.7s ease;
  text-shadow: 0 3px 22px rgba(0, 0, 0, 0.95);
}
.rome-cine-intro.show .rci-title { transform: translateY(0); }
.rcf-date {
  font: 700 clamp(1.1rem, 4.5vw, 2rem)/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.32em;
  color: var(--gold, #e8d6a8);
  margin-bottom: 0.55rem;
}
.rcf-name {
  font: 700 clamp(1.6rem, 7vw, 4rem)/1.05 'Fraunces', Georgia, serif;
  letter-spacing: 0.06em;
  color: #fff;
}
.rcf-skip {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  left: 1rem;
  z-index: 3;
  background: rgba(20, 15, 6, 0.7);
  color: var(--gold, #e8d6a8);
  border: 1px solid rgba(232, 214, 168, 0.5);
  border-radius: 999px;
  padding: 0.5rem 1.05rem;
  font: 600 0.9rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.rcf-skip:hover { background: rgba(40, 30, 12, 0.92); transform: translateY(-1px); }

/* Aftermath card */
.rome-cine-card {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.rome-cine-card.on { opacity: 1; }
.rome-cine-card.leaving { opacity: 0; }
.rcc-inner {
  max-width: 560px;
  width: 100%;
  text-align: center;
  background: linear-gradient(180deg, rgba(28, 20, 9, 0.96), rgba(16, 11, 4, 0.97));
  border: 1px solid rgba(232, 214, 168, 0.28);
  border-radius: 16px;
  padding: 2rem 1.6rem 1.7rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  transform: translateY(14px);
  transition: transform 0.5s ease;
}
.rome-cine-card.on .rcc-inner { transform: translateY(0); }
.rcc-date {
  font: 700 0.95rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.3em;
  color: var(--gold, #e8d6a8);
  margin-bottom: 0.6rem;
}
.rcc-heading {
  font: 700 clamp(1.5rem, 6vw, 2.3rem)/1.1 'Fraunces', Georgia, serif;
  color: #fff;
  margin-bottom: 1.1rem;
}
.rcc-line {
  font: 400 clamp(1rem, 3.6vw, 1.15rem)/1.5 'Inter', system-ui, sans-serif;
  color: #ece3d0;
  margin: 0 0 0.7rem;
}
.rcc-continue {
  margin-top: 1rem;
  background: var(--gold, #e8d6a8);
  color: #1a1206;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.5rem;
  font: 700 0.95rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.rcc-continue:hover { transform: translateY(-1px); filter: brightness(1.07); }

/* Cinematic quote intertitle (e.g. the Pyrrhic-Victory quote) — clean text on
   black, shown after a film fades out, before the aftermath card. */
.rome-cine-quote {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
  background: radial-gradient(ellipse at center, rgba(8, 6, 3, 0.92), rgba(0, 0, 0, 0.98));
  opacity: 0;
  transition: opacity 0.7s ease;
}
.rome-cine-quote.on { opacity: 1; }
.rome-cine-quote.leaving { opacity: 0; }
.rcq-inner {
  max-width: 720px;
  width: 100%;
  text-align: center;
  transform: translateY(16px);
  transition: transform 0.8s ease;
}
.rome-cine-quote.on .rcq-inner { transform: translateY(0); }
.rcq-date {
  font: 700 0.95rem/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.42em;
  color: var(--gold, #e8d6a8);
  margin-bottom: 0.9rem;
}
.rcq-heading {
  font: 700 clamp(1.6rem, 7vw, 2.8rem)/1.05 'Fraunces', Georgia, serif;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 1.5rem;
}
.rcq-quote {
  font: 400 italic clamp(1.25rem, 4.6vw, 2rem)/1.45 'Fraunces', Georgia, serif;
  color: #f3ead4;
  margin: 0 auto 1.1rem;
  max-width: 18em;
}
.rcq-attr {
  font: 600 clamp(0.95rem, 3vw, 1.1rem)/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.08em;
  color: rgba(232, 214, 168, 0.85);
}
.rome-cine-quote .rcc-continue { margin-top: 1.8rem; }

/* Mobile: the film goes edge-to-edge so it fills most of the screen width,
   with the dimmed map (not black bars) filling the rest. */
@media (max-width: 640px) {
  .rome-cine-frame {
    width: 100dvw;
    max-width: 100dvw;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .rcf-video-wrap {
    flex: 0 1 auto;
    width: min(calc(100vw - 24px), calc(80vh * 16 / 9));
    width: min(calc(100dvw - 24px), calc(80dvh * 16 / 9));
    max-width: calc(100dvw - 24px);
    height: auto;
  }
  .rcf-video { border-radius: 12px; box-shadow: 0 14px 50px rgba(0, 0, 0, 0.7); }
  .rcf-title { top: 9%; }
  .rcf-skip { bottom: 0.7rem; left: 0.7rem; padding: 0.45rem 0.85rem; font-size: 0.82rem; }
}

/* ---- Events-showcase invasion set piece (Hannibal) ---- */
/* During the invasion sequence dim the culture labels so they recede behind the
   action, and hide them entirely while the camera is flying so they never block
   the marching army or the route. */
body.story-cinematic .culture-name-text,
body.story-cinematic .rome-client-text {
  opacity: 0.5;
  transition: opacity 0.45s ease;
}
body.story-cinematic.cam-moving .culture-name-text,
body.story-cinematic.cam-moving .rome-client-text {
  opacity: 0 !important;
}

/* Marching army column that rides the invasion arrowhead. */
.hb-army { background: none !important; border: none !important; }
.hb-army-col {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 1px 5px;
  background: rgba(12, 8, 3, 0.55);
  border: 1px solid rgba(232, 214, 168, 0.35);
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
  animation: hb-army-bob 0.5s ease-in-out infinite alternate;
}
@keyframes hb-army-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-1.5px); }
}

/* Fading campaign route labels — dim until the marching column nears them. */
.hb-route-label-wrap { background: none !important; border: none !important; }
.hb-route-label {
  position: absolute;
  left: 5px;
  top: 5px;
  white-space: nowrap;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffe9c2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.7);
  padding: 2px 9px;
  background: rgba(28, 18, 10, 0.55);
  border: 1px solid rgba(232, 214, 168, 0.35);
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, -160%) scale(0.9);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
}
.hb-route-label.near { opacity: 1; transform: translate(-50%, -185%) scale(1); }

/* Film loading spinner — shown while the clip buffers and between auto-retries. */
.rcf-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 3;
}
.rcf-spinner.on { opacity: 1; pointer-events: auto; }
.rcf-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid rgba(232, 214, 168, 0.22);
  border-top-color: #e8d6a8;
  animation: rcf-spin 0.9s linear infinite;
}
@keyframes rcf-spin { to { transform: rotate(360deg); } }
.rcf-load-text {
  color: #e8d6a8;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}
.rcf-retry {
  margin-top: 4px;
  background: rgba(232, 214, 168, 0.14);
  color: #f3ecd8;
  border: 1px solid rgba(232, 214, 168, 0.5);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  cursor: pointer;
}
.rcf-retry:hover { background: rgba(232, 214, 168, 0.26); }

/* Result/aftermath line inside a story result card. */
.rcc-result { font-size: 1.18rem; line-height: 1.5; }

/* ---- Admin: Rome timeline editor ---- */
.rome-fieldset { border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 10px 12px; margin: 12px 0; }
.rome-fieldset legend { padding: 0 6px; font-weight: 600; opacity: 0.85; }
.rome-row { border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 8px; margin-bottom: 8px; background: rgba(255,255,255,0.03); }
.rome-row input[type="text"], .rome-row textarea { width: 100%; margin-bottom: 6px; }
.rome-row textarea.rome-wide { min-height: 48px; }
.rome-coord-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rome-coord-row label { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-size: 0.85rem; }
.rome-coord-row input[type="number"] { width: 92px; }
.sidebar-hint { font-size: 0.8rem; opacity: 0.7; padding: 0 4px 6px; line-height: 1.4; }

/* Public visitor counter (footer) */
.visit-counter {
  margin-top: 6px;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* "What's New": compact pill button under the hero + popup with the details */
.whats-new-bar {
  background: linear-gradient(135deg, #1c2431, #232f42);
  border-top: 1px solid rgba(255, 214, 130, 0.25);
  border-bottom: 1px solid rgba(255, 214, 130, 0.25);
  padding: 10px 20px;
  text-align: center;
}
.whats-new-pill {
  background: rgba(255, 200, 90, 0.15);
  color: #ffd682;
  border: 1px solid rgba(255, 214, 130, 0.45);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
}
.whats-new-pill:hover { background: rgba(255, 200, 90, 0.25); }
.whats-new-pill.unseen {
  animation: whatsNewPulse 2s ease-in-out infinite;
}
@keyframes whatsNewPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 130, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(255, 214, 130, 0); }
}
.whats-new-modal { position: fixed; inset: 0; z-index: 13000; }
.whats-new-modal[hidden] { display: none; }
.whats-new-backdrop { position: absolute; inset: 0; background: rgba(4, 8, 18, 0.72); }
.whats-new-card {
  position: relative;
  max-width: 620px;
  margin: 9vh auto 0;
  max-height: 78vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #1c2431, #232f42);
  border: 1px solid rgba(255, 214, 130, 0.35);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}
body.whats-new-open { overflow: hidden; }
.whats-new-listbtn {
  display: block;
  margin-top: 8px;
  background: rgba(143, 184, 255, 0.12);
  color: #8fb8ff;
  border: 1px solid rgba(143, 184, 255, 0.4);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.whats-new-listbtn:hover { background: rgba(143, 184, 255, 0.22); }
.whats-new-culture-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
}
.whats-new-culture-chip {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.whats-new-culture-chip:hover { border-color: #ffd682; color: #ffd682; }
.whats-new-body { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .whats-new-card { margin: 6vh 12px 0; max-height: 82vh; }
}
.whats-new-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.whats-new-badge {
  background: rgba(255, 200, 90, 0.15);
  color: #ffd682;
  border: 1px solid rgba(255, 214, 130, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.whats-new-week { color: rgba(255, 255, 255, 0.55); font-size: 0.82rem; }
.whats-new-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.whats-new-close:hover { color: #fff; }
.whats-new-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.whats-new-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
  line-height: 1.45;
}
.whats-new-icon { flex: 0 0 auto; }

/* Toolkit chips in the culture detail overlay (stone-tool explorer links) */
.toolkit-section {
  background: rgba(230, 181, 102, 0.07);
  border: 1px solid rgba(230, 181, 102, 0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 1.5rem;
}
.toolkit-title { font-weight: 700; color: var(--gold, #e6b566); margin-bottom: 4px; }
.toolkit-hint { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); margin-bottom: 10px; }
.toolkit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.toolkit-chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.85rem;
  color: #fff;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.toolkit-chip:hover {
  border-color: var(--gold, #e6b566);
  background: rgba(230, 181, 102, 0.15);
}

/* Toolkit chips under the enlarged Tools picture */
#modalToolkit { position: relative; z-index: 3001; }
.modal-toolkit {
  margin: 0 auto;
  max-width: 700px;
  width: 90%;
  text-align: center;
  padding-bottom: 24px;
}
.modal-toolkit-hint {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.modal-toolkit .toolkit-chips { justify-content: center; }

/* When the enlarged Tools picture shows toolkit chips, leave room to scroll */
.image-modal.has-toolkit { justify-content: flex-start; padding-top: 30px; }
.image-modal.has-toolkit .modal-content { max-height: 55vh; margin: 10px auto 0; flex-shrink: 0; }
.image-modal.has-toolkit #modalCaption { padding: 10px 0; flex-shrink: 0; }
.image-modal.has-toolkit #modalToolkit { flex-shrink: 0; width: 100%; padding-bottom: 40px; }

/* ---- Language picker (Google Translate) ---- */
.lang-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}
.lang-pick .lang-globe { font-size: 0.95rem; }
.lang-pick select {
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  max-width: 110px;
}
.lang-pick select option { background: #0d1424; color: #e8e6df; }
/* Hide the Google Translate top banner + tooltips it injects */
.goog-te-banner-frame, .skiptranslate iframe { display: none !important; }
body { top: 0 !important; }
#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
font[style] { background: none !important; box-shadow: none !important; }

/* Force black text on the gold nav bars (mobile Chrome auto-darkening washed it out) */
.site-nav .nav-links a.nav-cta,
.site-nav .nav-links a.nav-cta:hover,
.site-nav .nav-links a.nav-cta:visited,
.site-nav .nav-links a.nav-cta.active {
  color: #000 !important;
  -webkit-text-fill-color: #000;
}

/* Bigger, more visible language picker */
.lang-pick {
  padding: 8px 14px;
  gap: 8px;
  border-color: rgba(230, 181, 102, 0.5);
  background: rgba(230, 181, 102, 0.1);
}
.lang-pick .lang-globe { font-size: 1.2rem; }
.lang-pick select {
  font-size: 1rem;
  font-weight: 600;
  max-width: 140px;
}

/* ---- Share toast ---- */
.share-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 26, 40, 0.95);
  color: #f3ecd8;
  border: 1px solid rgba(230, 181, 102, 0.5);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 4000;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Mobile bottom sheet for Guided Experience panels ----
   On phones the story / Rome cinematic panel becomes a compact bottom
   sheet: collapsed shows just title, year, event title and Continue;
   the chevron in the header expands the full controls. Desktop is
   untouched (the .rc-expand button is hidden outside these queries). */
.rc-expand { display: none; }

@media (max-width: 640px), ((pointer: coarse) and (max-height: 480px)) {
  .rome-cine {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    max-height: 80dvh;
  }
  .rome-cine .rc-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .rome-cine.expanded {
    max-height: 74vh;
    max-height: 74dvh;
  }
  .rome-cine.expanded .rc-body {
    max-height: calc(74vh - 54px);
    max-height: calc(74dvh - 54px);
  }
  .rome-cine.expanded .rc-text {
    max-height: 15dvh;
  }
  .rome-cine.expanded .rc-actions2 {
    flex-wrap: wrap;
  }
  .rome-cine.expanded .rc-actions2 .rc-btn.small {
    flex: 1 1 calc(50% - .4rem);
    min-width: 0;
  }
  .rc-expand { display: inline-flex; align-items: center; }
  .rc-expand svg { transition: transform 0.2s; }
  .rome-cine.expanded .rc-expand svg { transform: rotate(180deg); }

  /* Collapsed: essentials only, map stays visible above. */
  .rome-cine:not(.expanded) {
    max-height: 30vh;
    max-height: 30dvh;
  }
  .rome-cine:not(.expanded) .rc-text,
  .rome-cine:not(.expanded) .rc-more,
  .rome-cine:not(.expanded) .ds-gallery,
  .rome-cine:not(.expanded) .rc-ai,
  .rome-cine:not(.expanded) .ds-ai,
  .rome-cine:not(.expanded) .rc-actions3,
  .rome-cine:not(.expanded) .rc-dots,
  .rome-cine:not(.expanded) .rc-timeline,
  .rome-cine:not(.expanded) .rc-actions2,
  .rome-cine:not(.expanded) .rc-scene,
  .rome-cine:not(.expanded) .rc-sound-toggle,
  .rome-cine:not(.expanded) .rc-settings,
  .rome-cine:not(.expanded) .rc-btn.ghost {
    display: none !important;
  }
  .rome-cine:not(.expanded) .rc-actions { margin-top: 6px; }

  /* Easy one-handed tap target. */
  .rome-cine .rc-btn.primary { min-height: 44px; font-size: 0.95rem; }
  /* Minimized (–) keeps just the header bar, as before. */
  .rome-cine.min { max-height: none; }

  /* The player already owns the lower edge of the viewport; the fixed
     feedback tab must not sit over its Continue/actions row. */
  body.story-player-open .feedback-tab,
  body.rome-cine-immersive .feedback-tab {
    display: none;
  }
  .story-evidence-label {
    max-width: min(58vw, 230px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    text-align: center;
  }
  .story-orientation-label-wrap span {
    max-width: min(70vw, 280px);
    padding: .35rem .48rem;
    font-size: .68rem;
    white-space: normal;
  }
  .story-orientation-label-wrap.wide span { font-size: .76rem; }
  .ds-resource-link {
    align-self: start;
    height: auto;
    min-height: 44px;
    margin-top: .45rem;
    padding: .5rem .55rem;
    font-size: .68rem;
    line-height: 1.2;
  }
  .story-cutaway {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: 8px;
    width: min(46vw, 190px);
    padding: .42rem;
  }
  .story-cutaway-media {
    max-height: 34vh;
  }
  .story-cutaway-title { font-size: .68rem; }
  .story-cutaway-note,
  .story-cutaway-credit { font-size: .56rem; }
}

/* Landscape phones: keep the sheet short so the map stays usable. */
@media ((pointer: coarse) and (max-height: 480px)) {
  .rome-cine:not(.expanded) { max-height: 45vh; max-height: 45dvh; }
  .rome-cine.expanded { max-height: 88vh; max-height: 88dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .story-orientation-label-wrap span { transition: none; }
}

/* ---- Admin: Traffic / campaign analytics ---- */
.traffic-gen { display: flex; flex-direction: column; gap: 8px; padding: 10px 4px; }
.traffic-gen-title { margin: 6px 0 2px; font-size: 0.95rem; }
.traffic-gen label { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; }
.traffic-gen select, .traffic-gen input, .traffic-gen textarea {
  padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(128,128,128,0.4);
  background: rgba(0,0,0,0.15); color: inherit; font-size: 0.85rem;
}
.traffic-gen textarea { resize: vertical; word-break: break-all; }
.traffic-table { border-collapse: collapse; margin: 12px 0; width: 100%; font-size: 0.88rem; }
.traffic-table th, .traffic-table td { border: 1px solid rgba(128,128,128,0.35); padding: 6px 9px; text-align: left; }
.traffic-table thead th { background: rgba(128,128,128,0.15); }
.traffic-dim { opacity: 0.65; font-size: 0.85rem; }
.people-stats-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 0; }
.people-stat-card { flex: 1; min-width: 170px; background: rgba(128,128,128,0.1); border: 1px solid rgba(128,128,128,0.25); border-radius: 10px; padding: 18px 20px; }
.people-stat-total { font-size: 2.4rem; font-weight: 700; line-height: 1; }
.people-stat-label { font-size: 0.82rem; opacity: 0.7; margin: 4px 0 10px; }
.people-stat-sub { display: flex; gap: 14px; font-size: 0.82rem; opacity: 0.75; }

/* ---- Announcements ("What's New") editor ---- */
.awn-label { display: block; font-size: 0.85rem; margin-bottom: 14px; }
.awn-week-label { margin-bottom: 18px; }
.awn-label input[type="text"], .awn-label textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; background: rgba(128,128,128,0.12); border: 1px solid rgba(128,128,128,0.35); border-radius: 6px; color: inherit; padding: 6px 9px; font-size: 0.9rem; font-family: inherit; }
.awn-label textarea { resize: vertical; }
.awn-req { color: #e57373; }
.awn-item { border: 1px solid rgba(128,128,128,0.25); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; position: relative; background: rgba(128,128,128,0.06); }
.awn-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.awn-item-num { font-weight: 600; font-size: 0.88rem; opacity: 0.75; }
.awn-remove-btn { background: rgba(200,50,50,0.15); border: 1px solid rgba(200,50,50,0.35); color: #e57373; border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 0.85rem; }
.awn-remove-btn:hover { background: rgba(200,50,50,0.3); }

/* ---- User accounts (Sign In, My History, Continue Your Story) ---- */
.account-btn {
  background: transparent; border: 1px solid rgba(212,175,55,0.55); color: #e8d9a0;
  border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; cursor: pointer;
  font-family: inherit; white-space: nowrap;
}
.account-btn:hover { background: rgba(212,175,55,0.15); }

.acct-modal-backdrop {
  position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center;
  justify-content: center; background: rgba(5,8,16,0.72); padding: 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}
.acct-modal {
  position: relative; width: 100%; max-width: 380px; max-height: 86dvh; overflow-y: auto;
  background: #101726; border: 1px solid rgba(212,175,55,0.35); border-radius: 14px;
  padding: 22px 20px; color: #e9e4d4; box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}
.acct-close {
  position: absolute; top: 10px; right: 10px; background: none; border: none;
  color: inherit; opacity: 0.7; font-size: 1rem; cursor: pointer; padding: 6px;
}
.acct-title { margin: 0 0 8px; padding-right: 34px; font-size: 1.2rem; letter-spacing: .035em; }
.acct-msg { margin: 0 0 12px; font-size: 0.9rem; opacity: 0.85; }
.acct-unlock-pitch {
  display: grid; gap: 5px; margin: 0 0 14px; padding: 12px;
  border: 1px solid rgba(212,175,55,.28); border-radius: 10px;
  background: rgba(212,175,55,.07);
}
.acct-unlock-pitch p { margin: 0; font-size: .9rem; }
.acct-unlock-pitch strong { color: #e8c86c; font-size: .92rem; line-height: 1.35; }
.acct-unlock-pitch span { color: #c7c5be; font-size: .78rem; line-height: 1.45; }
.acct-social { display: grid; gap: 9px; }
.acct-oauth {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 11px;
  width: 100%; min-height: 52px; padding: 11px 42px; border-radius: 9px;
  font-family: inherit; font-size: .84rem; font-weight: 800; letter-spacing: .035em;
  cursor: pointer; transition: filter .15s ease, transform .15s ease;
}
.acct-oauth:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.acct-oauth:focus-visible { outline: 3px solid #e7c45b; outline-offset: 2px; }
.acct-oauth:disabled { opacity: .48; cursor: not-allowed; }
.acct-oauth-google { background: #fff; border: 1px solid #d4d8df; color: #202124; }
.acct-oauth-apple { background: #000; border: 1px solid #777; color: #fff; }
.acct-oauth-icon {
  position: absolute; left: 17px; width: 21px; height: 21px; display: grid; place-items: center;
  font-size: .9rem; line-height: 1;
}
.acct-google-icon { color: #4285f4; font: 800 1.05rem/1 Arial, sans-serif; }
.acct-oauth-note { margin: 0; color: #d9bd72; font-size: .76rem; line-height: 1.4; text-align: center; }
.acct-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 11px;
  color: #aaa99f; font-size: .78rem; white-space: nowrap;
}
.acct-divider::before, .acct-divider::after {
  content: ''; height: 1px; flex: 1; background: rgba(255,255,255,.16);
}
.acct-form { display: flex; flex-direction: column; gap: 10px; }
.acct-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.acct-form input {
  padding: 10px 11px; border-radius: 8px; border: 1px solid rgba(212,175,55,0.3);
  background: rgba(0,0,0,0.3); color: inherit; font-size: 1rem;
}
.acct-error { color: #ff9a8a; font-size: 0.85rem; margin: 0; }
.acct-primary {
  background: #d4af37; color: #14100a; border: none; border-radius: 8px;
  padding: 11px 16px; font-size: 0.95rem; font-weight: 700; cursor: pointer; width: 100%;
  font-family: inherit;
}
.acct-primary:hover { filter: brightness(1.08); }
.acct-primary:disabled { opacity: 0.6; cursor: default; }
.acct-ghost {
  background: transparent; border: 1px solid rgba(255,255,255,0.25); color: inherit;
  border-radius: 8px; padding: 10px 16px; font-size: 0.9rem; cursor: pointer;
  width: 100%; margin-top: 10px; font-family: inherit;
}
.acct-link {
  background: none; border: none; color: #d4af37; cursor: pointer; padding: 0;
  font-size: 0.85rem; text-decoration: underline; font-family: inherit;
}
.acct-switch { margin: 12px 0 0; font-size: 0.85rem; opacity: 0.9; }
.acct-small {
  background: rgba(212,175,55,0.16); border: 1px solid rgba(212,175,55,0.4);
  color: #e8d9a0; border-radius: 6px; padding: 6px 10px; font-size: 0.8rem;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
@media (max-width: 480px) {
  .acct-modal-backdrop { align-items: flex-end; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .acct-modal { max-height: 94dvh; padding: 18px 16px; border-radius: 14px 14px 10px 10px; }
  .acct-oauth { min-height: 54px; font-size: .82rem; }
}

/* My History lists */
.hist-body h4 { margin: 14px 0 6px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.hist-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hist-row-main strong { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row-meta { font-size: 0.78rem; opacity: 0.7; }
.hist-empty { font-size: 0.85rem; opacity: 0.6; padding: 6px 0; }

/* Continue Your Story card */
.continue-story { max-width: 1100px; margin: 18px auto 0; padding: 0 18px; }
.continue-inner {
  border: 1px solid rgba(212,175,55,0.4); border-radius: 12px; padding: 14px 18px;
  background: linear-gradient(120deg, rgba(212,175,55,0.10), rgba(212,175,55,0.03));
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
}
.continue-label { flex-basis: 100%; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: #d4af37; }
.continue-title { font-weight: 700; font-size: 1.05rem; }
.continue-meta { display: flex; gap: 12px; font-size: 0.85rem; opacity: 0.8; flex-wrap: wrap; }
.continue-btn { width: auto; padding: 9px 20px; margin-left: auto; }
@media (max-width: 640px) {
  .continue-btn { width: 100%; margin-left: 0; }
}

/* Bookmark stars */
.bm-btn { font-size: 1rem; line-height: 1; }
.bm-btn.bm-on { color: #d4af37; }
.detail-bm {
  background: transparent; border: 1px solid rgba(212,175,55,0.4); border-radius: 8px;
  cursor: pointer; padding: 3px 9px; margin-left: 10px; vertical-align: middle;
  font-size: 1.05rem; color: inherit; display: inline-flex; align-items: center; gap: 5px;
}
.detail-bm-label {
  font-family: Inter, sans-serif; font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.06em; line-height: 1; text-transform: uppercase;
}

/* ---- First-visit onboarding ---- */
.story-intro-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 12, 20, 0.82);
  backdrop-filter: blur(7px);
}
.story-intro-backdrop[hidden] { display: none; }
.story-intro-panel {
  position: relative;
  box-sizing: border-box;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: clamp(28px, 6vw, 52px);
  border: 1px solid rgba(201, 164, 91, 0.55);
  border-radius: 18px;
  background: #111c26;
  color: #f7f3e8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.story-intro-panel:focus { outline: 2px solid transparent; }
.story-intro-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #f7f3e8;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.story-intro-kicker, .story-intro-period {
  color: #d8b66b;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.story-intro-panel h1 { margin: 10px 0 8px; font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1.05; }
.story-intro-period { margin: 0 0 22px; }
.story-intro-hook { margin: 0 auto 28px; max-width: 44ch; line-height: 1.65; color: #dce2e7; }
.story-intro-start {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: #d8b66b;
  color: #101820;
  font-weight: 900;
  letter-spacing: .08em;
  cursor: pointer;
}
.story-intro-start:focus-visible, .story-intro-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.story-intro-note { margin: 14px 0 0; color: #aeb8c0; font-size: .78rem; }
body.story-intro-open { overflow: hidden; }
@media (max-width: 520px) {
  .story-intro-backdrop { padding: 10px; align-items: end; }
  .story-intro-panel { max-height: calc(100dvh - 20px); padding: 38px 22px 24px; border-radius: 16px; }
}

.onb-backdrop {
  position: fixed; inset: 0; z-index: 9500; display: flex; align-items: center;
  justify-content: center; background: rgba(5,8,16,0.78); padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  animation: onbFade 0.25s ease;
}
.onb-panel {
  width: 100%; max-width: 460px; max-height: 90dvh; overflow-y: auto;
  background: #101726; border: 1px solid rgba(212,175,55,0.4); border-radius: 16px;
  padding: 26px 22px 18px; color: #e9e4d4; text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  animation: onbRise 0.3s ease;
}
@keyframes onbFade { from { opacity: 0; } }
@keyframes onbRise { from { opacity: 0; transform: translateY(14px); } }
.onb-kicker { font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: #d4af37; margin-bottom: 10px; }
.onb-title { margin: 0 0 8px; font-size: 1.25rem; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.04em; }
.onb-sub { margin: 0 0 18px; font-size: 0.9rem; opacity: 0.82; line-height: 1.45; }
.onb-choices { display: flex; flex-direction: column; gap: 10px; }
.onb-choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: rgba(212,175,55,0.07); border: 1px solid rgba(212,175,55,0.32);
  border-radius: 12px; padding: 14px 16px; color: inherit; cursor: pointer;
  font-family: inherit; font-size: 1rem; transition: background 0.15s, border-color 0.15s;
}
.onb-choice:hover { background: rgba(212,175,55,0.16); border-color: rgba(212,175,55,0.6); }
.onb-icon { font-size: 1.45rem; line-height: 1; }
.onb-label { font-weight: 600; }
.onb-skip {
  background: none; border: none; color: #d4af37; cursor: pointer; font-family: inherit;
  font-size: 0.9rem; text-decoration: underline; margin-top: 16px; padding: 8px;
}
.onb-note { font-size: 0.78rem; opacity: 0.6; margin-top: 6px; }
@media (max-width: 480px) {
  .onb-backdrop { align-items: flex-end; padding: 0; }
  .onb-panel { border-radius: 16px 16px 0 0; max-width: none; border-bottom: none; }
  .onb-choice { padding: 13px 14px; }
}

/* Migration Focus Mode: newly revealed cultures fade in gently (~450ms) */
.mf-reveal { animation: mfReveal 0.45s ease both; }
@keyframes mfReveal { from { opacity: 0; } to { opacity: 1; } }

/* ---- Guided-experience completion card ---- */
#storyCompleteOverlay {
  position: fixed; inset: 0; z-index: 12000;
  background: rgba(4, 7, 14, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: ccFade 0.25s ease;
}
@keyframes ccFade { from { opacity: 0; } to { opacity: 1; } }
.cc-card {
  position: relative; width: 100%; max-width: 420px; text-align: center;
  background: linear-gradient(165deg, #131e38 0%, var(--surface, #111a2e) 55%, #0b1226 100%);
  border: 1px solid var(--gold, #e6b566); border-radius: 18px;
  padding: 34px 26px 28px; color: var(--text, #f4f1ea);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  animation: ccPop 0.3s ease;
}
@keyframes ccPop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.cc-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  color: var(--text-dim, #9fb0c9); font-size: 18px; cursor: pointer; padding: 6px;
}
.cc-icon { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.cc-kicker {
  font-size: 11px; letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--gold, #e6b566); margin-bottom: 8px;
}
.cc-title {
  font-family: var(--font-display, 'Fraunces', serif); font-size: 24px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.25;
}
.cc-years { margin-top: 8px; color: var(--gold-soft, #f1cd8e); font-size: 14px; font-weight: 600; }
.cc-blurb { margin-top: 12px; color: var(--text-dim, #9fb0c9); font-size: 14.5px; line-height: 1.55; }
.cc-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.cc-actions .cc-share { width: 100%; font-size: 15px; padding: 12px 16px; }
.cc-card-custom .cc-actions button { min-height: 44px; }
.cc-secondary {
  width: 100%; padding: 11px 16px; font-size: 14.5px; cursor: pointer;
  background: transparent; color: var(--text, #f4f1ea);
  border: 1px solid var(--border, #1e2a44); border-radius: 10px;
}
.cc-secondary:hover { border-color: var(--gold, #e6b566); color: var(--gold-soft, #f1cd8e); }
@media (max-width: 480px) {
  .cc-card { padding: 28px 18px 22px; }
  .cc-title { font-size: 20px; }
}

/* Completion card: save-image row */
.cc-imgrow {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 2px; font-size: 12.5px; color: var(--text-dim, #9fb0c9);
}
.cc-imgbtn {
  background: transparent; border: 1px solid var(--border, #1e2a44); border-radius: 8px;
  color: var(--text-dim, #9fb0c9); font-size: 12.5px; padding: 6px 12px; cursor: pointer;
}
.cc-imgbtn:hover { border-color: var(--gold, #e6b566); color: var(--gold-soft, #f1cd8e); }

/* Completion card: "Continue your journey" recommendation */
.cc-next {
  margin-top: 16px; padding: 14px 14px 15px; text-align: center;
  background: rgba(230, 181, 102, 0.06);
  border: 1px solid rgba(230, 181, 102, 0.35); border-radius: 12px;
}
.cc-next-kicker {
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold, #e6b566); margin-bottom: 5px;
}
.cc-next-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 17px; font-weight: 700; color: var(--text, #f4f1ea);
}
.cc-next-text { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--text-dim, #9fb0c9); }
.cc-next-btn {
  margin-top: 10px; padding: 8px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--gold-soft, #f1cd8e);
  border: 1px solid var(--gold, #e6b566); border-radius: 9px;
}
.cc-next-btn:hover { background: rgba(230, 181, 102, 0.12); }
@media (max-width: 480px) {
  .cc-next { margin-top: 12px; padding: 11px 10px 12px; }
}

/* ---- Local resume block on showcase cards ---- */
.showcase-resume {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px; margin-top: 6px;
}
.sr-kicker {
  font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: #d4af5f; opacity: 0.9;
}
.sr-line { font-size: 0.85rem; color: #f0e6d2; font-weight: 600; }
.sr-btn {
  display: inline-block; margin-top: 2px; padding: 6px 14px;
  border: 1px solid rgba(212, 175, 95, 0.75); border-radius: 999px;
  color: #ffd98a; font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.sr-restart {
  font-size: 0.72rem; color: #9aa7bd; text-decoration: underline;
  cursor: pointer; margin-top: 2px;
}
.sr-restart:hover { color: #d7dfee; }

/* ==================== Country History Explorer ==================== */
.chx-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.chx-overlay.hidden { display: none; }
.chx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.chx-head-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.chx-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold-soft);
}
.chx-hint { color: var(--text-dim); font-size: 0.8rem; }
.chx-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
}
.chx-close:hover { border-color: var(--gold); color: var(--gold-soft); }
.chx-country-select {
  width: min(260px, 34vw);
  min-height: 38px;
  padding: 0.4rem 2rem 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #101a30;
  color: var(--text);
  font: 600 0.82rem var(--font-body);
  cursor: pointer;
}
.chx-country-select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.chx-body { flex: 1; position: relative; min-height: 0; }
#chxMap {
  position: absolute;
  inset: 0;
  background: #b8d8ea; /* plain sea — no base tiles, just country shapes */
}
.chx-tip {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #342d23;
  font-family: var(--font-body);
  font-size: clamp(0.56rem, 0.65vw, 0.72rem);
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    -1px -1px 0 rgba(255,255,255,0.9),
     1px -1px 0 rgba(255,255,255,0.9),
    -1px  1px 0 rgba(255,255,255,0.9),
     1px  1px 0 rgba(255,255,255,0.9);
}
.chx-tip::before { display: none; }
.chx-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(360px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: rgba(11, 16, 32, 0.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  z-index: 1200;
  overflow: hidden;
}
.chx-panel.hidden { display: none; }
.chx-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-soft);
  font-size: 1rem;
}
.chx-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.chx-panel-close:hover { color: var(--gold-soft); }
.chx-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  flex: 1;
}
.chx-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(30, 42, 68, 0.6);
}
.chx-item:last-child { border-bottom: none; }
.chx-item:hover { background: #1b2743; }
.chx-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chx-item-name { flex: 1; color: var(--text); font-size: 0.88rem; min-width: 0; }
.chx-item-dates { color: var(--text-dim); font-size: 0.74rem; white-space: nowrap; }
.chx-empty { padding: 0.9rem; color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; }
body.chx-open { overflow: hidden; }

/* Phones: the results become a bottom sheet over the lower half of the map. */
@media (max-width: 640px) {
  .chx-head { flex-wrap: wrap; }
  .chx-country-select {
    order: 3;
    width: 100%;
    min-height: 44px;
  }
  .chx-panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 52%;
  }
  .chx-hint { font-size: 0.72rem; }
  .chx-tip { font-size: 0.55rem; }
}

/* ---- Country story panel: journey choices ---- */
.chx-tagline {
  margin: 0;
  padding: 0.55rem 0.9rem 0.2rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.45;
}
.chx-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem 0.9rem;
}
.chx-choices.hidden { display: none; }
.chx-choice {
  padding: 0.75rem 0.9rem;
  background: #16213c;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.chx-choice:hover { border-color: var(--gold); background: #1b2743; }
.chx-choice-journey {
  background: linear-gradient(135deg, #2a2410, #1b2743);
  border-color: rgba(230, 181, 102, 0.55);
  color: var(--gold-soft);
}
.chx-list.hidden { display: none; }

/* ---- Guided Country Journey HUD ---- */
.jny-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2100;
  width: min(360px, calc(100% - 24px));
  background: rgba(10, 16, 32, 0.92);
  border: 1px solid rgba(230, 181, 102, 0.45);
  border-radius: 12px;
  padding: 0.7rem 0.85rem 0.8rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  color: var(--text);
  backdrop-filter: blur(4px);
}
.jny-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.jny-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--gold-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jny-stageline {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.jny-stage-name { font-weight: 700; font-size: 0.95rem; }
.jny-stage-date { color: var(--text-dim); font-size: 0.78rem; white-space: nowrap; }
.jny-dots-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.45rem 0 0.15rem;
}
.jny-dots-label {
  color: var(--text-dim);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.jny-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: space-between;
}
.jny-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(230, 181, 102, 0.6);
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.jny-dot.seen { background: rgba(230, 181, 102, 0.35); }
.jny-dot.active {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(230, 181, 102, 0.8);
}
.jny-blurb {
  margin: 0.4rem 0 0.55rem;
  color: #d8e2f2;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 5.8em;
  overflow-y: auto;
}
.jny-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.jny-btn {
  padding: 0.5rem 0.65rem;
  min-height: 40px;
  background: #16213c;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1 1 auto;
}
.jny-btn:hover:not(:disabled) { border-color: var(--gold); }
.jny-btn:disabled { opacity: 0.4; cursor: default; }
.jny-play { color: var(--gold-soft); border-color: rgba(230, 181, 102, 0.5); }
.jny-exit { flex: 0 0 auto; min-height: 32px; padding: 0.25rem 0.55rem; font-size: 0.72rem; }
.jny-voice { flex: 0 0 auto; }

/* ---- Time Machine: year ticker + traveling state ---- */
.jny-year-ticker {
  display: none;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  margin: 0.25rem 0 0;
  text-shadow: 0 0 18px rgba(230, 181, 102, 0.55);
  animation: jnyTickerPulse 1.4s ease-in-out infinite;
}
@keyframes jnyTickerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
/* When the camera is flying + year is rewinding */
.jny-hud.jny-traveling .jny-year-ticker { display: block; }
.jny-hud.jny-traveling .jny-blurb {
  opacity: 0.3;
  transition: opacity 0.3s;
}
/* Keep Pause and Exit fully interactive; dim nav/explore */
.jny-hud.jny-traveling .jny-prev,
.jny-hud.jny-traveling .jny-next,
.jny-hud.jny-traveling .jny-explore {
  opacity: 0.25;
  pointer-events: none;
}

.jny-resume-btn {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 12000;
  display: none;
  padding: 0.8rem 1.4rem;
  background: linear-gradient(135deg, #e6b566, #c98f3d);
  color: #1a1206;
  border: none;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}
.jny-resume-btn.on { display: block; }

/* ---- Feedback tab (fixed corner) + modal ---- */
.feedback-tab {
  position: fixed;
  bottom: 80px;
  right: 0;
  z-index: 9000;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 14px 8px;
  background: var(--surface, #111a2e);
  color: var(--text-dim, #9fb0c9);
  border: 1px solid var(--border, #1e2a44);
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-shadow: -2px 2px 12px rgba(0,0,0,0.35);
}
.feedback-tab:hover { background: #1a2640; color: var(--gold-soft, #f1cd8e); }

/* Nav link version */
.nav-feedback-btn {
  background: none; border: none; cursor: pointer;
  color: inherit; font-size: inherit; padding: 0;
  font-family: inherit;
}
.nav-feedback-btn:hover { color: var(--gold-soft, #f1cd8e); }

.feedback-modal { position: fixed; inset: 0; z-index: 13500; }
.feedback-modal[hidden] { display: none; }
.feedback-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 8, 18, 0.7); backdrop-filter: blur(3px);
}
.feedback-card {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: linear-gradient(165deg, #131e38 0%, var(--surface, #111a2e) 60%, #0b1226 100%);
  border: 1px solid var(--gold, #e6b566);
  border-radius: 18px;
  padding: 34px 28px 28px;
  color: var(--text, #f4f1ea);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  animation: ccPop 0.25s ease;
  text-align: center;
}
.feedback-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none;
  color: var(--text-dim, #9fb0c9); font-size: 18px;
  cursor: pointer; padding: 6px;
}
.feedback-icon { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.feedback-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-size: 22px; font-weight: 700; margin: 0 0 6px;
}
.feedback-sub { font-size: 14px; color: var(--text-dim, #9fb0c9); margin: 0 0 18px; line-height: 1.5; }
#feedbackForm { display: flex; flex-direction: column; gap: 10px; }
#feedbackForm textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border, #1e2a44);
  border-radius: 10px; color: var(--text, #f4f1ea);
  font-size: 14px; padding: 10px 12px;
  resize: vertical; min-height: 90px;
  font-family: inherit;
}
#feedbackForm textarea:focus { outline: none; border-color: var(--gold, #e6b566); }
#feedbackForm input[type="email"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border, #1e2a44);
  border-radius: 10px; color: var(--text, #f4f1ea);
  font-size: 14px; padding: 10px 12px;
}
#feedbackForm input[type="email"]:focus { outline: none; border-color: var(--gold, #e6b566); }
.feedback-submit {
  padding: 12px 16px; font-size: 15px; font-weight: 600;
  cursor: pointer; border-radius: 10px;
}
.feedback-ok {
  margin-top: 12px; color: var(--gold-soft, #f1cd8e);
  font-size: 15px; font-weight: 500;
}
.feedback-ok[hidden] { display: none; }
body.feedback-open { overflow: hidden; }

@media (max-width: 640px) {
  /* Map stays the visual focus on phones: the HUD hugs the bottom edge and
     the blurb shrinks so the journey never covers the whole map. */
  .jny-hud {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    padding: 0.55rem 0.65rem 0.65rem;
  }
  .jny-blurb { max-height: 4.5em; font-size: 0.76rem; }
  .jny-btn { font-size: 0.74rem; padding: 0.45rem 0.5rem; }
}

/* ============================================================================
   IRISH ANCESTRY — a quiet museum label for the map's living story
   ========================================================================== */
:root {
  --anc-lichen: #91a894;
  --anc-moss: #536f61;
  --anc-ochre: #d5a85d;
  --anc-cream: #f1e8d4;
  --anc-ink: #0b1322;
  --anc-line: rgba(210, 188, 137, 0.28);
}

.anc-entry-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(213, 168, 93, 0.74);
  background:
    radial-gradient(90% 110% at 100% 0%, rgba(82, 121, 95, 0.32), transparent 58%),
    linear-gradient(145deg, rgba(39, 56, 54, 0.9), rgba(14, 24, 38, 0.98));
  box-shadow: 0 0 0 1px rgba(213, 168, 93, 0.12), 0 18px 42px rgba(0, 0, 0, 0.42);
}
.anc-entry-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -48px;
  bottom: -70px;
  border: 1px solid rgba(213, 168, 93, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(213, 168, 93, 0.045), 0 0 0 38px rgba(213, 168, 93, 0.03);
  pointer-events: none;
}
.anc-entry-card:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(213, 168, 93, 0.2), 0 20px 46px rgba(0, 0, 0, 0.55);
}
.anc-entry-card:focus-visible,
.anc-chooser summary:focus-visible,
.anc-chooser select:focus-visible {
  outline: 2px solid var(--anc-ochre);
  outline-offset: 3px;
}
.anc-flag {
  display: inline-flex;
  width: 40px;
  height: 25px;
  overflow: hidden;
  border: 1px solid rgba(241, 232, 212, 0.35);
  border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.anc-flag i { display: block; width: 33.333%; height: 100%; }
.anc-flag i:nth-child(1) { background: #169b62; }
.anc-flag i:nth-child(2) { background: #f5f1e8; }
.anc-flag i:nth-child(3) { background: #ff883e; }
.anc-country-flag {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 25px;
  border: 1px solid rgba(241, 232, 212, 0.35);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  font-size: 1.22rem;
  line-height: 1;
}
.anc-country-flag.anc-flag-england {
  background:
    linear-gradient(to bottom, transparent 38%, #c8102e 38%, #c8102e 62%, transparent 62%),
    linear-gradient(to right, transparent 40%, #c8102e 40%, #c8102e 60%, transparent 60%),
    #fff;
}
.anc-card-kicker {
  color: var(--anc-lichen);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.1;
  text-transform: uppercase;
}
.anc-entry-card .showcase-card-go { color: var(--anc-cream); }
.anc-entry-card .showcase-card-go span { color: var(--anc-ochre); font-size: 1.05rem; }

.anc-chooser {
  max-width: 680px;
  margin: 1.45rem auto 0;
  text-align: left;
  border: 1px solid var(--anc-line);
  border-radius: 14px;
  background: rgba(17, 29, 44, 0.76);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}
.anc-chooser summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 58px;
  padding: 0.8rem 1rem;
  color: var(--anc-cream);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  list-style: none;
}
.anc-chooser summary::-webkit-details-marker { display: none; }
.anc-chooser summary::after {
  content: "＋";
  margin-left: auto;
  color: var(--anc-ochre);
  font-family: sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  transition: transform 0.25s ease;
}
.anc-chooser[open] summary::after { transform: rotate(45deg); }
.anc-chooser-mark {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--anc-ochre);
  box-shadow: 0 0 0 4px rgba(213, 168, 93, 0.12);
}
.anc-summary-note {
  margin-left: auto;
  color: var(--anc-lichen);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.anc-chooser summary .anc-summary-note + * { margin-left: 0; }
.anc-chooser-body {
  padding: 0 1rem 1rem 1.95rem;
  animation: ancReveal 0.28s ease both;
}
@keyframes ancReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.anc-select-label {
  display: block;
  margin: 0 0 0.45rem;
  color: var(--text-dim);
  font-size: 0.77rem;
}
.anc-select-wrap { position: relative; }
.anc-chooser select {
  width: 100%;
  min-height: 46px;
  appearance: none;
  padding: 0.7rem 2.6rem 0.7rem 0.8rem;
  color: var(--anc-cream);
  background: rgba(7, 15, 28, 0.72);
  border: 1px solid rgba(213, 168, 93, 0.45);
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
}
.anc-chooser option { color: var(--anc-ink); background: var(--anc-cream); }
.anc-select-chevron {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  color: var(--anc-ochre);
  font-size: 1.2rem;
  pointer-events: none;
  transform: translateY(-58%);
}
.anc-coming {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.7rem 0 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.45;
}
.anc-coming-rule { width: 16px; height: 1px; flex: 0 0 auto; margin-top: 0.6em; background: var(--anc-moss); }
.anc-chooser-start {
  width: 100%;
  min-height: 48px;
  margin-top: .85rem;
  border: 1px solid var(--anc-ochre);
  border-radius: 9px;
  color: var(--anc-ink);
  background: var(--anc-ochre);
  cursor: pointer;
  font: 700 .84rem var(--font-display);
}
.anc-chooser-start:hover { filter: brightness(1.06); }
.anc-chooser-start:focus-visible { outline: 2px solid var(--anc-cream); outline-offset: 3px; }

/* Runtime journey shell. The map remains beneath this translucent editorial UI. */
.anc-shell { position: absolute; inset: 0; z-index: 2200; pointer-events: none; color: var(--anc-cream); }
.anc-header, .anc-progress, .anc-stage-copy, .anc-source-links, .anc-chapter-actions,
.anc-newgrange, .anc-strands, .anc-result, .anc-resume { pointer-events: auto; }
.anc-header {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--anc-line); border-radius: 12px;
  background: rgba(9, 17, 31, 0.82); backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.anc-header-title { color: var(--anc-cream); font: 700 1rem/1.15 var(--font-display); }
.anc-header-meta { color: var(--anc-lichen); font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; }
.anc-header-heading { display: grid; gap: .18rem; margin-right: auto; }
.anc-header-actions { display: flex; align-items: center; gap: .42rem; }
.anc-head-btn {
  min-height: 38px;
  padding: .48rem .68rem;
  border: 1px solid var(--anc-line);
  border-radius: 8px;
  color: var(--anc-cream);
  background: rgba(19, 33, 49, .84);
  cursor: pointer;
  font: 700 .72rem var(--font-display);
}
.anc-head-btn:hover, .anc-head-btn:focus-visible { border-color: var(--anc-ochre); }
.anc-exit { color: #ffcfba; }
.anc-progress {
  position: absolute; top: 82px; left: 16px; width: min(320px, calc(100% - 32px));
  padding: .55rem .65rem; border: 1px solid rgba(210,188,137,.18); border-radius: 9px;
  background: rgba(9,17,31,.78); backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.anc-progress-track { height: 3px; overflow: hidden; border-radius: 3px; background: rgba(241,232,212,.2); }
.anc-progress-fill { height: 100%; border-radius: inherit; background: var(--anc-ochre); transition: width .5s ease; }
.anc-progress-label { display: flex; justify-content: space-between; margin-top: .35rem; color: var(--text-dim); font-size: .68rem; }
.anc-stage-copy {
  position: absolute; left: 16px; bottom: 18px; width: min(440px, calc(100% - 32px));
  padding: 1rem 1.1rem; border-left: 2px solid var(--anc-ochre);
  max-height: min(60%, 560px); overflow-y: auto;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(100deg, rgba(9,17,31,.96), rgba(9,17,31,.88));
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 40px rgba(0,0,0,.3);
  text-shadow: 0 2px 10px rgba(0,0,0,.55);
}
.anc-shell.is-opening .anc-stage-copy,
.anc-shell.is-result .anc-stage-copy { width: min(650px, calc(100% - 32px)); }
.anc-shell.is-result .anc-stage-copy { max-height: 72%; }
.anc-stage-kicker { color: var(--anc-ochre); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; }
.anc-stage-title { margin: .3rem 0; color: var(--anc-cream); font: 700 clamp(1.25rem, 3vw, 1.9rem)/1.1 var(--font-display); }
.anc-stage-body { margin: 0; color: #d6d9d0; font-size: .86rem; line-height: 1.55; }
.anc-stage-prompt { margin: .6rem 0 0; color: var(--anc-lichen); font-size: .78rem; line-height: 1.48; }
.anc-badge {
  display: inline-flex; margin: 0 0 .65rem; padding: .3rem .58rem;
  border: 1px solid rgba(213,168,93,.45); border-radius: 999px;
  color: var(--anc-ochre); background: rgba(213,168,93,.09);
  font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.anc-sources { margin-top: .72rem; border-top: 1px solid var(--anc-line); padding-top: .62rem; }
.anc-sources summary { color: var(--anc-cream); cursor: pointer; font-size: .74rem; font-weight: 700; }
.anc-source-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.anc-source-links a { color: var(--anc-cream); font-size: .7rem; line-height: 1.35; text-underline-offset: 3px; }
.anc-source-links a:hover { color: var(--anc-ochre); }
.anc-chapter-actions {
  position: sticky; bottom: -1rem;
  display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: .5rem;
  margin: .85rem -1.1rem -1rem; padding: .65rem 1.1rem 1rem;
  background: linear-gradient(180deg, rgba(9,17,31,.12), rgba(9,17,31,.98) 30%);
}
.anc-chapter-actions button, .anc-resume {
  min-height: 44px; padding: .65rem .9rem; color: var(--anc-cream);
  border: 1px solid var(--anc-line); border-radius: 8px; background: rgba(14,27,43,.9);
  cursor: pointer; font: 700 .78rem var(--font-display); transition: background .2s, border-color .2s, transform .2s;
}
.anc-chapter-actions button:hover, .anc-resume:hover { border-color: var(--anc-ochre); background: rgba(69,78,55,.86); transform: translateY(-2px); }
.anc-chapter-actions .anc-next { color: var(--anc-ink); border-color: var(--anc-ochre); background: var(--anc-ochre); }
.anc-chapter-actions button:disabled,
.anc-result-actions button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.anc-context-actions, .anc-modal-actions, .anc-result-actions {
  display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .72rem;
}
.anc-context-actions button, .anc-modal-actions button, .anc-result-actions button {
  min-height: 42px; padding: .55rem .72rem;
  border: 1px solid rgba(145,168,148,.42); border-radius: 8px;
  color: var(--anc-cream); background: rgba(44,66,58,.56);
  cursor: pointer; font: 700 .72rem var(--font-display);
}
.anc-context-actions button:hover, .anc-modal-actions button:hover, .anc-result-actions button:hover {
  border-color: var(--anc-ochre); background: rgba(75,82,57,.78);
}
.anc-layer-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin-top: .8rem; }
.anc-layer-card {
  display: flex; gap: .55rem; min-width: 0; padding: .68rem;
  border: 1px solid var(--anc-line); border-radius: 9px;
  background: rgba(27, 42, 49, .75);
}
.anc-layer-icon { flex: 0 0 auto; font-size: 1.25rem; line-height: 1; }
.anc-layer-card strong { display: block; color: var(--anc-cream); font: 700 .74rem/1.25 var(--font-display); }
.anc-layer-card small { display: block; margin-top: .25rem; color: var(--text-dim); font-size: .66rem; line-height: 1.35; }
.anc-language-trail {
  display: flex; flex-wrap: wrap; align-items: center; gap: .42rem;
  margin-top: .8rem; padding: .7rem; border: 1px solid var(--anc-line); border-radius: 9px;
  background: rgba(24, 39, 47, .72);
}
.anc-language-trail span { color: var(--anc-cream); font-size: .7rem; font-weight: 700; }
.anc-language-trail i { color: var(--anc-ochre); font-style: normal; }
.anc-newgrange, .anc-result {
  position: absolute; top: 50%; left: 50%; width: min(390px, calc(100% - 32px));
  padding: 1.2rem; border: 1px solid var(--anc-line); border-radius: 14px;
  background: rgba(13, 25, 38, .94); box-shadow: 0 16px 48px rgba(0,0,0,.42); transform: translate(-50%,-50%);
}
.anc-newgrange-title, .anc-result-title { margin: 0 0 .4rem; color: var(--anc-cream); font: 700 1.25rem var(--font-display); }
.anc-newgrange-note, .anc-result-copy { margin: 0; color: var(--text-dim); font-size: .84rem; line-height: 1.55; }
.anc-strands { display: grid; gap: .45rem; width: min(260px, calc(100% - 32px)); position: absolute; right: 16px; bottom: 18px; }
.anc-strand { padding: .65rem .8rem; border-left: 3px solid var(--anc-moss); background: rgba(9,17,31,.82); border-radius: 5px; }
.anc-strand:nth-child(2) { border-color: var(--anc-ochre); }
.anc-strand:nth-child(3) { border-color: #b87858; }
.anc-strand-name { display: block; color: var(--anc-cream); font: 700 .8rem var(--font-display); }
.anc-strand-detail { color: var(--text-dim); font-size: .7rem; }
.anc-resume {
  position: fixed; z-index: 10050; left: 50%; bottom: 18px;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 14px); color: var(--anc-ink); border: 0;
  background: var(--anc-ochre); box-shadow: 0 8px 24px rgba(0,0,0,.38);
  transition: opacity .2s, transform .2s;
}
.anc-resume.on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.anc-shell.is-collapsed .anc-stage-content { display: none; }
.anc-shell.is-collapsed .anc-stage-copy { width: min(420px, calc(100% - 32px)); padding-top: .7rem; }
.anc-shell.is-collapsed .anc-chapter-actions { margin-top: 0; }

/* Closing genetics model. This deliberately separates autosomal proportions from Y-DNA. */
.anc-header, .anc-progress, .anc-stage-copy {
  transition: opacity .42s ease, transform .42s ease, filter .42s ease;
}
.anc-shell.is-genetics-finale .anc-header,
.anc-shell.is-genetics-finale .anc-progress,
.anc-shell.is-genetics-finale .anc-stage-copy {
  opacity: 0; pointer-events: none; filter: blur(4px); transform: translateY(8px);
}
.anc-genetics-mount {
  position: fixed; z-index: 10060; inset: 0;
  display: grid; place-items: center; overflow: hidden;
  padding: 16px; opacity: 0; pointer-events: none;
  background: rgba(5, 10, 18, 0);
  backdrop-filter: blur(0);
  transition: opacity .5s ease, background .5s ease, backdrop-filter .5s ease;
}
.anc-genetics-mount.is-visible {
  opacity: 1; pointer-events: auto;
  background: rgba(5, 10, 18, .9);
  backdrop-filter: blur(8px);
}
.anc-genetics-card {
  position: relative; width: min(850px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(.9rem, 2vw, 1.25rem);
  border: 1px solid rgba(213,168,93,.7); border-radius: 18px;
  color: #182534; background: #faf8f2;
  box-shadow: 0 26px 80px rgba(0,0,0,.62);
  transform: translateY(18px) scale(.975);
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.anc-genetics-mount.is-visible .anc-genetics-card { transform: translateY(0) scale(1); }
.anc-genetics-return-top {
  min-height: 34px; margin: 0; padding: .25rem .15rem;
  border: 0; color: #31546f; background: transparent;
  cursor: pointer; font: 700 .72rem var(--font-display);
}
.anc-genetics-return-top:hover, .anc-genetics-return-top:focus-visible { color: #0a77ad; text-decoration: underline; }
.anc-genetics-heading { max-width: 720px; margin: 0 auto .6rem; text-align: center; }
.anc-genetics-eyebrow {
  color: #8a5a15; font-size: .68rem; font-weight: 800;
  letter-spacing: .15em; text-transform: uppercase;
}
.anc-genetics-heading h2 {
  margin: .28rem 0 .38rem; color: #132238;
  font: 700 clamp(1.45rem, 3vw, 2.2rem)/1.08 var(--font-display);
}
.anc-genetics-heading h2:focus { outline: none; }
.anc-genetics-heading p { max-width: 620px; margin: 0 auto; color: #53606b; font-size: .78rem; line-height: 1.42; }
.anc-genetics-chart-layout {
  display: grid; grid-template-columns: minmax(260px, .95fr) minmax(290px, 1.05fr);
  align-items: center; gap: clamp(1rem, 3vw, 2rem);
}
.anc-genetics-pie-wrap { display: grid; place-items: center; min-width: 0; }
.anc-genetics-pie {
  position: relative; width: min(245px, 100%); aspect-ratio: 1;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 16px 42px rgba(25,44,57,.24);
}
.anc-genetics-percent {
  position: absolute; color: #fff; font: 800 .78rem/1 var(--font-body);
  text-shadow: 0 1px 4px rgba(0,0,0,.65); transform: translate(-50%,-50%);
}
.anc-genetics-percent-farmer { top: 34%; left: 70%; }
.anc-genetics-percent-steppe { top: 68%; left: 35%; }
.anc-genetics-percent-hunter { top: 24%; left: 35%; }
.anc-genetics-legend { display: grid; gap: .48rem; margin: 0; padding: 0; list-style: none; }
.anc-genetics-legend li {
  position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: .65rem;
  min-width: 0; padding: .52rem .65rem .52rem .74rem;
  border: 1px solid #d9dedc; border-left: 5px solid var(--anc-segment-color);
  border-radius: 9px; background: #fff;
}
.anc-genetics-legend-value { color: #172638; font: 800 .98rem var(--font-display); }
.anc-genetics-legend-label { align-self: center; color: #172638; font: 700 .8rem var(--font-display); }
.anc-genetics-legend small {
  grid-column: 1 / -1; margin-top: .25rem; color: #5f686d; font-size: .62rem; line-height: 1.3;
}
.anc-genetics-ydna {
  display: grid; grid-template-columns: 42px 1fr; gap: .75rem; align-items: center;
  margin-top: .65rem; padding: .55rem .72rem;
  border: 1px solid #c8d2d4; border-radius: 10px;
  color: #ecf2ed; background: #183041;
}
.anc-genetics-chromosome {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid rgba(255,255,255,.36); border-radius: 50%;
  color: #f0c06b; font: 800 1.1rem var(--font-display);
}
.anc-genetics-ydna h3 { margin: 0 0 .18rem; color: #fff7e7; font: 700 .86rem var(--font-display); }
.anc-genetics-ydna p { margin: 0; color: #cbd7d7; font-size: .7rem; line-height: 1.42; }
.anc-genetics-caveat {
  margin: .55rem 0 0; padding: .48rem .65rem;
  border-left: 3px solid #b47620; color: #5e4c32; background: #f3ead8;
  font-size: .68rem; line-height: 1.42;
}
.anc-genetics-scroll-cue { display: none; }
.anc-genetics-sources {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem;
  margin-top: .55rem; padding: .5rem .6rem;
  border: 1px solid #d3dddf; border-radius: 8px;
  color: #4f5b62; background: #edf3f3; font-size: .7rem;
}
.anc-genetics-sources strong { color: #263947; font-size: .72rem; }
.anc-genetics-sources a { color: #17658f; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.anc-genetics-sources a:hover { color: #0d4565; }
.anc-genetics-actions {
  position: sticky; bottom: -1.25rem; z-index: 2;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: .5rem;
  margin: .55rem -1.25rem -1.25rem; padding: .55rem 1.25rem 1.25rem;
  border-top: 1px solid #d5d8d4;
  background: linear-gradient(180deg, rgba(250,248,242,.82), #faf8f2 24%);
}
.anc-genetics-actions button {
  min-height: 43px; padding: .55rem .7rem; border: 1px solid #314b5d; border-radius: 8px;
  color: #fff; background: #1d3a4e; cursor: pointer; font: 700 .72rem var(--font-display);
}
.anc-genetics-actions button:first-child { color: #152739; border-color: #d4a14f; background: #e4b45f; }
.anc-genetics-actions button:hover, .anc-genetics-actions button:focus-visible { filter: brightness(1.08); outline: 2px solid #d4a14f; outline-offset: 2px; }
.anc-visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important; white-space: nowrap !important;
}
body.anc-genetics-open { overflow: hidden; }
body.anc-genetics-open .feedback-tab { opacity: 0; pointer-events: none; }

.anc-route-line { animation: ancRouteFlow 2.1s linear infinite; }
@keyframes ancRouteFlow { to { stroke-dashoffset: -42; } }
.anc-country-shape { filter: drop-shadow(0 0 7px rgba(226,189,112,.55)); }
.anc-newgrange-marker span {
  display: block; width: 20px; height: 20px; margin: 5px;
  border: 3px solid var(--anc-cream); border-radius: 50%;
  background: var(--anc-ochre);
  box-shadow: 0 0 0 0 rgba(213,168,93,.65);
  animation: ancSitePulse 2s ease-out infinite;
}
@keyframes ancSitePulse { 70% { box-shadow: 0 0 0 14px rgba(213,168,93,0); } 100% { box-shadow: 0 0 0 0 rgba(213,168,93,0); } }
.leaflet-tooltip.anc-newgrange-label {
  border: 1px solid var(--anc-line); color: var(--anc-cream);
  background: rgba(9,17,31,.94); box-shadow: 0 8px 22px rgba(0,0,0,.3);
  font: 700 .7rem var(--font-display);
}
.leaflet-tooltip-top.anc-newgrange-label::before { border-top-color: rgba(9,17,31,.94); }

.anc-modal-backdrop {
  position: fixed; z-index: 10040; inset: 0; display: grid; place-items: center;
  padding: 1rem; background: rgba(4, 9, 17, .78); backdrop-filter: blur(7px);
}
.anc-modal {
  position: relative; width: min(540px, 100%); max-height: 86vh; overflow-y: auto;
  padding: 1.35rem; border: 1px solid var(--anc-line); border-radius: 15px;
  color: var(--anc-cream); background: linear-gradient(150deg, #15263a, #0b1422);
  box-shadow: 0 24px 70px rgba(0,0,0,.58);
}
.anc-modal h2 { margin: .3rem 4rem .55rem 0; color: var(--anc-cream); font: 700 1.5rem var(--font-display); }
.anc-modal p { color: #d2d8d3; font-size: .86rem; line-height: 1.6; }
.anc-modal-kicker { color: var(--anc-ochre); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.anc-modal-note { padding: .65rem .75rem; border-left: 2px solid var(--anc-ochre); background: rgba(213,168,93,.08); }
.anc-modal-close {
  position: absolute; top: .8rem; right: .8rem; min-height: 38px; padding: .45rem .65rem;
  border: 1px solid var(--anc-line); border-radius: 8px; color: var(--anc-cream);
  background: rgba(9,17,31,.72); cursor: pointer;
}

@media (max-width: 640px) {
  .anc-summary-note { display: none; }
  .anc-chooser-body { padding-left: 1rem; }
  .anc-chooser summary { min-height: 62px; }
  .anc-header { top: 8px; left: 8px; right: 8px; min-height: 54px; padding: .55rem .62rem; gap: .4rem; }
  .anc-header .anc-flag,
  .anc-header .anc-country-flag { width: 28px; min-width: 28px; height: 18px; font-size: .92rem; }
  .anc-header-title { font-size: .78rem; }
  .anc-header-meta { display: none; }
  .anc-header-actions { gap: .25rem; }
  .anc-head-btn { min-height: 40px; padding: .35rem .42rem; font-size: .6rem; }
  .anc-progress { top: 74px; left: 10px; width: calc(100% - 20px); }
  .anc-stage-copy,
  .anc-shell.is-opening .anc-stage-copy,
  .anc-shell.is-result .anc-stage-copy,
  .anc-shell.is-collapsed .anc-stage-copy {
    left: 8px; bottom: 8px; width: calc(100% - 16px); max-height: 47%; padding: .75rem .8rem;
  }
  .anc-stage-body { font-size: .78rem; }
  .anc-stage-prompt { font-size: .72rem; }
  .anc-layer-list { grid-template-columns: 1fr; }
  .anc-layer-card { padding: .52rem .6rem; }
  .anc-layer-card small { display: none; }
  .anc-shell.is-opening .anc-layer-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .32rem; }
  .anc-shell.is-opening .anc-layer-card { display: block; padding: .48rem; }
  .anc-shell.is-opening .anc-layer-icon { display: block; margin-bottom: .35rem; }
  .anc-shell.is-opening .anc-layer-card strong { font-size: .64rem; }
  .anc-shell.is-opening .anc-layer-card small {
    display: -webkit-box; margin-top: .22rem; overflow: hidden;
    font-size: .57rem; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
  }
  .anc-source-links { display: grid; }
  .anc-strands { right: 8px; bottom: 8px; width: calc(100% - 16px); }
  .anc-chapter-actions { gap: .35rem; }
  .anc-chapter-actions { bottom: -.75rem; margin: .7rem -.8rem -.75rem; padding: .55rem .8rem .75rem; }
  .anc-chapter-actions button { min-height: 48px; padding: .48rem .38rem; font-size: .7rem; }
  .anc-context-actions button, .anc-result-actions button { flex: 1 1 46%; min-height: 46px; }
  .anc-modal { max-height: 82vh; padding: 1rem; }
  .anc-genetics-mount { padding: 8px; }
  .anc-genetics-card { max-height: calc(100vh - 16px); padding: .9rem; border-radius: 12px; }
  .anc-genetics-return-top { margin-bottom: .15rem; }
  .anc-genetics-heading { margin-bottom: .65rem; }
  .anc-genetics-heading h2 { font-size: 1.34rem; }
  .anc-genetics-heading p { font-size: .72rem; }
  .anc-genetics-chart-layout { grid-template-columns: 1fr; gap: .75rem; }
  .anc-genetics-pie { width: min(220px, 72vw); }
  .anc-genetics-legend { grid-template-columns: 1fr; width: 100%; }
  .anc-genetics-legend li { padding: .5rem .58rem; }
  .anc-genetics-legend small { display: none; }
  .anc-genetics-ydna { margin-top: .65rem; }
  .anc-genetics-scroll-cue {
    display: block; margin: .52rem 0 .2rem; color: #5e6870;
    font-size: .62rem; font-weight: 700; text-align: center;
  }
  .anc-genetics-caveat { font-size: .64rem; }
  .anc-genetics-actions { position: static; grid-template-columns: 1fr 1fr; }
  .anc-genetics-actions { margin: .55rem -.9rem -.9rem; padding: .55rem .9rem .9rem; }
  .anc-genetics-actions button:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .anc-chooser-body, .anc-chapter-actions button, .anc-resume, .anc-route-line, .anc-newgrange-marker span,
  .anc-header, .anc-progress, .anc-stage-copy, .anc-genetics-mount, .anc-genetics-card { animation: none; transition: none; }
}
