/* Layout: one narrow column: paste, test, result. Everything optional is folded away. */
:root {
  --bg: #f6f7f5; --panel: #ffffff; --ink: #1c2321; --muted: #5f6965; --line: #d9ddd8; --soft: #eceeea;
  --accent: #e2711d; --accent-ink: #ffffff; --part: #2f6fd6; --rev: #9a9fa6; --hw: #d4a017; --stage: #e9ece8;
  --pass: #1d7a46; --pass-bg: #e3f3e9; --fail: #b3261e; --fail-bg: #fbe7e5; --warn: #8a5a00; --warn-bg: #fdf1d8;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131715; --panel: #1b201e; --ink: #e8ece9; --muted: #9aa5a0; --line: #2e3532; --soft: #232926;
    --accent: #f08a3c; --accent-ink: #1a1208; --part: #5b93f2; --rev: #8e939a; --hw: #e0b23a; --stage: #202624;
    --pass: #5fd08f; --pass-bg: #173426; --fail: #ff8a80; --fail-bg: #3a1c1a; --warn: #f2c063; --warn-bg: #3a2e14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131715; --panel: #1b201e; --ink: #e8ece9; --muted: #9aa5a0; --line: #2e3532; --soft: #232926;
  --accent: #f08a3c; --accent-ink: #1a1208; --part: #5b93f2; --rev: #8e939a; --hw: #e0b23a; --stage: #202624;
  --pass: #5fd08f; --pass-bg: #173426; --fail: #ff8a80; --fail-bg: #3a1c1a; --warn: #f2c063; --warn-bg: #3a2e14;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body); }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* top menu, shared by every page */
.topnav { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--line); }
.topnav-in { max-width: 1220px; margin: 0 auto; display: flex; align-items: center; gap: 8px 20px; padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand img { display: block; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.steps { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 4px; }
.steps a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 700; white-space: nowrap; }
.steps a:hover { background: var(--soft); color: var(--ink); }
.steps a[aria-current="page"] { background: var(--soft); color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
@media (max-width: 720px) { .brand span { display: none; } }
@media (max-width: 520px) {
  .topnav-in { padding-block: 6px; gap: 10px; }
  .steps { flex: 1; }
  .steps li { flex: 1; min-width: 0; }
  .steps a { padding: 8px 4px; font-size: 13px; white-space: normal; text-align: center; line-height: 1.2; }
}

.wrap { max-width: 860px; margin: 0 auto; padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 14px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: .01em; }
.lead { font-weight: 700; }

textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); padding: 12px 14px; resize: vertical; }
.paste { min-height: 150px; font-size: 15px; }
.code { font-family: var(--mono); font-size: 13px; line-height: 1.55; min-height: 260px; tab-size: 2; white-space: pre; overflow: auto; }
.code.spec { min-height: 150px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 10px 20px; font-weight: 700; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.status { color: var(--muted); font-size: 15px; }
.status.bad { color: var(--fail); }

.fold { border-top: 1px solid var(--line); padding-top: 12px; }
.fold summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.fold[open] summary { color: var(--ink); margin-bottom: 8px; }
.fold .hint { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.sub { display: block; font-weight: 700; font-size: 15px; margin: 10px 0 6px; }
.meta { font-weight: 400; color: var(--muted); }
.meta.bad { color: var(--fail); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.checklist input { margin-top: 5px; accent-color: var(--accent); }

#result { display: grid; gap: 12px; margin-top: 8px; }
.verdict { font-size: 28px; font-weight: 700; border-radius: var(--r); padding: 10px 16px; }
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.error { background: var(--warn-bg); color: var(--warn); font-size: 20px; }
.facts { margin: 0; font-variant-numeric: tabular-nums; }

.viewer-box { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--panel); }
.viewer { height: min(56vh, 480px); min-height: 300px; background: var(--stage); touch-action: none; }
.viewer-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 8px 12px; font-size: 14px; color: var(--muted); }
.viewer-bar label { cursor: pointer; color: var(--ink); }
.viewer-bar .tip { margin-left: auto; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin: 0 6px 0 0; vertical-align: -1px; }
.sw.rev { margin-left: 12px; }
.sw.part { background: var(--part); } .sw.rev { background: var(--rev); } .sw.hw { background: var(--hw); margin-left: 12px; }

.problems { margin: 0; padding-left: 1.4em; display: grid; gap: 12px; }
.problems:empty { display: none; }
.problems li { padding-left: 4px; }
.problems p { margin: 0; overflow-wrap: anywhere; }
.problems .fix { margin-top: 4px; }
.problems .fix b { color: var(--pass); }
.problems li.note::marker { color: var(--muted); }
.problems li.note p { color: var(--muted); }
