:root {
  --bg: #101214;
  --bg-deep: #0c0e10;
  --bg-raise: #171a1d;
  --line: #262a2e;
  --line-strong: #3c4248;
  --ink: #e8e4da;
  --ink-soft: #a8adb3;
  --amber: #f2a93b;
  --coral: #e8735a;
  --olive: #8e7b4a;
  --slate: #3c4248;
  --mint: #7dc3a4;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --pad: 40px;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 8px; top: -40px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10;
}
.skip:focus { top: 8px; }

.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft);
}
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-soft); }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 0 var(--pad); min-height: 56px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-word { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.brand-accent { color: var(--amber); }
.brand-tld { color: var(--ink-soft); }
.top-nav { display: flex; gap: 4px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 18px 12px 16px; cursor: pointer;
  font-size: 13px; color: var(--ink-soft);
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--amber); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--ink-soft);
}
.privacy-badge .dot { width: 7px; height: 7px; background: var(--mint); display: inline-block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn-solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-solid:hover { background: #fff; border-color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.link:hover { color: var(--ink); }

/* ---------- landing ---------- */
.landing {
  display: grid; grid-template-columns: 5fr 7fr; gap: 40px;
  padding: 72px var(--pad) 64px; max-width: 1440px; width: 100%; margin: 0 auto;
}
.landing-copy { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.landing h1 { font-size: clamp(36px, 4.2vw, 56px); line-height: 1.02; font-weight: 600; letter-spacing: -0.03em; }
.lede { font-size: 17px; line-height: 1.55; color: var(--ink-soft); max-width: 52ch; }
.promises { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 14px; max-width: 60ch; }
.promises li { display: flex; gap: 14px; align-items: flex-start; }
.promises .num { font-family: var(--mono); font-size: 12px; color: var(--amber); padding-top: 2px; flex: 0 0 auto; }

.landing-upload { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.drop {
  border: 1px dashed var(--line-strong); background: var(--bg-deep); padding: 56px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.drop:hover, .drop.is-over { border-color: var(--amber); background: #0e1113; }
.drop-title { font-size: 18px; font-weight: 600; }
.drop-help { font-size: 13px; color: var(--ink-soft); max-width: 46ch; line-height: 1.5; }
.drop .btn { margin-top: 6px; height: 44px; padding: 0 22px; font-size: 14px; }
.status { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); min-height: 18px; }
.status.is-error { color: var(--coral); }
.landing-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }

/* ---------- report: summary ---------- */
.summary {
  display: grid; grid-template-columns: 3fr 5fr 4fr; gap: 32px;
  padding: 40px var(--pad) 32px; border-bottom: 1px solid var(--line);
}
.score-block { display: flex; flex-direction: column; gap: 12px; }
.score-row { display: flex; align-items: baseline; gap: 14px; }
.score { font-family: var(--mono); font-size: 112px; line-height: 0.9; font-weight: 500; letter-spacing: -0.04em; }
.grade { font-family: var(--mono); font-size: 28px; font-weight: 600; color: var(--amber); }
.grade.g-A { color: var(--mint); } .grade.g-D, .grade.g-F { color: var(--coral); }

.sev-block { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.sev-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sev-bar { display: flex; height: 18px; gap: 2px; background: var(--bg-raise); }
.sev-bar > span { display: block; height: 100%; }
.sev-bar .b-critical { background: var(--coral); } .sev-bar .b-high { background: var(--amber); }
.sev-bar .b-medium { background: var(--olive); } .sev-bar .b-low { background: var(--slate); }
.sev-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.sev-count { display: flex; flex-direction: column; gap: 4px; border-top: 2px solid var(--slate); padding-top: 10px; }
.sev-count .n { font-family: var(--mono); font-size: 26px; font-weight: 500; }
.sev-count .l { font-size: 12px; color: var(--ink-soft); }
.sev-critical { border-top-color: var(--coral); } .sev-high { border-top-color: var(--amber); } .sev-medium { border-top-color: var(--olive); }

.meta {
  margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; font-size: 13px;
  padding-top: 4px; border-left: 1px solid var(--line); padding-left: 32px;
}
.meta > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.meta dd.mono { font-size: 12px; }

/* ---------- report: body ---------- */
.body { display: flex; flex-wrap: wrap; }
.findings { flex: 999 1 560px; min-width: 0; padding: 32px var(--pad); display: flex; flex-direction: column; gap: 20px; }
.findings-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.findings h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.table-wrap { overflow-x: auto; }
.ftable { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.ftable th {
  text-align: left; font-weight: 500; padding: 8px 12px 10px 0; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
}
.ftable td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.ftable tr { cursor: pointer; }
.ftable tbody tr:hover { background: var(--bg-raise); }
.ftable tbody tr.is-selected { background: var(--bg-raise); box-shadow: inset 2px 0 0 var(--amber); }
.ftable tbody tr.is-selected td:first-child { padding-left: 10px; }
.c-sev { width: 56px; } .c-check { width: 88px; } .c-rules { width: 220px; }
.sev-dot { display: inline-block; width: 10px; height: 10px; margin-top: 5px; background: var(--slate); }
.sev-dot.s-critical { background: var(--coral); } .sev-dot.s-high { background: var(--amber); } .sev-dot.s-medium { background: var(--olive); }
.f-title { font-weight: 600; margin-bottom: 4px; }
.f-detail { color: var(--ink-soft); line-height: 1.5; }
.f-check, .f-rules { font-family: var(--mono); font-size: 12px; }
.f-check { color: var(--ink-soft); }
.empty { color: var(--ink-soft); font-size: 13px; padding: 24px 0; }
.warnings { font-size: 13px; color: var(--ink-soft); }
.warnings summary { cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.warnings ul { margin: 10px 0 0; padding-left: 18px; }

.detail {
  flex: 1 1 380px; max-width: 440px; min-width: 0; border-left: 1px solid var(--line); background: var(--bg-deep);
  padding: 28px 28px 32px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto;
}
.detail-empty { color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.detail h3 { font-size: 17px; font-weight: 600; line-height: 1.3; margin: 4px 0 8px; }
.d-detail { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin-bottom: 10px; }
.d-rules { margin: 0 0 10px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.code {
  margin: 0; padding: 14px; background: var(--bg-raise); border: 1px solid var(--line); font-family: var(--mono);
  font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; max-height: 320px;
}
.detail-actions { display: flex; gap: 8px; margin-top: 4px; }

.report-foot, .site-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px var(--pad); border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-soft); letter-spacing: 0.04em;
}
.site-foot { margin-top: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .meta { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 24px; }
}
@media (max-width: 860px) {
  :root { --pad: 20px; }
  .top { padding: 12px var(--pad); gap: 12px; }
  .top-nav { order: 3; width: 100%; overflow-x: auto; gap: 12px; }
  .tab { padding: 6px 2px; white-space: nowrap; }
  .privacy-badge { display: none; }
  .landing { grid-template-columns: 1fr; gap: 36px; padding: 40px var(--pad) 48px; }
  .drop { padding: 40px 20px; }
  .summary { grid-template-columns: 1fr; gap: 28px; padding: 28px var(--pad); }
  .score { font-size: 88px; }
  .findings { padding: 24px var(--pad); }
  .detail { max-width: none; border-left: 0; border-top: 1px solid var(--line); padding: 24px var(--pad) 32px; position: static; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* print-only elements, hidden on screen */
.print-head, .appendix, .sev-text { display: none; }

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root { color-scheme: light; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { width: auto; height: auto; background: #fff; }
  body { color: #111; font-size: 10.5pt; display: block; }
  .top, .site-foot, .landing, .detail, .warnings { display: none !important; }
  .report { color: #111; max-width: 100%; overflow: hidden; }
  .report .muted, .report .kicker, .report .f-detail, .report .f-check, .report .d-detail, .report .ap-detail, .report .ap-rules, .report .meta dt, .report .ftable th, .report .sev-count .l, .report .report-foot { color: #555; }

  .print-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
    border-bottom: 1px solid #bbb; padding-bottom: 8px; margin-bottom: 18px;
    font-family: var(--mono); font-size: 9pt; color: #555;
  }
  .print-head .brand-word { font-size: 12pt; color: #111; }
  .print-head .brand-accent { color: #b8761a; }
  .print-head .brand-tld { color: #777; }

  .summary { display: block; padding: 0 0 18px; border-bottom: 1px solid #bbb; }
  .score-block { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
  .score-block .kicker { flex: 0 0 100%; }
  .score { font-size: 54pt; line-height: 1; }
  .grade { color: #333; font-size: 20pt; }
  .grade.g-A { color: #1f7a4d; } .grade.g-D, .grade.g-F { color: #b23a2a; }
  .sev-block { gap: 12px; margin-bottom: 18px; }
  .sev-bar { background: #eee; height: 12pt; }
  .sev-counts { gap: 12px; }
  .sev-count .n { font-size: 16pt; }
  .meta { border-left: 0; padding-left: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; font-size: 9.5pt; }

  .body { display: block; }
  .findings { padding: 18px 0 0; gap: 12px; }
  .findings h2, .appendix h2 { font-size: 14pt; }
  .table-wrap { overflow: visible; }
  .ftable { min-width: 0; width: 100%; table-layout: fixed; font-size: 9.5pt; }
  .ftable th, .ftable td { padding: 7pt 8pt 7pt 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; }
  .ftable thead { display: table-header-group; }
  .ftable tbody tr { break-inside: avoid; cursor: default; }
  .ftable tbody tr:hover, .ftable tbody tr.is-selected { background: none; box-shadow: none; }
  .ftable tbody tr.is-selected td:first-child { padding-left: 0; }
  .c-sev { width: 64pt; } .c-check { width: 54pt; } .c-rules { width: 120pt; }
  .sev-dot { display: none; }
  .sev-text { display: inline; font-family: var(--mono); font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.06em; }
  .sev-text.s-critical { color: #b23a2a; } .sev-text.s-high { color: #b8761a; } .sev-text.s-medium { color: #6f5f33; } .sev-text.s-low { color: #666; }
  .sev-bar .b-critical { background: #c0392b; } .sev-bar .b-high { background: #d68910; }
  .sev-bar .b-medium { background: #8e7b4a; } .sev-bar .b-low { background: #95a5a6; }
  .sev-critical { border-top-color: #c0392b; } .sev-high { border-top-color: #d68910; } .sev-medium { border-top-color: #8e7b4a; } .sev-low { border-top-color: #95a5a6; }

  .appendix { display: block; break-before: page; padding-top: 4pt; }
  .ap-item { break-inside: avoid; padding: 10pt 0; border-bottom: 1px solid #ddd; }
  .ap-head h3 { font-size: 11pt; margin: 2pt 0 4pt; }
  .ap-detail { font-size: 9.5pt; margin-bottom: 4pt; }
  .ap-rules { font-size: 8.5pt; margin-bottom: 6pt; overflow-wrap: anywhere; }
  .code { background: #f4f4f2; border: 1px solid #ddd; color: #111; font-size: 8.5pt; white-space: pre-wrap; overflow: visible; max-height: none; }

  .report-foot { border-top: 1px solid #bbb; padding: 10pt 0 0; font-size: 8.5pt; }
}
