/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

button, input, select, textarea { font-family: inherit; }

:root {
  --bg:          #161616;
  --surface:     #1e1e1e;
  --surface2:    #252525;
  --surface3:    #2d2d2d;
  --border:      #2e2e2e;
  --border-hi:   #3c3c3c;
  --text:        #e3e1dc;
  --text-dim:    #bfb9b1;
  --muted:       #969696;
  --muted-hi:    #9a9690;
  --accent:      #e74c3c;
  --accent2:     #9b59b6;
  --accent3:     #f39c12;
  --green:       #2ecc71;
  --warn:        #e67e22;
  --header-h:    52px;
  --panel-w:     320px;
  --radius:      5px;
  --radius-sm:   3px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --mono:        ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', 'Courier New', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Header ───────────────────────────────────────────────────── */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  z-index: 1000;
}

#brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
#brand-icon { font-size: 20px; line-height: 1; }
#brand-name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.015em;
  white-space: nowrap;
  color: var(--text);
}

#coord-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

#coord-bar label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

#coord-bar input {
  width: 106px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid #686868;
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
  transition: border-color 0.12s, box-shadow 0.12s;
}
#coord-bar input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
#coord-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

#query-btn, #clear-btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.12s, opacity 0.12s, transform 0.08s;
}
#query-btn {
  background: var(--accent);
  color: #fff;
}
#query-btn:hover  { background: #d44232; }
#query-btn:active { transform: translateY(1px); opacity: 0.88; }

#clear-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 5px 9px;
}
#clear-btn:hover  { color: var(--text); border-color: var(--border-hi); }
#clear-btn:active { transform: translateY(1px); }

#header-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
#header-status.status-error   { color: var(--accent); }
#header-status.status-warn    { color: var(--warn); }
#header-status.status-success { color: var(--green); }

/* ── Main layout ──────────────────────────────────────────────── */
#main {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
}

/* ── Map ──────────────────────────────────────────────────────── */
#map-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-container { background: #b8d4e8; }

#map-overlay-loading {
  position: absolute;
  inset: 0;
  background: rgba(22, 22, 22, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 500;
  font-size: 15px;
  color: var(--muted);
}

/* ── Eruption timeline strip ──────────────────────────────────── */
#tl-strip {
  width: 32px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Post-1790 marks area */
#tl-post1790 {
  flex: 3;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

#tl-marks {
  position: absolute;
  inset: 16px 2px 16px 2px;
}

/* Individual eruption mark */
.tl-mark {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 1px;
  opacity: 0.6;
  transition: opacity 0.12s, box-shadow 0.12s;
}
.tl-mark-active { opacity: 1 !important; box-shadow: 0 0 0 2px #fff; }
.tl-mark-dim    { opacity: 0.3; }

/* Year label */
.tl-edge {
  position: absolute;
  left: 0; right: 0;
  font-size: 9px;
  color: var(--muted-hi);
  text-align: center;
  user-select: none;
  pointer-events: none;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.tl-edge-top { top: 2px; }

/* Pre-1790 geologic band */
#tl-pre1790 {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1px;
  overflow: hidden;
}

#tl-pre1790-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
  writing-mode: vertical-rl;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}

#tl-pre1790-band {
  flex: 1;
  align-self: stretch;
  position: relative;
  border-radius: 2px;
  background: #4a4a4a;
}

.tl-pre1790-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 1px;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
}


/* ── 1790 boundary label ──────────────────────────────────────── */
#tl-1790-label {
  flex-shrink: 0;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
  padding: 0 0 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  user-select: none;
  pointer-events: none;
}

/* ── Era divider ──────────────────────────────────────────────── */
#tl-divider {
  flex-shrink: 0;
  height: 2px;
  background: var(--muted);
  margin: 0 2px;
}

/* ── Right panel (tabbed) ─────────────────────────────────────── */
#right-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Tab bar ──────────────────────────────────────────────────── */
#panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 0.12s, border-bottom-color 0.12s;
  white-space: nowrap;
}
.panel-tab:hover { color: var(--text-dim); }
.panel-tab.active,
.panel-tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── Tab content ──────────────────────────────────────────────── */
.tab-content {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.tab-content.active { display: flex; }

/* ── Panel headers ────────────────────────────────────────────── */
#layer-panel-header,
#results-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#layer-panel-header h2,
#results-header h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

#results-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted-hi);
  font-variant-numeric: tabular-nums;
}

/* ── Data gaps ────────────────────────────────────────────────── */
#data-gaps-section {
  border-bottom: 1px solid var(--border);
}

.section-toggle {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.1s;
}
.section-toggle:hover { background: var(--surface2); }

#data-gaps-list {
  list-style: none;
  padding: 0 14px 10px;
  display: none;
}
#data-gaps-list.open { display: block; }
#data-gaps-list li {
  font-size: 13px;
  color: var(--warn);
  padding: 4px 0;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

#gap-count {
  margin-left: 3px;
  background: var(--warn);
  color: #fff;
  border-radius: 10px;
  padding: 0 5px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ── Layer groups ─────────────────────────────────────────────── */
#layer-groups {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.layer-group {
  margin-bottom: 1px;
}

.layer-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.layer-group-header:hover,
.layer-group-header:focus-visible { background: var(--surface2); }

.group-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.group-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}
.group-label a {
  color: inherit;
  text-decoration: none;
}
.group-label a:hover { text-decoration: underline; }

.group-count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.group-toggle {
  width: 30px;
  height: 16px;
  background: var(--surface3);
  border: 1px solid #757575;
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s;
  cursor: pointer;
}
.group-toggle.on { background: var(--accent); border-color: var(--accent); }
.group-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
  transition: transform 0.18s;
}
.group-toggle.on::after { transform: translateX(14px); }
.group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Layer detail (expandable) */
.layer-detail {
  display: none;
  padding: 7px 14px 9px 34px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.layer-group.expanded .layer-detail { display: block; }

.layer-visibility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.layer-visibility-label {
  font-size: 13px;
  color: var(--muted);
}

.layer-source {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.5;
}
.layer-source a {
  color: var(--muted-hi);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border-hi);
  transition: color 0.12s;
}
.layer-source a:hover { color: var(--text); text-decoration-color: var(--muted); }

.layer-type-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--muted);
}

.layer-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 4px;
}
.layer-note.warn { color: var(--warn); }

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-hi);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.large { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes expand-btn-bounce {
  0%, 100% { transform: translateY(0); }
  35%       { transform: translateY(5px); }
  65%       { transform: translateY(1px); }
}

/* ── Results panel ────────────────────────────────────────────── */
#results-content {
  overflow-y: auto;
  flex: 1;
  padding: 10px;
}

.muted { color: var(--muted); }
.hint  { font-size: 14px; line-height: 1.65; color: var(--muted-hi); }

/* ── Flow cards ───────────────────────────────────────────────── */
.flow-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.flow-card:last-child { margin-bottom: 0; }

.flow-card.highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.22), 0 2px 8px rgba(0,0,0,0.35);
}

.flow-card-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.flow-card-header:hover { background: rgba(255,255,255,0.03); }

.flow-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-top: 4px;
  flex-shrink: 0;
}

.flow-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  color: #edebe6;
}

.flow-code {
  font-size: 14px;
  font-family: var(--mono);
  color: #b5b1ab;
  line-height: 1.3;
  margin-top: 1px;
}

.flow-meta {
  font-size: 14px;
  color: #b5b1ab;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.flow-meta.missing   { color: var(--warn); }
.flow-meta.secondary { color: #959595; }
.flow-meta-raw       { font-size: 13px; color: #959595; }

.flow-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.order-badge {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface3);
  border-radius: 8px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.flow-source-tag {
  font-size: 12px;
  color: var(--muted-hi);
  background: var(--surface3);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  padding: 1px 7px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}
.flow-source-tag:hover { color: var(--text); border-color: var(--accent2); }

.flow-expand-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  padding: 1px 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.1s;
  animation: expand-btn-bounce 0.55s ease-out 0.7s 1 both;
}
.flow-expand-btn:hover { color: var(--text); background: var(--surface3); }

.group-expand-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 1px 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color 0.12s, background 0.1s;
}
.group-expand-btn:hover { color: var(--text); background: var(--surface3); }

/* Expandable attributes */
.flow-attrs {
  display: none;
  padding: 8px 11px 11px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.flow-attrs.open { display: block; }

.flow-card-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 6px 4px;
}

/* Attribute table */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.attr-table tr:nth-child(even) td { background: rgba(255,255,255,0.03); }
.attr-table td {
  padding: 3px 5px;
  font-size: 14px;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.45;
}
.attr-key {
  width: 42%;
  color: #959595;
  white-space: normal;
  word-break: break-word;
  padding-right: 10px;
  font-size: 11px;
}
.attr-val { color: #d9d5cf; }

.geo-context-header {
  margin: 10px 0 4px;
  padding: 4px 0 4px 3px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-hi);
  border-top: 1px solid var(--border);
}

/* ── Welcome card ─────────────────────────────────────────────── */
.welcome-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  padding: 32px 20px;
  text-align: center;
}
.welcome-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted-hi);
  line-height: 1.65;
}

/* ── No-results / error states ────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 32px 16px;
}

.no-results-icon {
  font-size: 24px;
  margin-bottom: 12px;
  line-height: 1;
  color: var(--border-hi);
}

.no-results-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  line-height: 1.4;
}

.no-results-hint {
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

/* ── Welcome modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  padding: 32px 28px;
  max-width: 380px;
  width: calc(100% - 40px);
  text-align: center;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.modal-body {
  font-size: 15px;
  color: var(--muted-hi);
  line-height: 1.65;
  margin-bottom: 24px;
}

.modal-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.12s, transform 0.08s;
}
.modal-btn:hover  { background: #d44232; }
.modal-btn:active { transform: translateY(1px); }

/* ── Leaflet overrides ────────────────────────────────────────── */
.leaflet-control-attribution {
  background: rgba(0,0,0,0.65) !important;
  color: rgba(255,255,255,0.6) !important;
  font-size: 9px !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 3px 0 0 0 !important;
}
.leaflet-control-attribution a { color: rgba(255,255,255,0.6) !important; }

.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { font-size: 14px; }

.flow-popup-title {
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.flow-popup-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.flow-popup-sublabel {
  font-weight: 400;
  color: var(--muted);
}

.flow-popup-row    { font-size: 13px; margin-top: 2px; }
.flow-popup-date   { color: var(--text); }
.flow-popup-vent   { color: var(--muted); }
.flow-popup-source { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Volcano markers ──────────────────────────────────────────── */
.volcano-swatch {
  background: #ffb347;
  border: 1.5px solid #ff8c00;
  border-radius: 50%;
  width: 12px;
  height: 12px;
}

.volcano-popup-wrapper .leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #ff8c00;
}
.volcano-popup-wrapper .leaflet-popup-tip { background: var(--surface); }

.volcano-popup-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.volcano-popup-row {
  display: flex;
  gap: 6px;
  font-size: 13px;
  padding: 2px 0;
}

.volcano-popup-key {
  color: var(--muted);
  flex-shrink: 0;
  min-width: 80px;
}

/* Pin tooltip */
.pin-tooltip {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Scrollbars ───────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 5px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--border-hi); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--muted); }

/* ── Drawer handle (desktop: hidden) ─────────────────────────── */
#drawer-handle { display: none; }

/* ── Horizontal timeline strip (desktop: hidden) ─────────────── */
#tl-strip-h { display: none; }

/* ── Horizontal timeline internals ───────────────────────────── */
#tl-strip-h {
  flex-shrink: 0;
  height: 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-direction: row;
  overflow: hidden;
}

/* pre-1790 column */
#tl-h-pre1790 {
  min-width: 56px;
  width: 56px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

#tl-h-pre-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

#tl-h-pre-bar {
  flex: 1;
  position: relative;
  background: #4a4a4a;
  margin: 0 0 2px;
  border-radius: 1px;
}

#tl-h-divider {
  width: 1px;
  flex-shrink: 0;
  background: var(--border);
}

#tl-h-post1790 {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#tl-h-year-row {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 2px 4px 1px;
}

#tl-h-1790,
#tl-h-year-now {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
}

#tl-h-marks {
  flex: 1;
  position: relative;
  margin: 0 4px 2px;
}

.tl-h-mark {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 1px;
  opacity: 0.6;
  transition: opacity 0.12s, box-shadow 0.12s;
}

/* ── Mobile responsive ────────────────────────────────────────── */
@media (max-width: 767px) {

  :root { --header-h: 44px; }
  #brand-name    { display: none; }
  #header-status { display: none; }
  #header        { gap: 8px; padding: 0 10px; }
  #coord-bar     { gap: 4px; }
  #coord-bar label { display: none; }
  #coord-bar input { width: 76px; padding: 5px 6px; }
  #query-btn     { padding: 5px 9px; }

  #tl-strip { display: none; }
  #map-wrap { width: 100%; }

  /* Right panel → bottom drawer */
  #right-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto;
    height: 55vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    transform: translateY(calc(100% - 36px));
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 900;
    will-change: transform;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  }
  #right-panel.drawer-open { transform: translateY(0); }

  /* Show drag handle */
  #drawer-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 36px;
    cursor: grab;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
  }
  #drawer-handle:active { cursor: grabbing; }

  #drawer-handle-bar {
    width: 32px;
    height: 4px;
    background: var(--border-hi);
    border-radius: 2px;
  }

  /* Show horizontal timeline */
  #tl-strip-h { display: flex; }

  #results-content { -webkit-overflow-scrolling: touch; }
}
