:root {
  color-scheme: dark;
  --black: #050505;
  --surface: #0a0a09;
  --white: #f3f1ea;
  --muted: #98958b;
  --line: #ffffff1f;
  --line-strong: #ffffff33;
  --gold: #d0a83f;
  --gold-light: #f0d276;
  --warning: #f0a08b;
  --warning-bg: #f0a08b0a;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --gutter: clamp(1.25rem, 7vw, 8rem);
}

* { box-sizing: border-box; }
html { background: var(--black); color: var(--white); scroll-behavior: smooth; }
body { margin: 0; font: 1rem/1.6 var(--sans); }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.03em; text-wrap: balance; }
h1 { margin: 0; line-height: 1.02; }
h2 { line-height: 1.25; }
a { color: inherit; text-underline-offset: .25em; }
button, select { font: inherit; border-radius: 0; }
button { cursor: pointer; }
button, a, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 5px; }
::selection { background: var(--gold); color: var(--black); }
.hidden { display: none !important; }

.topbar {
  margin: 0 var(--gutter);
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.brand { display: flex; align-items: center; gap: .75rem; min-height: 44px; font: 1.3rem var(--serif); text-decoration: none; }
.brand b { color: var(--gold); font-weight: 400; }
.brand-mark { width: 32px; height: 32px; border: 1px solid var(--gold); display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 7px; flex-shrink: 0; }
.brand-mark i { display: block; width: 3px; background: var(--gold); }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 12px; }
.top-actions { display: flex; align-items: center; gap: 1.5rem; }
.privacy { color: var(--muted); font: .7rem/1.5 var(--mono); }
.privacy > span:first-child { display: inline-block; width: 6px; height: 6px; background: var(--gold); margin-right: .5rem; }
.language-control { display: flex; align-items: center; gap: .75rem; color: var(--muted); font: .75rem var(--mono); }
.language-control select { min-height: 44px; max-width: 100%; padding: .5rem; background: var(--black); color: var(--white); border: 1px solid var(--line-strong); cursor: pointer; }
.icon-button { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); color: var(--gold-light); background: transparent; font-family: var(--mono); flex-shrink: 0; }

main { margin-inline: var(--gutter); }
.hero {
  padding: clamp(3.5rem, 7vw, 7rem) 0 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
}
.hero-intro, .upload-workspace { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: .75rem; color: var(--gold-light); text-transform: uppercase; letter-spacing: .1em; font: .7rem/1.7 var(--mono); }
.eyebrow > span:first-child { width: 22px; height: 1px; flex-shrink: 0; background: var(--gold); }
.hero h1 { font-size: clamp(3.6rem, 6.5vw, 7.8rem); margin-top: 1.5rem; }
h1 em { color: var(--gold-light); font-weight: 400; }
.hero-copy { max-width: 40rem; margin: 2rem 0 0; padding-left: 1rem; border-left: 1px solid var(--gold); color: var(--muted); font-size: clamp(1rem, 1.3vw, 1.15rem); }
.drop-zone { padding: 2rem 1.5rem; border: 1px dashed var(--line-strong); border-top: 1px solid var(--gold); background: var(--surface); transition: border-color .18s, background-color .18s; }
.drop-zone.dragover { background: #d0a83f0d; border-color: var(--gold-light); }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 1.5rem; border: 1px solid var(--line-strong); color: var(--gold); }
.upload-icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.drop-zone h2 { font-size: clamp(1.6rem, 2.2vw, 2.1rem); margin: 0 0 .75rem; }
.drop-zone p { margin: 0; color: var(--muted); font-size: .875rem; }
.text-button { min-height: 44px; border: 0; padding: .5rem .2rem; background: transparent; color: var(--gold-light); text-decoration: underline; text-underline-offset: .25em; }
.file-help { display: block; margin-top: 1rem; color: var(--muted); font: .65rem/1.8 var(--mono); text-transform: uppercase; letter-spacing: .05em; }
.file-list { display: grid; gap: .5rem; }
.file-list:not(:empty) { margin-top: 1rem; }
.file-card { display: flex; align-items: center; gap: .75rem; padding: .5rem 0 .5rem 1rem; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; }
.file-card b { min-width: 0; flex: 1; overflow-wrap: anywhere; font-weight: 400; }
.file-card span { flex-shrink: 0; color: var(--muted); font: .65rem var(--mono); }
.file-card button { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; }
.primary-button, .secondary-button { min-height: 44px; padding: .8rem 1.2rem; border: 1px solid var(--gold); background: transparent; color: var(--gold-light); font: .8rem/1.5 var(--mono); }
.primary-button { width: 100%; margin-top: 1rem; }
.primary-button:disabled { color: var(--muted); border-color: var(--line-strong); }
.primary-button:not(:disabled):hover, .secondary-button:hover, .icon-button:hover { color: var(--white); border-color: var(--gold-light); background: var(--surface); }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 1rem; color: var(--muted); font: .65rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-button { display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 44px; padding: 1rem 0; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; text-align: left; color: var(--white); }
.demo-icon { color: var(--gold); font-size: .75rem; }
.demo-button b { display: block; font-size: .875rem; font-weight: 400; }
.demo-button small { display: block; margin-top: .25rem; color: var(--muted); font: .65rem/1.5 var(--mono); }
.demo-button .arrow { margin-left: auto; color: var(--gold); }
.demo-button:hover { border-color: var(--gold); }
.text-button:hover, .back-button:hover, .file-card button:hover { color: var(--white); }
.principles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; margin-top: 1rem; }
.principles article { display: flex; align-items: flex-start; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line-strong); }
.principle-icon { color: var(--gold); font-size: 1.3rem; line-height: 1.5; }
.principles b { font: 1.35rem/1.25 var(--serif); }
.principles p { margin: .75rem 0 0; color: var(--muted); font-size: .875rem; }

.results { padding: 2.5rem 0 4rem; }
.back-button { min-height: 44px; padding: .5rem 0; border: 0; background: transparent; color: var(--gold-light); font: .75rem/1.5 var(--mono); }
.results-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; margin: 1.5rem 0 2rem; }
.results-heading > div { min-width: 0; }
.results-heading h1 { font-size: clamp(2.75rem, 4.2vw, 4.75rem); margin: 1rem 0; }
.results-heading p { max-width: 46rem; color: var(--muted); font-size: .875rem; margin: 0; }
.secondary-button { flex-shrink: 0; }
.status-strip { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem .75rem; padding: 1.25rem; border-left: 2px solid var(--gold); background: var(--surface); font-size: .8rem; }
.status-dot { width: 6px; height: 6px; flex-shrink: 0; background: var(--gold); }
.status-strip b { font-weight: 500; }
.status-strip p { margin: 0; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 0 2rem; margin-top: 2rem; border-bottom: 1px solid var(--line-strong); }
.tabs button { min-height: 44px; padding: 1rem 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: .75rem/1.5 var(--mono); }
.tabs button.active { color: var(--gold-light); border-bottom-color: var(--gold); }
.tabs button:hover { color: var(--white); }
.tabs button span:not([data-i18n]) { margin-left: .25rem; padding: .1rem .35rem; border: 1px solid var(--line); font-size: .65rem; }
.panel { display: none; }
.panel.active { display: block; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--gold); margin-top: 2rem; }
table { width: 100%; min-width: 800px; border-collapse: collapse; }
th, td { padding: 1.5rem 1rem; border-bottom: 1px solid var(--line-strong); text-align: left; vertical-align: top; }
th { color: var(--muted); background: var(--surface); font: .7rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
td { font-size: .95rem; }
td:first-child { width: 30%; }
td:not(:first-child) { width: 23.333%; }
td b, td strong { display: block; margin-bottom: .75rem; font-weight: 400; }
td b { font: 1.4rem/1.3 var(--serif); }
td strong { color: var(--gold-light); font: 1.25rem/1.5 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; color: var(--muted); font: .7rem/1.8 var(--mono); }
.pill { display: inline-block; margin-top: 1rem; padding: .35rem .5rem; border: 1px solid var(--line-strong); font: .6rem/1.6 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.converted { color: var(--gold-light); border-color: #d0a83f66; }
.partial { background: var(--warning-bg); color: var(--warning); border-color: #f0a08b66; }
.unknown { display: block; margin: .3rem 0 .75rem; color: var(--warning); font-size: .875rem; }
.warning, .muted { color: var(--warning); }
.table-note { margin: 1rem 0; color: var(--muted); font: .7rem/1.7 var(--mono); }
.panel > h2, .commercial h2 { font-size: clamp(1.8rem, 3vw, 2.75rem); margin: 2rem 0 1.5rem; }
.issue-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.issue-list li { display: flex; gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.issue-list li > span { flex-shrink: 0; color: var(--gold); font: .75rem/1.6 var(--mono); }
.issue-list b { font-size: 1rem; font-weight: 500; }
.issue-list p { margin: .5rem 0 0; color: var(--muted); font-size: .95rem; }
.warning-list li > span { color: var(--warning); }
.panel > .unsafe-title { margin-top: 3rem; }
.unsafe-card { border-left: 2px solid var(--warning); padding: 1.25rem; background: var(--warning-bg); font-size: .95rem; }
.unsafe-card b { color: var(--warning); font-weight: 500; }
.unsafe-card p { color: var(--muted); margin: .5rem 0 0; }
.commercial { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.term-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.term-grid > div { padding: 1.5rem 0 0; border-top: 1px solid var(--line-strong); }
.term-grid > div > span { font: 1.5rem/1.3 var(--serif); }
.term-grid dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .75rem; font-size: .8rem; margin: 1.5rem 0 0; }
.term-grid dt { color: var(--muted); }
.term-grid dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 2rem; margin-top: 3rem; padding: 1.5rem; border-top: 1px solid var(--gold); background: var(--surface); }
.summary span { color: var(--gold-light); font: .7rem/1.7 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.summary p { margin: 0; max-width: 46rem; font: 1.2rem/1.6 var(--serif); }

footer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1rem 2rem; margin: 0 var(--gutter); padding: 2rem 0; border-top: 1px solid var(--line); }
footer > span { font: 1.2rem var(--serif); }
footer p { margin: 0; color: var(--muted); font-size: .875rem; }
footer small { margin-left: auto; color: var(--muted); font: .65rem/1.7 var(--mono); }
dialog { width: min(36rem, calc(100% - 2.5rem)); max-height: calc(100% - 2.5rem); padding: 2rem; border: 1px solid var(--line-strong); border-top-color: var(--gold); background: var(--surface); color: var(--white); }
dialog::backdrop { background: #000c; }
dialog button { float: right; min-width: 44px; min-height: 44px; margin: -.75rem -.75rem 0 .5rem; padding: 0; border: 0; background: transparent; color: var(--gold-light); font-size: 1.5rem; }
dialog h2 { font-size: 2.25rem; margin: 0 0 1.5rem; }
dialog ol { padding-left: 1.5rem; }
dialog li { padding: .5rem 0; }
dialog li::marker { color: var(--gold); font-family: var(--mono); }
dialog li, dialog p { color: var(--muted); font-size: .95rem; }
dialog p { margin-bottom: 0; }

@media (max-width: 1100px) {
  .privacy { display: none; }
  .term-grid { gap: 1.25rem; }
}

@media (max-width: 960px) {
  :root { --gutter: clamp(1.25rem, 5.5vw, 3.5rem); }
  .hero { gap: 2rem; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 1.5rem; }
  .term-grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero h1 { font-size: clamp(2.65rem, 7.6vw, 4.6rem); max-width: 17ch; }
  .upload-workspace { width: 100%; }
  .principles { grid-template-columns: 1fr; }
  .principles article { padding-top: 1.25rem; }
  .summary { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 600px) {
  .topbar { gap: .75rem; }
  .top-actions { width: 100%; justify-content: space-between; gap: .75rem; }
  .language-control { flex: 1; justify-content: space-between; }
  .hero { padding-bottom: 3.5rem; }
  .drop-zone { padding: 1.5rem 1.25rem; }
  .results-heading h1 { font-size: clamp(2rem, 8vw, 2.75rem); }
  .tabs { gap: 0 1.25rem; }
  .tabs button { font-size: .7rem; }
  .summary { padding: 1.25rem; }
  footer { gap: .75rem; }
  footer small { width: 100%; margin-left: 0; }
  dialog { padding: 1.5rem; }
}

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