:root {
  --ink: #1f2924;
  --muted: #67716b;
  --paper: #f4f1e9;
  --card: #fffefa;
  --line: #d9dbd3;
  --green: #175c45;
  --green-2: #dce9df;
  --lime: #cce076;
  --orange: #e26f38;
  --shadow: 0 24px 60px rgba(45, 54, 47, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Avenir Next, Avenir, Inter, system-ui, sans-serif;
  min-height: 100vh;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
.noise {
  position: fixed; inset: 0; pointer-events: none; opacity: .22; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}
.site-header, main, footer { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.site-header { height: 86px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { width: 32px; height: 32px; background: var(--green); border-radius: 50%; display: grid; place-content: center; gap: 2px; transform: rotate(-10deg); }
.brand-mark i { display: block; width: 14px; height: 2px; background: var(--lime); border-radius: 9px; }
.brand-mark i:nth-child(2) { width: 10px; }
.privacy-pill { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 30px; padding: 9px 14px; color: var(--muted); background: rgba(255,255,255,.35); font-size: 12px; font-weight: 600; }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: #4a9b67; box-shadow: 0 0 0 4px rgba(74,155,103,.12); }
.hero { padding: 72px 0 54px; position: relative; }
.hero::after { content: "✣"; position: absolute; right: 7%; top: 92px; color: var(--orange); font-size: 38px; transform: rotate(15deg); }
.eyebrow { margin: 0 0 18px; text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; color: var(--green); }
h1, h2 { font-family: Iowan Old Style, Baskerville, Georgia, serif; letter-spacing: -.055em; font-weight: 600; }
h1 { margin: 0; font-size: clamp(58px, 8.4vw, 104px); line-height: .88; }
h1 em { color: var(--green); font-weight: inherit; }
.lead { max-width: 610px; margin: 34px 0 0 35%; color: var(--muted); line-height: 1.7; font-size: 16px; }
.workspace { background: var(--card); border: 1px solid #dedfd8; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.workspace-topbar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.mode-switch { display: flex; background: #eff0ea; border-radius: 10px; padding: 4px; }
.mode-switch input { position: absolute; opacity: 0; }
.mode-switch span { display: block; padding: 8px 15px; border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--muted); transition: .2s; }
.mode-switch input:checked + span { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(30,40,35,.08); }
.text-button, .findings-title button { border: 0; background: none; font-size: 12px; font-weight: 700; color: var(--green); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.editor-grid { display: grid; grid-template-columns: 1fr 34px 1fr; min-height: 390px; }
.editor-panel { padding: 22px 24px 20px; display: flex; flex-direction: column; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-heading label { font-size: 12px; font-weight: 800; }
.panel-heading span { color: #929a95; font-size: 11px; }
.drop-zone, textarea { flex: 1; min-height: 300px; }
.drop-zone { position: relative; display: flex; border-radius: 10px; transition: .2s; }
.drop-zone.is-dragging { outline: 2px dashed var(--green); outline-offset: 3px; background: var(--green-2); }
textarea { display: block; width: 100%; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 18px; color: var(--ink); background: #fbfaf6; font-size: 14px; line-height: 1.65; outline: 0; transition: border-color .2s, box-shadow .2s; }
textarea:focus { border-color: #7fa691; box-shadow: 0 0 0 3px rgba(23,92,69,.08); }
textarea::placeholder { color: #abb0ac; }
.empty-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #7c8680; pointer-events: none; }
.empty-hint[hidden] { display: none; }
.empty-hint small { color: #a1a8a3; font-size: 10px; }
.paste-icon { width: 36px; height: 36px; border: 1px solid #b9bdb9; border-radius: 9px; display: grid; place-items: center; margin-bottom: 4px; font-size: 13px; font-weight: 700; }
.divider { position: relative; display: grid; place-items: center; }
.divider::before { content: ""; height: calc(100% - 50px); width: 1px; background: var(--line); position: absolute; }
.divider span { z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--green); background: var(--green-2); font-size: 13px; }
.output-panel { position: relative; }
.output-panel textarea { padding-bottom: 65px; }
.output-actions { position: absolute; right: 40px; bottom: 36px; display: flex; gap: 7px; }
.copy-button, .download-button { border: 0; height: 36px; border-radius: 7px; cursor: pointer; background: var(--green); color: white; font-size: 11px; font-weight: 700; }
.copy-button { padding: 0 13px; display: flex; align-items: center; gap: 8px; }
.download-button { width: 36px; font-size: 17px; }
.copy-button:disabled, .download-button:disabled { opacity: .35; cursor: default; }
.copy-icon { width: 11px; height: 13px; border: 1px solid currentColor; border-radius: 2px; position: relative; }
.copy-icon::before { content: ""; position: absolute; inset: -4px 3px 3px -4px; border: 1px solid currentColor; border-radius: 2px; }
.options-row { min-height: 76px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 26px; padding: 12px 18px 12px 24px; }
.check-option { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); cursor: pointer; }
.check-option input { position: absolute; opacity: 0; }
.fake-check { width: 17px; height: 17px; border: 1px solid #b3b8b4; border-radius: 4px; display: grid; place-items: center; }
.check-option input:checked + .fake-check { background: var(--green); border-color: var(--green); }
.check-option input:checked + .fake-check::after { content: "✓"; color: white; font-size: 11px; }
.clean-button { margin-left: auto; min-width: 185px; height: 45px; padding: 0 14px 0 19px; display: flex; justify-content: space-between; align-items: center; border: 0; border-radius: 9px; background: var(--green); color: white; cursor: pointer; font-size: 12px; font-weight: 800; box-shadow: 0 8px 20px rgba(23,92,69,.2); transition: transform .18s, background .18s; }
.clean-button:hover { transform: translateY(-2px); background: #0f4d39; }
.clean-button b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: rgba(255,255,255,.12); font-size: 14px; }
.result-card { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.38); overflow: hidden; }
.result-card.has-findings { background: #fffaf0; border-color: #e7d4b2; }
.result-card.is-clean { background: rgba(230,241,232,.65); border-color: #bfd5c4; }
.result-status { padding: 20px 24px; display: flex; gap: 13px; align-items: center; }
.status-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--green-2); color: var(--green); font-weight: 800; }
.has-findings .status-icon { background: #f5dfb7; color: #9a5c1a; }
.result-status strong { display: block; font-size: 13px; }
.result-status p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.stats { border-top: 1px solid rgba(120,130,123,.18); display: grid; grid-template-columns: repeat(3, 1fr); }
.stats div { padding: 18px 24px; border-right: 1px solid rgba(120,130,123,.18); }
.stats div:last-child { border: 0; }
.stats strong { display: block; font-family: Iowan Old Style, Baskerville, Georgia, serif; font-size: 25px; line-height: 1; }
.stats span { color: var(--muted); font-size: 10px; }
.findings { border-top: 1px solid rgba(120,130,123,.18); padding: 18px 24px 23px; }
.findings-title { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; margin-bottom: 12px; }
.finding-list { display: flex; flex-wrap: wrap; gap: 7px; }
.finding { display: inline-flex; align-items: center; gap: 8px; background: white; border: 1px solid #e7dfd0; border-radius: 8px; padding: 7px 10px; font-size: 10px; }
.finding code { color: var(--green); font-weight: 800; }
.finding b { display: grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px; background: #f0eee7; }
.explanation { margin: 110px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10%; align-items: start; }
.explanation h2 { margin: 0; font-size: clamp(43px, 5vw, 65px); line-height: .98; }
.explanation-copy { padding-top: 29px; color: var(--muted); line-height: 1.75; font-size: 13px; }
.explanation-copy p { margin: 0 0 18px; }
.explanation-copy strong { color: var(--ink); }
footer { border-top: 1px solid var(--line); min-height: 80px; display: flex; justify-content: space-between; align-items: center; color: #808984; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: white; padding: 11px 17px; border-radius: 8px; font-size: 11px; transition: .25s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- tabs & header */
.header-side { display: flex; align-items: center; gap: 12px; }
.lang-switch { display: grid; place-items: center; min-width: 44px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 30px; color: var(--muted); background: rgba(255,255,255,.35); font-size: 12px; font-weight: 800; text-decoration: none; letter-spacing: .04em; transition: .2s; }
.lang-switch:hover { color: var(--green); border-color: #a9bfb2; }
.tool-tabs { display: flex; background: #eff0ea; border-radius: 10px; padding: 4px; gap: 2px; }
.tool-tab { border: 0; background: none; padding: 9px 14px; border-radius: 7px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; transition: .2s; }
.tool-tab.is-active { background: var(--card); color: var(--ink); box-shadow: 0 2px 8px rgba(30,40,35,.08); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.upload-hint { margin-top: 2px; }

/* --------------------------------------------------------------- prose panel */
.options-row--wrap { flex-wrap: wrap; row-gap: 12px; }
.options-label { font-size: 11px; font-weight: 800; margin-right: 2px; }
.finding--fixed { border-color: #bfd5c4; background: #f2f8f3; }
.finding--fixed b { background: var(--green-2); color: var(--green); }
.findings-title--spaced { margin-top: 22px; }
.muted-note { margin: 0; color: var(--muted); font-size: 11px; }

.rhythm { margin-top: 24px; }
.rhythm-chart { display: flex; align-items: flex-end; gap: 3px; height: 74px; padding: 8px 10px; background: white; border: 1px solid #e7dfd0; border-radius: 8px; overflow-x: auto; }
.rhythm-bar { flex: 1 0 6px; min-width: 6px; border-radius: 3px 3px 0 0; background: var(--green); opacity: .78; }
.rhythm-verdict { margin: 9px 0 0; font-size: 11px; font-weight: 700; color: var(--muted); }
.rhythm-verdict[data-verdict="flat"] { color: #9a5c1a; }
.rhythm-verdict[data-verdict="good"] { color: var(--green); }

.annotated { background: white; border: 1px solid #e7dfd0; border-radius: 8px; padding: 16px 18px; font-size: 13px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; }
.issue { padding: 1px 3px; border-radius: 3px; background: none; color: inherit; border-bottom: 2px solid; cursor: help; }
.issue--bureaucratic { border-color: #e26f38; background: rgba(226,111,56,.09); }
.issue--cliche { border-color: #c9a227; background: rgba(201,162,39,.11); }
.issue--nominalization { border-color: #7a5cc4; background: rgba(122,92,196,.09); }
.issue--passive { border-color: #3d7ea6; background: rgba(61,126,166,.09); }
.issue--triple { border-color: #8a8f7a; background: rgba(138,143,122,.11); }
.issue--anglicism { border-color: #b5533f; background: rgba(181,83,63,.09); }

/* ------------------------------------------------------- article & reference */
.article { max-width: 780px; margin: 96px 0 0; }
.article h2 { margin: 44px 0 14px; font-size: clamp(26px, 3vw, 34px); letter-spacing: -.03em; }
.article h2:first-child { margin-top: 0; }
.article p { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 18px 0 34px; }
.ref-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ref-table th { text-align: left; padding: 13px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ref-table td { padding: 12px 16px; border-bottom: 1px solid rgba(120,130,123,.14); vertical-align: top; }
.ref-table tr:last-child td { border-bottom: 0; }
.ref-table code { color: var(--green); font-weight: 700; white-space: nowrap; }

.related { margin: 90px 0 0; border-top: 1px solid var(--line); padding-top: 28px; }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.related a { display: inline-block; padding: 11px 16px; border: 1px solid var(--line); border-radius: 30px; color: var(--ink); background: rgba(255,255,255,.4); text-decoration: none; font-size: 13px; font-weight: 600; transition: .2s; }
.related a:hover { border-color: #a9bfb2; color: var(--green); }

.lang-nav { display: flex; gap: 4px; }
.lang-switch.is-active { color: var(--green); border-color: #a9bfb2; background: var(--green-2); }

/* ------------------------------------------------------------------------ faq */
.faq { margin: 0 0 110px; max-width: 780px; }
.faq h2 { margin: 0 0 26px; font-size: clamp(34px, 4vw, 48px); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary { cursor: pointer; padding: 18px 0; font-size: 14px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--green); font-size: 19px; line-height: 1; flex: none; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.75; }

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 24px, 1160px); }
  .site-header { height: 70px; }
  .privacy-pill { display: none; }
  .hero { padding: 44px 0 38px; }
  .hero::after { display: none; }
  /* 8.4vw hit 63px at 375px wide and crowded the edge. */
  h1 { font-size: clamp(38px, 11.5vw, 62px); line-height: .94; }
  .lead { margin-left: 0; margin-top: 22px; font-size: 15px; }
  .eyebrow { font-size: 10px; }
  .workspace-topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .tool-tabs { justify-content: stretch; }
  .tool-tab { flex: 1; }
  .topbar-actions { justify-content: space-between; }
  /* Comfortable touch targets. The checkbox inputs are visually hidden, so
     the tappable area is the label — it has to carry the height itself. */
  .text-button, .lang-switch, .tool-tab { min-height: 44px; }
  .check-option { min-height: 44px; font-size: 12px; }
  .mode-switch label { display: flex; flex: 1; }
  .mode-switch span { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 38px; }
  .mode-switch { width: 100%; }
  .copy-button, .download-button { height: 44px; }
  .download-button { width: 44px; }
  .options-row .clean-button { min-height: 48px; }
  .faq { margin-bottom: 72px; }
  .annotated { max-height: 260px; font-size: 12.5px; }
  .editor-grid { grid-template-columns: 1fr; }
  .divider { height: 28px; }
  .divider::before { height: 1px; width: calc(100% - 48px); }
  .divider span { transform: rotate(90deg); }
  .editor-panel { padding: 18px; }
  .options-row { align-items: flex-start; flex-direction: column; gap: 14px; padding: 18px; }
  .clean-button { width: 100%; margin: 4px 0 0; }
  .output-actions { right: 34px; bottom: 32px; }
  .stats div { padding: 15px; }
  .explanation { margin: 80px 5px; grid-template-columns: 1fr; }
  .explanation-copy { padding-top: 15px; }
  footer { flex-direction: column; justify-content: center; gap: 5px; align-items: flex-start; }
}

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