:root {
  color-scheme: dark;
  --ink: #f4f2f0;
  --muted: #a6a09d;
  --quiet: #938b86;
  --ground: #080808;
  --surface: #11100f;
  --surface-raised: #181615;
  --line: #342f2c;
  --line-soft: #242120;
  --red: #ef514b;
  --red-soft: #351816;
  --green: #92c8a2;
  --amber: #e3b671;
  --radius: 12px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ground);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink); }
button, textarea { font: inherit; }
button, a, label.file-button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ff9388; outline-offset: 3px; }

.topbar { min-height: 64px; padding: 0 clamp(18px, 4vw, 56px); border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 760; letter-spacing: -.035em; font-size: 18px; }
.wordmark-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--red); color: #150b0a; font-size: 14px; font-weight: 900; }
.wordmark-dot { color: var(--red); }
.topbar-right { display: flex; align-items: center; gap: clamp(14px, 3vw, 32px); }
.mode-chip, .computed-tag, .synthetic-tag { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; font-size: 11px; color: #cbc4c0; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; }
.top-link { display: inline-flex; min-height: 44px; align-items: center; color: var(--muted); font-size: 13px; text-decoration-thickness: 1px; text-underline-offset: 4px; }

main { width: min(1420px, 100%); margin: 0 auto; padding: 0 clamp(18px, 4vw, 56px); }
.intro { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); align-items: end; gap: clamp(24px, 7vw, 96px); padding: clamp(32px, 5vw, 58px) 0 26px; }
h1 { max-width: 670px; margin: 0; font-size: clamp(31px, 4vw, 49px); line-height: 1.04; letter-spacing: -.04em; font-weight: 760; }
.intro-copy { max-width: 470px; margin: 0 0 3px; color: #b6aeaa; font-size: 14px; line-height: 1.7; }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .88fr); gap: 15px; align-items: start; }
.inputs-panel, .results-panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.inputs-panel { padding: clamp(16px, 2vw, 24px); }
.results-panel { padding: clamp(16px, 2vw, 24px); background: #100f0e; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2, .method-note h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.synthetic-tag { font-size: 10px; color: #d5b88e; border-color: #59482f; }
.computed-tag { color: #b7c8b9; border-color: #36513b; font-size: 10px; }
.computed-tag span { color: var(--green); font-size: 9px; }
.field { margin-top: 15px; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.field label:not(.file-button) { font-size: 12px; font-weight: 670; }
.count { color: var(--quiet); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
textarea { display: block; width: 100%; min-height: 142px; resize: vertical; border: 1px solid #403a36; border-radius: 8px; padding: 12px 13px; background: #090909; color: #eee9e6; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
textarea:hover { border-color: #5b504b; }
.field-help { margin: 7px 0 8px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.file-button { display: inline-flex; min-height: 36px; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; color: #d9d1cc; background: #171514; font-size: 11px; cursor: pointer; }
.file-button:hover { border-color: #78615d; background: #211716; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.visually-hidden:focus-visible + .file-button, .file-button:has(+ .visually-hidden:focus-visible) { outline: 3px solid #ff9388; outline-offset: 3px; }
.form-actions, .result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; font-weight: 680; font-size: 12px; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button:disabled { cursor: wait; opacity: .6; }
.button-primary { background: var(--red); color: #1a0908; }
.button-primary:hover:not(:disabled) { background: #ff6a62; }
.button-subtle, .button-outline { border-color: #48413c; background: transparent; color: #d4ccc7; }
.button-subtle:hover, .button-outline:hover { border-color: #84716a; background: #1b1715; }
.input-status, .export-status { min-height: 1em; margin: 0; color: var(--muted); font-size: 11px; }
.input-status.error, .export-status.error { color: #ff9b92; }
.input-status.success, .export-status.success { color: var(--green); }
.error-copy { color: #ff9b92; }

.result-content { min-height: 344px; }
.score-block { display: grid; grid-template-columns: 94px minmax(0, 1fr); align-items: center; gap: 17px; padding: 14px 0 17px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.score-number { font-size: 42px; font-weight: 790; letter-spacing: -.055em; line-height: 1; color: var(--red); }
.score-number span { color: #918985; font-size: 16px; font-weight: 550; letter-spacing: 0; }
.score-label { margin: 0 0 5px; font-size: 12px; font-weight: 690; }
.score-description { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.score-track { height: 4px; margin-top: 11px; background: #2b2522; }
.score-fill { width: 100%; height: 100%; background: var(--red); transform: scaleX(var(--score)); transform-origin: left; transition: transform .18s ease-out; }
.criteria-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 8px; color: #c9c1bc; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.criteria-list { display: grid; gap: 8px; }
.criterion { padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #151312; }
.criterion-head { display: flex; align-items: flex-start; gap: 8px; }
.status-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 4px; text-transform: uppercase; font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.status-implemented { background: #193020; color: #a1d0aa; }
.status-partial { background: #352b1b; color: #e6c17d; }
.status-missing { background: #381b19; color: #f18d83; }
.criterion-title { margin: 0; color: #e6e0dd; font-size: 11px; line-height: 1.5; font-weight: 620; }
.basis { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.evidence { margin: 7px 0 0; padding: 7px 8px; color: #c9c0bb; border: 1px solid #322d2a; border-radius: 5px; background: #0a0909; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence-label { display: block; margin-bottom: 3px; color: #e58a81; font-size: 9px; }
.evidence-removed { border-color: #54422e; }
.evidence-removed .evidence-label { color: #d5b580; }
.score-method { margin: 13px 0 0; color: #958d89; font-size: 10px; line-height: 1.6; }
.limit-note { margin: 11px 0 0; padding-top: 11px; border-top: 1px solid var(--line-soft); color: #9c9692; font-size: 10px; line-height: 1.55; }
.limit-note strong { color: #c7beb9; }
.result-actions { margin-top: 13px; }
.button-outline { min-height: 34px; padding: 0 10px; font-size: 10px; }

.method-note { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 20px; padding: 24px 0 30px; margin-top: 20px; border-top: 1px solid var(--line-soft); }
.method-note p { max-width: 800px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.footer { min-height: 56px; padding: 14px clamp(18px, 4vw, 56px); border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 14px; color: #aaa09b; font-size: 10px; }

@media (max-width: 980px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .results-panel { order: 0; }
  .inputs-panel { order: 1; }
  .result-content { min-height: 0; }
}
@media (max-width: 640px) {
  .topbar { min-height: 58px; padding-inline: 16px; }
  .mode-chip { padding: 6px 8px; font-size: 9px; }
  .topbar-right { gap: 10px; }
  .top-link { font-size: 11px; }
  main { padding-inline: 16px; }
  .intro { grid-template-columns: 1fr; gap: 13px; padding-top: 29px; }
  h1 { font-size: 34px; }
  .desktop-break { display: none; }
  .intro-copy { font-size: 12px; }
  .panel-heading { align-items: flex-start; }
  .computed-tag { white-space: normal; text-align: right; max-width: 145px; }
  textarea { min-height: 135px; font-size: 11px; }
  .method-note { grid-template-columns: 1fr; gap: 12px; }
  .footer { flex-direction: column; }
  .score-block { grid-template-columns: 78px minmax(0, 1fr); }
  .score-number { font-size: 37px; }
  .form-actions .button-primary { flex: 1 1 100%; }
}
@media (pointer: coarse) { .button, .file-button { min-height: 44px; } .button-outline { min-height: 44px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
