/* Dünya Dillerinin Tarihsel Atlası — minimalist high-contrast UI */
:root {
  --bg: #0e141d;
  --ink: #f4f6f9;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;
  --gold: #eab962;
  --gold-2: #f6d58e;
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.22);
  --glass: rgba(14, 19, 28, 0.93);
  --glass-2: rgba(22, 29, 41, 0.96);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38), 0 1px 4px rgba(0, 0, 0, 0.28);
  --serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --top: 62px;
  --tl-h: 112px;
  --gap: 12px;
  --left-w: 320px;
  --right-w: 400px;
  --r: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--gold-2); }
::selection { background: rgba(234, 185, 98, 0.32); }

#scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.vignette { display: none; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(14, 19, 28, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 20; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand h1 {
  margin: 0; font: 600 18px/1.15 var(--sans); letter-spacing: -0.01em; color: var(--ink); text-shadow: none;
}
.brand p {
  margin: 2px 0 0; font-size: 12px; letter-spacing: 0.01em; text-transform: none; color: var(--ink-3);
}
.tools { margin-left: auto; display: flex; gap: 8px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  color: var(--ink-2); font-size: 13px; font-weight: 500; transition: all 0.2s ease;
}
.tbtn svg { width: 16px; height: 16px; fill: currentColor; }
.tbtn:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255, 255, 255, 0.10); }
.tbtn.on { color: #111827; background: var(--gold-2); border-color: transparent; font-weight: 600; }
.tbtn.accent { border-color: rgba(234, 185, 98, 0.45); color: var(--gold-2); }
.tbtn.busy { opacity: 0.6; cursor: progress; }

/* ------------------------------------------------------------ focus picker */
.focus { position: relative; display: flex; align-items: center; margin-left: 16px; }
.focus-btn { max-width: 340px; }
.focus .focus-btn span {
  display: inline-flex !important; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.focus-pre { color: var(--ink-3); }
#focus-label { color: var(--ink); font-weight: 500; }
#focus-label small { color: var(--ink-3); font-weight: 400; }
.focus .caret { width: 14px; height: 14px; opacity: 0.75; transition: transform 0.2s; }
.focus.open .caret { transform: rotate(180deg); }
.focus.has .focus-btn { border-color: rgba(234, 185, 98, 0.6); box-shadow: 0 0 0 1px rgba(234, 185, 98, 0.25); }
.focus-clear {
  margin-left: 6px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255, 255, 255, 0.06); color: var(--ink-2); font-size: 16px; line-height: 1;
}
.focus-clear:hover { color: var(--ink); border-color: var(--line-2); }
.fo-sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--c); flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.3); }
.focus-pop {
  position: absolute; top: calc(100% + 8px); left: 0; width: 320px; max-height: min(520px, 70vh);
  display: flex; flex-direction: column; padding: 10px; border-radius: 12px; z-index: 30;
  background: var(--glass-2);
}
.focus-pop[hidden] { display: none; }
#focus-search {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06); color: var(--ink); font: inherit; font-size: 13.5px; outline: none;
}
#focus-search:focus { border-color: var(--line-2); }
.focus-list { overflow-y: auto; margin-top: 8px; padding-right: 2px; }
.fo-head { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 8px 8px 4px; }
.fo-hint { font-size: 12.5px; color: var(--ink-3); padding: 8px; }
.fo-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px;
  background: none; color: var(--ink-2); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.fo-item .fo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.fo-item small { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
.fo-item:hover, .fo-item.act { background: rgba(255, 255, 255, 0.08); }
.fo-all { color: var(--gold-2); font-weight: 500; justify-content: space-between; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); cursor: pointer; transition: all 0.2s; color: var(--ink-2);
  font-size: 20px; line-height: 1;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255, 255, 255, 0.12); }
.icon-btn.ghost { background: transparent; }
.icon-btn.small { width: 30px; height: 30px; font-size: 18px; }

/* ------------------------------------------------------------ panels */
.panel {
  position: fixed; top: calc(var(--top) + 10px); bottom: calc(var(--tl-h) + var(--gap) * 2);
  z-index: 15; display: flex; flex-direction: column; overflow: hidden;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), opacity 0.25s;
}
.panel.left { left: var(--gap); width: var(--left-w); }
.panel.right { right: var(--gap); width: var(--right-w); transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }
.panel.right.show { transform: none; opacity: 1; pointer-events: auto; }
body.left-collapsed .panel.left { transform: translateX(calc(-100% - 40px)); opacity: 0; pointer-events: none; }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 16px; }
.panel-head h2 { margin: 0; font: 600 16px/1.2 var(--sans); letter-spacing: -0.01em; color: var(--ink); }

.search-wrap { position: relative; margin: 4px 14px 8px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: var(--ink-3); }
#search {
  width: 100%; height: 38px; padding: 0 12px 0 34px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06); color: var(--ink); outline: none; font: inherit; font-size: 13.5px; transition: border-color 0.2s, background 0.2s;
}
#search:focus { border-color: rgba(234, 185, 98, 0.55); background: rgba(255, 255, 255, 0.09); }
#search::placeholder { color: var(--ink-3); }

.tree-actions { display: flex; gap: 6px; padding: 0 14px 10px; }
.tree-actions button {
  flex: 1; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05);
  color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; padding: 0 6px;
}
.tree-actions button:hover { color: var(--ink); border-color: var(--line-2); background: rgba(255, 255, 255, 0.10); }

.tree-scroll { flex: 1; overflow: auto; padding: 0 8px 12px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.tree-scroll::-webkit-scrollbar, .info::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 7px; }
.tree-scroll::-webkit-scrollbar-thumb, .info::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 8px; }

.fam { border-radius: 9px; margin: 2px 0; transition: opacity 0.25s; }
.fam-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 2px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s;
}
.fam-head:hover { background: rgba(255, 255, 255, 0.06); }
.fam-sw { width: 12px; height: 12px; border-radius: 3px; background: var(--fc); box-shadow: none; flex: none; }
.fam-name { flex: 1; font: 600 14px/1.3 var(--sans); letter-spacing: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fam .cnt { font-size: 11.5px; color: var(--ink-2); background: rgba(255, 255, 255, 0.08); padding: 2px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.fam.dormant .fam-name { color: var(--ink-3); }
.fam.off .fam-name, .fam.off .fam-sw { opacity: 0.42; }
.fam-body { display: none; padding-bottom: 4px; }
.fam.open > .fam-body { display: block; }

.caret {
  width: 18px; height: 18px; flex: none; border: 0; background: none; cursor: pointer; padding: 0; position: relative; color: var(--ink-3);
}
.caret::before {
  content: ''; position: absolute; left: 6px; top: 5px; border: 4px solid transparent; border-left: 5px solid currentColor;
  transition: transform 0.2s; transform-origin: 2px 4px;
}
.fam.open > .fam-head .caret::before, .node.open > .row .caret::before { transform: rotate(90deg); }
.node:not(.has-kids) > .row .caret { visibility: hidden; }

.chk { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk span { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); display: inline-block; transition: all 0.15s; }
.chk input:checked + span { background: var(--fc); border-color: transparent; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28); }
.chk input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.node > .kids { display: none; }
.node.open > .kids { display: block; }
.row {
  display: flex; align-items: center; gap: 7px; padding: 4px 8px 4px calc(6px + var(--d) * 12px); margin-left: 6px;
  border-radius: 7px; cursor: pointer; transition: background 0.15s, opacity 0.25s; min-height: 32px; font-size: 13.5px;
}
.row:hover { background: rgba(255, 255, 255, 0.07); }
.row.sel { background: rgba(234, 185, 98, 0.16); box-shadow: inset 2px 0 0 var(--gold-2); }
.row .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.row.k-proto .nm { font-style: italic; }
.row.k-branch .nm { color: var(--ink-2); }
.row .yr { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.dead { opacity: 0.52; }
.row.dead .sw { filter: grayscale(0.5); }

.sw {
  width: 11px; height: 11px; flex: none; border-radius: 3px; background: var(--c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.sw.hatch, .big-sw.hatch, .k-sw.hatch {
  background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.35) 0 1.2px, transparent 1.2px 4px);
  background-color: var(--c);
}
.empty { color: var(--ink-3); padding: 16px; text-align: center; }

.results { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px; }
.res {
  display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 13.5px;
}
.res:hover { background: rgba(255, 255, 255, 0.07); }
.res-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.res-main b { font-weight: 600; color: var(--ink); }
.res-main small, .res-meta small { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 11.5px; color: var(--ink-2); max-width: 42%; text-align: right; }

.legend-key { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.legend-key span { display: inline-flex; align-items: center; gap: 6px; }
.k-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.k-sw.proto { background: hsl(215 68% 40%); }
.k-sw.deep { background: hsl(212 58% 64%); }
.k-sw.hatch { --c: hsl(215 62% 50%); }

/* ------------------------------------------------------------ info */
.close-info { position: absolute; top: 12px; right: 12px; z-index: 2; }
.info { overflow: auto; padding: 22px 24px 26px; height: 100%; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent; }
.info-head { display: flex; align-items: flex-start; gap: 14px; padding-right: 28px; }
.big-sw {
  width: 36px; height: 36px; border-radius: 10px; flex: none; background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.info-head h2 { margin: 0; font: 700 22px/1.2 var(--sans); letter-spacing: -0.015em; color: var(--ink); }
.info-head .sub { color: var(--ink-2); margin-top: 4px; font-size: 13.5px; }
.native { font-family: var(--sans); font-style: normal; font-size: 14px; color: var(--gold-2); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 12px; }
.badge {
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--line-2); color: var(--ink); background: rgba(255, 255, 255, 0.06);
}
.badge.st-living { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.14); color: #86efac; }
.badge.st-extinct { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
.badge.st-reconstructed { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.14); color: #c4b5fd; border-style: dashed; }
.badge.cert-low { color: #fda4af; }
.badge.cert-high { color: #86efac; }

.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13px; line-height: 1.5;
  padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.crumbs .sep { color: var(--ink-3); }
.crumb { text-decoration: none; color: var(--ink-2); border-bottom: 1px dotted color-mix(in srgb, var(--c) 80%, white 0%); transition: color 0.15s; }
.crumb:hover { color: var(--gold-2); }
.crumb.cur { color: var(--ink); font-weight: 600; }
.crumb-fam { color: var(--gold-2); font-family: var(--sans); font-size: 13px; font-weight: 600; }

.facts-grid { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; margin: 16px 0; font-size: 14px; }
.facts-grid dt { color: var(--ink-3); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0.01em; padding-top: 2px; }
.facts-grid dd { margin: 0; color: var(--ink); }
.facts-grid small { color: var(--ink-3); }
.linkish { border: 0; background: none; padding: 0; color: var(--gold-2); cursor: pointer; font-weight: 500; border-bottom: 1px dotted rgba(246, 213, 142, 0.55); }
.live-state { margin-left: 8px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 99px; }
.live-state.on { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.live-state.off { background: rgba(255, 255, 255, 0.08); color: var(--ink-2); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; }

.desc { font-size: 15px; line-height: 1.72; color: #e2e8f0; margin: 14px 0; }
.info h3 { font: 600 15px/1.3 var(--sans); margin: 20px 0 10px; color: var(--ink); letter-spacing: 0; }
.info h3 small { color: var(--ink-3); font-family: var(--sans); font-size: 12px; font-weight: 500; }
.facts { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.facts li { margin: 5px 0; }
.facts li::marker { color: var(--gold-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; text-decoration: none;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--ink); font-size: 13px; transition: all 0.15s;
}
.chip small { color: var(--ink-3); font-size: 11.5px; }
.chip:hover { border-color: color-mix(in srgb, var(--c) 75%, transparent); background: color-mix(in srgb, var(--c) 16%, transparent); }
.chip.dead { opacity: 0.55; }
.info-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.btn {
  height: 36px; padding: 0 14px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  background: var(--gold-2); color: #111827; font-weight: 600; font-size: 13px;
}
.btn.ghost { background: rgba(255, 255, 255, 0.06); color: var(--ink); border-color: var(--line-2); font-weight: 500; }
.btn:hover { filter: brightness(1.08); }
.family-box { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 14px 10px; background: rgba(255, 255, 255, 0.03); }
.family-box summary { cursor: pointer; font: 600 14.5px var(--sans); padding: 8px 0; color: var(--ink); list-style: none; }
.family-box summary::-webkit-details-marker { display: none; }
.family-box summary::after { content: '+'; float: right; color: var(--ink-3); font-family: var(--sans); }
.family-box[open] summary::after { content: '–'; }
.family-box p { color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.family-box h4 { margin: 12px 0 6px; font: 600 12px var(--sans); color: var(--gold-2); text-transform: uppercase; letter-spacing: 0.06em; }
.homeland { font-size: 13.5px; }
.debates { padding-left: 18px; color: var(--ink-2); margin: 0 0 6px; font-size: 14px; }
.debates li { margin: 6px 0; line-height: 1.6; }

/* ------------------------------------------------------------ stats */
.stats {
  position: fixed; top: calc(var(--top) + 10px); left: 50%; transform: translateX(-50%); z-index: 14;
  padding: 7px 14px; min-width: 220px; border-radius: 10px; pointer-events: none;
}
.st-nums { display: flex; gap: 14px; justify-content: center; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.st-nums b { font: 600 15px var(--sans); color: var(--ink); margin-right: 3px; font-variant-numeric: tabular-nums; }
.st-nums .muted { color: var(--ink-3); }
.st-bar { display: flex; height: 4px; margin-top: 6px; border-radius: 3px; overflow: hidden; gap: 1px; background: rgba(255, 255, 255, 0.08); }
.st-bar i { background: var(--c); min-width: 2px; transition: flex 0.4s; }
.notice { position: fixed; top: calc(var(--top) + 64px); left: 50%; transform: translateX(-50%); z-index: 30; padding: 10px 16px; color: var(--gold-2); }

/* ------------------------------------------------------------ timeline */
.timeline {
  position: fixed; left: var(--gap); right: var(--gap); bottom: var(--gap); height: var(--tl-h); z-index: 16;
  display: grid; grid-template-columns: 188px auto 1fr; grid-template-rows: 1fr; align-items: center; gap: 18px; padding: 10px 24px 10px 20px;
}
.tl-left { display: flex; flex-direction: column; }
.tl-year {
  font: 700 32px/1.05 var(--sans); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap; text-shadow: none;
}
.tl-ago { color: var(--ink-2); font-size: 12.5px; margin-top: 4px; letter-spacing: 0.01em; }
.tl-controls { display: flex; align-items: center; gap: 8px; }
.icon-btn.play { width: 44px; height: 44px; background: var(--gold-2); color: #111827; border: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.icon-btn.play:hover { color: #000; filter: brightness(1.06); }
.icon-btn.play svg { width: 20px; height: 20px; }
.i-pause { display: none; }
.timeline.playing .i-play { display: none; }
.timeline.playing .i-pause { display: block; }
.speed { display: flex; margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.speed button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 9px; cursor: pointer; font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.speed button + button { border-left: 1px solid var(--line); }
.speed button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.speed button.on { background: rgba(234, 185, 98, 0.22); color: var(--gold-2); }

.tl-track-wrap { position: relative; padding: 0 4px; min-width: 0; }
.tl-track { position: relative; height: 38px; cursor: pointer; outline: none; touch-action: none; }
.tl-rail {
  position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
}
.tl-fill {
  position: absolute; left: 0; top: 50%; height: 6px; transform: translateY(-50%); border-radius: 3px;
  background: var(--gold);
}
.tl-handle {
  position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--gold-2); box-shadow: 0 0 0 3px rgba(234, 185, 98, 0.25), 0 2px 8px rgba(0, 0, 0, 0.5); transition: box-shadow 0.2s; z-index: 3; pointer-events: none;
}
.tl-track:focus-visible .tl-handle, .timeline.dragging .tl-handle { box-shadow: 0 0 0 6px rgba(234, 185, 98, 0.35), 0 2px 8px rgba(0, 0, 0, 0.5); }
.tl-handle span {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
  background: #0b1017; color: var(--gold-2); border: 1px solid var(--line-2); opacity: 0; transition: opacity 0.2s;
}
.timeline.dragging .tl-handle span { opacity: 1; }
.tl-events { position: absolute; inset: 0; pointer-events: none; }
.tl-ev {
  position: absolute; top: 3px; width: 9px; height: 9px; margin-left: -4.5px; padding: 0; border: 0; border-radius: 2px; transform: rotate(45deg);
  background: var(--c); box-shadow: 0 0 0 1.5px rgba(14, 19, 28, 0.85); cursor: pointer; pointer-events: auto; transition: transform 0.15s; z-index: 2;
}
.tl-ev:hover { transform: rotate(45deg) scale(1.45); }
.tl-ticks { position: relative; height: 22px; }
.tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.tick.first { transform: none; } .tick.last { transform: translateX(-100%); }
.tick i { display: block; width: 1px; height: 6px; background: var(--line-2); margin: 0 auto 3px; }
.tick.first i { margin-left: 0; } .tick.last i { margin-right: 0; }
.tick b { font-weight: 500; }

/* ------------------------------------------------------------ toasts / tooltip */
.toasts {
  position: fixed; left: 50%; bottom: calc(var(--tl-h) + var(--gap) * 2); transform: translateX(-50%); z-index: 18;
  display: flex; flex-direction: column; gap: 6px; width: min(400px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  display: flex; gap: 10px; align-items: baseline; padding: 10px 32px 10px 14px; position: relative; pointer-events: auto;
  background: rgba(14, 19, 28, 0.95); backdrop-filter: blur(10px); border: 1px solid var(--line-2); border-left: 3px solid var(--c);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); opacity: 0; transform: translateY(10px); transition: all 0.25s cubic-bezier(.2,.8,.2,1);
}
.toast.show { opacity: 1; transform: none; }
.toast-year { font: 600 13px/1.3 var(--sans); color: var(--gold-2); white-space: nowrap; }
.toast-body { min-width: 0; }
.toast-body b { font: 600 14px/1.35 var(--sans); color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-body p, .toast-langs { display: none; }
.toast:hover, .toast.expanded { background: rgba(18, 24, 36, 0.98); }
.toast:hover .toast-body b, .toast.expanded .toast-body b { white-space: normal; }
.toast:hover .toast-body p, .toast.expanded .toast-body p { display: block; margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.toast:hover .toast-langs, .toast.expanded .toast-langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.toast-langs a { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, 0.08); padding: 3px 8px; border-radius: 6px; }
.toast-x { position: absolute; top: 4px; right: 8px; border: 0; background: none; color: var(--ink-2); cursor: pointer; font-size: 18px; }

.tooltip {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; display: flex; gap: 9px; align-items: center;
  padding: 9px 12px; border-radius: 9px; background: rgba(14, 19, 28, 0.96); border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.12s; max-width: 290px;
}
.tooltip.show { opacity: 1; }
.tooltip b { display: block; font: 600 14px var(--sans); color: var(--ink); }
.tooltip small { color: var(--ink-2); font-size: 12px; }
.tooltip .sw { width: 12px; height: 12px; }

/* ------------------------------------------------------------ map labels & pins */
.labels-layer, .pins-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.pins-layer { z-index: 6; }
.lbl {
  position: absolute; left: 0; top: 0; white-space: nowrap;
  font: 600 var(--s, 12px)/1.15 var(--sans);
  letter-spacing: 0.01em; text-transform: none; font-variant: normal;
  color: #f8fafc;
  background: rgba(14, 19, 28, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 3px 8px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
  text-shadow: none;
  pointer-events: auto; cursor: pointer;
  transition: opacity 0.3s, background 0.15s, border-color 0.15s;
}
.lbl.proto { font-style: italic; border-style: dashed; }
.lbl.sel {
  color: #111827; background: var(--gold-2); border-color: var(--gold-2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.lbl:hover { background: rgba(24, 33, 47, 0.95); border-color: var(--gold-2); color: #ffffff; }
.pin { position: absolute; left: 0; top: 0; border: 0; padding: 0; background: none; cursor: pointer; pointer-events: auto; transition: opacity 0.35s; }
.pin-dot {
  position: absolute; left: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold-2);
  box-shadow: 0 0 0 2px rgba(14, 19, 28, 0.9), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.pin.near .pin-dot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(246, 213, 142, 0.8); animation: ping 1.8s ease-out infinite;
}
@keyframes ping { from { transform: scale(0.5); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
.pin-label {
  position: absolute; left: 10px; top: -11px; white-space: nowrap; font-size: 12.5px; padding: 4px 9px; border-radius: 7px;
  background: rgba(14, 19, 28, 0.94); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); opacity: 0; transform: translateX(-4px); transition: all 0.2s;
}
.pin-label b { color: var(--gold-2); font-weight: 600; }
.pin:hover .pin-label, .pin.near .pin-label { opacity: 1; transform: none; }

/* ------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(6, 10, 16, 0.72); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.25s; }
.modal.show { opacity: 1; }
.modal-card {
  position: relative; width: min(860px, 100%); max-height: min(88vh, 1000px); display: flex; flex-direction: column;
  background: #111722; border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6); transform: translateY(16px) scale(0.98); transition: transform 0.25s cubic-bezier(.2,.8,.2,1); overflow: hidden;
}
.modal.show .modal-card { transform: none; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-head { padding: 26px 32px 16px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.modal-head h2 { margin: 0; font: 700 26px/1.2 var(--sans); color: var(--ink); }
.modal-head p { margin: 8px 0 14px; color: var(--ink-2); font-family: var(--sans); font-size: 15px; max-width: 680px; line-height: 1.6; }
.about-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.about-nav a { font-size: 12.5px; font-weight: 500; text-decoration: none; color: var(--ink-2); padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; transition: all 0.15s; }
.about-nav a:hover { color: var(--gold-2); border-color: rgba(234, 185, 98, 0.55); background: rgba(255, 255, 255, 0.04); }
.modal-body { overflow: auto; padding: 10px 32px 30px; font-size: 15px; line-height: 1.75; color: #dbe3ee; }
.modal-body h3 { font: 600 19px/1.3 var(--sans); color: var(--ink); margin: 24px 0 8px; }
.modal-body b { color: var(--ink); font-weight: 600; }
.modal-body ul { padding-left: 20px; }
.modal-body li { margin: 6px 0; }
.modal-body li::marker { color: var(--gold-2); }
.modal-body section { scroll-margin-top: 12px; }
.sources li { font-size: 14px; }
.caveat { border-left: 3px solid var(--gold); padding: 12px 14px; background: rgba(234, 185, 98, 0.08); border-radius: 0 10px 10px 0; color: var(--ink); }
.howto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 16px; margin: 10px 0 14px; }
.howto div { font-size: 13.5px; }
kbd {
  display: inline-block; min-width: 24px; padding: 2px 7px; margin-right: 6px; border-radius: 6px; text-align: center;
  font: 600 11.5px var(--sans); color: var(--ink); background: rgba(255, 255, 255, 0.10); border: 1px solid var(--line-2); border-bottom-width: 2px;
}

/* ------------------------------------------------------------ loading */
.loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #0e141d; transition: opacity 0.6s; }
.loading.done { opacity: 0; pointer-events: none; }
.loading-inner { text-align: center; }
.loading h1 { font: 600 24px var(--sans); margin: 20px 0 6px; color: var(--ink); }
.loading p { color: var(--ink-2); margin: 0; font-size: 14px; }
.loading.error p { color: #fda4af; }
.loading-globe {
  width: 68px; height: 68px; margin: 0 auto; border-radius: 50%; border: 1px solid rgba(234, 185, 98, 0.5);
  background: repeating-linear-gradient(90deg, transparent 0 11px, rgba(234, 185, 98, 0.3) 11px 12px), radial-gradient(circle at 35% 30%, #2c475c, #14212e);
  background-size: 48px 100%, 100% 100%; animation: spin 2.4s linear infinite;
}
@keyframes spin { to { background-position: 48px 0, 0 0; } }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  :root { --left-w: 295px; --right-w: 350px; }
  .tbtn span { display: none; }
  .tbtn { padding: 0 10px; }
}
@media (max-width: 900px) {
  :root { --top: 58px; --tl-h: 146px; --gap: 8px; }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
  .focus { margin-left: 4px; }
  .focus-pre { display: none !important; }
  .focus-btn { max-width: 44vw; }
  .focus-pop { width: min(320px, 90vw); }
  .panel.left, .panel.right { width: auto; left: var(--gap); right: var(--gap); z-index: 25; }
  .panel.right { top: auto; height: 62vh; bottom: calc(var(--tl-h) + var(--gap) * 2); transform: translateY(calc(100% + 200px)); }
  .panel.right.show { transform: none; }
  .timeline { grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 10px 14px; gap: 8px 12px; }
  .tl-track-wrap { grid-column: 1 / -1; }
  .tl-year { font-size: 26px; }
  .speed button { padding: 5px 7px; }
  .stats { top: calc(var(--top) + 6px); }
  .tick:nth-child(even) b { display: none; }
  .modal-head, .modal-body { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 520px) {
  .tl-controls .speed { display: none; }
  .tl-ago { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
