/* KKT/FN checker, контур v2. Направление: DESIGN.md, диала ENERGY 2 / RHYTHM 2 / MOTION 1. */

:root {
  --paper: #f7f7f5;
  --surface: #ffffff;
  --ink: #121212;
  --ink-muted: #5c5c5c;
  --rule: #e2e2df;
  --accent: #3730a3;
  --accent-ink: #ffffff;

  --ok: #166534;      --ok-soft: #e7f6ec;
  --warn: #92400e;    --warn-soft: #fdf3d8;
  --bad: #b91c1c;     --bad-soft: #fdeaea;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 12px;
}

:root[data-theme="dark"] {
  --paper: #101012;
  --surface: #17181a;
  --ink: #f2f2ef;
  --ink-muted: #a0a0a0;
  --rule: #2a2b2e;
  --accent: #a5b4fc;
  --accent-ink: #101012;

  --ok: #4ade80;      --ok-soft: #0f2a1a;
  --warn: #fbbf24;    --warn-soft: #33240a;
  --bad: #f87171;     --bad-soft: #3a1414;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101012;
    --surface: #17181a;
    --ink: #f2f2ef;
    --ink-muted: #a0a0a0;
    --rule: #2a2b2e;
    --accent: #a5b4fc;
    --accent-ink: #101012;

    --ok: #4ade80;      --ok-soft: #0f2a1a;
    --warn: #fbbf24;    --warn-soft: #33240a;
    --bad: #f87171;     --bad-soft: #3a1414;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--ink);
  padding: 8px 12px; border: 1px solid var(--rule);
}
.skip:focus { left: 12px; top: 12px; z-index: 10; }

/* header */
.top { border-bottom: 1px solid var(--rule); background: var(--surface); }
.top-inner {
  max-width: 760px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { font-weight: 600; font-size: 15px; }

/* segmented controls (real radios, keyboard for free) */
.theme, .modes { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.opt, .mode { position: relative; }
.opt input, .mode input {
  position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer;
}
.opt span, .mode span {
  display: block; padding: 8px 12px; font-size: 13px; color: var(--ink-muted);
  border-right: 1px solid var(--rule); background: var(--surface);
}
.opt:last-child span, .mode:last-child span { border-right: 0; }
.opt input:checked + span, .mode input:checked + span { background: var(--paper); color: var(--ink); font-weight: 600; }
.opt input:focus-visible + span, .mode input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* layout */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px; flex: 1 0 auto; }

/* form */
.modes { margin-bottom: 18px; }
.lab { display: block; font-size: 13px; color: var(--ink-muted); margin-bottom: 6px; }
.row { display: flex; gap: 10px; }
.sn {
  flex: 1; min-width: 0; padding: 12px 14px;
  font: 600 17px/1.2 var(--mono);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r);
}
.sn::placeholder { color: var(--ink-muted); font-weight: 400; }
.sn:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.go {
  padding: 12px 22px; min-height: 46px;
  font: 600 15px/1 var(--sans);
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--r); cursor: pointer;
  transition: filter .15s ease;
}
.go:hover:not(:disabled) { filter: brightness(1.08); }
.go:disabled { opacity: .55; cursor: default; }
.help { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.err { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--bad); }
.err:empty { display: none; }

/* result */
.result { margin-top: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  overflow: hidden;
  animation: enter .18s ease-out;
}
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--rule);
}
.tag {
  font: 600 12px/1 var(--mono); color: var(--ink-muted);
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 4px 6px;
}
.serial { font: 600 22px/1.1 var(--mono); letter-spacing: .5px; overflow-wrap: anywhere; }
.actions { margin-left: auto; display: flex; gap: 6px; }
.act {
  font: 600 12.5px/1 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 7px 10px; min-height: 34px; cursor: pointer;
}
.act:hover { background: var(--paper); }
.note { margin-left: 8px; font-size: 12px; color: var(--ink-muted); }

.banner {
  margin: 0; padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  border-bottom: 1px solid var(--rule);
}
.banner[data-tone="bad"] { background: var(--bad-soft); color: var(--bad); }
.banner[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.banner[data-tone="muted"] { background: var(--paper); color: var(--ink-muted); }

.model { padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.model:last-child { border-bottom: 0; }
.model-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mname { font-weight: 600; overflow-wrap: anywhere; }

.chip {
  display: inline-block; font: 600 12.5px/1.3 var(--sans);
  padding: 3px 8px; border-radius: var(--r-sm);
}
.chip[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.chip[data-tone="warn"] { background: var(--warn-soft); color: var(--warn); }
.chip[data-tone="bad"] { background: var(--bad-soft); color: var(--bad); }
.chip[data-tone="muted"] { background: var(--paper); color: var(--ink-muted); border: 1px solid var(--rule); }

.grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px; margin: 0;
}
.pair { margin: 0; }
.pair.wide { grid-column: 1 / -1; }
.pair dt { font-size: 12px; color: var(--ink-muted); margin-bottom: 2px; }
.pair dd { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); }

.exc { margin-top: 14px; border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; }
.exc h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-muted); }

/* collapsed extras */
.more { border-top: 1px solid var(--rule); }
.more summary { padding: 12px 16px; font-size: 13.5px; cursor: pointer; }
.more summary:hover { color: var(--accent); }
.more .grid { padding: 0 16px 16px; }

/* states */
.state { padding: 28px 16px; text-align: center; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.state p { margin: 6px 0 0; font-size: 14px; }
.state .big { font-size: 15px; font-weight: 600; }
.state .retry { margin-top: 12px; }
.state.empty { color: var(--ink-muted); }
.state.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.load { padding: 20px 16px; color: var(--ink-muted); font-size: 14px; }
.load-title { margin: 0 0 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.mlog { margin: 0; padding: 0; list-style: none; font: 12.5px/1.7 var(--mono); color: var(--ink-muted); }
.mlog li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* footer */
.foot {
  border-top: 1px solid var(--rule);
  padding: 14px 16px; text-align: center;
  font-size: 12.5px; color: var(--ink-muted);
}
.foot .dot { margin: 0 8px; color: var(--rule); }

@media (max-width: 620px) {
  .top-inner { flex-wrap: wrap; }
  .row { flex-direction: column; }
  .go { width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .serial { font-size: 19px; }
  .actions { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
