:root {
  --bg: #e7e8ee;
  --panel: rgba(255, 255, 255, 0.92);
  --text: #15171c;
  --muted: #646a78;
  --line: rgba(20, 24, 40, 0.12);
  --accent: #0b4ea2;
  --red: #ee1c25;
  --shadow: 0 6px 24px rgba(10, 14, 30, 0.16);
  --radius: 12px;
  --on-accent: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101218;
    --panel: rgba(24, 27, 36, 0.92);
    --text: #eef0f6;
    --muted: #9aa1b2;
    --line: rgba(255, 255, 255, 0.12);
    --accent: #6fa8ff;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    --on-accent: #0b1020;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#map.dragging { cursor: grabbing; }
#map.pointer { cursor: pointer; }
a { color: var(--accent); }

.bar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: center;
  pointer-events: none; flex-wrap: wrap; }
.bar > * { pointer-events: auto; }
.logo, .tabs, .search input, .icon-btn, .zoom, .status, .tip {
  background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow); }
.logo { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo b { color: var(--red); }
.logo-grid { display: grid; grid-template-columns: 8px 8px; gap: 2px; }
.logo-grid i { width: 8px; height: 8px; border-radius: 2px; background: #fff; border: 1px solid var(--line); }
.logo-grid i:nth-child(2) { background: var(--accent); border: 0; }
.logo-grid i:nth-child(3) { background: var(--red); border: 0; }
.logo-grid i:nth-child(4) { background: #f5b301; border: 0; }

.tabs { display: flex; padding: 4px; border-radius: var(--radius); gap: 2px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.search { position: relative; flex: 1 1 220px; max-width: 340px; margin-left: auto; display: flex; }
.search input { width: 100%; border-radius: var(--radius); padding: 9px 40px 9px 14px; font: inherit;
  color: var(--text); outline: none; }
.search input:focus { border-color: var(--accent); }
.search button { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 32px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); cursor: pointer; font-size: 15px; }
.search-msg { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); padding: 10px 12px; }
.search-msg button { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 2px 0; display: block; }

.pill { display: flex; align-items: center; height: 38px; padding: 0 14px; border-radius: var(--radius); font-weight: 600;
  color: var(--text); text-decoration: none; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pill:hover { color: var(--accent); }
.archive-banner { position: fixed; left: 50%; transform: translateX(-50%); top: 64px; z-index: 3; display: flex; gap: 14px;
  align-items: center; padding: 7px 14px; border-radius: 999px; background: #f5b301; color: #1b1400; font-weight: 600;
  box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 24px); overflow-x: auto; }
.archive-banner a { color: inherit; }
#archive-prev, #archive-next { text-decoration: none; font-size: 20px; line-height: 1; padding: 0 4px; }
.icon-btn { width: 38px; height: 38px; border-radius: var(--radius); font: inherit; font-weight: 700; font-size: 16px;
  color: var(--text); cursor: pointer; }

.zoom { position: fixed; right: 12px; bottom: 44px; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; }
.zoom button { width: 40px; height: 40px; border: 0; background: none; color: var(--text); font-size: 20px; cursor: pointer; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--line); }

.status { position: fixed; left: 12px; bottom: 12px; padding: 5px 10px; border-radius: 8px; font-size: 12px; color: var(--muted);
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tip { position: fixed; left: 0; top: 0; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 10px;
  display: flex; gap: 10px; align-items: center; max-width: 300px; }
.tip.pinned { pointer-events: auto; }
.tip canvas { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 4px; flex: none; background: #fff;
  border: 1px solid var(--line); }
.tip .name { font-weight: 700; word-break: break-all; }
.tip .title { font-weight: 600; }
.tip .text { color: var(--muted); font-size: 13px; }
.tip .hint { color: var(--muted); font-size: 12px; }
.tip a.open { display: inline-block; margin-top: 4px; font-weight: 600; }
.tip.extra { border-color: #f5b301; }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow);
  max-width: min(560px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 20px 24px; backdrop-filter: blur(14px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog h2 { margin: 0 0 8px; }
dialog h3 { margin: 18px 0 4px; font-size: 15px; }
dialog .close { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.muted { color: var(--muted); }
#stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
#stats div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
#stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
#stats span { font-size: 12px; color: var(--muted); }
.top-icons { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.top-icons li { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.top-icons img { width: 24px; height: 24px; image-rendering: pixelated; background: #fff; border-radius: 3px; border: 1px solid var(--line); }
.noscript { position: fixed; inset: 40% 0 auto; text-align: center; }

@media (max-width: 640px) {
  .bar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .logo { padding: 7px 10px; font-size: 15px; }
  .search { order: 5; max-width: none; flex-basis: 100%; }
  .tabs button { padding: 6px 9px; }
  .zoom { display: none; }
  .pill { padding: 0 10px; }
  .archive-banner { top: auto; bottom: 44px; gap: 10px; }
  #stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---- archive page ---------------------------------------------------------------- */
html:has(body.page), body.page { overflow: auto; height: auto; }
body.page { min-height: 100%; }
.page-bar { position: sticky; top: 0; z-index: 4; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }
.archive { max-width: 960px; margin: 0 auto; padding: 8px 16px 64px; }
.archive h1 { font-size: 34px; letter-spacing: -0.02em; margin: 12px 0 4px; }
.archive h2 { font-size: 17px; margin: 0 0 12px; }
.lead { color: var(--muted); max-width: 640px; margin: 0 0 20px; font-size: 15px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 16px; }

.hist-form { display: flex; gap: 8px; max-width: 420px; }
.hist-form input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; outline: none; }
.hist-form input:focus { border-color: var(--accent); }
.hist-form button { padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }
.hist { display: flex; gap: 10px; overflow-x: auto; padding: 14px 2px 4px; }
.hist:empty { display: none; }
.hist .msg { color: var(--muted); }
.hist a { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px;
  color: var(--muted); text-decoration: none; font-size: 12px; text-align: center; }
.hist a:hover { color: var(--accent); }
.hist canvas, .hist .none { width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.hist .none { display: grid; place-items: center; color: #9aa1b2; font-size: 20px; }
.hist a.changed canvas { outline: 2px solid #f5b301; outline-offset: 2px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--line); }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart g:hover .bar { fill: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; }
.chart-tip { flex-direction: column; align-items: flex-start; gap: 0; font-size: 13px; }

.timeline-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.timeline-head h2 { margin: 0; }
.timeline-head .tabs { box-shadow: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .year { margin: 18px 0 10px -22px; font-weight: 700; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; }
.month { position: relative; display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; scroll-margin-top: 80px; }
.month::before { content: ""; position: absolute; left: -21px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.month.live::before { background: var(--red); border-color: var(--red); }
.month.flash { animation: flash 1.2s; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px #f5b301; } }
.thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.thumb img { position: absolute; left: 0; top: 0; image-rendering: auto; }
.month h3 { margin: 0; font-size: 20px; text-transform: capitalize; }
.month .when { color: var(--muted); font-size: 12px; margin: 2px 0 10px; }
.month .badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  vertical-align: 3px; background: var(--red); color: #fff; text-transform: none; }
.month .badge.test { background: var(--line); color: var(--muted); }
.nums { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 12px; }
.nums div b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.nums div span { font-size: 12px; color: var(--muted); }
.delta { font-size: 12px; font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; color: var(--muted); }
.month .open { display: inline-block; padding: 7px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; }
@media (max-width: 640px) {
  .month { grid-template-columns: 1fr; }
  .archive h1 { font-size: 28px; }
}

/* ---- progress page --------------------------------------------------------------- */
.stages { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; flex-wrap: wrap; counter-reset: st; }
.stages li { counter-increment: st; flex: 1 1 140px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted); font-weight: 600; font-size: 13px; }
.stages li::before { content: counter(st) ". "; }
.stages li.done { color: var(--text); }
.stages li.done::before { content: "✓ "; color: var(--accent); }
.stages li.active { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.stages li.failed { color: #fff; background: var(--red); border-color: var(--red); }
.progress-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pct { font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.progress { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 16px; }
.progress div { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.6s; }
.card h2 + .chart { margin-top: -4px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: var(--accent); opacity: 0.12; }
.statuses { display: grid; grid-template-columns: minmax(120px, 200px) 1fr auto; gap: 8px 12px; align-items: center; font-size: 13px; }
.statuses .track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.statuses .track div { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.statuses .v { font-variant-numeric: tabular-nums; text-align: right; }
.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.recent a { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); text-decoration: none; overflow: hidden; }
.recent a:hover { color: var(--accent); }
.recent canvas { width: 32px; height: 32px; flex: none; image-rendering: pixelated; border-radius: 4px; background: #fff; border: 1px solid var(--line); }
.recent span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn { color: var(--red); font-weight: 600; }
.page-links { display: flex; gap: 8px; }
