:root {
  --bg: #0e0f12; --panel: #17191e; --panel-2: #1f2228; --line: #2b2f37;
  --text: #eef0f3; --muted: #9aa1ad; --accent: #c6ff3d; --accent-ink: #11140a;
  --bad: #ff5d5d; --mid: #ffc23d; --good: #3ddc84; --they: #8fb7ff;
  --radius: 14px; --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f5f2; --panel: #ffffff; --panel-2: #f0f1ec; --line: #dfe1da;
    --text: #15171a; --muted: #5e6470; --accent: #5a8f00; --accent-ink: #ffffff;
    --bad: #d33a3a; --mid: #b97d00; --good: #1f9d5a; --they: #2f62c9;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 760px; margin: 0 auto; padding: 14px 16px;
}
.brand { text-decoration: none; font-family: var(--mono); font-weight: 800; letter-spacing: -.02em; font-size: 17px; white-space: nowrap; }
.brand-num { color: var(--accent); margin-left: 2px; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
#nav a, #nav button {
  background: none; border: 0; padding: 6px 10px; border-radius: 8px; color: var(--muted);
  text-decoration: none; font-size: 14px; cursor: pointer;
}
#nav a:hover, #nav button:hover, #nav a.on { color: var(--text); background: var(--panel-2); }

main { max-width: 760px; margin: 0 auto; padding: 4px 16px 80px; }
.pad { padding: 40px 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { font-size: 28px; line-height: 1.15; margin: 18px 0 6px; letter-spacing: -.02em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 28px 0 10px; font-weight: 700; }
h3 { font-size: 17px; margin: 0 0 6px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=url], input[type=number], textarea, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; outline: none; font-size: 16px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { width: 100%; padding: 15px; font-size: 17px; font-family: var(--mono); letter-spacing: .02em; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 10px; font-size: 13px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 8px 14px;
  cursor: pointer; font-size: 14px; user-select: none;
}
.chip small { color: var(--muted); margin-left: 4px; }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.chip:disabled { opacity: .45; cursor: not-allowed; }

.tabs { display: flex; gap: 6px; margin: 18px 0 14px; }
.tabs button { flex: 1; }
.err { color: var(--bad); font-size: 14px; min-height: 1em; }

/* history */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.item:hover { border-color: var(--muted); }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.score-pill { font-family: var(--mono); font-weight: 800; min-width: 44px; text-align: center; border-radius: 8px; padding: 4px 6px; background: var(--panel-2); }

/* result */
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.dial { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.dial::before { content: ""; position: absolute; inset: 9px; background: var(--panel); border-radius: 50%; }
.dial span { position: relative; font-family: var(--mono); font-weight: 800; font-size: 28px; }
.verdict .label { font-family: var(--mono); font-weight: 800; font-size: 22px; line-height: 1.2; }
.say { border-left: 4px solid var(--accent); }
.say p { font-size: 19px; line-height: 1.45; margin: 0 0 10px; font-weight: 600; }
.point { padding: 14px 0; border-top: 1px solid var(--line); }
.point:first-child { border-top: 0; padding-top: 0; }
.point p { margin: 4px 0 0; color: var(--muted); }
.counter { display: grid; gap: 8px; padding: 14px 0; border-top: 1px solid var(--line); }
.counter:first-child { border-top: 0; padding-top: 0; }
.they, .you { border-radius: 12px; padding: 10px 12px; max-width: 92%; }
.they { background: var(--panel-2); border: 1px solid var(--line); }
.they::before { content: "THEY SAY"; display: block; font: 700 11px var(--mono); color: var(--they); letter-spacing: .08em; margin-bottom: 2px; }
.you { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); justify-self: end; }
.you::before { content: "YOU SAY"; display: block; font: 700 11px var(--mono); color: var(--accent); letter-spacing: .08em; margin-bottom: 2px; }
.receipts li, .weak li { margin: 8px 0; }
.cite {
  display: inline-block; font: 700 11px var(--mono); padding: 1px 6px; border-radius: 6px; margin-left: 4px;
  background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; vertical-align: 1px;
}
.cite:hover { border-color: var(--accent); }
.sources li { margin: 10px 0; word-break: break-word; }
.sources .kind { font: 700 11px var(--mono); color: var(--muted); margin-left: 6px; }
.closer p { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }

.loading { text-align: center; padding: 48px 8px; }
.loading .big { font-family: var(--mono); font-size: 20px; font-weight: 800; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); margin: 0 auto 18px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
.scroll-x { overflow-x: auto; }
code, .code { font-family: var(--mono); font-size: 14px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600;
  transition: .2s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  h1 { font-size: 24px; }
  .brand { font-size: 15px; }
  .dial { width: 76px; height: 76px; }
  .dial span { font-size: 23px; }
  .verdict .label { font-size: 19px; }
  .say p { font-size: 17px; }
  #nav { gap: 0; flex-wrap: nowrap; }
  #nav a, #nav button { padding: 6px 7px; font-size: 13px; }
  .nav-new { display: none; }
  .top { padding: 12px 16px; gap: 6px; }
  .brand { font-size: 14px; }
}
