:root {
  color-scheme: dark;
  --ink: #f5f0ed;
  --muted: #aaa09b;
  --quiet: #948984;
  --ground: #090808;
  --surface: #12100f;
  --surface-2: #191514;
  --line: #3a302d;
  --line-soft: #282220;
  --red: #ed554c;
  --red-soft: #3a1a18;
  --orange: #e9a36c;
  --green: #91c7a1;
  --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; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ff9a8c; 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: 780; letter-spacing: -.035em; font-size: 18px; }
.wordmark-mark { display: grid; place-items: center; width: 30px; height: 28px; border-radius: 6px; background: var(--red); color: #180b09; font-size: 10px; font-weight: 900; letter-spacing: -.08em; }
.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: #d1c6c0; 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: 770; }
.intro-copy { max-width: 470px; margin: 0 0 3px; color: #b9aeaa; font-size: 14px; line-height: 1.7; }
.workbench { display: grid; grid-template-columns: minmax(0, .95fr) minmax(390px, 1.05fr); gap: 15px; align-items: start; }
.inputs-panel, .results-panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2vw, 24px); }
.results-panel { background: #100e0d; }
.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; white-space: normal; text-align: right; max-width: 165px; }
.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: clamp(290px, 38vw, 460px); resize: vertical; border: 1px solid #443834; border-radius: 8px; padding: 13px; background: #090808; color: #eee7e3; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
textarea:hover { border-color: #71524c; }
.field-help, .input-limit { margin: 8px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.input-limit { margin-top: 12px; color: #8f8580; }
.file-button { display: inline-flex; min-height: 36px; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; color: #ded3ce; background: #1a1514; font-size: 11px; cursor: pointer; }
.file-button:hover { border-color: #91655c; background: #241817; }
.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; }
.file-button:has(+ .visually-hidden:focus-visible) { outline: 3px solid #ff9a8c; 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: #ff7066; }
.button-subtle, .button-outline { border-color: #504441; background: transparent; color: #d8ccc6; }
.button-subtle:hover, .button-outline:hover { border-color: #8b6b62; background: #201917; }
.input-status, .export-status { min-height: 1em; margin: 0; color: var(--muted); font-size: 11px; }
.input-status.error, .export-status.error { color: #ffa096; }
.input-status.success, .export-status.success { color: var(--green); }
.error-copy { color: #ffa096; }
.result-content { min-height: 230px; }
.score-block { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 16px; padding: 12px 0 17px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.score-number { color: var(--red); font-size: 42px; font-weight: 790; letter-spacing: -.055em; line-height: 1; }
.score-number span { color: #958a85; 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: #302522; }
.score-fill { width: 100%; height: 100%; background: var(--red); transform: scaleX(var(--score)); transform-origin: left; transition: transform .18s ease-out; }
.stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 13px 0 19px; }
.stat { min-width: 0; padding: 9px 10px; background: #171311; border-top: 1px solid #473a35; }
.stat-value { display: block; color: #f0ded4; font-size: 19px; font-weight: 720; letter-spacing: -.04em; }
.stat-label { color: #a99c95; font-size: 9px; line-height: 1.4; }
.docs-heading, .annotation-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 15px 0 8px; }
.docs-heading h3, .annotation-heading h3 { margin: 0; font-size: 12px; }
.docs-preview { min-height: 150px; max-height: 260px; overflow: auto; margin: 0; padding: 12px; border: 1px solid #332a27; border-radius: 7px; background: #0a0908; color: #d7ccc6; font: 10px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.annotation-heading { border-top: 1px solid var(--line-soft); padding-top: 14px; margin-top: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: #c4b8b2; font-size: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 29px; height: 16px; position: relative; flex: 0 0 auto; border-radius: 20px; background: #49403c; transition: background .15s ease; }
.toggle-track::after { content: ""; position: absolute; width: 10px; height: 10px; left: 3px; top: 3px; border-radius: 50%; background: #eee7e3; transition: transform .15s ease; }
.toggle input:checked + .toggle-track { background: #9c5149; }
.toggle input:checked + .toggle-track::after { transform: translateX(13px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid #ff9a8c; outline-offset: 3px; }
.annotation-list { display: grid; gap: 7px; }
.annotation { padding: 9px 10px; border: 1px solid #51302b; border-radius: 7px; background: #1b1110; }
.annotation-title { margin: 0 0 4px; color: #ef9a8d; font-size: 10px; font-weight: 700; }
.annotation-copy { margin: 0; color: #c6ada5; font-size: 10px; line-height: 1.55; }
.professional-note { margin: 0; color: #a99f99; font-size: 11px; line-height: 1.55; }
.button-outline { min-height: 34px; padding: 0 10px; font-size: 10px; }
.result-actions { margin-top: 14px; }
.limit-note { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--line-soft); color: #a49a94; font-size: 10px; line-height: 1.55; }
.limit-note strong { color: #d0c4bd; }
.method-note { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 24px 0 30px; margin-top: 20px; border-top: 1px solid var(--line-soft); }
.method-note p { max-width: 850px; 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: 1020px) { .workbench { grid-template-columns: minmax(0, 1fr); } .result-content { min-height: 0; } textarea { min-height: 310px; } }
@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 { max-width: 132px; }
  textarea { min-height: 275px; 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%; }
  .annotation-heading { align-items: flex-start; }
}
@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; } }
