:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #17171c;
  --muted: #5b5b66;
  --border: #d9d9e0;
  --accent: #3d4bd6;
  --accent-text: #ffffff;
  --code-bg: #eeeef3;
  --ok: #146c2e;
  --ok-bg: #e6f4ea;
  --bad: #b3261e;
  --bad-bg: #fce8e6;
  --warn: #7a5300;
  --warn-bg: #fff4d6;
  --focus: #3d4bd6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114;
    --surface: #1b1b20;
    --text: #ececf1;
    --muted: #a3a3b0;
    --border: #34343d;
    --accent: #8f99ff;
    --accent-text: #0d0d12;
    --code-bg: #26262e;
    --ok: #7fd99a;
    --ok-bg: #12301c;
    --bad: #ff9a90;
    --bad-bg: #3a1513;
    --warn: #f3c969;
    --warn-bg: #33270b;
    --focus: #8f99ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111114;
  --surface: #1b1b20;
  --text: #ececf1;
  --muted: #a3a3b0;
  --border: #34343d;
  --accent: #8f99ff;
  --accent-text: #0d0d12;
  --code-bg: #26262e;
  --ok: #7fd99a;
  --ok-bg: #12301c;
  --bad: #ff9a90;
  --bad-bg: #3a1513;
  --warn: #f3c969;
  --warn-bg: #33270b;
  --focus: #8f99ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 7rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 56rem; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
code, pre, textarea, input[type="text"], input[type="password"] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--code-bg); padding: 0.05em 0.3em; border-radius: 4px; font-size: 0.92em; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; }

.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.brand img { border-radius: 6px; }
.tabs { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: block; white-space: nowrap; padding: 6px 10px; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: 0.93rem; }
.tabs a:hover, .tabs a[aria-current="true"] { background: var(--code-bg); color: var(--text); }

.privacy { margin: 20px 0; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--ok); background: var(--surface); border-radius: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin: 0 0 20px; }
.card h2 { margin: 0 0 6px; font-size: 1.3rem; }
.lede { margin: 0 0 16px; color: var(--muted); }
h3 { font-size: 0.95rem; margin: 8px 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; flex: 1; }
.field label, legend { font-weight: 600; font-size: 0.95rem; }
.help { margin: 0; color: var(--muted); font-size: 0.88rem; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1 1 14rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="search"], textarea {
  width: 100%;
  font-size: 0.92rem;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
textarea { resize: vertical; min-height: 4.5rem; }
.with-button { display: flex; gap: 8px; }
.with-button input { flex: 1; min-width: 0; }

button { font: inherit; font-size: 0.95rem; border-radius: 8px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 44px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.ghost:hover { background: var(--code-bg); }
button.small { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }

.result:empty { display: none; }
.result { margin-top: 12px; }
.verdict { border-radius: 10px; padding: 12px 14px; border: 1px solid transparent; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.verdict.bad { background: var(--bad-bg); color: var(--bad); border-color: currentColor; }
.verdict.warn { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }
.verdict .title { font-weight: 700; display: block; }
.verdict p, .verdict ul { color: var(--text); margin: 6px 0 0; }
.verdict ul { padding-left: 1.2rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.out { margin-top: 12px; }
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 0.92rem; }
pre.block { margin: 6px 0 0; padding: 10px 12px; background: var(--code-bg); border-radius: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.85rem; }
.errors { list-style: none; padding: 0; margin: 8px 0 0; }
.errors li { padding: 6px 0; border-top: 1px solid var(--border); color: var(--text); }
.errors code { color: var(--bad); }

.scopes { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; min-width: 0; }
.scope-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 12px; }
.scope-list { list-style: none; margin: 0; padding: 0; max-height: 18rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.scope-list li { border-bottom: 1px solid var(--border); }
.scope-list li:last-child { border-bottom: 0; }
.scope-list label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; cursor: pointer; font-size: 0.88rem; }
.scope-list label span { color: var(--muted); display: block; }
.scope-list li[hidden] { display: none; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.checks label { display: flex; gap: 8px; align-items: center; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); flex: none; margin-top: 0.15rem; }

.foot { color: var(--muted); font-size: 0.88rem; padding-bottom: 32px; }

@media (max-width: 480px) {
  .card { padding: 16px; border-radius: 10px; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
