:root {
  --bg: #090b12;
  --panel: rgba(14, 17, 28, .72);
  --panel-solid: #11141f;
  --line: rgba(255, 255, 255, .10);
  --text: #e9ecf6;
  --muted: #98a0b8;
  --accent: #ffb840;
  --accent2: #55f0ff;
  --chip: rgba(255, 255, 255, .07);
  --chip-hover: rgba(255, 255, 255, .14);
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --good: #4fd8a0; --ok: #e8d35a; --warn: #ff9a3c; --bad: #ff5a5a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; }
#map { position: fixed; inset: 0; background: var(--bg); }
#map canvas { outline: none; }

.glass { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); }
h1, h2, p { margin: 0; }
h2 { font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
h2 .sub { font-weight: 500; letter-spacing: .02em; text-transform: none; font-size: 11px; opacity: .8; }
.muted { color: var(--muted); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------------------------------------------------------------- brand */
#brand { position: fixed; top: 14px; left: 14px; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 12px; z-index: 5; }
#brand h1 { font-size: 17px; letter-spacing: .28em; font-weight: 750; line-height: 1.05; }
#brand p { color: var(--muted); font-size: 11.5px; }
.logo { display: flex; align-items: center; gap: 2px; padding: 0 2px; }
.logo i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: block; }
.logo b { width: 7px; height: 13px; border-radius: 4px; background: var(--accent2); display: block; margin-left: 1px; }
.pill { background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600; }
.pill:hover { background: var(--chip-hover); }
a.pill { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- side panels */
aside { position: fixed; z-index: 4; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 150px); overflow-y: auto; scrollbar-width: none; }
aside::-webkit-scrollbar { display: none; }
#left { top: 84px; left: 14px; width: 270px; max-height: calc(100vh - 84px - 112px); }
#right { top: 14px; right: 14px; width: 330px; max-height: calc(100vh - 140px); }
.card { padding: 13px 14px; }
.row { display: flex; gap: 8px; }
select, input[type=date], input[type=time] { width: 100%; background: var(--chip); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; outline: none; }
select option { background: var(--panel-solid); color: var(--text); }
select:focus, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; }
.chip:hover { background: var(--chip-hover); }
.chk { display: flex; align-items: center; gap: 9px; padding: 3px 0; cursor: pointer; user-select: none; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.chk em { color: var(--muted); font-style: normal; font-size: 11px; }
#legend { margin-top: 10px; font-size: 11px; color: var(--muted); }
#legend .ramp { height: 8px; border-radius: 4px; margin: 4px 0 2px; }
#legend .rl { display: flex; justify-content: space-between; }
#legend .cat { display: flex; align-items: center; gap: 7px; margin: 2px 0; }
#legend .cat i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------------------------------------------------------------- now card */
.big { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 8px; }
.big span { font-size: 36px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.big small { color: var(--muted); font-size: 13px; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.trio b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.trio span { color: var(--muted); font-size: 11px; line-height: 1.2; display: block; }
#spark { width: 100%; height: 64px; display: block; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot.single { background: var(--accent2); } .dot.convoy { background: var(--accent); } .dot.wait { background: #fff; border: 1px solid var(--muted); }

/* ---------------------------------------------------------------- zone card */
.zhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.zhead h3 { margin: 0; font-size: 17px; line-height: 1.15; }
.zhead small { color: var(--muted); }
.verdict { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; color: #101420; white-space: nowrap; }
.v0 { background: var(--good); } .v1 { background: var(--ok); } .v2 { background: var(--warn); } .v3 { background: var(--bad); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 6px 0; }
.kpis div b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.kpis div span { color: var(--muted); font-size: 11px; }
.zread { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text); opacity: .92; }
.zspark { width: 100%; height: 44px; margin-top: 6px; display: block; }
.x2 { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 0 4px; line-height: 1; }

/* ---------------------------------------------------------------- time bar */
#timebar { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: 14px; width: min(1180px, calc(100vw - 28px));
  display: grid; grid-template-columns: auto 128px 1fr auto; align-items: center; gap: 16px; padding: 12px 18px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: #17120a; display: grid; place-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.round svg { fill: currentColor; }
.clock #clock { font-size: 30px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1; }
.clock #daypart { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; }
.slidewrap { position: relative; height: 54px; }
#daycurve { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 34px; pointer-events: none; }
#slider { position: absolute; left: 0; right: 0; top: 14px; width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
#slider::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--accent); }
.ticks { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.ctl { display: flex; align-items: center; gap: 12px; }
.ctl label { display: flex; flex-direction: column; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); gap: 3px; }
.ctl select, .ctl input[type=date], .ctl input[type=time] { width: auto; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text); }
.sun { font-size: 11px; color: var(--muted); line-height: 1.3; white-space: nowrap; }

/* ---------------------------------------------------------------- tooltip, loading, modal */
#tooltip { position: fixed; z-index: 20; pointer-events: none; background: var(--panel-solid); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; font-size: 12px; max-width: 260px; box-shadow: var(--shadow); }
#tooltip b { display: block; margin-bottom: 1px; }
#loading { position: fixed; inset: 0; z-index: 50; background: #090b12; display: grid; place-items: center; transition: opacity .6s; color: #e9ecf6; }
#loading.done { opacity: 0; pointer-events: none; }
.loadbox { text-align: center; width: 320px; }
.loadbox h1 { letter-spacing: .5em; font-size: 22px; margin: 16px 0 6px; padding-left: .5em; }
.loadbox p { color: #98a0b8; margin-bottom: 14px; min-height: 20px; }
.bar { height: 3px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
#loadbar { height: 100%; width: 0; background: #ffb840; transition: width .3s; }
.worm { display: flex; justify-content: center; gap: 4px; height: 26px; }
.worm i { width: 14px; height: 14px; border-radius: 50%; background: #ffb840; display: block; animation: inch 1.2s ease-in-out infinite; }
.worm i:nth-child(1) { animation-delay: 0s; } .worm i:nth-child(2) { animation-delay: .1s; } .worm i:nth-child(3) { animation-delay: .2s; }
.worm i:nth-child(4) { animation-delay: .3s; } .worm i:nth-child(5) { animation-delay: .4s; } .worm i:nth-child(6) { animation-delay: .5s; background: #55f0ff; width: 12px; height: 18px; border-radius: 6px; }
@keyframes inch { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(5, 7, 12, .55); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.sheet { position: relative; width: min(920px, 100%); height: min(86vh, 900px); overflow: hidden; background: var(--panel-solid); }
.sheet iframe { width: 100%; height: 100%; border: 0; background: transparent; }
.x { position: absolute; right: 12px; top: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--chip); font-size: 22px; line-height: 1; }

/* ---------------------------------------------------------------- light theme (set by JS) */
:root[data-look="day"] {
  --bg: #f3f0e9; --panel: rgba(255, 255, 255, .72); --panel-solid: #fbfaf6; --line: rgba(20, 24, 40, .12);
  --text: #1a1e2c; --muted: #636a80; --accent: #e5560f; --accent2: #007a8a; --chip: rgba(20, 24, 40, .06); --chip-hover: rgba(20, 24, 40, .12);
  --shadow: 0 10px 40px rgba(60, 50, 30, .16); color-scheme: light;
  --good: #1f9d6b; --ok: #c9a810; --warn: #e5780f; --bad: #d63c3c;
}
:root[data-look="day"] .round { color: #fff; }
:root[data-look="day"] .verdict { color: #fff; }
:root[data-look="day"] #slider::-webkit-slider-thumb { border-color: #fff; }

@media (max-width: 980px) {
  #right { top: auto; bottom: 150px; right: 14px; width: 300px; max-height: 36vh; }
  #timebar { grid-template-columns: auto 1fr; }
  .slidewrap { grid-column: 1 / -1; order: 3; }
  .ctl { grid-column: 1 / -1; order: 4; flex-wrap: wrap; }
  #left { display: none; }
}

@media (max-width: 700px) {
  #brand p { display: none; }
  #right { top: 84px; bottom: auto; right: 14px; left: 14px; width: auto; max-height: 120px; overflow: hidden; }
  #card-zone, #spark, .legend-inline, .trio { display: none; }
  #card-now { padding: 9px 14px; }
  .big { margin: 0; } .big span { font-size: 28px; }
  #timebar { padding: 10px 14px; gap: 10px; }
  .clock #clock { font-size: 24px; }
}
.glass, select, input[type=date], input[type=time] { transition: background-color .8s, color .8s, border-color .8s; }

#attrib { position: fixed; z-index: 4; left: 0; right: 0; bottom: 1px; text-align: center; font-size: 9.5px; line-height: 12px; color: var(--muted); opacity: .8; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
#attrib a { color: inherit; pointer-events: auto; }
