:root {
  --bg: #f6f5f1; --card: #ffffff; --text: #1d1d1b; --muted: #66645e; --line: #e2e0d8;
  --accent: #1f6f5c; --accent-text: #ffffff; --good: #1f7a3a; --bad: #b3261e; --warn: #8a5a00;
  --banner: #fff3c4;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161614; --card: #22221f; --text: #ecebe6; --muted: #a3a197; --line: #34332e;
    --accent: #5cc3a6; --accent-text: #0f1a16; --good: #6fd08c; --bad: #ff8a80; --warn: #f0c060; --banner: #4a3d10; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; padding: 16px; }
header, section, footer { max-width: 1100px; margin: 0 auto 16px; }
h1 { margin: 0; font-size: 1.6rem; }
h2 { margin: 0 0 8px; font-size: 1.15rem; }
h3 { margin: 16px 0 4px; font-size: 1rem; }
.sub, .small, footer { color: var(--muted); }
.small { font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.banner { max-width: 1100px; margin: 0 auto 16px; background: var(--banner); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
button { font: inherit; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-text); cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 4px; text-decoration: underline; }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); max-width: 100%; }
#keyForm { display: flex; gap: 8px; flex-wrap: wrap; }
#keyInput { flex: 1 1 260px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.err { color: var(--bad); min-height: 1.5em; }
canvas { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; image-rendering: auto; }
.phase { font-weight: 600; margin: 8px 0 0; }
.hint { color: var(--warn); min-height: 1.5em; margin: 4px 0; }
.trust { list-style: none; padding: 0; margin: 8px 0; }
.trust li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.trust span { color: var(--muted); }
.big { font-size: 2.6rem; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.big small { font-size: 1rem; font-weight: 400; color: var(--muted); }
.label { margin: 0 0 8px; font-weight: 600; }
a { color: var(--accent); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: .9rem; }
.banner .speed { padding: 2px 10px; margin-left: 4px; background: transparent; color: inherit; border: 1px solid currentColor; }
.banner .speed.on { background: var(--text); color: var(--bg); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.beat { display: block; width: 100%; padding: 28px; font-size: 1.3rem; margin-top: 10px; }
.beat.flash { filter: brightness(1.3); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: .92rem; }
#countResult { font-size: 1.05rem; min-height: 1.5em; }
details { margin-top: 12px; }
/* Result headline: the app's one answer, shown first */
.verdict { border: 1px solid var(--line); border-left: 6px solid var(--muted); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; background: var(--bg); color: var(--text); }
.verdict.good { border-left-color: var(--good); } .verdict.bad { border-left-color: var(--bad); } .verdict.warn { border-left-color: var(--warn); }
.verdict p { margin: 4px 0; }
.verdict-title { font-size: 1.35rem; font-weight: 700; }
.verdict.good .verdict-title { color: var(--good); } .verdict.bad .verdict-title { color: var(--bad); } .verdict.warn .verdict-title { color: var(--warn); }
