@font-face {
  font-family: "Outfit";
  src: url("../fonts/Outfit.ttf") format("truetype");
  font-weight: 100 900;
  font-display: block;
}

:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --fg: #142033;
  --muted: #5a677b;
  --line: #d6dde7;
  --accent: #173d73;
  --accent-fg: #ffffff;
  --chip: #e6ebf2;
  --ok: #2f7a4a;
  --err: #b0413a;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Outfit", var(--font-ui);
  --font-mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b; --surface: #161d28; --fg: #e6ebf2; --muted: #95a2b6; --line: #273246;
    --accent: #7fa6e0; --accent-fg: #0e131b; --chip: #1f2836; --ok: #63b884; --err: #e07a72;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-ui); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 13px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
  padding: 18px max(16px, 3vw); border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 14px; }
.mark { width: 42px; height: 42px; color: var(--accent); flex: none; }
.brand h1 { font-family: var(--font-head); font-weight: 600; font-size: 22px; line-height: 1.1; margin: 0; letter-spacing: .01em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.privacy { margin: 0; font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 12px max(16px, 3vw) 0; max-width: 1400px; margin: 0 auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font-weight: 600; font-size: 15px; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.check { display: grid; gap: 16px; padding: 20px max(16px, 3vw) 48px; max-width: 900px; margin: 0 auto; }
.check-intro h2 { margin: 0 0 6px; font-family: var(--font-head); font-weight: 600; font-size: 22px; }
.check-intro p { margin: 0; color: var(--muted); max-width: 70ch; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.result { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.result img { width: 140px; height: 100px; object-fit: cover; border-radius: 6px; display: block; background: var(--chip); }
.result .verdict { font-family: var(--font-head); font-weight: 600; font-size: 17px; }
.result .verdict.yes { color: var(--ok); }
.result .verdict.no { color: var(--muted); }
.result .detail { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.result .code { font-family: var(--font-mono); font-size: 15px; color: var(--fg); background: var(--chip); padding: 1px 6px; border-radius: 4px; }
@media (max-width: 560px) { .result { grid-template-columns: 1fr; } .result img { width: 100%; height: 160px; } }

.layout {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start;
  padding: 24px max(16px, 3vw) 48px; max-width: 1400px; margin: 0 auto;
}
.panel { display: grid; gap: 16px; position: sticky; top: 16px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 14px; }
.group h2 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field { display: grid; gap: 6px; }
.field > span { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; }
.field output { font-family: var(--font-mono); font-weight: 400; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.field small { color: var(--muted); font-size: 12.5px; }
.field select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
input[type=range] { width: 100%; accent-color: var(--accent); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg label { position: relative; }
.seg-fit { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
.seg-fit span { white-space: nowrap; padding-inline: 8px; }
.seg-fit label:nth-child(odd) span { border-left: 0; }
.seg-fit label:nth-child(n+3) span { border-top: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 6px 4px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--accent); color: var(--accent-fg); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }

.field input[type=text] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.adv { border-color: var(--accent); }
.checks { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13.5px; }
.checks li { padding-left: 20px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 4px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }

button.link { justify-self: start; background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
button.ghost { background: var(--chip); border: 1px solid var(--line); border-radius: 7px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
button.ghost[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 7px; padding: 8px 18px; font-weight: 600; cursor: pointer; font-size: 14px; }
button:disabled { opacity: .55; cursor: progress; }

.work { display: grid; gap: 16px; min-width: 0; }
.drop {
  display: grid; justify-items: center; gap: 4px; text-align: center; cursor: pointer;
  padding: 36px 16px; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); color: var(--muted);
}
.drop strong { color: var(--accent); font-size: 17px; }
.drop small { font-size: 13px; }
.drop.over { border-color: var(--accent); background: var(--chip); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.has-files .drop { padding: 16px; grid-auto-flow: column; justify-content: center; gap: 10px; }
.has-files .drop small { display: none; }

.preview { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.preview-head span { overflow-wrap: anywhere; color: var(--muted); }
.canvas-wrap {
  display: grid; place-items: center; border-radius: 8px; overflow: hidden;
  background-color: #c9d0da;
  background-image: linear-gradient(45deg, #b9c1cc 25%, transparent 25%, transparent 75%, #b9c1cc 75%),
                    linear-gradient(45deg, #b9c1cc 25%, transparent 25%, transparent 75%, #b9c1cc 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.canvas-wrap canvas { display: block; max-width: 100%; max-height: 70vh; height: auto; width: auto; }

.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.list-head #count { font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status { margin: -6px 0 0; min-height: 1.5em; color: var(--muted); font-size: 14px; }

.files { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.file { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; }
.file.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.file button.thumb { all: unset; cursor: pointer; display: block; aspect-ratio: 4 / 3; background: var(--chip); }
.file button.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .meta { padding: 8px 10px 10px; display: grid; gap: 6px; }
.file .name { font-size: 13px; overflow-wrap: anywhere; line-height: 1.35; }
.file .row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.file .state { font-size: 12.5px; color: var(--muted); }
.file .state.ok { color: var(--ok); }
.file .state.err { color: var(--err); }
.file .row button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; cursor: pointer; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
