/* Speedy — quiet instrument. Warm paper neutrals, sage for download, clay for upload,
   hairline borders, light-weight numerals. Light + dark follow the device. */
:root {
  --bg: #f3efe8;          /* warm paper */
  --surface: #fbf9f5;     /* cards */
  --surface-2: #e9e3d8;   /* chips, inputs, gauge track */
  --line: #e2dbcf;        /* hairlines */
  --line-strong: #d3cabb;
  --fg: #2a2722;          /* ink */
  --muted: #7a7268;
  --dim: #aaa196;
  --down: #6f8466;        /* sage */
  --up: #b07a55;          /* clay */
  --accent: #3e4a3d;      /* deep moss, primary actions */
  --on-accent: #f3efe8;
  --good: #5e8a5a;
  --warn: #c49a3a;        /* ochre */
  --bad: #b5543c;         /* rust */
  --shadow: 0 1px 2px rgba(60, 48, 30, 0.05), 0 8px 24px rgba(60, 48, 30, 0.06);
  --ui: 'Geist', -apple-system, 'Helvetica Neue', system-ui, sans-serif;
  --tab-h: 62px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191714; --surface: #221f1b; --surface-2: #2e2a25; --line: #2f2b26; --line-strong: #3d3832;
    --fg: #ede6da; --muted: #a39a8d; --dim: #6e665c; --down: #9db08f; --up: #d39b74;
    --accent: #dcd3c3; --on-accent: #191714; --good: #8db585; --warn: #d9b25c; --bad: #d97b5f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .file-btn:focus-within { outline: 2px solid var(--down); outline-offset: 2px; }
input, select { font: inherit; color: var(--fg); }
[hidden] { display: none !important; }
h2, h3 { font-weight: 500; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
small { font-size: 0.75em; color: var(--muted); }
b { font-weight: 500; }
.metric b, .readout b, .stat b, .rrow b, .vs b { font-variant-numeric: tabular-nums; }

#app { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }

/* header */
.top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; height: 56px; flex: none;
  padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.brand { justify-self: center; display: flex; align-items: center; gap: 8px; font: 500 17px/1 var(--ui); letter-spacing: -0.01em; color: var(--fg); text-transform: none; }
.brand-icon { width: 30px; height: 30px; display: block; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

main { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.tab { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tab.pad { padding: 8px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }

/* tab bar */
.tabbar { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar button { height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--dim); font-size: 11px; font-weight: 500; letter-spacing: 0.01em; }
.tabbar svg { width: 23px; height: 23px; }
.tabbar svg [stroke-width] { stroke-width: 1.5; }
.tabbar button.on { color: var(--fg); }

/* ---------- speed tab ---------- */
#tab-speed { display: flex; flex-direction: column; }
.speed-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 16px; min-height: 420px; position: relative; }
.idle-view { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.go { width: min(56vw, 220px); aspect-ratio: 1; border-radius: 50%; position: relative; display: grid; place-items: center; isolation: isolate;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); transition: transform 0.2s ease, border-color 0.2s;
  grid-template-rows: auto auto; align-content: center; gap: 4px; }
.go-label { font: 500 17px/1 var(--ui); letter-spacing: 0.02em; color: var(--on-accent); background: var(--accent); padding: 8px 22px 9px; border-radius: 999px; box-shadow: var(--shadow); transition: background 0.2s; }
.go:hover .go-label { background: var(--down); }
.go::after { content: ''; position: absolute; inset: -14px; border-radius: 50%; z-index: -1; border: 1px solid var(--down); opacity: 0.35; animation: breathe 3.6s ease-in-out infinite; }
/* runner: an original kid ballplayer running in side view */
.runner { width: 68%; height: auto; aspect-ratio: 1; margin: -10% 0 -8%; overflow: visible; --jersey: #e6d6bb; --cap: #3e4a3d; --skin: #d6a47a; --pants: #efe7da; --sock: #b07a55; --ink: #2a2722; --shoe: #2a2722; }
@media (prefers-color-scheme: dark) { .runner { --cap: #7d9472; --ink: #0d0b09; --shoe: #a07a5c; --pants: #e2d8c8; } }
.runner * { transform-box: view-box; }
.runner .ground { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 7 9; animation: ground 0.45s linear infinite; }
.runner .speedlines path { stroke: var(--dim); stroke-width: 2; stroke-linecap: round; fill: none; animation: whoosh 0.9s ease-in-out infinite; }
.runner .body { animation: bob 0.45s ease-in-out infinite; }
.runner .lean { transform: rotate(9deg); transform-origin: 60px 74px; }
.runner .jersey { fill: var(--jersey); stroke: var(--ink); stroke-width: 1.6; }
.runner .stripe { stroke: var(--sock); stroke-width: 2.4; }
.runner .head { fill: var(--skin); stroke: var(--ink); stroke-width: 1.6; }
.runner .cap, .runner .brim { fill: var(--cap); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.runner .thigh { stroke: var(--pants); stroke-width: 7.5; stroke-linecap: round; }
.runner .sock { stroke: var(--sock); stroke-width: 5.5; stroke-linecap: round; }
.runner .shoe { fill: var(--shoe); }
.runner .upper { stroke: var(--jersey); stroke-width: 6; stroke-linecap: round; }
.runner .fore path { stroke: var(--skin); stroke-width: 4.6; stroke-linecap: round; }
.runner .leg-back, .runner .arm-back { filter: brightness(0.82); }
.runner .leg { transform-origin: 60px 74px; animation: thigh 0.45s linear infinite; }
.runner .shin { transform-origin: 60px 88px; animation: shin 0.45s linear infinite; }
.runner .arm { transform-origin: 60px 52px; animation: arm 0.45s ease-in-out infinite; }
.runner .fore { transform-origin: 60px 63px; transform: rotate(-80deg); }
.runner .leg-back, .runner .leg-back .shin, .runner .arm-front { animation-delay: -0.225s; }
@keyframes thigh { 0% { transform: rotate(-38deg); } 50% { transform: rotate(36deg); } 100% { transform: rotate(-38deg); } }
@keyframes shin { 0% { transform: rotate(12deg); } 30% { transform: rotate(18deg); } 55% { transform: rotate(40deg); } 75% { transform: rotate(105deg); } 100% { transform: rotate(12deg); } }
@keyframes arm { 0% { transform: rotate(48deg); } 50% { transform: rotate(-52deg); } 100% { transform: rotate(48deg); } }
@keyframes bob { 0%, 50%, 100% { transform: translateY(0); } 25%, 75% { transform: translateY(-3px); } }
@keyframes ground { to { stroke-dashoffset: 16; } }
@keyframes whoosh { 0%, 100% { opacity: 0.25; transform: translateX(4px); } 50% { opacity: 0.8; transform: translateX(-4px); } }
.go:hover { border-color: var(--down); }
.go:active { transform: scale(0.98); }
@keyframes breathe { 50% { opacity: 0.08; transform: scale(1.05); } }

.speed-stage:has(#metrics:not([hidden])) { justify-content: flex-start; padding-top: 0; }
.metrics { position: sticky; top: 0; z-index: 3; background: var(--bg); width: 100%; max-width: 520px; padding: 10px 0 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; border-bottom: 1px solid var(--line); }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric b { font: 300 38px/1.05 var(--ui); letter-spacing: -0.03em; }
.m-label { font: 500 11px/1 var(--ui); letter-spacing: 0.08em; color: var(--muted); display: flex; align-items: center; gap: 6px; text-transform: uppercase; }
.m-label small { letter-spacing: 0; text-transform: none; }
.arrow { font-style: normal; width: 8px; height: 8px; border-radius: 50%; font-size: 0; display: inline-block; }
.metric.down .arrow { background: var(--down); }
.metric.up .arrow { background: var(--up); }
.pings { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pings b { color: var(--fg); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.idle { background: var(--warn); } .dot.down { background: var(--down); } .dot.up { background: var(--up); }

.run-view { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; margin-top: 16px; }
.gauge-wrap { position: relative; width: min(84vw, 330px); aspect-ratio: 1; }
.gauge-wrap canvas { width: 100%; height: 100%; display: block; }
.readout { position: absolute; left: 0; right: 0; bottom: 15%; display: flex; flex-direction: column; align-items: center; }
.readout b { font: 300 48px/1 var(--ui); letter-spacing: -0.035em; }
.phase { font: 500 11px/1 var(--ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.progress { width: min(64vw, 240px); height: 2px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--fg); transition: width 0.15s linear; }
.text-btn { color: var(--fg); font-weight: 500; padding: 8px 10px; border-radius: 10px; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.text-btn:hover { text-decoration-color: var(--fg); }

/* result */
.result-view { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 12px; padding-top: 6px; padding-bottom: 12px; }
.again { align-self: center; width: 76px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; margin: 6px 0;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); color: var(--fg); transition: border-color 0.2s; }
.again:hover { border-color: var(--down); }
.again svg { width: 26px; height: 26px; transition: transform 0.3s ease; }
.again svg path { stroke-width: 1.6; }
.again:active svg { transform: rotate(90deg); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h4 { margin: 0; font: 500 11px/1 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card p b { color: var(--fg); }
.big { font: 400 20px/1.3 var(--ui); letter-spacing: -0.015em; color: var(--fg); }
.grade-row { display: flex; align-items: center; gap: 16px; }
.grade { font: 400 28px/1 var(--ui); letter-spacing: -0.02em; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.g-good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.g-ok { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.g-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; }
.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 12px; }
.use { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.use span { width: 18px; text-align: center; }
.use .ok { color: var(--good); } .use .meh { color: var(--warn); } .use .no { color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { text-align: right; overflow-wrap: anywhere; }
.kv a { color: var(--fg); }

/* info sheet (bottom) */
.info-sheet { flex: none; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; margin: 0 6px;
  padding: 8px max(18px, env(safe-area-inset-right, 0px)) 16px max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; }
.grab { width: 34px; height: 4px; border-radius: 4px; background: var(--line-strong); align-self: center; margin: 0 auto 2px; }
.info-row { display: flex; align-items: center; gap: 14px; }
.conn-badge { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--fg); flex: none; }
.conn-badge svg { width: 21px; height: 21px; }
.info-text { display: flex; flex-direction: column; min-width: 0; }
.info-text b { font: 500 18px/1.25 var(--ui); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-text span { color: var(--muted); font-size: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--fg); display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; }
.chip.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.chip.on { background: var(--fg); color: var(--bg); }

/* ---------- video: a dark "screening room" in both themes ---------- */
.video-tab { overflow: hidden; background: #1f1b16; --fg: #ede6da; --muted: #b5ab9c; --line: rgba(237, 230, 218, 0.12); color: var(--fg); }
#swirl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.video-overlay { position: absolute; inset: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center;
  padding: 24px max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px)); background: radial-gradient(ellipse at center, rgba(31, 27, 22, 0.25), rgba(31, 27, 22, 0.78)); }
.video-overlay h2 { font-size: 28px; font-weight: 400; letter-spacing: -0.02em; }
.video-overlay p { color: var(--muted); max-width: 34ch; margin: 0; }
.video-overlay p b { color: var(--fg); }
.play { width: 108px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; color: #1f1b16; background: #ede6da; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); transition: transform 0.2s; }
.play:active { transform: scale(0.97); }
.play svg { width: 34px; height: 34px; margin-left: 5px; }
.video-overlay .text-btn { color: var(--fg); }
.video-status { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(31, 27, 22, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.vprog { height: 2px; background: var(--line); } .vprog i { display: block; height: 100%; width: 0; background: #c9b79c; transition: width 0.3s; }
.vstat-row { display: flex; align-items: center; gap: 12px; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); color: var(--muted); }
.conn-mini { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.conn-mini svg { width: 15px; height: 15px; }
.ladder { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 1px; text-align: left; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.rung { display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; align-items: center; background: rgba(31, 27, 22, 0.72); padding: 11px 14px; }
.rung b { font: 500 15px var(--ui); }
.rung .st { font-size: 13px; color: var(--muted); }
.rung .ok { color: #a9bf9a; } .rung .no { color: #e09a80; }
.best { font: 300 56px/1 var(--ui); letter-spacing: -0.04em; color: #e6d6bb; }

/* ---------- status ---------- */
.status-head { padding: 6px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; }
.powered { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.powered b { color: var(--fg); }
.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; height: 46px; color: var(--muted); }
.search:focus-within { border-color: var(--line-strong); }
.search svg { width: 19px; height: 19px; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 16px; }
.status-actions { display: flex; align-items: center; justify-content: space-between; padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); color: var(--muted); font-size: 13px; }
.group-label { display: flex; align-items: center; gap: 8px; margin: 0 16px; padding: 18px 0 8px; font: 500 11px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.group-label svg { width: 14px; height: 14px; }
.svc { border-bottom: 1px solid var(--line); margin: 0 16px; }
.svc-row { display: grid; grid-template-columns: 30px 1fr 26px 96px; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 58px; }
.svc-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.star { width: 30px; height: 30px; display: grid; place-items: center; color: var(--dim); }
.star svg { width: 18px; height: 18px; }
.star.on { color: var(--up); }
.star.on svg path { fill: currentColor; }
.sicon { width: 24px; height: 24px; display: grid; place-items: center; }
.sicon svg { width: 20px; height: 20px; }
.sicon.down { color: var(--bad); } .sicon.issues { color: var(--warn); } .sicon.ok { color: var(--good); } .sicon.pending { color: var(--dim); }
.spark { width: 96px; height: 28px; display: block; }
.svc-detail { padding: 0 0 14px 40px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.svc-detail b { color: var(--fg); }
.svc-detail a { color: var(--fg); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.svc-detail .links { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

/* ---------- map ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.section-head h2 { font-size: 24px; font-weight: 400; letter-spacing: -0.02em; }
.row-btns { display: flex; gap: 2px; }
.file-btn { position: relative; overflow: hidden; display: inline-block; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sub { color: var(--muted); margin: 6px 0 14px; font-size: 14px; }
.floor { position: relative; width: 100%; aspect-ratio: 4 / 3; max-width: 100%; border-radius: 20px; overflow: hidden; background-color: var(--surface);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1.4px); background-size: 22px 22px; border: 1px solid var(--line); }
.floor.has-img { aspect-ratio: auto; background-image: none; }
.floor img { display: block; width: 100%; height: auto; opacity: 0.85; filter: grayscale(0.6) sepia(0.15); }
.floor.placing { cursor: crosshair; border-color: var(--fg); }
#pins { position: absolute; inset: 0; }
.pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pin .dotp { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px currentColor, 0 0 0 7px color-mix(in srgb, currentColor 18%, transparent); background: currentColor; }
.pin .lbl { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; font-size: 12px; color: var(--fg); white-space: nowrap; order: -1; box-shadow: var(--shadow); }
.place-banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--fg); color: var(--bg); font-weight: 500; padding: 6px 14px; border-radius: 999px; font-size: 13px; }
.cards { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.room-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.room-card .stats { grid-column: 1 / -1; display: flex; gap: 16px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.room-card .stats b { color: var(--fg); }
.room-name { font: 500 17px var(--ui); letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.room-name i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.callout { margin-top: 14px; }

/* ---------- history ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg button { padding: 8px 4px; border-radius: 9px; font-weight: 500; color: var(--muted); font-size: 14px; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(60, 48, 30, 0.08); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font: 300 28px/1.1 var(--ui); letter-spacing: -0.03em; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.chart { width: 100%; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.vs { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px 16px; font-size: 14px; align-items: center; }
.vs .h { color: var(--muted); font-size: 12px; }
.vs b { text-align: right; }
.list { display: flex; flex-direction: column; }
.rrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; font-size: 14px; }
.rrow:last-child { border-bottom: 0; }
.rrow .when { display: flex; flex-direction: column; min-width: 0; }
.rrow .when small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow b { text-align: right; min-width: 46px; }
.rrow .d { color: var(--down); } .rrow .u { color: var(--up); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty b { color: var(--fg); font: 400 19px var(--ui); letter-spacing: -0.01em; }
.btn { background: var(--surface-2); border-radius: 12px; padding: 12px 16px; font-weight: 500; text-align: center; border: 1px solid transparent; }
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--bad); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.watch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); animation: pulse 1.8s infinite; display: inline-block; margin-right: 8px; vertical-align: 1px; }
.pulse.off { background: var(--dim); animation: none; }
.pulse.bad { background: var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* switch */
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 28px; transition: 0.2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.switch input:checked + span { background: var(--down); }
.switch input:checked + span::after { transform: translateX(20px); }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(30, 24, 16, 0.35); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 88%; z-index: 41; background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; display: flex; flex-direction: column;
  padding: 8px max(18px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); animation: up 0.22s ease-out; max-width: 640px; margin: 0 auto; box-shadow: 0 -10px 40px rgba(40, 30, 15, 0.12); }
@keyframes up { from { transform: translateY(40px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 10px; }
.sheet-head h3 { font-size: 21px; font-weight: 400; }
.sheet-body { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; min-height: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input, .field select { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 16px; width: 100%; min-width: 0; }
.field input:focus, .field select:focus { border-color: var(--line-strong); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting div { display: flex; flex-direction: column; min-width: 0; }
.setting small { font-size: 13px; }
.group { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.group h4 { margin: 0; font: 500 11px var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pick { display: flex; flex-direction: column; }
.pick button { text-align: left; padding: 14px 4px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 16px; }
.pick button.on { font-weight: 500; }
.pick button.on span { color: var(--down); }
.copy-box { display: flex; gap: 8px; align-items: center; }
.copy-box code { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 12px; overflow-x: auto; white-space: nowrap; user-select: all; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 500; font-size: 14px; max-width: calc(100% - 32px); box-shadow: var(--shadow); }

@media (min-width: 760px) {
  .tab.pad { padding-left: calc(50% - 340px); padding-right: calc(50% - 340px); }
  .info-sheet { max-width: 640px; margin: 0 auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .go::after, .pulse, .runner *, .runner .body { animation: none !important; }
  .sheet { animation: none; }
}
