/* ==========================================================================
   中华文明起源考古遗址时空图谱 — Museum Archival GIS Styling
   ========================================================================== */

:root {
  /* Archival Xuan-paper & Patina Bronze palette */
  --paper-bg: #f6f1e7;
  --paper-surface: rgba(250, 247, 240, 0.94);
  --paper-solid: #faf7f0;
  --paper-elevated: #ffffff;
  --paper-muted: #ebe3d3;
  --paper-border: rgba(89, 71, 48, 0.18);
  --paper-border-strong: rgba(89, 71, 48, 0.32);

  --ink-primary: #1f2427;
  --ink-secondary: #4c5358;
  --ink-muted: #706b62;

  /* Historical pigments */
  --bronze-teal: #1d5460;
  --bronze-teal-dark: #133b44;
  --cinnabar: #a63728;
  --cinnabar-soft: rgba(166, 55, 40, 0.11);
  --ochre: #b46a2c;
  --jade: #3c735f;
  --indigo: #394d78;
  --umber: #6d4c3d;
  --gold: #9a7426;

  /* Era colors */
  --era-paleolithic: #6d5547;
  --era-early-neo: #b86c2c;
  --era-mid-neo: #b83f31;
  --era-longshan: #2f725b;
  --era-xia-shang: #1d5460;
  --era-late-shang-zhou: #4a3f7a;

  --shadow-sm: 0 2px 8px rgba(31, 36, 39, 0.08);
  --shadow-md: 0 8px 24px rgba(31, 36, 39, 0.14);
  --shadow-lg: 0 14px 40px rgba(31, 36, 39, 0.2);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;

  --top-bar-height: 62px;
  --region-bar-height: 38px;
  --dock-height: 146px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background: #d9d3c5;
  -webkit-font-smoothing: antialiased;
}

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

.is-hidden {
  display: none !important;
}

/* Shell & Map Canvas */
.atlas-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #cad2c5;
}

/* Override Leaflet zoom controls position so they never clash with panels */
.leaflet-top.leaflet-right {
  top: 112px;
  right: 14px;
}

.leaflet-control-zoom {
  border: 1px solid var(--paper-border-strong) !important;
  box-shadow: var(--shadow-sm) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--paper-solid) !important;
  color: var(--ink-primary) !important;
  border-bottom-color: var(--paper-border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--paper-muted) !important;
}

/* ==========================================================================
   Top Header Bar & Region Strip Stack
   ========================================================================== */
.top-overlay-stack {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.top-bar {
  position: relative;
  pointer-events: auto;
  min-height: var(--top-bar-height);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--paper-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-seal {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--cinnabar);
  color: #fffaf0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 250, 240, 0.35);
  letter-spacing: 0.05em;
}

.brand-titles {
  min-width: 0;
}

.brand-heading {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-primary);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  margin: 1px 0 0;
  font-size: 0.74rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--paper-elevated);
  border: 1px solid var(--paper-border-strong);
  font-size: 0.8rem;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.stat-pill strong {
  color: var(--cinnabar);
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(60, 115, 95, 0.2);
}

.stat-sep {
  color: var(--ink-muted);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  background: var(--paper-elevated);
  border: 1px solid var(--paper-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--bronze-teal);
  box-shadow: 0 0 0 3px rgba(29, 84, 96, 0.15);
}

.search-icon {
  width: 15px;
  height: 15px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.search-box input {
  width: 185px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-primary);
  outline: none;
}

.search-submit-btn {
  border: none;
  background: var(--bronze-teal);
  color: #fff;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-submit-btn:hover {
  background: var(--bronze-teal-dark);
}

.select-control {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-border-strong);
  background: var(--paper-elevated);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.select-control.compact {
  height: 28px;
  font-size: 0.76rem;
  padding: 0 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-border-strong);
  background: var(--paper-elevated);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  background: var(--paper-muted);
  border-color: var(--bronze-teal);
}

/* ==========================================================================
   Region Filter Strip
   ========================================================================== */
.region-strip {
  position: relative;
  pointer-events: none;
}

.region-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 8px;
  background: rgba(250, 247, 240, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--paper-border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  scrollbar-width: none;
}

.region-pills::-webkit-scrollbar {
  display: none;
}

.region-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.region-pill:hover {
  background: var(--paper-muted);
  color: var(--ink-primary);
}

.region-pill.is-active {
  background: var(--bronze-teal);
  color: #fff;
  box-shadow: 0 2px 6px rgba(29, 84, 96, 0.25);
}

.region-pill .pill-count {
  font-size: 0.7rem;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Side Panels (Left Site List & Right Archaeological Dossier)
   ========================================================================== */
.side-panel {
  position: absolute;
  top: 120px;
  bottom: 162px;
  z-index: 460;
  display: flex;
  flex-direction: column;
  background: var(--paper-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--paper-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.left-panel {
  left: 12px;
  width: 316px;
}

.right-panel {
  right: 12px;
  width: 420px;
  max-width: calc(100vw - 24px);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--paper-border);
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.panel-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.panel-meta {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.close-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--paper-border);
  background: var(--paper-elevated);
  color: var(--ink-secondary);
  font-size: 0.86rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.close-btn:hover {
  background: var(--cinnabar);
  color: #fff;
  border-color: var(--cinnabar);
}

/* Era legend strip inside left panel */
.era-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--paper-border);
  background: rgba(235, 227, 211, 0.38);
  flex-shrink: 0;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.69rem;
  color: var(--ink-secondary);
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Site List Items */
.site-list-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-card {
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-border);
  background: var(--paper-elevated);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.site-card:hover {
  border-color: var(--bronze-teal);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.site-card.is-selected {
  border-color: var(--cinnabar);
  background: #fffcf7;
  box-shadow: 0 0 0 2px rgba(166, 55, 40, 0.18);
}

.site-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.site-card-name {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.site-card-date {
  font-size: 0.72rem;
  color: var(--cinnabar);
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.site-card-sub {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.site-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.mini-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-muted);
  color: var(--ink-secondary);
}

.mini-tag.has-photo {
  background: rgba(29, 84, 96, 0.12);
  color: var(--bronze-teal-dark);
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

/* ==========================================================================
   Right Archaeological Dossier Panel
   ========================================================================== */
.detail-header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
}

.detail-badge.subtle {
  background: var(--paper-muted);
  color: var(--ink-secondary);
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 20px;
}

.detail-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.3;
}

.detail-culture-line {
  margin: 4px 0 12px;
  font-size: 0.84rem;
  color: var(--bronze-teal);
  font-weight: 600;
}

/* Lifespan visualizer inside dossier */
.lifespan-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-elevated);
  border: 1px solid var(--paper-border);
  margin-bottom: 12px;
}

.lifespan-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.lifespan-dates {
  font-weight: 700;
  color: var(--cinnabar);
  font-variant-numeric: tabular-nums;
}

.lifespan-track {
  position: relative;
  height: 8px;
  background: var(--paper-muted);
  border-radius: 999px;
  overflow: visible;
}

.lifespan-fill {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  opacity: 0.85;
}

.lifespan-marker {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--ink-primary);
  box-shadow: 0 0 0 2px #fff;
  transform: translateX(-50%);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(235, 227, 211, 0.45);
  border: 1px solid var(--paper-border);
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.meta-item {
  display: flex;
  gap: 8px;
  line-height: 1.45;
}

.meta-label {
  flex-shrink: 0;
  width: 64px;
  color: var(--ink-muted);
  font-weight: 500;
}

.meta-value {
  color: var(--ink-primary);
  flex: 1;
}

.ext-map-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--bronze-teal);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.75rem;
}

.ext-map-link:hover {
  text-decoration: underline;
}

.dossier-section {
  margin-bottom: 16px;
}

.dossier-section h3 {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-section h3::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--cinnabar);
}

.dossier-desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.72;
  color: var(--ink-secondary);
  text-align: justify;
}

/* Artifact Cards */
.artifact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.artifact-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-border);
  background: var(--paper-elevated);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.artifact-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #23272a;
  overflow: hidden;
  cursor: zoom-in;
}

.artifact-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.artifact-photo-wrap:hover img {
  transform: scale(1.03);
}

.zoom-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(18, 22, 24, 0.72);
  color: #fff;
  font-size: 0.69rem;
}

.artifact-text-plate {
  padding: 10px 12px;
  background: linear-gradient(135deg, #f3ede0 0%, #eae1cf 100%);
  border-bottom: 1px dashed var(--paper-border-strong);
  display: flex;
  align-items: center;
  gap: 10px;
}

.plate-seal {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(166, 55, 40, 0.12);
  border: 1px solid rgba(166, 55, 40, 0.35);
  color: var(--cinnabar);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.plate-note {
  font-size: 0.74rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.artifact-body {
  padding: 10px 12px;
}

.artifact-name {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.artifact-desc {
  margin: 0;
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--ink-secondary);
}

.artifact-credit {
  margin: 5px 0 0;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.source-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-secondary);
}

.source-list li + li {
  margin-top: 4px;
}

/* ==========================================================================
   Bottom Precision Timeline Dock
   ========================================================================== */
.timeline-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  padding: 10px 16px 10px;
  background: var(--paper-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--paper-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.timeline-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.year-display-block {
  min-width: 240px;
}

.year-main-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.year-badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--cinnabar-soft);
  color: var(--cinnabar);
}

.year-readout {
  font-family: var(--font-serif);
  font-size: 1.42rem;
  font-weight: 700;
  color: var(--ink-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.bp-readout {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.era-summary {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--ink-secondary);
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--paper-muted);
  border: 1px solid var(--paper-border);
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 4px 9px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
}

.mode-btn.is-active {
  background: var(--paper-elevated);
  color: var(--ink-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.year-jump-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--paper-elevated);
  border: 1px solid var(--paper-border-strong);
}

.jump-label,
.jump-unit {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.year-jump-form input {
  width: 72px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.jump-btn {
  border: none;
  background: var(--bronze-teal);
  color: #fff;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.74rem;
  cursor: pointer;
}

.jump-btn:hover {
  background: var(--bronze-teal-dark);
}

.range-span-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.playback-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.step-btn,
.play-btn {
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-border-strong);
  background: var(--paper-elevated);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.step-btn {
  width: 30px;
}

.play-btn {
  padding: 0 12px;
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fff;
  font-weight: 600;
}

.play-btn:hover {
  filter: brightness(0.92);
}

.step-btn:hover {
  background: var(--paper-muted);
}

/* Slider Stage with Density Sparkline */
.slider-stage {
  position: relative;
  height: 44px;
  padding-top: 6px;
}

.density-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 26px;
  pointer-events: none;
  opacity: 0.75;
}

.timeline-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 12px 0 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--era-paleolithic) 0%,
    var(--era-paleolithic) 10%,
    var(--era-early-neo) 10%,
    var(--era-early-neo) 36%,
    var(--era-mid-neo) 36%,
    var(--era-mid-neo) 55%,
    var(--era-longshan) 55%,
    var(--era-longshan) 82%,
    var(--era-xia-shang) 82%,
    var(--era-xia-shang) 91%,
    var(--era-late-shang-zhou) 91%,
    var(--era-late-shang-zhou) 100%
  );
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cinnabar);
  border: 3px solid #fffaf0;
  box-shadow: 0 2px 8px rgba(31, 36, 39, 0.38);
  cursor: grab;
  transition: transform 0.12s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.16);
}

.timeline-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cinnabar);
  border: 3px solid #fffaf0;
  box-shadow: 0 2px 8px rgba(31, 36, 39, 0.38);
  cursor: grab;
}

.slider-ticks {
  position: relative;
  height: 16px;
  margin-top: 2px;
  font-size: 0.68rem;
  color: var(--ink-muted);
  user-select: none;
}

.slider-ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.slider-ticks span:first-child {
  transform: translateX(0);
}

.slider-ticks span:last-child {
  transform: translateX(-100%);
}

/* Milestone Bookmarks */
.milestone-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.milestone-bar::-webkit-scrollbar {
  display: none;
}

.milestone-btn {
  flex-shrink: 0;
  border: 1px solid var(--paper-border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.milestone-btn:hover {
  background: var(--bronze-teal);
  color: #fff;
  border-color: var(--bronze-teal);
}

.milestone-btn.is-near {
  background: var(--cinnabar-soft);
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  font-weight: 600;
}

/* ==========================================================================
   Custom Archaeological Map Markers & Tooltips
   ========================================================================== */
.arch-marker-wrap {
  background: transparent;
  border: none;
}

.arch-pin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #fffaf0;
  box-shadow: 0 1.5px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.arch-pin.is-major {
  width: 17px;
  height: 17px;
}

.arch-pin.is-major::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fffaf0;
}

.arch-pin:hover,
.arch-pin.is-selected {
  transform: scale(1.25);
  box-shadow: 0 0 0 4px rgba(166, 55, 40, 0.32), 0 4px 12px rgba(0, 0, 0, 0.42);
}

.arch-label-tag {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 3px);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(250, 247, 240, 0.92);
  border: 1px solid rgba(89, 71, 48, 0.28);
  color: var(--ink-primary);
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}

.arch-tooltip {
  background: var(--paper-solid) !important;
  border: 1px solid var(--paper-border-strong) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-md) !important;
  color: var(--ink-primary) !important;
  padding: 7px 10px !important;
  font-family: var(--font-sans) !important;
}

.arch-tooltip-title {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 700;
}

.arch-tooltip-sub {
  font-size: 0.74rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Native Modal Dialogs (Light-Dismiss + Scroll Containment per modern-web-guidance)
   ========================================================================== */
dialog.modal-dialog {
  padding: 0;
  border: 1px solid var(--paper-border-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-solid);
  color: var(--ink-primary);
  box-shadow: var(--shadow-lg);
  max-width: min(760px, 92vw);
  max-height: 88vh;
  overflow: hidden;
}

dialog.modal-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(20, 24, 27, 0.62);
  backdrop-filter: blur(3px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--paper-border);
  background: var(--paper-elevated);
}

.dialog-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.08rem;
  font-weight: 700;
}

.dialog-body {
  padding: 16px 20px 22px;
  overflow-y: auto;
  font-size: 0.86rem;
  line-height: 1.72;
  color: var(--ink-secondary);
}

.about-section + .about-section {
  margin-top: 16px;
}

.about-section h2 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 0.96rem;
  color: var(--ink-primary);
}

.about-section p {
  margin: 0 0 8px;
}

.ref-list {
  margin: 0;
  padding-left: 20px;
}

.ref-list li + li {
  margin-top: 5px;
}

.about-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.about-legend-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--paper-elevated);
  border: 1px solid var(--paper-border);
  font-size: 0.78rem;
}

/* Lightbox specific */
dialog.lightbox-dialog {
  max-width: min(860px, 94vw);
}

.lightbox-figure {
  margin: 0;
  padding: 16px;
  background: #171a1c;
  color: #f3ede0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  overflow-y: auto;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 66vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-figure figcaption {
  font-size: 0.84rem;
  line-height: 1.6;
  text-align: center;
  max-width: 680px;
  color: #e4ddd0;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 960px) {
  .brand-subtitle {
    display: none;
  }

  .search-box input {
    width: 130px;
  }

  .left-panel {
    width: 280px;
  }

  .right-panel {
    width: 360px;
  }
}

@media (max-width: 720px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .side-panel {
    top: 164px;
    bottom: 184px;
  }

  .left-panel,
  .right-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .year-readout {
    font-size: 1.18rem;
  }
}
