:root {
  --bg: #0f1115; --card: #181b22; --line: #2a2f3a; --text: #e8eaf0; --dim: #8b93a5;
  --accent: #6ea8fe; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --nav-h: 56px; --run-h: 68px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f5f6f8; --card: #fff; --line: #dde1e8; --text: #1a1d24; --dim: #667085; --accent: #1d6fe0;
    --ok: #15803d; --warn: #b45309; --bad: #b91c1c; color-scheme: light; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif; }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 17px; }
main { padding: 12px 16px calc(var(--nav-h) + var(--run-h) + 24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.tab[hidden], [hidden] { display: none !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
label { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
input, textarea { width: 100%; margin-top: 6px; padding: 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: 16px ui-monospace, SFMono-Regular, Menlo, monospace; /* 16px: no iOS zoom */ }
textarea { resize: vertical; min-height: 120px; tab-size: 2; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge { font-size: 12px; } .badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); }
button { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; min-height: 44px; cursor: pointer; }
button:disabled { opacity: .5; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; flex: none; min-width: 120px; }
button.ghost { border: 0; background: none; font-size: 20px; padding: 4px 8px; min-height: 40px; }
nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
nav button { flex: 1; border: 0; border-radius: 0; background: none; color: var(--dim); }
nav button.on { color: var(--accent); font-weight: 600; }
#runbar { position: fixed; left: 0; right: 0; z-index: 5; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); display: flex; gap: 12px;
  align-items: center; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); }
#expectedNote { flex: 1; font-size: 12px; color: var(--dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: flex; } .seg button { min-height: 34px; padding: 4px 12px; border-radius: 0; }
.seg button:first-child { border-radius: 8px 0 0 8px; } .seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { min-height: 34px; padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.scen > summary { cursor: pointer; padding: 12px; font-weight: 600; list-style: none; min-height: 44px; }
.scen { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.scen > summary::after { content: "▾"; float: right; color: var(--dim); } .scen[open] > summary::after { content: "▴"; }
.sample { display: block; width: calc(100% - 16px); margin: 0 8px 8px; text-align: left; }
.sample .t { font-weight: 600; } .sample .m { color: var(--dim); font-size: 12px; margin-top: 2px; }
.sample .p { color: var(--dim); font-size: 13px; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); margin-right: 4px; }
.tag.risky { color: var(--bad); } .tag.benign { color: var(--ok); } .tag.ambiguous { color: var(--warn); }
.ans h3 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.ans .val { font-size: 22px; font-weight: 700; }
.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.bar .n { width: 30%; min-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); } .bar .v { width: 48px; text-align: right; color: var(--dim); }
.match { font-size: 12px; } .match.ok { color: var(--ok); } .match.bad { color: var(--bad); } .match.na { color: var(--dim); }
.stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--dim); }
.err { color: var(--bad); white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.hist { display: block; width: 100%; text-align: left; margin-bottom: 8px; }
.hist .m { color: var(--dim); font-size: 12px; }
.empty { color: var(--dim); text-align: center; padding: 32px 0; }
pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; font-size: 12px; color: var(--dim); }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--run-h) + 20px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9; }
#toast.show { opacity: 1; }
@media (min-width: 900px) { main { max-width: 760px; } }
