/* ===== The Tree of Life — dark, primordial → living ===== */
:root {
  --bg: #05070f;
  --ink: #e9edf6;
  --ink-dim: #98a2bd;
  --ink-faint: #5a6483;
  --line: rgba(140, 158, 205, 0.13);
  --panel-bg: rgba(11, 15, 27, 0.93);
  --card-bg: rgba(16, 21, 38, 0.98);
  --accent: #7fbfb0;
  --c-organism: #7fd68a;
  --c-innovation: #5cc6ff;
  --c-extinction: #ff6b6b;
  --c-discovery: #e0b0ff;
  --c-lineage: #cdd8f0;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --topbar-h: 52px;
  --tabs-h: 54px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; }

#ambience { position: fixed; inset: 0; z-index: 0; }
#map {
  position: fixed; inset: 0; z-index: 1; width: 100vw; height: 100vh;
  touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none;
}
#map.dragging { cursor: grabbing; }
#scrubber { user-select: none; -webkit-user-select: none; }

/* ---- top bar ---- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: linear-gradient(to bottom, rgba(5,7,15,0.9), rgba(5,7,15,0.5) 75%, transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
#brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
#brand h1 {
  font-family: var(--serif); font-size: 19px; font-weight: 500; letter-spacing: 0.05em;
  background: linear-gradient(100deg, #bfead0, #7fd6b0 45%, #8fc0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap;
}
#progress-counter { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
#searchbox { position: relative; flex: 1; max-width: 360px; }
#search {
  width: 100%; padding: 7px 12px; background: rgba(19, 25, 45, 0.8);
  border: 1px solid rgba(120, 150, 200, 0.22); border-radius: 17px;
  color: var(--ink); font-size: 13px; outline: none; transition: border-color 0.2s, background 0.2s;
}
#search:focus { border-color: rgba(130, 200, 175, 0.55); background: rgba(21, 28, 52, 0.94); }
#search::placeholder { color: var(--ink-faint); }
#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card-bg);
  border: 1px solid rgba(120, 150, 200, 0.25); border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6); max-height: 60vh; overflow-y: auto;
}
.search-item { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.search-item .si-date { margin-left: auto; color: var(--ink-faint); font-size: 11px; white-space: nowrap; }
.search-item .si-cat { font-size: 9.5px; padding: 1px 6px; border-radius: 8px; flex-shrink: 0; text-transform: capitalize; font-weight: 600; }
.search-item:hover, .search-item.active { background: rgba(90, 160, 140, 0.16); }

#topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
#year-pill {
  font-size: 13px; font-variant-numeric: tabular-nums; color: #d3e0dc; padding: 4px 13px;
  background: rgba(19, 25, 45, 0.8); border: 1px solid rgba(120, 150, 200, 0.22);
  border-radius: 15px; min-width: 110px; text-align: center; white-space: nowrap;
  display: flex; flex-direction: column; line-height: 1.15;
}
.pill-era { font-size: 9px; letter-spacing: 0.08em; color: var(--ink-faint); text-transform: uppercase; }
#zoom-controls { display: flex; gap: 4px; }
#zoom-controls button, #about-btn {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(19, 25, 45, 0.8);
  border: 1px solid rgba(120, 150, 200, 0.22); color: var(--ink-dim); font-size: 15px; line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
#zoom-controls button:hover, #about-btn:hover { color: #fff; border-color: rgba(130,200,175,0.5); }
#linear-btn.on { color: #8fe0c4; border-color: rgba(130,224,196,0.6); background: rgba(60,120,105,0.28); }

/* ---- scrubber ---- */
#scrubber {
  position: fixed; left: 0; top: var(--topbar-h); width: 58px;
  height: calc(100vh - var(--topbar-h) - var(--tabs-h)); z-index: 10;
  touch-action: none; cursor: pointer;
}
.scrub-track { fill: rgba(9, 12, 24, 0.72); stroke: rgba(120, 150, 200, 0.14); stroke-width: 1; }
.scrub-window { fill: rgba(130, 210, 180, 0.15); stroke: rgba(130, 210, 180, 0.5); stroke-width: 1; cursor: grab; }
.scrub-tick { stroke: rgba(150, 165, 210, 0.32); }
.scrub-tick-label { fill: var(--ink-dim); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.scrub-era-label { fill: rgba(150, 168, 210, 0.55); font-size: 7.5px; letter-spacing: 0.1em; text-transform: uppercase; text-anchor: middle; }
.scrub-center { stroke: #ffd27a; stroke-width: 1; opacity: 0.7; }

/* ---- clear-highlight floating button ---- */
#clear-hl {
  position: fixed; left: 68px; top: calc(var(--topbar-h) + 10px); z-index: 18;
  padding: 6px 13px; font-size: 12px; color: #d9e2f2;
  background: rgba(18, 24, 44, 0.9); border: 1px solid rgba(130, 155, 235, 0.4);
  border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
#clear-hl:hover { border-color: rgba(150,180,255,0.7); color: #fff; }

/* ---- tabs ---- */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--tabs-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; padding: 0 12px;
  background: linear-gradient(to top, rgba(5,7,15,0.94), rgba(5,7,15,0.6) 75%, transparent);
}
#tab-group { display: flex; gap: 3px; }
.tab {
  --tc: #9db8ff; display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
  background: transparent; border: 1px solid transparent; border-radius: 17px;
  color: var(--ink-dim); font-size: 12.5px; transition: all 0.2s; white-space: nowrap;
}
.tab::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tc); opacity: 0.55; flex-shrink: 0; transition: opacity 0.2s, box-shadow 0.2s; }
.tab[data-tab="lineages"] { --tc: #cdd8f0; }
.tab[data-tab="organisms"] { --tc: #7fd68a; }
.tab[data-tab="innovations"] { --tc: #5cc6ff; }
.tab[data-tab="extinctions"] { --tc: #ff6b6b; }
.tab[data-tab="discovery"] { --tc: #e0b0ff; }
.tab:hover { color: var(--ink); }
.tab:hover::before { opacity: 0.9; }
.tab.active {
  color: #fff; background: color-mix(in srgb, var(--tc) 14%, transparent);
  border-color: color-mix(in srgb, var(--tc) 45%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 20%, transparent);
}
.tab.active::before { opacity: 1; box-shadow: 0 0 8px var(--tc); }
#tab-tools { display: flex; gap: 6px; }
#tab-tools button {
  padding: 7px 12px; background: rgba(19, 25, 45, 0.8); border: 1px solid rgba(120, 150, 200, 0.22);
  border-radius: 15px; color: var(--ink-dim); font-size: 12.5px; transition: color 0.15s, border-color 0.15s;
}
#tab-tools button:hover { color: #fff; border-color: rgba(130,200,175,0.5); }

/* ---- map svg: eon & period bands ---- */
.eon-band { fill: rgba(255,255,255,0.010); }
.eon-band.alt { fill: rgba(120,145,220,0.026); }
.eon-line { stroke: rgba(150, 168, 220, 0.16); stroke-width: 1; stroke-dasharray: 2 6; }
.eon-label {
  fill: rgba(165, 180, 225, 0.32); font-family: var(--serif);
  letter-spacing: 0.34em; text-transform: uppercase; text-anchor: middle; pointer-events: none;
}
.period-line { stroke: rgba(150, 165, 215, 0.12); stroke-width: 1; stroke-dasharray: 1 7; }
.period-label { fill: rgba(150, 168, 210, 0.5); font-size: 9px; letter-spacing: 0.06em; pointer-events: none; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.grid-label { fill: var(--ink-faint); font-size: 10px; font-variant-numeric: tabular-nums; pointer-events: none; }

/* ---- extinction bands ---- */
.extinct-band { fill: rgba(255, 70, 70, 0.05); cursor: pointer; transition: fill 0.4s; }
.extinct-band:hover { fill: rgba(255, 90, 90, 0.12); }
.extinct-band.pulse { fill: rgba(255, 80, 80, 0.2); animation: extinct-pulse 1.4s ease-in-out infinite; }
@keyframes extinct-pulse { 0%,100% { fill: rgba(255,80,80,0.10); } 50% { fill: rgba(255,90,90,0.28); } }
.extinct-line { stroke: rgba(255, 90, 90, 0.4); stroke-width: 1; stroke-dasharray: 5 4; pointer-events: none; }
.extinct-label {
  fill: rgba(255, 150, 150, 0.85); font-size: 10px; letter-spacing: 0.08em; text-anchor: end;
  cursor: pointer; paint-order: stroke; stroke: rgba(5,7,16,0.7); stroke-width: 2.5px;
}

/* ---- tree ribbons ---- */
.ribbon { opacity: 0.94; transition: opacity 0.35s, filter 0.25s; cursor: pointer; }
.ribbon:hover { opacity: 1; filter: brightness(1.32) saturate(1.2); }
.ribbon.selected { opacity: 1; filter: brightness(1.4) saturate(1.3); }
.ribbon.dim { opacity: 0.14; filter: saturate(0.35) brightness(0.7); }
.ribbon.lit { opacity: 1; filter: brightness(1.5) saturate(1.4); }
.ribbon.killed { opacity: 0.85; filter: brightness(0.55) saturate(0.5) hue-rotate(-18deg); }
.ribbon.survivor { opacity: 1; filter: brightness(1.55) saturate(1.45); }
.ribbon-label {
  fill: rgba(255,255,255,0.94); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  text-anchor: middle; cursor: pointer; pointer-events: auto;
  paint-order: stroke; stroke: rgba(2,4,10,0.62); stroke-width: 2.8px;
}

/* ---- biodiversity curve ---- */
.curve-line { fill: none; stroke: rgba(130, 220, 180, 0.5); stroke-width: 1.6; pointer-events: none; filter: drop-shadow(0 0 3px rgba(130,220,180,0.4)); }

/* ---- markers ---- */
.marker { cursor: pointer; }
.marker .m-label {
  font-size: 11px; fill: #d0dbf0; paint-order: stroke; stroke: rgba(4,6,14,0.8); stroke-width: 2.6px; cursor: pointer;
}
.marker.visited .m-label { fill: #8790b0; }
.marker.visited .m-core { opacity: 0.72; }
.marker .m-ring { fill: none; stroke-width: 1.2; opacity: 0; }
.marker.selected .m-ring { opacity: 0.95; }
.marker .m-halo { pointer-events: none; }

.cluster { cursor: pointer; }
.cluster circle { fill: rgba(80, 100, 150, 0.28); stroke: rgba(140, 165, 225, 0.42); stroke-width: 1; }
.cluster text { fill: #aeb9de; font-size: 10px; text-anchor: middle; pointer-events: none; }
.cluster:hover circle { fill: rgba(105, 130, 200, 0.42); }

.thread { fill: none; stroke-width: 1.4; opacity: 0.72; pointer-events: none; }
.thread-dot { cursor: pointer; stroke: #05070e; stroke-width: 1.5; }
.thread-label { font-size: 11px; font-weight: 600; cursor: pointer; paint-order: stroke; stroke: rgba(4,6,14,0.85); stroke-width: 2.6px; }
.thread-label:hover { fill: #fff !important; }

/* ---- panel ---- */
#panel {
  position: fixed; top: var(--topbar-h); right: 0; bottom: var(--tabs-h); width: min(408px, 92vw); z-index: 30;
  background: var(--panel-bg); backdrop-filter: blur(14px); border-left: 1px solid rgba(120, 150, 200, 0.2);
  transform: translateX(105%); transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.3, 1);
  display: flex; flex-direction: column;
}
#panel.open { transform: translateX(0); }
#panel-close {
  position: absolute; top: 10px; right: 12px; z-index: 2; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(9, 12, 24, 0.72); border: 1px solid rgba(120,150,200,0.25); color: var(--ink-dim); font-size: 17px;
}
#panel-close:hover { color: #fff; }
#panel-scroll { overflow-y: auto; padding: 0 0 24px; height: 100%; }
#panel-image { width: 100%; height: 200px; background-size: cover; background-position: center 25%; position: relative; touch-action: pan-y; transition: background-image 0.15s; }
#panel-image::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(to bottom, transparent 40%, var(--panel-bg)); pointer-events: none; }
.img-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 32px; height: 32px; border-radius: 50%; background: rgba(7, 9, 20, 0.62); border: 1px solid rgba(150, 165, 215, 0.3); color: #dde4f5; font-size: 19px; line-height: 1; opacity: 0.65; transition: opacity 0.15s, background 0.15s; }
.img-nav:hover { opacity: 1; background: rgba(7, 9, 20, 0.85); }
#img-prev { left: 10px; } #img-next { right: 10px; }
#img-count { position: absolute; left: 12px; bottom: 12px; z-index: 2; font-size: 10.5px; color: #dde4f5; font-variant-numeric: tabular-nums; background: rgba(7, 9, 20, 0.62); border-radius: 9px; padding: 2px 8px; }
#panel-head { padding: 18px 22px 0; }
#panel-category { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; padding: 2px 9px; border-radius: 9px; border: 1px solid currentColor; }
#panel-title { font-family: var(--serif); font-size: 24px; font-weight: 500; margin: 10px 0 3px; }
#panel-rank { color: var(--ink-dim); font-size: 12px; letter-spacing: 0.04em; margin-bottom: 2px; }
#panel-date { color: #ffd27a; font-size: 13px; font-variant-numeric: tabular-nums; }
#panel-living { margin-top: 6px; font-size: 12.5px; color: #8fe0b8; }
#panel-blurb { padding: 14px 22px 4px; font-size: 14.5px; line-height: 1.65; color: #d6dcee; }
#panel-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 22px 2px; }
.panel-action {
  padding: 6px 12px; font-size: 12.5px; background: rgba(90, 160, 140, 0.14);
  border: 1px solid rgba(120, 200, 175, 0.34); border-radius: 13px; color: #bfe8d8; transition: all 0.15s;
}
.panel-action:hover { background: rgba(90, 170, 145, 0.28); color: #fff; }
#panel-related-wrap { padding: 14px 22px 0; }
#panel-related-wrap h3 { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 9px; font-weight: 600; }
#panel-related { display: flex; flex-wrap: wrap; gap: 7px; }
.related-chip { padding: 5px 12px; font-size: 12.5px; background: rgba(100, 130, 220, 0.12); border: 1px solid rgba(120, 150, 235, 0.3); border-radius: 14px; color: #bcd0f7; transition: all 0.15s; }
.related-chip:hover { background: rgba(110, 140, 230, 0.28); color: #fff; }
#panel-wiki { display: inline-block; margin: 18px 22px 0; color: var(--accent); font-size: 13px; text-decoration: none; border-bottom: 1px solid rgba(127, 191, 176, 0.35); padding-bottom: 1px; }
#panel-wiki:hover { border-bottom-color: var(--accent); }

/* ---- slice / dialogs ---- */
#slice, #clock {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 40;
  width: min(680px, 94vw); max-height: 74vh; background: var(--card-bg);
  border: 1px solid rgba(120, 150, 200, 0.28); border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.7); display: flex; flex-direction: column; overflow: hidden;
}
#clock { width: min(460px, 94vw); }
#slice-head, #clock-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 10px; border-bottom: 1px solid var(--line); }
#slice-head h2, #clock-head h2 { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.slice-sub { color: var(--ink-faint); font-size: 13px; font-family: var(--font); }
#slice-close, #clock-close { background: none; border: none; color: var(--ink-dim); font-size: 20px; }
#slice-close:hover, #clock-close:hover { color: #fff; }
#slice-body { overflow-y: auto; padding: 6px 20px 18px; }
.slice-group { margin-top: 12px; }
.slice-group h3 { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 6px; font-weight: 600; }
.slice-item { display: flex; gap: 10px; align-items: baseline; padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.slice-item:hover { background: rgba(90, 150, 135, 0.14); }
.slice-item .sl-date { color: var(--ink-faint); font-size: 11.5px; min-width: 96px; font-variant-numeric: tabular-nums; text-transform: capitalize; }
.slice-empty { color: var(--ink-faint); font-size: 13px; padding: 12px 8px; }

/* clock */
#clock-sub { padding: 12px 20px 4px; font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
#clock-body { overflow-y: auto; padding: 4px 20px 6px; }
.clock-row { display: flex; gap: 14px; align-items: baseline; padding: 4px 0; font-size: 13.5px; border-bottom: 1px solid rgba(140,158,205,0.06); }
.clock-time { color: #8fe0c4; font-variant-numeric: tabular-nums; min-width: 74px; font-weight: 600; }
.clock-foot { padding: 10px 20px 4px; font-size: 12px; color: var(--ink-faint); font-style: italic; line-height: 1.5; }
#clock-toggle { margin: 10px 20px 18px; padding: 7px 15px; background: rgba(90, 160, 140, 0.16); border: 1px solid rgba(120, 200, 175, 0.35); border-radius: 14px; color: #cdeede; align-self: flex-start; }

/* ---- tours / convergence menus ---- */
#tour-menu, #conv-menu { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 10, 0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; }
#tour-menu-card, #conv-menu-card { width: min(500px, 92vw); max-height: 84vh; overflow-y: auto; background: var(--card-bg); border: 1px solid rgba(120, 150, 200, 0.28); border-radius: 14px; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,0.7); }
#tour-menu-card h2, #conv-menu-card h2 { font-family: var(--serif); font-weight: 500; margin-bottom: 14px; }
.conv-intro { font-size: 13px; color: var(--ink-dim); line-height: 1.55; margin-bottom: 14px; }
.tour-option, .conv-option { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; background: rgba(90, 150, 135, 0.09); border: 1px solid rgba(120, 200, 175, 0.22); border-radius: 10px; color: var(--ink); transition: all 0.15s; }
.tour-option:hover, .conv-option:hover { background: rgba(90, 160, 140, 0.2); }
.tour-option b, .conv-option b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.tour-option span, .conv-option span { display: block; font-size: 12.5px; color: var(--ink-dim); }
.tour-option .tour-stops { font-size: 11px; color: var(--ink-faint); margin-top: 3px; }
#tour-menu-close, #conv-menu-close { margin-top: 6px; padding: 7px 16px; background: none; border: 1px solid rgba(120,150,200,0.3); border-radius: 14px; color: var(--ink-dim); }

#tour-hud { position: fixed; bottom: calc(var(--tabs-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 35; width: min(560px, 92vw); background: var(--card-bg); border: 1px solid rgba(130, 200, 175, 0.35); border-radius: 14px; padding: 14px 18px 12px; box-shadow: 0 12px 50px rgba(40, 120, 100, 0.2), 0 12px 50px rgba(0,0,0,0.5); }
#tour-note { font-size: 13.5px; line-height: 1.5; color: #d6ecdf; margin-bottom: 10px; }
#tour-controls { display: flex; align-items: center; gap: 10px; }
#tour-controls button { padding: 6px 14px; background: rgba(90, 160, 140, 0.16); border: 1px solid rgba(120, 200, 175, 0.35); border-radius: 13px; color: #cdeede; font-size: 12.5px; }
#tour-controls button:hover:not(:disabled) { background: rgba(90, 170, 145, 0.3); color: #fff; }
#tour-controls button:disabled { opacity: 0.35; cursor: default; }
#tour-progress { font-size: 12px; color: var(--ink-dim); margin: 0 auto; }
#tour-exit { margin-left: auto; }

/* ---- toast / hint / about ---- */
#toast { position: fixed; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px; max-width: min(560px, 92vw); background: var(--card-bg); border: 1px solid rgba(130, 200, 175, 0.32); border-radius: 12px; padding: 10px 16px; font-size: 13px; color: #dceee6; box-shadow: 0 10px 40px rgba(0,0,0,0.55); animation: toast-in 0.5s cubic-bezier(0.22, 0.9, 0.3, 1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } }
#toast button { background: none; border: none; color: var(--ink-dim); font-size: 16px; flex-shrink: 0; }
#toast-text b { color: #9fe6cc; }
.toast-link { color: #8fd0ff !important; text-decoration: underline; font-size: 12.5px !important; }
#intro-hint { position: fixed; bottom: calc(var(--tabs-h) + 16px); left: 50%; transform: translateX(-50%); z-index: 15; font-size: 12.5px; color: var(--ink-dim); background: rgba(11, 15, 27, 0.82); padding: 8px 18px; border-radius: 16px; border: 1px solid var(--line); pointer-events: none; transition: opacity 1s; }
#intro-hint.fade { opacity: 0; }
#about { position: fixed; inset: 0; z-index: 50; background: rgba(3, 4, 10, 0.65); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; }
#about-card { width: min(580px, 92vw); max-height: 84vh; overflow-y: auto; background: var(--card-bg); border: 1px solid rgba(120, 150, 200, 0.28); border-radius: 14px; padding: 26px; }
#about-card h2 { font-family: var(--serif); font-weight: 500; margin-bottom: 12px; }
#about-card p { font-size: 13.5px; line-height: 1.66; color: #cfd6ea; margin-bottom: 12px; }
#about-card kbd { background: rgba(120, 150, 200, 0.18); border: 1px solid rgba(120,150,200,0.3); border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: inherit; }
.about-fine { font-size: 12px !important; color: var(--ink-faint) !important; }
#about-close { padding: 7px 18px; background: rgba(90, 160, 140, 0.16); border: 1px solid rgba(120, 200, 175, 0.35); border-radius: 14px; color: #cdeede; }

/* category chip colors */
.cat-lineage { color: var(--c-lineage); }
.cat-organism { color: var(--c-organism); }
.cat-innovation { color: var(--c-innovation); }
.cat-extinction { color: var(--c-extinction); }
.cat-discovery { color: var(--c-discovery); }
.related-chip.cat-lineage { color: #cdd8f0; border-color: rgba(205,216,240,0.3); }
.related-chip.cat-organism { color: #9fe0a8; border-color: rgba(127,214,138,0.3); }
.related-chip.cat-innovation { color: #9ad8ff; border-color: rgba(92,198,255,0.3); }
.related-chip.cat-extinction { color: #ff9a9a; border-color: rgba(255,107,107,0.3); }
.related-chip.cat-discovery { color: #ecc8ff; border-color: rgba(224,176,255,0.3); }

/* ---- mobile ---- */
@media (max-width: 720px) {
  :root { --topbar-h: 92px; --tabs-h: 50px; }
  #topbar { flex-wrap: wrap; padding: 6px 10px; gap: 8px; height: var(--topbar-h); }
  #brand h1 { font-size: 16px; }
  #progress-counter { display: none; }
  #searchbox { order: 3; flex-basis: 100%; max-width: none; }
  #year-pill { min-width: 92px; font-size: 12px; padding: 3px 9px; }
  #scrubber { width: 44px; }
  #tab-group { overflow-x: auto; scrollbar-width: none; }
  .tab { padding: 6px 8px; font-size: 11px; gap: 4px; }
  .tab::before { width: 6px; height: 6px; }
  #tab-tools button { padding: 6px 8px; font-size: 12px; }
  #clear-hl { left: 52px; font-size: 11px; padding: 5px 10px; }
  #panel { top: auto; left: 0; right: 0; bottom: var(--tabs-h); width: 100%; max-height: 60vh; height: auto; border-left: none; border-top: 1px solid rgba(120, 150, 200, 0.25); border-radius: 16px 16px 0 0; transform: translateY(110%); }
  #panel.open { transform: translateY(0); }
  #panel-image { height: 140px; }
  #tour-hud { width: 94vw; }
}
