/* ================================================================
   WINDA — symulator windy · blok z lat 80.
   "Blok o zmierzchu": a Warsaw panel block at dusk. Slate night,
   concrete panels, sodium-lamp amber, fluorescent lift cyan.
   ================================================================ */

:root {
  --bg0: #0d1017;          /* page / deep night */
  --surface: #191d26;      /* panels, chart surface */
  --surface2: #212633;
  --surface3: #2a3040;
  --concrete: #383d47;
  --concrete-dark: #2b2f38;
  --joint: #23262e;        /* panel joints */
  --ink: #f2eee3;          /* warm white */
  --ink2: #b9b4a5;
  --muted: #837f74;
  --hairline: #272c38;
  --amber: #f5a83c;        /* sodium vapour */
  --amber-hot: #ffc46a;
  --amber-deep: #b06f14;
  --cyan: #6dd3bd;         /* fluorescent lift light */
  --cyan-dim: #2e6e60;
  --red: #e0564d;
  --window-warm: #ffb84d;
  --floorH: 46px;
  --font-display: 'Unica One', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'IBM Plex Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  overflow: hidden;
  /* faint grain */
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(245,168,60,0.05), transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ================= topbar ================= */

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 22px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, #12151d, #0e1118);
}

.brand { display: flex; flex-direction: column; }

.neon {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 0.9;
  letter-spacing: 0.14em;
  color: var(--amber-hot);
  text-shadow:
    0 0 6px rgba(245,168,60,0.9),
    0 0 18px rgba(245,168,60,0.55),
    0 0 42px rgba(245,168,60,0.30);
  animation: neon-flicker 11s infinite;
}

@keyframes neon-flicker {
  0%, 100% { opacity: 1; }
  71.2% { opacity: 1; }
  71.6% { opacity: 0.55; }
  72.0% { opacity: 1; }
  84.1% { opacity: 1; }
  84.4% { opacity: 0.7; }
  84.7% { opacity: 1; }
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
  white-space: nowrap;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 16px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #0a0d13;
  font-family: var(--font-mono);
}
.clock-day { color: var(--cyan); font-size: 13px; min-width: 108px; }
.clock-time {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.clock-week { color: var(--muted); font-size: 11px; white-space: nowrap; }

.speed { display: flex; gap: 4px; }
.speed-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink2);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 7px 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.speed-btn:hover { border-color: var(--amber-deep); color: var(--ink); }
.speed-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #241503;
  font-weight: 600;
}

.speed-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}
#speed-slider { width: 150px; }
.speed-readout {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  min-width: 58px;
  font-variant-numeric: tabular-nums;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--cyan);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn:hover { border-color: var(--cyan-dim); background: #12211e; }

.tiles { display: flex; gap: 8px; margin-left: auto; }
.tile {
  min-width: 86px;
  padding: 7px 12px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
}
.tile-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tile-value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 1px;
}
.tile-value.good { color: var(--cyan); }
.tile-value.bad { color: var(--red); }
.tile-value.seg { color: var(--red); text-shadow: 0 0 8px rgba(224,86,77,0.6); }

/* ================= layout ================= */

main {
  display: flex;
  height: calc(100vh - 76px);
}

/* ================= scene ================= */

#scene {
  position: relative;
  flex: 0 0 460px;
  overflow: hidden;
  border-right: 1px solid var(--hairline);
}

#sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top, #0b0e1a) 0%, var(--sky-mid, #131a30) 55%, var(--sky-low, #2b2438) 100%);
  transition: background 2s linear;
}

#stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 44% 22%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 61% 12%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 75% 26%, #fff 50%, transparent 50%),
    radial-gradient(1.5px 1.5px at 88% 9%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 53% 33%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 8% 38%, #fff 50%, transparent 50%),
    radial-gradient(1px 1px at 94% 31%, #fff 50%, transparent 50%);
  opacity: var(--stars, 0.8);
  transition: opacity 2s linear;
}

#moon {
  position: absolute;
  top: 34px; right: 44px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #e8e4d4;
  box-shadow: inset -9px 4px 0 #b9b4a0, 0 0 24px rgba(232,228,212,0.35);
  opacity: var(--moon, 1);
  transition: opacity 2s linear;
}

#skyline {
  position: absolute;
  left: 0; right: 0; bottom: 40px;
  height: 120px;
  background:
    linear-gradient(180deg, transparent 0 26%, #10131b 26% 100%) 0 0/62px 100% no-repeat,
    linear-gradient(180deg, transparent 0 55%, #10131b 55% 100%) 70px 0/48px 100% no-repeat,
    linear-gradient(180deg, transparent 0 12%, #10131b 12% 100%) 340px 0/56px 100% no-repeat,
    linear-gradient(180deg, transparent 0 42%, #10131b 42% 100%) 404px 0/70px 100% no-repeat;
  opacity: 0.9;
}

#ground {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  background: linear-gradient(180deg, #171a20, #0c0e13);
  border-top: 1px solid #22262e;
}

/* --- the block itself --- */

#building {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  width: 320px;
}

#roof {
  height: 18px;
  background: var(--concrete-dark);
  border: 1px solid #1d2027;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  position: relative;
}
.antenna {
  position: absolute;
  top: -26px; left: 48px;
  width: 2px; height: 26px;
  background: #4a4f59;
}
.antenna::before {
  content: '';
  position: absolute;
  top: 2px; left: -6px;
  width: 14px; height: 1.5px;
  background: #4a4f59;
}
.antenna.a2 { left: auto; right: 74px; height: 18px; top: -18px; }

#floors { display: flex; flex-direction: column-reverse; }

.floor {
  display: grid;
  grid-template-columns: 104px 96px 104px 16px;
  height: var(--floorH);
  background:
    linear-gradient(180deg, var(--concrete) 0 92%, var(--joint) 92% 100%),
    var(--concrete);
  border-left: 1px solid #1d2027;
  border-right: 1px solid #1d2027;
  position: relative;
}
/* vertical panel joints */
.floor::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 51px, var(--joint) 51px 52px, transparent 52px),
    linear-gradient(90deg, transparent 0 268px, var(--joint) 268px 269px, transparent 269px);
  pointer-events: none;
}

.flat {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
}

.window {
  width: 26px;
  height: 22px;
  background: #141821;
  border: 2px solid var(--concrete-dark);
  border-radius: 1px;
  position: relative;
  transition: background 1.2s, box-shadow 1.2s;
}
.window::after { /* crossbar */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0 48%, rgba(0,0,0,0.55) 48% 56%, transparent 56%);
}
.window.lit {
  background: linear-gradient(180deg, #ffcf7e, var(--window-warm));
  box-shadow: 0 0 14px rgba(255,184,77,0.5);
}
.window.lit.cool {
  background: linear-gradient(180deg, #9fd8ec, #6fb6d8);
  box-shadow: 0 0 12px rgba(111,182,216,0.45); /* the TV glow flat */
}
.window.empty-flat { background: #10131a; border-color: #23262e; }

.landing {
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--concrete-dark);
  border-left: 1px solid var(--joint);
  border-right: 1px solid var(--joint);
}

.queue {
  position: absolute;
  left: 3px;
  bottom: 3px;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  z-index: 3;
  max-width: 56px;
  flex-wrap: nowrap;
}

/* little people */
.person {
  width: 7px; height: 15px;
  position: relative;
  flex: 0 0 auto;
}
.person::before { /* head */
  content: '';
  position: absolute;
  top: 0; left: 1.25px;
  width: 4.5px; height: 4.5px;
  border-radius: 50%;
  background: var(--p-color, var(--amber));
}
.person::after { /* body */
  content: '';
  position: absolute;
  top: 5px; left: 0;
  width: 7px; height: 10px;
  border-radius: 3px 3px 1px 1px;
  background: var(--p-color, var(--amber));
}
.person.up { --p-color: var(--cyan); }
.person.down { --p-color: var(--amber); }
.person.impatient::before, .person.impatient::after { animation: fidget 0.7s infinite; }
@keyframes fidget {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(1.5px); }
}
.person .dog {
  position: absolute;
  bottom: 0; left: 8px;
  width: 9px; height: 5px;
  border-radius: 2.5px 3px 1px 1px;
  background: var(--p-color, var(--amber));
  opacity: 0.75;
}
.person .dog::before { /* dog head */
  content: '';
  position: absolute;
  top: -2.5px; right: -1px;
  width: 3.5px; height: 3.5px;
  border-radius: 50%;
  background: inherit;
}
.queue-more {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink2);
  padding-bottom: 2px;
}

/* shaft door on each landing (right side) */
.shaft-door {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 26px;
  height: calc(var(--floorH) - 10px);
  background: #23272f;
  border: 1px solid #303540;
  border-bottom: none;
}
.shaft-door::after { /* little porthole */
  content: '';
  position: absolute;
  top: 7px; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 8px;
  border-radius: 3px;
  background: #0d0f14;
  transition: background 0.3s, box-shadow 0.3s;
}
.floor.lift-here .shaft-door::after {
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(109,211,189,0.8);
}

.floor-label {
  position: absolute;
  right: -26px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  width: 20px;
  text-align: left;
}
.floor.lift-here .floor-label { color: var(--cyan); }

/* call button lamp on landing */
.call-lamp {
  position: absolute;
  right: 36px;
  top: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #3a2f22;
  transition: all 0.2s;
}
.floor.called .call-lamp {
  background: var(--amber-hot);
  box-shadow: 0 0 6px var(--amber);
}

/* --- the cab, riding an overlay shaft --- */

#shaft-overlay {
  position: absolute;
  right: 126px; /* aligned over the landing shaft doors */
  bottom: 34px; /* sits on top of the entrance strip */
  width: 26px;
  top: 18px;
  pointer-events: none;
  z-index: 2;
}

#cab {
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 26px;
  height: calc(var(--floorH) - 10px);
  background: #10131a;
  border: 1px solid #3c424e;
  overflow: hidden;
  will-change: transform;
}

.cab-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(109,211,189,0.35), rgba(109,211,189,0.12));
  transition: opacity 0.4s;
}

.cab-people {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  display: flex;
  flex-wrap: wrap-reverse;
  gap: 1.5px;
  z-index: 1;
}
.cab-people .rider {
  width: 5px; height: 9px;
  border-radius: 2px 2px 1px 1px;
  background: var(--ink2);
}

.cab-door {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, #2c313c, #232830);
  z-index: 2;
  transition: transform 0.3s linear;
}
.cab-door.left { left: 0; border-right: 0.5px solid #12151b; }
.cab-door.right { right: 0; border-left: 0.5px solid #12151b; }
#cab.doors-open .cab-door.left { transform: translateX(-96%); }
#cab.doors-open .cab-door.right { transform: translateX(96%); }

/* entrance */
#entrance {
  height: 34px;
  background: var(--concrete-dark);
  border: 1px solid #1d2027;
  border-top: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.entrance-sign {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: #0c0e13;
  background: var(--ink2);
  padding: 2px 8px;
  border-radius: 2px;
}

/* street lamp */
#lamp {
  position: absolute;
  bottom: 40px;
  left: 36px;
  width: 4px;
  height: 110px;
  background: #3a3f49;
  z-index: 1;
}
#lamp::before {
  content: '';
  position: absolute;
  top: -2px; left: 0;
  width: 26px; height: 4px;
  background: #3a3f49;
  border-radius: 2px;
}
#lamp::after {
  content: '';
  position: absolute;
  top: 2px; left: 18px;
  width: 10px; height: 6px;
  border-radius: 0 0 5px 5px;
  background: var(--amber-hot);
  box-shadow: 0 0 16px 4px rgba(245,168,60,0.65);
  opacity: var(--lamp-on, 1);
  transition: opacity 2s;
}
.lamp-glow {
  position: absolute;
  top: 6px; left: -22px;
  width: 70px; height: 120px;
  background: radial-gradient(ellipse 50% 90% at 65% 0%, rgba(245,168,60,0.13), transparent 70%);
  opacity: var(--lamp-on, 1);
  transition: opacity 2s;
}

/* narrative feed */
#feed {
  position: absolute;
  left: 12px;
  bottom: 48px;
  width: 168px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.75;
  color: var(--ink2);
  pointer-events: none;
  z-index: 4;
}
#feed .feed-line {
  opacity: 0.9;
  background: rgba(10, 13, 19, 0.78);
  border-radius: 3px;
  padding: 1px 6px;
  margin-top: 3px;
  width: fit-content;
  max-width: 168px;
}
#feed .feed-line:nth-last-child(n+4) { opacity: 0.45; }
#feed .feed-time { color: var(--amber); margin-right: 5px; }

/* ================= panel ================= */

#panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg0);
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.tab {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 14px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.tab .tab-pl {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.tab-page {
  display: none;
  overflow-y: auto;
  padding: 18px;
  flex: 1;
}
.tab-page.active { display: block; }

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--ink);
  margin-bottom: 3px;
}
.card .card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* sliders */
.slider-row {
  display: grid;
  grid-template-columns: 190px 1fr 74px;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
}
.slider-row label { font-size: 12.5px; color: var(--ink2); }
.slider-row .slider-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #241503;
  box-shadow: 0 0 6px rgba(245,168,60,0.45);
}
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid #241503;
}

/* radio cards for parking policy */
.policy-grid { display: flex; flex-direction: column; gap: 8px; }
.policy {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 13px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.15s;
}
.policy:hover { border-color: var(--amber-deep); }
.policy.selected { border-color: var(--amber); background: #241f14; }
.policy input { margin-top: 3px; accent-color: var(--amber); }
.policy .policy-name { font-weight: 600; font-size: 13px; }
.policy .policy-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.policy .policy-extra { margin-top: 8px; }

/* toggle (mode switch) */
.mode-row {
  display: flex;
  gap: 8px;
}
.mode-btn {
  flex: 1;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink2);
  background: var(--surface2);
  border: 1px solid var(--hairline);
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}
.mode-btn small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 400; }
.mode-btn.selected { border-color: var(--cyan); color: var(--cyan); background: #12211e; }

/* buttons */
.btn {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface2);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--amber-deep); }
.btn.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #241503;
}
.btn.primary:hover { background: var(--amber-hot); }
.btn.primary:disabled { opacity: 0.45; cursor: default; }
.btn.ghost { background: none; }

/* ============ residents grid ============ */

.pop-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink2);
  background: var(--surface2);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 4px 11px;
}
.chip b { color: var(--amber); font-weight: 600; }

.flats-grid {
  display: grid;
  grid-template-columns: 34px 1fr 1fr;
  gap: 5px;
  align-items: stretch;
}
.flats-floor-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.flat-card {
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--surface2);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.flat-card.empty { opacity: 0.55; }
.flat-card .flat-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.flat-glyph { font-size: 17px; line-height: 1; width: 24px; text-align: center; }
.flat-label { color: var(--ink2); }
.flat-label small { display: block; color: var(--muted); font-size: 10px; }
.flat-mini-btn {
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 1px solid var(--hairline);
  background: var(--surface3);
  color: var(--ink2);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.flat-mini-btn:hover { border-color: var(--amber-deep); }
.flat-mini-btn.on { border-color: var(--amber); color: var(--amber); background: #241f14; }

.hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 12px;
}

/* ============ analytics ============ */

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 12px 14px;
}
.stat-tile .st-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-tile .st-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  margin-top: 3px;
}
.stat-tile .st-note { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.chart-filters { display: flex; gap: 6px; margin-bottom: 10px; }
.filter-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--hairline);
  background: none;
  color: var(--ink2);
  cursor: pointer;
}
.filter-chip.active { border-color: var(--amber); color: var(--amber); background: #241f14; }

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 6px 0 8px;
  font-size: 11.5px;
  color: var(--ink2);
}
.legend-key { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.chart-box { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; }

.axis-text {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--muted);
}
.gridline { stroke: var(--hairline); stroke-width: 1; }
.chart-direct-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink2);
}

/* optimizer */
.opt-progress {
  height: 5px;
  border-radius: 3px;
  background: var(--surface3);
  overflow: hidden;
  margin: 12px 0;
  display: none;
}
.opt-progress.running { display: block; }
.opt-progress .opt-bar {
  height: 100%;
  width: 0%;
  background: var(--cyan);
  transition: width 0.2s;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.compare-tile {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--surface2);
}
.compare-tile.winner { border-color: var(--cyan); background: #12211e; }
.compare-tile .cmp-name { font-size: 11px; color: var(--ink2); font-weight: 600; }
.compare-tile .cmp-value { font-family: var(--font-mono); font-size: 21px; font-weight: 600; margin-top: 4px; }
.compare-tile.winner .cmp-value { color: var(--cyan); }
.compare-tile .cmp-note { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 44px repeat(24, 1fr);
  gap: 2px;
  margin-top: 10px;
}
.hm-corner, .hm-hour {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--muted);
  text-align: center;
  align-self: end;
  padding-bottom: 3px;
}
.hm-day {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink2);
  display: flex;
  align-items: center;
}
.hm-cell {
  aspect-ratio: 1 / 1.15;
  min-width: 0;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--muted);
  cursor: default;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.heatmap-legend .hl-swatch {
  width: 18px; height: 10px; border-radius: 2px;
}

/* tooltip */
#tooltip {
  position: fixed;
  z-index: 50;
  background: #0a0d13;
  border: 1px solid var(--surface3);
  border-radius: 6px;
  padding: 8px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  pointer-events: none;
  max-width: 230px;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}
#tooltip .tt-title { color: var(--amber); font-weight: 600; }
#tooltip .tt-muted { color: var(--muted); }

/* scrollbars */
.tab-page::-webkit-scrollbar { width: 9px; }
.tab-page::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 5px; }
.tab-page::-webkit-scrollbar-track { background: transparent; }

/* ============ responsive ============ */

@media (max-width: 980px) {
  body { overflow: auto; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  .tiles { margin-left: 0; width: 100%; }
  .tile { flex: 1; }
  main { flex-direction: column; height: auto; }
  #scene { flex: none; height: 76vh; border-right: none; border-bottom: 1px solid var(--hairline); }
  #panel { flex: none; }
  .tab-page { overflow: visible; }
  .slider-row { grid-template-columns: 1fr 60px; }
  .slider-row label { grid-column: 1 / -1; }
}
