:root {
  --bg: #f3f4f6; --ink: #111215; --ink2: #43464d; --muted: #63676f; --line: rgba(17,18,21,.10);
  --red: #c62a2f; --blue: #2f6bc0; --btn-bg: #111215; --btn-fg: #fff;
  --gf: rgba(255,255,255,.62); --gf2: rgba(255,255,255,.3); --ge: rgba(255,255,255,.95); --chip: rgba(255,255,255,.72);
  --field: rgba(255,255,255,.6); --field-line: rgba(17,18,21,.14); --ring: rgba(47,107,192,.26);
  --sg: inset 0 1px 0 rgba(255,255,255,.25), 0 24px 60px -32px rgba(17,18,21,.38); --orb: .19;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07080a; --ink: #f2f3f5; --ink2: #b4b9c1; --muted: #8c929b; --line: rgba(255,255,255,.10);
    --red: #e5555c; --blue: #6fa3e8; --btn-bg: #f2f3f5; --btn-fg: #111215;
    --gf: rgba(255,255,255,.075); --gf2: rgba(255,255,255,.015); --ge: rgba(255,255,255,.4); --chip: rgba(255,255,255,.08);
    --field: rgba(255,255,255,.05); --field-line: rgba(255,255,255,.14); --ring: rgba(111,163,232,.34);
    --sg: inset 0 1px 0 rgba(255,255,255,.06), 0 30px 80px -40px rgba(0,0,0,.9); --orb: .12; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 "Geist", ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: clip; }
.orb { position: fixed; border-radius: 50%; filter: blur(110px); opacity: var(--orb); pointer-events: none; z-index: 0; }
.orb.r { width: 520px; height: 520px; left: -200px; top: -220px; background: var(--red); }
.orb.b { width: 560px; height: 560px; right: -240px; bottom: -260px; background: var(--blue); }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: 19px; letter-spacing: -0.03em; }
main { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 20px 16px 60px; display: flex; flex-direction: column; gap: 14px; }
h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.05; margin: 8px 0 0; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; }
.eyebrow { font-family: "Geist Mono", ui-monospace, monospace; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--ink2); } .faint { color: var(--muted); } .small { font-size: 14px; }
.card { background: linear-gradient(145deg, var(--gf), var(--gf2)); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1.2px solid var(--ge); box-shadow: var(--sg); border-radius: 26px; padding: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }
button { font: inherit; font-size: 15px; font-weight: 500; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--field-line);
  background: var(--chip); color: var(--ink); cursor: pointer; touch-action: manipulation; }
button.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
button.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
button.danger { color: var(--red); background: transparent; border-color: color-mix(in srgb, var(--red) 45%, transparent); }
button:disabled { opacity: .45; }
button:focus-visible, input:focus { outline: 0; box-shadow: 0 0 0 4px var(--ring); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink2); font-weight: 500; }
input { font: inherit; font-size: 16px; color: var(--ink); background: var(--field); border: 1px solid var(--field-line); border-radius: 14px; padding: 0 14px; min-height: 48px; }
input.code { font-family: "Geist Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.err { color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); border-radius: 16px; padding: 10px 14px; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); }
.tabs button { flex: 1; min-height: 38px; border: 0; background: transparent; font-size: 14px; }
.tabs button.on { background: var(--btn-bg); color: var(--btn-fg); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* home */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.hero .big { font-size: 56px; font-weight: 500; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.on { background: #2fa36b; }
.pill { display: inline-flex; gap: 7px; align-items: center; font-size: 13px; padding: 4px 11px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); color: var(--ink2); }
.pill.hot { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.fact { background: var(--chip); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.fact b { display: block; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.fact span { font-size: 11.5px; color: var(--muted); }
.zone { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.zone + .zone { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 4px; }
.zone .name { font-weight: 600; }
.zone .temp { font-size: 34px; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.zone .state { font-size: 13px; color: var(--muted); }
.zone .state.heat { color: var(--red); }
.stepper { display: flex; align-items: center; gap: 6px; background: var(--chip); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.stepper button { width: 42px; min-height: 42px; padding: 0; font-size: 22px; line-height: 1; border: 0; }
.stepper output { min-width: 70px; text-align: center; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper output small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); font-family: "Geist Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }
.pending { font-size: 12.5px; color: var(--blue); grid-column: 1 / -1; }
.alert { border-color: color-mix(in srgb, var(--blue) 50%, transparent); box-shadow: 0 0 0 4px var(--ring), var(--sg); }
.alert.warn { border-color: color-mix(in srgb, var(--red) 40%, transparent); box-shadow: var(--sg); }
svg.spark { width: 100%; height: 120px; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink2); margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; text-align: right; }
.mono { font-family: "Geist Mono", monospace; font-size: 13.5px; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--btn-bg); color: var(--btn-fg); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: s .8s linear infinite; margin: 30px auto; }
@keyframes s { to { transform: rotate(360deg); } }
/* charts */
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-top h2 { margin: 0; }
.card-top .tabs { flex: 0 1 auto; }
.card-top .tabs button { flex: none; padding: 0 12px; min-height: 32px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { min-height: 30px; padding: 0 11px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); background: transparent; }
.chip.on { color: var(--ink); background: var(--chip); }
.chip i, .readout i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; flex: none; }
.chip i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 7px); }
.chip i.area { height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--c) 30%, transparent); }
.chip:not(.on) i { opacity: .35; }
.readout { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink2); min-height: 20px; margin-bottom: 4px; }
.readout .rt { color: var(--muted); font-family: "Geist Mono", monospace; font-size: 12px; }
.readout span { display: inline-flex; align-items: center; gap: 6px; }
.readout b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.plot { width: 100%; min-height: 60px; }
.plot .u-select { background: color-mix(in srgb, var(--blue) 14%, transparent); }
.plot .u-cursor-x, .plot .u-cursor-y { border-color: var(--muted) !important; }
.plot-status { margin: 6px 0 0; }
.empty-plot { padding: 30px 0; text-align: center; }
.energy-facts { margin: 0 0 10px; }
