:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e5e7ef;
  --line-2: #eef0f6;
  --accent: #2f5bff;
  --accent-soft: #e8edff;
  --warn: #b45309;
  --warn-soft: #fff6e5;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --ok: #047857;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 5px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* header */
.top { background: linear-gradient(120deg, #0b1437 0%, #1b2b7a 55%, #2f5bff 100%); color: #fff; padding: 26px 0 64px; }
.brand { display: flex; gap: 16px; align-items: center; }
.mark { width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, .12); display: flex; align-items: flex-end; justify-content: center; gap: 4px; padding: 9px; flex: none; }
.mark span { width: 6px; border-radius: 2px; background: #fff; }
.mark span:nth-child(1) { height: 40%; opacity: .6; }
.mark span:nth-child(2) { height: 100%; }
.mark span:nth-child(3) { height: 70%; opacity: .8; }
h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; font-weight: 700; }
h1 em { font-style: normal; font-weight: 500; opacity: .75; }
.sub { margin: 4px 0 0; opacity: .8; font-size: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
main { margin-top: -44px; display: grid; gap: 16px; }

/* controls */
.controls { padding: 14px 18px 12px; position: sticky; top: 8px; z-index: 20; }
.lens-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 550; padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg button .tag { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.seg.small button { padding: 5px 10px; font-size: 13px; }
.seg.hidden { display: none; }

.time-row { display: grid; grid-template-columns: auto 190px 1fr auto; gap: 16px; align-items: center; margin-top: 12px; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(47, 91, 255, .35); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.play .i-pause { display: none; }
.play.on .i-play { display: none; }
.play.on .i-pause { display: block; }
.date-label { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.date-sub { font-size: 12px; color: var(--muted); }
.slider-block { position: relative; padding: 4px 0 18px; }
.slider-block input[type=range] { width: 100%; margin: 0; position: relative; z-index: 2; background: transparent; -webkit-appearance: none; appearance: none; height: 22px; }
.slider-block input[type=range]::-webkit-slider-runnable-track { height: 6px; background: transparent; }
.slider-block input[type=range]::-moz-range-track { height: 6px; background: transparent; }
.slider-block input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); box-shadow: 0 2px 6px rgba(15, 23, 42, .25); cursor: grab; }
.slider-block input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: grab; }
.track { position: absolute; left: 0; right: 0; top: 12px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; z-index: 1; }
.track .seg-era { position: absolute; top: 0; bottom: 0; }
.track .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(15, 23, 42, .18); }
.years { position: absolute; left: 0; right: 0; top: 26px; height: 14px; font-size: 11px; color: var(--muted); }
.years span { position: absolute; transform: translateX(-50%); }
.jumps { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.jumps button { border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12px; padding: 5px 9px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.jumps button:hover { border-color: var(--accent); color: var(--accent); }

/* status */
.status { display: grid; gap: 8px; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.note b { color: var(--ink); }
.note .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--accent); }
.note-main { min-width: 0; }
.note-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.note-body { margin-top: 2px; max-width: 980px; }
.note-body .strong { font-weight: 600; color: var(--ink); }
.note-list { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.note a.ext { margin-left: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.note.warn { background: var(--warn-soft); border-color: #f7d9a6; }
.note.warn .dot { background: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: #f5c2c2; }
.note.bad .dot { background: var(--bad); }
.note .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.chip.era { color: #fff; }
.chip.ok { background: #e6f6ef; color: var(--ok); }

/* chart */
.chart-card { padding: 16px 18px 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.chart-head h2, .table-head h2, .about h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.chart-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 860px; }
.chart-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle.hidden { display: none; }
.chart { position: relative; min-height: 300px; margin-top: 14px; transition: height .25s; }
.chart .grid { position: absolute; right: 0; border-top: 1px dashed var(--line); z-index: 0; }
.chart .grid.base { border-top: 1px solid #cbd2e1; }
.chart .grid span { position: absolute; right: calc(100% + 8px); top: -8px; white-space: nowrap; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { position: absolute; z-index: 1; border-radius: 5px 5px 2px 2px; transition: left .45s cubic-bezier(.2, .8, .2, 1), height .45s cubic-bezier(.2, .8, .2, 1), width .3s, background-color .3s, opacity .3s; cursor: pointer; }
/* While the slider thumb is held, bars snap to each snapshot instead of animating. */
.chart.instant, .chart.instant .bar { transition: none; }
.bar.est { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .45) 0 4px, transparent 4px 8px); }
.bar.dim { opacity: .25; }
.bar.pin { outline: 3px solid var(--ink); outline-offset: 2px; }
.bar .val { position: absolute; left: 50%; transform: translateX(-50%); font-size: 11px; line-height: 1; font-weight: 650; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Narrow bars: read the value bottom-to-top so neighbours never overlap. */
.bar .val.v { writing-mode: vertical-rl; transform: translateX(-50%) rotate(180deg); }
.bar .whisker { position: absolute; left: 50%; width: 2px; margin-left: -1px; background: rgba(15, 23, 42, .45); }
.bar .whisker::before, .bar .whisker::after { content: ""; position: absolute; left: -3px; width: 8px; height: 2px; background: rgba(15, 23, 42, .45); }
.bar .whisker::before { top: 0; }
.bar .whisker::after { bottom: 0; }
.bar .lab { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); border-radius: 50%; display: grid; place-items: center; font-weight: 700; letter-spacing: -.02em; box-shadow: 0 0 0 2px #fff; }
.bar .name { position: absolute; font-size: 11px; line-height: 1.3; color: var(--ink-2); }
/* Angled names end at their bar and run down-left. */
.bar .name.a { right: 50%; top: calc(100% + 30px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; transform-origin: 100% 50%; transform: rotate(-60deg); }
/* Wide slots: names sit flat under the bar, up to three lines. */
.bar .name.h { left: 50%; top: calc(100% + 38px); transform: translateX(-50%); text-align: center; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; }
.bar .rank { position: absolute; top: 5px; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 700; opacity: .9; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty .actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empty button { border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 9px; font: inherit; cursor: pointer; }
.empty button:hover { border-color: var(--accent); color: var(--accent); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 8px 0 4px; border-top: 1px solid var(--line-2); margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .hatch { background: #94a3b8 repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 3px, transparent 3px 6px); }

/* table */
.table-card { padding: 16px 18px; }
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.count { color: var(--muted); font-weight: 500; font-size: 13px; }
#filter { border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font: inherit; width: 240px; }
#filter:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.table-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--line-2); border-radius: 10px; }
.table-foot { margin: 8px 2px 0; color: var(--muted); font-size: 12px; }
.table-foot:empty { display: none; }
/* The table catches up once the slider pauses or playback stops. */
#tbody { transition: opacity .15s; }
#tbody.stale { opacity: .45; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { position: sticky; top: 0; background: #fafbfe; font-size: 12px; color: var(--muted); font-weight: 600; z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fafbff; }
tr.pin td { background: var(--accent-soft); }
tr.est td { color: var(--muted); }
.model-cell { display: flex; align-items: center; gap: 8px; }
.labdot { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 8px; font-weight: 700; flex: none; }
.badge { font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: var(--line-2); color: var(--muted); font-weight: 600; }
.badge.est { background: #fff1d6; color: var(--warn); }
.mv { font-size: 11px; font-weight: 700; }
.mv.up { color: var(--ok); }
.mv.down { color: var(--bad); }
.mv.new { color: var(--accent); }
.gap { color: #b6bdca; }

/* about */
.about { padding: 18px; }
.about h3 { margin: 22px 0 4px; font-size: 14px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.about-grid .item { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; }
.about-grid .item h4 { margin: 0 0 4px; font-size: 13px; }
.about-grid .item p { margin: 0; color: var(--ink-2); font-size: 12.5px; }
table.eras td { white-space: normal; vertical-align: top; }
table.eras td:first-child { white-space: nowrap; }
.era-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.tooltip { position: fixed; pointer-events: none; z-index: 50; background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 10px 12px; font-size: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 320px; opacity: 0; transition: opacity .12s; }
.tooltip.on { opacity: 1; }
.tooltip b { color: #fff; font-size: 13px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 18px; }
.tooltip .row span:first-child { color: #94a3b8; }
.tooltip hr { border: 0; border-top: 1px solid rgba(255, 255, 255, .12); margin: 6px 0; }

.foot { color: var(--muted); font-size: 12px; padding: 22px 20px 40px; }

@media (max-width: 900px) {
  .time-row { grid-template-columns: auto 1fr; }
  .slider-block { grid-column: 1 / -1; }
  .jumps { grid-column: 1 / -1; justify-content: flex-start; }
  .controls { position: static; }
  #filter { width: 160px; }
}
