:root {
  --bg: #EEF0F2; --card: #FFFFFF; --ink: #11161C; --muted: #5A6470; --faint: #9AA3AD;
  --line: #D8DDE2; --line2: #E6E9EC; --line3: #F0F2F4;
  --accent: #B4541E; --accent-ink: #8F3F12; --accent-bg: #F3DDD0; --row-hi: #FBF4EF;
  --amber-bg: #FBEFD9; --amber-line: #E8C989; --amber-ink: #6B4600; --amber-sub: #5C4A26; --amber-dot: #A36A00;
  --red: #B3362F; --red-sub: #FBE1DE; --green: #1D7A4A; --green-bg: #E1F1E8; --green-ink: #1D6B42;
  --mm: #2C64B8; --mm-bg: #EEF3FB; --chip: #EEF0F2; --dark-card: #11161C; --dark-card-sub: #B9C0C8;
  --lock-bg: #E6E9EC;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1217; --card: #171C23; --ink: #E8ECF0; --muted: #9AA4AF; --faint: #6B7580;
    --line: #2A313A; --line2: #232A32; --line3: #1E242B;
    --accent: #F0A878; --accent-ink: #F6C3A0; --accent-bg: #3A2517; --row-hi: #221A14;
    --amber-bg: #2E2410; --amber-line: #5E4A1C; --amber-ink: #F2C76A; --amber-sub: #E2CFA4; --amber-dot: #E0A63A;
    --red: #C8453D; --red-sub: #FFE2DE; --green: #4CC08A; --green-bg: #12301F; --green-ink: #7FD9AA;
    --mm: #7FA8F0; --mm-bg: #17233A; --chip: #222931; --dark-card: #E8ECF0; --dark-card-sub: #3A434D;
    --lock-bg: #222931;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

header.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px; }
header.top .l, header.top .r { display: flex; flex-direction: column; gap: 2px; }
header.top .r { align-items: flex-end; text-align: right; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
h1 { margin: 0; font-size: 22px; font-weight: 600; }
.small { font-size: 11px; color: var(--muted); }
.big-mono { font-family: var(--mono); font-size: 16px; font-weight: 600; }

.stack { margin: 0 16px; display: flex; flex-direction: column; gap: 6px; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px;
  text-decoration: none; min-height: 44px; }
.banner.caution { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--ink); }
.banner.fail { background: var(--red); color: #fff; padding: 11px 12px; }
.banner .dia { margin-top: 4px; width: 10px; height: 10px; flex-shrink: 0; border-radius: 2px; background: var(--amber-dot); transform: rotate(45deg); }
.banner .txt { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.banner .h { font-size: 13px; font-weight: 600; }
.banner.caution .h, .banner.caution .go { color: var(--amber-ink); }
.banner.caution .s { color: var(--amber-sub); }
.banner.fail .h { font-size: 14px; font-weight: 700; }
.banner.fail .s { color: var(--red-sub); }
.banner .s { font-size: 12px; }
.banner .imp { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.banner.caution .imp { color: var(--amber-ink); }
.banner .go { font-size: 12px; font-weight: 600; align-self: center; white-space: nowrap; }
.okline { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); padding-left: 2px; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--green); flex-shrink: 0; }

.card { margin: 10px 16px 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.pad { padding: 12px 14px; }
.lbl { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.centre-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.centre-row > :first-child { white-space: nowrap; }
.centre { font-family: var(--mono); font-size: 36px; font-weight: 600; color: var(--accent); line-height: 1.1; }
.centre.dead { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.sig { font-family: var(--mono); font-size: 15px; color: var(--muted); }
.mmc { font-family: var(--mono); font-size: 15px; color: var(--mm); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--chip); }
.chip.hot { background: var(--accent-bg); color: var(--accent-ink); }
.seen { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; margin-top: 8px; border-top: 1px solid var(--line2); }
.seen button { all: unset; cursor: pointer; font-size: 11px; color: var(--accent); }
svg { display: block; width: 100%; height: auto; }
svg text { font-family: var(--mono); }

.tbl { overflow: hidden; }
.tr { display: grid; grid-template-columns: 82px 50px 1fr 1fr 50px; gap: 4px; align-items: center; padding: 0 12px;
  min-height: 44px; font-family: var(--mono); font-size: 13px; text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line3); }
.tr.head { min-height: 30px; font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: .04em; border-bottom: 1px solid var(--line2); }
.tr > :not(:first-child) { text-align: right; }
.tr .k { font-weight: 500; }
.tr .f { font-weight: 600; color: var(--accent); }
.tr .f.dead { color: var(--faint); font-weight: 400; }
.tr.hi { background: var(--row-hi); }
.tr.take { background: var(--accent-bg); }
.sz { color: var(--muted); font-size: 11px; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.more { all: unset; display: block; text-align: center; padding: 14px 8px; box-sizing: border-box; font-size: 12px; color: var(--accent); cursor: pointer; width: 100%; }

.takes { margin: 10px 16px 0; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
  background: var(--dark-card); color: var(--bg); min-height: 48px; }
.takes .h { font-size: 14px; font-weight: 600; }
.takes .s { font-size: 11px; color: var(--dark-card-sub); }
.takes .t { font-family: var(--mono); font-size: 12px; }
.takes.locked { background: var(--lock-bg); color: var(--muted); }
.takes.locked .h { color: var(--ink); }

.pill { font-family: var(--sans); justify-self: end; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green-ink); }
.pill.caution { background: var(--amber-bg); color: var(--amber-ink); }
.pill.fail { background: var(--red); color: #fff; }
.lvl { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.lvl.ok { color: var(--green); } .lvl.caution { color: var(--amber-ink); } .lvl.fail { color: var(--red); }
.lvl i { width: 10px; height: 10px; border-radius: 5px; background: currentColor; }

.inp { display: grid; grid-template-columns: 1fr 44px 82px; gap: 6px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line3); }
.inp.head { padding: 8px 12px; font-size: 11px; color: var(--muted); letter-spacing: .04em; border-bottom: 1px solid var(--line2); }
.inp .n { font-size: 13px; font-weight: 600; }
.inp .src { font-size: 11.5px; color: var(--muted); }
.inp .imp { font-size: 12px; font-weight: 600; color: var(--amber-ink); }
.inp .w { text-align: right; font-family: var(--mono); font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.kv > :last-child { font-family: var(--mono); text-align: right; overflow-wrap: anywhere; }
.kv .warn { color: var(--amber-ink); }
.sec { display: flex; flex-direction: column; gap: 6px; }

.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trio .v { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.ftab { display: grid; grid-template-columns: 70px 1fr 84px; gap: 4px 8px; font-size: 12px; }
.ftab > :nth-child(3n) { text-align: right; font-family: var(--mono); }
.ftab .mono { font-size: 11.5px; }

.strikes { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 4px; scrollbar-width: none; }
.strikes a { flex-shrink: 0; font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 44px; box-sizing: border-box; }
.strikes a.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.book { display: grid; grid-template-columns: 1fr 1fr; }
.book .col { display: flex; flex-direction: column; }
.book .col:first-child { border-right: 1px solid var(--line2); }
.lv { display: flex; justify-content: space-between; align-items: center; padding: 0 12px; min-height: 30px;
  font-family: var(--mono); font-size: 13px; border-bottom: 1px solid var(--line3); }
.lv.mm { background: var(--mm-bg); }
.tag { font-family: var(--sans); font-size: 10px; font-weight: 600; color: var(--mm); margin-left: 4px; }
.tape { display: grid; grid-template-columns: 78px 1fr 56px; gap: 4px 6px; font-size: 12px; }
.tape .mono { color: var(--muted); }
.tape .you { font-weight: 600; color: var(--accent); }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line); background: var(--card); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 52px; font-size: 13px;
  color: var(--muted); text-decoration: none; border-top: 2px solid transparent; }
.tabs a.on { color: var(--accent); font-weight: 600; border-top-color: var(--accent); }
.tabs a.alert { color: var(--red); font-weight: 600; }
.tabs a.alert::after { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; }

.conn { position: sticky; top: 0; z-index: 6; background: var(--red); color: #fff; font-size: 13px; font-weight: 600;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; }
.note { font-size: 12px; color: var(--muted); }
.warnbox { font-size: 12px; color: var(--amber-sub); background: var(--amber-bg); border-radius: 6px; padding: 6px 8px; }
.empty { padding: 24px 16px; color: var(--muted); font-size: 14px; }
.kv > .pill { font-family: var(--sans); }

body.anon .tabs { display: none; }
a.takes { text-decoration: none; }
.btn { all: unset; box-sizing: border-box; text-align: center; min-height: 48px; border-radius: 12px; border: 1px solid var(--accent);
  color: var(--accent); font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; }
.inp-text { font-size: 18px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); letter-spacing: .08em; }
.banner.dry { background: var(--mm-bg); border: 1px solid var(--line); color: var(--ink); }
.banner.dry .h { color: var(--mm); }
.lims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lim { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.lim select { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; min-height: 40px; padding: 0 8px; }
.tk { display: grid; grid-template-columns: 32px 1fr 50px 50px 64px; gap: 6px; align-items: center; padding: 10px 12px; min-height: 52px; border-bottom: 1px solid var(--line3); font-size: 13px; }
.tk > :nth-child(n+3) { text-align: right; }
.tk.head { font-size: 11px; color: var(--muted); letter-spacing: .04em; padding: 8px 12px; border-bottom: 1px solid var(--line2); }
.tk.off { opacity: .55; }
.chk { all: unset; width: 26px; height: 26px; border-radius: 6px; border: 2px solid var(--faint); cursor: pointer; box-sizing: border-box; }
.chk.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--card); }
.sendbar { position: relative; overflow: hidden; margin: 12px 16px 0; width: calc(100% - 32px); min-height: 64px; border: none; border-radius: 14px;
  background: var(--accent); color: #fff; font-family: var(--sans); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; touch-action: none; -webkit-user-select: none; user-select: none; }
.sendbar.live { background: var(--red); }
.sendbar .h { position: relative; font-size: 17px; font-weight: 700; }
.sendbar .s { position: relative; font-size: 12px; opacity: .85; }
.sendbar .fill { position: absolute; inset: 0; width: 0; background: rgba(0,0,0,.25); }
.sendbar.holding .fill { width: 100%; transition: width .6s linear; }
.sendbar.locked { background: var(--lock-bg); color: var(--muted); cursor: default; }
.sendbar.locked .h { color: var(--ink); font-size: 15px; }
.sendbar:disabled { opacity: .7; }
pre.body { font-size: 11px; overflow-x: auto; background: var(--bg); padding: 8px; border-radius: 8px; max-height: 260px; }
