:root {
  --bg: #0a0d13;
  --panel: #121722;
  --panel-2: #1a2030;
  --line: #262e40;
  --text: #e6e9ef;
  --muted: #98a1b3;
  --accent: #7cc4ff;
  --warn: #f3b562;
  --r: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; font-size: 14px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

#sky { position: fixed; inset: 0; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#labels span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg), 0 0 10px var(--bg); }
#labels span.gal { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
#labels span.cl { font-size: 11px; font-weight: 600; color: #8a93a6; text-transform: uppercase; letter-spacing: .07em; }

.bar { position: fixed; top: 12px; left: 12px; right: 12px; display: flex; gap: 10px; align-items: center; pointer-events: none; z-index: 5; }
.bar > * { pointer-events: auto; }
.brand { font-weight: 650; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); white-space: nowrap; }
.search { position: relative; flex: 0 1 380px; min-width: 0; }
#q { width: 100%; padding: 9px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); outline: none; }
#q:focus { border-color: var(--accent); }
#results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); max-height: 60vh; overflow: auto; }
#results li { padding: 7px 9px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
#results li.on, #results li:hover { background: var(--panel-2); }
#results li small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.modes { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; }
.modes button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); }
.modes button.on { background: var(--panel-2); color: var(--text); }

.side { position: fixed; top: 64px; right: 12px; bottom: 64px; width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; z-index: 6; padding: 16px; }
.close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; background: var(--panel-2); border-radius: 50%; font-size: 18px; line-height: 1; z-index: 1; }
.side h2 { margin: 0 34px 4px 0; font-size: 20px; line-height: 1.25; }
.side h3 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.sum { font-size: 15px; line-height: 1.5; margin: 10px 0 0; }
.img { position: relative; margin: 12px 0 0; border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.img img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #fff1; }
.img.blur img { filter: blur(22px) saturate(.4); }
.img button { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; padding: 8px 14px; background: #000b; border: 1px solid var(--line); border-radius: 8px; }
.img:not(.blur) button { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; text-align: left; }
.chip.f3 { border-color: #3d4a66; }
.chip.f1 { opacity: .75; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.chip.static { cursor: default; opacity: .7; }
.chip small { color: var(--muted); }
.rel { list-style: none; margin: 0; padding: 0; }
.rel li { padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.rel li:hover { background: var(--panel-2); }
.rel li small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.ext { font-size: 13px; line-height: 1.5; color: #c2c8d3; white-space: pre-line; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 14px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.score { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 6px; }

.controls { position: fixed; left: 12px; top: 64px; z-index: 4; display: flex; flex-direction: column; gap: 8px; max-height: calc(100% - 140px); width: 230px; }
.controls details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; overflow: auto; }
.controls summary { cursor: pointer; font-weight: 600; font-size: 13px; }
#legend { list-style: none; margin: 8px 0 2px; padding: 0; }
#legend li { display: flex; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 13px; }
#legend li:hover { background: var(--panel-2); }
#legend li.off { opacity: .35; }
#legend li small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
#legend .hint { color: var(--muted); font-size: 11px; cursor: default; }
#linksBox label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 0; }
.ln { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.l1 { border-color: #d5dbe6; } .l2 { border-color: #f3b562; } .l4 { border-color: #7cc4ff; }

.timeline { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: min(640px, calc(100% - 24px)); display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; z-index: 4; }
.timeline button { border: 0; background: var(--panel-2); width: 32px; height: 32px; border-radius: 50%; flex: none; }
#year { flex: 1; accent-color: var(--accent); min-width: 0; }
#yearLbl { min-width: 150px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }

#loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); z-index: 10; background: var(--bg); }
.tip { position: fixed; z-index: 7; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 13px; max-width: 280px; }
.tip small { color: var(--muted); display: block; }

@media (max-width: 760px) {
  .brand { display: none; }
  .bar { top: 8px; left: 8px; right: 8px; }
  .search { flex: 1; }
  .modes button { padding: 6px 9px; }
  .controls { top: 56px; left: 8px; width: auto; max-width: 60%; }
  .controls details:not([open]) { padding: 6px 10px; }
  .side { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58vh; border-radius: 14px 14px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .timeline { bottom: 8px; padding: 6px 10px; }
  #yearLbl { min-width: 96px; font-size: 12px; }
  body.sheet .timeline { display: none; }
  #labels span.gal { font-size: 11px; }
}
