:root {
  --paper: #f6f3ea;
  --card: #fffdf7;
  --ink: #1c1b17;
  --muted: #6c6759;
  --line: #e3ddcc;
  --line-strong: #d3cbb4;
  --accent: #17624a;
  --accent-hover: #114b39;
  --accent-soft: #e4efe7;
  --mark: #ffe9a3;
  --mark-line: #cfa93b;
  --shadow: 0 1px 2px rgba(28, 27, 23, .05), 0 12px 30px -18px rgba(28, 27, 23, .4);
  --radius: 14px;
}

[data-theme="dark"] {
  --paper: #131512;
  --card: #1a1d19;
  --ink: #eceae1;
  --muted: #a09d8f;
  --line: #2b2f29;
  --line-strong: #3a3f37;
  --accent: #63d6a9;
  --accent-hover: #8ae7c2;
  --accent-soft: #1d2a23;
  --mark: #4b3d16;
  --mark-line: #c9a63c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .8);
}

/* The theme picker's four palettes, expressed in the shared editorial tokens.
   Both the Paraphraser and the two editorial pages read these, so a choice
   saved on any page styles every page. */
html[data-theme="slate"],
html[data-theme="paper"],
html[data-theme="aqua"],
html[data-theme="green"] {
  --paper: var(--st-bg);
  --card: var(--st-card);
  --ink: var(--st-text);
  --muted: var(--st-dim);
  --line: var(--st-line);
  --line-strong: color-mix(in srgb, var(--st-line) 65%, var(--st-text));
  --accent: var(--st-accent);
  --accent-hover: var(--st-accent-hover);
  --accent-soft: var(--st-accent-soft);
  --on-accent: var(--st-on-accent);
  --mark: var(--st-accent-soft);
  --mark-line: var(--st-accent);
  --shadow: var(--st-shadow);
}

html[data-theme="slate"] { --ok: #86efac; --bad: #fca5a5; --warn-bg: #3a2b12; --warn-ink: #e6b96a; }
html[data-theme="paper"] { --ok: #15803d; --bad: #b91c1c; --warn-bg: #fdf3d8; --warn-ink: #8a5a12; }
html[data-theme="aqua"] { --ok: #7ee0c0; --bad: #ffb4a2; --warn-bg: #123243; --warn-ink: #ffd28a; }
html[data-theme="green"] { --ok: #8fe0b6; --bad: #ffb4a2; --warn-bg: #2b3a1a; --warn-ink: #e6b96a; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
}

button {
  font: inherit;
  cursor: pointer;
}

/* ------------------------------- topbar ------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--card);
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 1;
  padding-bottom: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-family: Georgia, serif;
  font-size: 17px;
  letter-spacing: -.01em;
}

.brand-text small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
}

.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.theme-select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  max-width: 9.5rem;
}
.theme-select:hover { border-color: var(--accent); color: var(--accent); }

/* -------------------------------- wrap -------------------------------- */

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 52px) clamp(16px, 4vw, 40px) 40px;
  flex: 1;
}

.intro h1 {
  font-size: clamp(30px, 4.6vw, 46px);
  line-height: 1.08;
  margin-bottom: 12px;
}

.intro p {
  max-width: 62ch;
  color: var(--muted);
  margin: 0;
  font-size: 16.5px;
}

/* -------------------------------- modes ------------------------------- */

.modes {
  margin-top: 26px;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-pill {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  transition: background .15s, border-color .15s, color .15s;
}

.mode-pill:hover { border-color: var(--accent); }

.mode-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--card);
}

.mode-pill[aria-pressed="true"] { color: var(--on-accent); }

.mode-blurb {
  color: var(--muted);
  font-size: 13.5px;
  margin: 10px 0 0;
  min-height: 20px;
}

/* -------------------------------- editor ------------------------------ */

.editor {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane + .pane {
  border-left: 1px solid var(--line);
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 55%, var(--card));
}

.pane-head h2 {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-tools {
  display: flex;
  gap: 4px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 7px;
  border-radius: 6px;
}

.link-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge {
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

textarea, .output {
  width: 100%;
  min-height: 320px;
  padding: 18px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.7;
  font-family: inherit;
}

textarea { resize: vertical; }

textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.output {
  overflow-y: auto;
  max-height: 60vh;
  white-space: pre-wrap;
  word-break: break-word;
}

.output .empty {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
  margin: 0;
  font-style: italic;
}

.output mark {
  background: var(--mark);
  color: inherit;
  border-bottom: 1px solid var(--mark-line);
  padding: 0 1px;
  border-radius: 2px;
}

.pane-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  background: color-mix(in srgb, var(--paper) 45%, var(--card));
  min-height: 38px;
}

.muted { color: var(--muted); }

/* ------------------------------ action bar ---------------------------- */

.actionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .06s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--card);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-primary { color: var(--on-accent); }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 500;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.actionbar-note {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 0 4px;
}

/* ------------------------------- details ------------------------------ */

.details {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  margin-top: 28px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card h3 {
  font-size: 19px;
  margin-bottom: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  background: color-mix(in srgb, var(--paper) 50%, var(--card));
}

.chip b {
  color: var(--accent);
  font-weight: 700;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14.5px;
}

.steps li { margin-bottom: 9px; }
.steps strong { color: var(--ink); font-weight: 600; }

.log {
  margin-top: 14px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 12px;
}

.log summary {
  cursor: pointer;
  font-size: 13.5px;
  color: var(--accent);
  font-weight: 600;
}

.log ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  font-size: 13px;
}

.log li {
  display: flex;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  color: var(--muted);
}

.log li span.rule {
  flex: 0 0 128px;
  color: var(--muted);
  font-size: 12px;
}

.log li span.swap { color: var(--ink); }
.log li span.swap i { color: var(--muted); font-style: normal; }

/* -------------------------------- notes ------------------------------- */

.notes { margin-top: 32px; }

.notes h3 { font-size: 20px; margin-bottom: 14px; }

.note-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.note-grid > div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.note-grid h4 {
  font-size: 15px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
}

.note-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.note-grid li { margin-bottom: 6px; }

.foot {
  border-top: 1px solid var(--line);
  padding: 20px clamp(16px, 4vw, 40px);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.foot a { color: var(--accent); }
.foot p + p { margin-top: 6px; }

.intro a { color: var(--accent); }

/* --------------------------- technique panel -------------------------- */

.techniques {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.technique-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tech-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
}

.tech {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  cursor: pointer;
}

.tech:hover { border-color: var(--line-strong); }

.tech input {
  margin: 3px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.tech span { line-height: 1.35; }

.tech b { display: block; font-weight: 600; font-size: 13px; }
.tech small { color: var(--muted); font-size: 12px; }

/* ------------------------------ navigation --------------------------- */

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  margin-right: 4px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nav a:hover { color: var(--ink); border-color: var(--line); }

.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ------------------------------- paper studio ------------------------ */

.tabs {
  display: flex;
  gap: 6px;
  margin: 22px 0 18px;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
}

.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffdf8;
}

.view[hidden] { display: none; }

.editor.single { grid-template-columns: 1fr; }

.paper-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
  margin-top: 22px;
  align-items: start;
}

.paper-grid .wide { grid-column: 1 / -1; }

.paper-grid .card p.small,
.small { font-size: 13px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric strong {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 22px;
  line-height: 1.1;
}

.metric span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.metric small { font-size: 11px; color: var(--muted); }

.outline { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

.move {
  border-left: 3px solid var(--line-strong);
  padding-left: 12px;
}

.move h4 {
  font-family: inherit;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.move-count {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  color: var(--muted);
}

.move ul { margin: 0; padding-left: 18px; font-size: 14px; }
.move li { margin-bottom: 5px; }
.move-accent { border-left-color: var(--accent); }
.move-good { border-left-color: #2f7d5c; }
.move-warn { border-left-color: #b8862b; }
.move-note { border-left-color: #8a6bb1; }

.plain-list { margin: 12px 0 0; padding-left: 18px; font-size: 14px; }
.plain-list li { margin-bottom: 7px; }

.check-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }

.check p { margin: 2px 0 0; font-size: 13px; }

.check-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.check-ok .check-mark { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.check-warn .check-mark { background: #f7e2c4; border-color: transparent; color: #8a5a12; }
.check-note .check-mark { background: var(--paper); }

.check-warn .check-mark { background: var(--warn-bg); color: var(--warn-ink); }

.phrasebank { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }

.bank-group h4 {
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.bank-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 6px;
}

.bank-item:hover { border-color: var(--line-strong); background: var(--accent-soft); }

.meter { margin: 14px 0 6px; }

.meter-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.meter-bar span {
  display: block;
  height: 100%;
  width: 3%;
  background: var(--accent);
  transition: width .25s ease;
}

.meter-bar span[data-tone="warn"] { background: #c08a2e; }
.meter-bar span[data-tone="note"] { background: #8a6bb1; }

.meter-label { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.meter-label strong { font-size: 18px; color: var(--ink); }

/* ----------------------------- responsive ----------------------------- */

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .paper-grid { grid-template-columns: 1fr; }
  .paper-grid .wide { grid-column: auto; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--line); }
  .details, .note-grid { grid-template-columns: 1fr; }
  textarea, .output { min-height: 220px; }
}

@media (max-width: 560px) {
  .wrap { padding-top: 22px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .brand-text small { display: none; }
  .actionbar .btn { flex: 1 1 auto; }
  .actionbar-note { flex-basis: 100%; margin: 4px 0 0; }
}

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

/* =======================================================================
   Before/after strip, side panel and review views
   ======================================================================= */

.wrap { max-width: 1320px; }

.strip {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px 16px;
}

.strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.strip-head h2 { font-size: 15px; letter-spacing: .01em; }
.strip-head .muted { margin: 0; }

.strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.strip-cell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.strip-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}

.strip-values {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 21px;
}

.strip-values b { font-weight: 600; }
.strip-values i { color: var(--muted); font-style: normal; font-size: 15px; }

.strip-delta { font-size: 11.5px; color: var(--muted); }
.strip-delta.better { color: var(--accent); }
.strip-delta.worse { color: #a8522c; }
.strip-delta.better { color: var(--ok); }
.strip-delta.worse { color: var(--bad); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
  margin-top: 6px;
}

.editor-col { min-width: 0; }

.aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.panel h3 { font-size: 14px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.panel-head h3 { margin: 0; }

.badge.subtle {
  background: var(--paper);
  color: var(--muted);
  border: 1px solid var(--line);
  font-weight: 500;
}

.ai-card { border-color: var(--line-strong); }

.ai-figure {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  line-height: 1;
  margin: 2px 0 0;
}

.ai-number { font-size: 46px; font-weight: 600; letter-spacing: -.02em; }
.ai-unit { font-size: 18px; color: var(--muted); }
.ai-band { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }

.driver-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.driver-list li { display: grid; grid-template-columns: 1fr 54px; gap: 2px 8px; align-items: center; font-size: 12.5px; }
.driver-list small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }

.driver-bar {
  height: 5px;
  background: var(--paper);
  border-radius: 999px;
  overflow: hidden;
}
.driver-bar span { display: block; height: 100%; background: var(--accent); }

.caveat {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.aside-tech { grid-template-columns: 1fr; gap: 6px; margin-top: 4px; }
.aside-tech .tech { font-size: 12px; padding: 6px 8px; }
.aside-tech .tech small { display: none; }

.targets { display: grid; gap: 10px; margin-top: 4px; }
.target { display: grid; gap: 4px; font-size: 12.5px; }
.target > span { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.target b { color: var(--ink); font-weight: 600; }
.target input[type="range"] { width: 100%; accent-color: var(--accent); }

.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.target-select { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.target-select select {
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px 7px;
}

.mini-textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
}

.tone-bars { display: grid; gap: 10px; margin-top: 6px; }
.tone-row { display: grid; gap: 4px; }
.tone-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.tone-label b { font-size: 12.5px; color: var(--ink); }
.tone-track {
  position: relative;
  height: 7px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tone-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.tone-ghost {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 13px;
  background: var(--muted);
  border-radius: 2px;
}

.overlap { display: grid; gap: 8px; margin-top: 6px; }
.overlap-line { font-size: 12.5px; color: var(--muted); }
.overlap-line b { color: var(--ink); }
.overlap-meter { height: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.overlap-meter span { display: block; height: 100%; background: var(--accent); }

.variants {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.variant-row { display: flex; gap: 8px; flex-wrap: wrap; }
.variant {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
}
.variant[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

.review {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.tab {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13.5px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel[hidden] { display: none; }

.sentence-list { display: grid; gap: 8px; margin-top: 10px; }
.sentence {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--paper);
}
.sentence.is-changed { border-color: var(--line-strong); }
.sentence.is-blocked { border-color: #c08a2e; }
.sentence-head { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.sentence-head .link-btn { margin-left: auto; }
.sentence-number {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.sentence-rules { flex: 1; min-width: 0; }
.sentence-body { margin-top: 5px; display: grid; gap: 3px; }
.sentence-before { margin: 0; color: var(--muted); font-size: 13px; }
.sentence-after { margin: 0; font-size: 13.5px; }
.sentence-after::before { content: "→ "; color: var(--accent); }
.sentence-flag { margin: 4px 0 0; font-size: 12px; color: #a8522c; }

.sent.changed { background: var(--mark); border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] .sent.changed { background: var(--mark); }
.sent.blocked { border-bottom: 2px dotted #c08a2e; }

.trace-list { margin-top: 10px; }
.trace { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-height: 320px; overflow: auto; }
.trace li { font-size: 12.5px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 9px; }
.trace b { color: var(--ink); font-weight: 600; }

.score-breakdown { display: grid; gap: 7px; }
.score-row {
  display: grid;
  grid-template-columns: 130px 1fr 34px 78px;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}
.score-row small { color: var(--muted); font-size: 11px; }
.score-bar { height: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--accent); }
.score-total { margin: 10px 0 0; font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 16px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .aside { position: static; }
  .aside-tech { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (max-width: 640px) {
  .score-row { grid-template-columns: 100px 1fr 30px; }
  .score-row small { display: none; }
  .strip-values { font-size: 18px; }
}

/* ---------------------------- paper controls --------------------------- */

.paper-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.paper-controls .target-select { min-width: 130px; }
.paper-controls .muted { flex: 1 1 200px; margin: 0 0 4px; }

.inline-select { min-width: 120px; margin: 0; }
.mini-input {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 8px;
}

.claim-out {
  margin: 10px 0 0;
  font-size: 14px;
  min-height: 22px;
  padding: 9px 11px;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
}

.paper-grid .ai-figure { margin-top: 4px; }
.paper-grid .driver-list { margin-top: 6px; }

@media (max-width: 700px) {
  .paper-controls { align-items: stretch; }
  .paper-controls .target-select { flex: 1 1 130px; }
}

.ref-list { margin: 0; padding-left: 18px; display: grid; gap: 7px; font-size: 13.5px; }
.ref-list li { line-height: 1.45; }

.intro-compact { margin-bottom: 6px; }
.intro-compact h1 { font-size: clamp(26px, 3.6vw, 36px); }
.intro-compact p { font-size: 15.5px; max-width: 78ch; }

/* ===== Rebuilt paraphraser UI (workspace, aside, review, measurements) ===== */

.summary-strip {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 8px 0 14px; box-shadow: var(--shadow);
}
.strip-item { min-width: 130px; flex: 1 1 130px; }
.strip-label { display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.strip-value { font-size: 17px; font-weight: 600; font-family: ui-sans-serif, system-ui, sans-serif; }
.strip-arrow { color: var(--muted); font-weight: 400; }
.strip-note { flex: 1 1 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.work-main { min-width: 0; display: grid; gap: 14px; }
.work-aside { position: sticky; top: 12px; display: grid; gap: 12px; min-width: 0; }
.workspace-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.aside-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow);
}
.aside-card h3 { font-size: 14px; margin-bottom: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }

.ai-head { display: flex; align-items: baseline; gap: 10px; }
.ai-head strong { font-size: 28px; font-family: ui-sans-serif, system-ui, sans-serif; }
.driver-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.driver-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 12.5px; align-items: center; }
.driver-list li > span:first-child { grid-column: 1; }
.driver-list li > small { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; }
.driver-bar { width: 64px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.driver-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.tone-bars { display: grid; gap: 8px; }
.tone-row { display: grid; gap: 3px; }
.tone-label { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); gap: 6px; }
.tone-label b { color: var(--ink); font-weight: 600; }
.tone-track { position: relative; height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
.tone-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tone-ghost { position: absolute; top: -2px; width: 2px; height: 11px; background: var(--muted); opacity: .5; border-radius: 2px; }

.overlap-line { font-size: 13px; margin-bottom: 6px; }
.overlap-meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.overlap-meter span { display: block; height: 100%; background: var(--accent); }

.mode-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-pill {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 13.5px;
}
.mode-pill[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.mode-pill[aria-pressed="true"] { color: var(--on-accent); }
.mode-blurb { margin: 4px 0 0; font-size: 13.5px; }

.tech-row { display: grid; gap: 6px; max-height: 280px; overflow: auto; padding-right: 2px; }
.tech { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.tech input { margin-top: 3px; accent-color: var(--accent); }
.tech span { display: grid; gap: 0; }
.tech b { font-weight: 600; font-size: 13px; }
.tech small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }

.field { display: grid; gap: 3px; font-size: 13px; margin: 6px 0; }
.field select, .field input[type="range"] { width: 100%; }
.field select {
  padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font: inherit; font-size: 13px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.variant {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); font-size: 12.5px; color: var(--ink);
}
.variant[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.change-badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600;
}

.output p { margin: 0 0 .6em; }
.output p:last-child { margin-bottom: 0; }
.sent.changed { background: var(--mark); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 1px; }
.sent.blocked { box-shadow: inset 0 -2px 0 #c75d2c; }

.review { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.review-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.review-tab {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); font-size: 13px; color: var(--ink);
}
.review-tab[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.review-tab[aria-selected="true"] { color: var(--on-accent); }

.sentence-list { display: grid; gap: 8px; margin-top: 8px; }
.sentence { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--paper); }
.sentence.is-changed { border-color: var(--line-strong); }
.sentence.is-blocked { border-color: #c75d2c; }
.sentence-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.sentence-number { width: 22px; height: 22px; border-radius: 999px; background: var(--line); display: inline-grid; place-items: center; font-weight: 600; font-size: 12px; }
.sentence-actions { margin-left: auto; display: flex; gap: 6px; }
.sentence-body { display: grid; gap: 4px; font-size: 13.5px; }
.sentence-body .orig { color: var(--muted); }
.sentence-body .new { color: var(--ink); }
.sentence-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sentence-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.sentence-tag.warn { background: #f8e7df; color: #8a3d17; }
.sentence-tag.warn { background: var(--warn-bg); color: var(--warn-ink); }

.trace-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; }
.rule-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rule-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line); }

.score-breakdown { display: grid; gap: 6px; font-size: 13.5px; }
.score-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: center; }
.score-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--accent); }
.score-notes { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .work-aside { position: static; }
}
@media (max-width: 760px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .summary-strip { gap: 8px 12px; }
}

/* ===== diff, history, library, consistency ===== */
.diff-view {
  margin-top: 8px; padding: 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.diff-del { background: #f6d7d2; color: #7a2318; text-decoration: line-through; border-radius: 2px; }
.diff-ins { background: #d7efe1; color: #145a36; text-decoration: none; border-radius: 2px; }
.diff-del { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.diff-ins { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

.history-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.history-item { font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); display: grid; gap: 2px; }
.history-meta { color: var(--muted); font-size: 11.5px; }
.history-preview { color: var(--ink); }

.lib-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.lib-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.lib-item > div { display: grid; gap: 1px; }
.lib-item strong { font-size: 13.5px; font-weight: 600; }

.check-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.check-mark { width: 20px; height: 20px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 20px; margin-top: 1px; }
.check-ok .check-mark { background: var(--accent-soft); color: var(--accent); }
.check-warn .check-mark { background: #f8e7df; color: #8a3d17; }
.check-note .check-mark { background: var(--line); color: var(--muted); }
.check-warn .check-mark { background: var(--warn-bg); color: var(--warn-ink); }
.check strong { display: block; font-size: 13.5px; }
.check p { margin: 2px 0 0; }

/* Optional local AI */
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox input { width: auto; margin: 0; }
.progress { height: 6px; margin-top: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }
.ai-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.ai-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.ai-row select { font-size: 12px; padding: 3px 6px; }
.ai-row .progress { flex: 1 1 120px; margin-top: 0; min-width: 90px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.compare-col { border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-width: 0; }
.compare-col h4 { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin: 0 0 4px; }
.compare-col p { font-size: 12px; line-height: 1.45; margin: 0; }
.compare-btn { margin-top: 8px; width: 100%; }
@media (max-width: 760px) { .compare { grid-template-columns: 1fr; } }

/* =========================================================================
   Shared chrome — one header, one palette, one set of surfaces.
   Appended so both pages read the same tokens and nothing above has to be
   rewritten to match.
   ========================================================================= */

:root {
  --radius-sm: 10px;
  --radius-lg: 20px;
  --ring: color-mix(in srgb, var(--accent) 32%, transparent);
  --card-raise: 0 1px 2px rgba(28, 27, 23, .045), 0 20px 44px -30px rgba(28, 27, 23, .55);
  --accent-grad: linear-gradient(135deg, color-mix(in srgb, var(--accent) 92%, #ffffff), var(--accent));
}

[data-theme="dark"] {
  --card-raise: 0 1px 2px rgba(0, 0, 0, .35), 0 22px 48px -30px rgba(0, 0, 0, .9);
}

.topbar {
  padding: 12px clamp(16px, 4vw, 40px);
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--card) 92%, transparent), color-mix(in srgb, var(--paper) 86%, transparent));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, var(--accent) 20%);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--card) 60%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 12px;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.brand-text strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17.5px;
  letter-spacing: -.012em;
}
.brand-text small { color: var(--muted); font-size: 12px; letter-spacing: .01em; }

.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.toplink {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.toplink:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 70%, transparent); border-color: var(--line); }
.toplink[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  font-weight: 600;
}

.icon-btn {
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  transition: border-color .15s, color .15s, transform .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.theme-select {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
  max-width: 9.5rem;
}
.theme-select:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------ hero ---------------------------------- */

.intro { position: relative; }
.intro .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  max-width: none;
}
.intro .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.intro h1 { letter-spacing: -.022em; }
.intro p:not(.eyebrow) { margin-top: 10px; }

/* ----------------------------- surfaces ------------------------------- */

.panel, .aside-card, .summary-strip, .review {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--card-raise);
}
.panel-head { padding-bottom: 10px; }
.panel h2, .aside-card h3 { letter-spacing: -.012em; }

.aside-card { transition: border-color .15s; }
.aside-card:hover { border-color: var(--line-strong); }

/* ------------------------------ buttons ------------------------------- */

.primary {
  background: var(--accent-grad);
  border: 1px solid color-mix(in srgb, var(--accent) 70%, #000);
  color: #f7fff9;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--accent) 80%, transparent);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.primary:active:not(:disabled) { transform: translateY(0); }
.primary { color: var(--on-accent); }

.ghost {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  padding: 9px 15px;
  transition: border-color .15s, color .15s, background .15s;
}
.ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ghost:disabled { opacity: .55; cursor: not-allowed; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------ footer -------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 55%, transparent);
  padding: 22px clamp(16px, 4vw, 40px) 30px;
  color: var(--muted);
}
.foot p { margin: 0; font-size: 13px; }
.foot a { color: var(--accent); text-underline-offset: 2px; }

/* ---------------------------- small screens --------------------------- */

@media (max-width: 760px) {
  .brand-text small { display: none; }
  .topbar { gap: 8px; }
  .toplink { padding: 7px 11px; font-size: 13px; }
  .intro .eyebrow { font-size: 10.5px; letter-spacing: .1em; }
}

/* ----------------------------- accessibility -------------------------- */

/* The skip link is keyboard-only: hidden until it takes focus. */
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #f7fff9;
  text-decoration: none;
  font-size: 14px;
  transition: top .15s ease;
}
.skip:focus { top: 12px; }
.skip:focus-visible { outline: 3px solid var(--ring); }

/* ------------------------------- header ------------------------------- */

.topbar { flex-wrap: wrap; row-gap: 8px; }
.brand-text strong { white-space: nowrap; }

@media (max-width: 620px) {
  .brand-logo { width: 34px; height: 34px; border-radius: 10px; }
  .brand-text strong { font-size: 16px; }
  .topnav { width: 100%; justify-content: space-between; }
  .icon-btn { padding: 6px 12px; }
}

/* =========================================================================
   Layout rhythm — spacing, panel heads and the summary strip, so the page
   reads as one system rather than a stack of separate attempts.
   ========================================================================= */

.modes { margin: 22px 0 16px; }
.workspace-grid { gap: 18px; }
.editor-panel, .output-panel { padding: 16px 18px 18px; }

.panel-head {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.panel-head h2 { font-size: 19px; }
.panel-head .actions { display: flex; flex-wrap: nowrap; gap: 6px; }
.panel-head .actions .ghost { padding: 7px 12px; font-size: 13px; white-space: nowrap; }

.review { margin-top: 20px; padding: 16px 18px 18px; }

.work-aside { gap: 14px; }
.aside-card { padding: 14px 15px; }
.aside-card h3 {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.summary-strip {
  padding: 14px 18px;
  gap: 14px 26px;
  border-radius: var(--radius-lg);
}
.strip-item { min-width: 150px; }
.strip-value { font-size: 19px; letter-spacing: -.01em; }
.strip-label { font-size: 11px; letter-spacing: .07em; }
.strip-note { flex-basis: 100%; margin: 2px 0 0; }

@media (max-width: 980px) {
  .editor-panel, .output-panel { padding: 14px; }
  .panel-head .actions { flex-wrap: wrap; justify-content: flex-end; }
}

/* Keep the hero line on one line on phones instead of ending a line on a dot. */
.eyebrow { text-wrap: balance; }
@media (max-width: 640px) { .eyebrow { font-size: 10.5px; letter-spacing: .12em; } }

/* =========================================================================
   Journal voice — editorial audit page
   ========================================================================= */

.voice-h {
  font-size: 13px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.voice-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 420px; overflow-y: auto; }

.finding { border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); padding: 2px 0 2px 12px; }
.finding-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.finding-match {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--mark);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 5px;
}
.finding-group {
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.finding-say { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.finding-fix { margin: 4px 0 0; font-size: 13.5px; }
.ok-line { color: var(--accent); font-size: 14px; }

.rhythm {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 150px;
  padding: 8px 2px 0;
  border-bottom: 1px solid var(--line);
}
.rhythm-bar {
  flex: 1 1 auto;
  min-width: 5px;
  max-width: 26px;
  background: color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  justify-content: center;
}
.rhythm-bar.flat { background: var(--mark-line); }
.rhythm-count {
  position: absolute;
  bottom: -18px;
  font-size: 10px;
  color: var(--muted);
}
.rhythm { margin-bottom: 20px; }

.big-count {
  font-family: var(--serif, Georgia, serif);
  font-size: 44px;
  line-height: 1;
  margin: 4px 0 6px;
  color: var(--accent);
}

#voicePreserve li { display: flex; justify-content: space-between; gap: 10px; }
.preserve-label { color: var(--muted); }
.preserve-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.preserve-value.lost { color: #b4452f; }

.metric-cell { display: grid; gap: 2px; }
.metric-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.rulebook { margin-top: 40px; }
.rulebook h2 { font-size: 24px; margin-bottom: 4px; }
.rulebook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

#voiceOut { min-height: 120px; max-height: 40vh; border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); padding: 14px; background: var(--paper); }
#voiceOutWrap { margin-top: 18px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }

@media (max-width: 900px) {
  .voice-split { grid-template-columns: 1fr; }
  .rhythm { height: 110px; }
}

/* -------------------------- Journal voice: fixes ------------------------ */

.input-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

.panel-head h2, .panel-head h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { white-space: nowrap; }

@media (max-width: 640px) {
  /* Three page links plus the theme button no longer fit on one line. */
  .topnav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .toplink, .icon-btn { text-align: center; padding: 8px 10px; }
}

@media (max-width: 640px) {
  /* Title and actions stack: the title keeps its badge, the actions form one row. */
  .panel-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .panel-head .actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  /* Even 2 × 2 grid of pills: every cell shows the same outline. */
  .toplink { border-color: var(--line); background: color-mix(in srgb, var(--card) 55%, transparent); }
  .topnav .icon-btn { width: 100%; }
}

.voice-model { display: grid; gap: 9px; }
.voice-model .tech { display: flex; gap: 8px; align-items: flex-start; }
.voice-model select { width: 100%; }
.voice-model .ghost { width: 100%; }
.model-log { margin-bottom: 16px; max-height: 220px; }
.model-log .finding-fix.rejected { color: #b4452f; }

.voice-model select {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}
.voice-model select:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.voice-field { display: grid; gap: 4px; }
.voice-field > span {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.voice-field select { width: 100%; }

.guide-link { display: inline-block; margin-top: -2px; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.guide-link:hover { color: var(--accent); }
.section-guide .aside-card { align-content: start; }
.guide-target { font-size: 13px; font-weight: 600; margin: 2px 0 6px; }
.section-guide details { margin-top: 8px; }
.section-guide summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.section-guide details p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }


/* ------------------------- word limits and counters ---------------------- */

.limit-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--muted, #6b675f);
}

.limit-hint[data-tone="over"] {
  color: #a33a2b;
  font-weight: 600;
}

.limit-warn {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid #a33a2b;
  border-radius: 0 6px 6px 0;
  background: rgba(163, 58, 43, 0.07);
  color: #8d3125;
  font-size: 0.82rem;
  line-height: 1.45;
}

.limit-warn[hidden] {
  display: none;
}


/* ======================= studio layout (Paraphraser) ===================== */

/* Four palettes. Every rule below reads these variables and nothing else, so
   a theme switch repaints the whole page in one attribute change. */
html[data-theme="slate"] {
  color-scheme: dark;
  --st-bg: #090d16;
  --st-card: #111827;
  --st-raise: #0b1220;
  --st-line: #1f2937;
  --st-line-soft: rgba(148, 163, 184, 0.16);
  --st-text: #f8fafc;
  --st-soft: #cbd5e1;
  --st-dim: #94a3b8;
  --st-faint: #64748b;
  --st-accent: #6366f1;
  --st-accent-hover: #7c7ff5;
  --st-accent-soft: rgba(99, 102, 241, 0.16);
  --st-on-accent: #ffffff;
  --st-scrim: rgba(4, 8, 18, 0.78);
  --st-danger: #fca5a5;
  --st-danger-bg: rgba(248, 113, 113, 0.1);
  --st-danger-line: #f87171;
  --st-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.8);
}

html[data-theme="paper"] {
  color-scheme: light;
  --st-bg: #f8fafc;
  --st-card: #ffffff;
  --st-raise: #f1f5f9;
  --st-line: #e2e8f0;
  --st-line-soft: rgba(15, 23, 42, 0.1);
  --st-text: #0f172a;
  --st-soft: #334155;
  --st-dim: #475569;
  --st-faint: #64748b;
  --st-accent: #4f46e5;
  --st-accent-hover: #4338ca;
  --st-accent-soft: rgba(79, 70, 229, 0.1);
  --st-on-accent: #ffffff;
  --st-scrim: rgba(15, 23, 42, 0.42);
  --st-danger: #b91c1c;
  --st-danger-bg: rgba(185, 28, 28, 0.07);
  --st-danger-line: #dc2626;
  --st-shadow: 0 24px 50px -28px rgba(15, 23, 42, 0.35);
}

html[data-theme="aqua"] {
  color-scheme: dark;
  --st-bg: #031926;
  --st-card: #072d42;
  --st-raise: #052433;
  --st-line: #0d3f57;
  --st-line-soft: rgba(224, 251, 252, 0.14);
  --st-text: #e0fbfc;
  --st-soft: #b9ecf0;
  --st-dim: #8bc4d2;
  --st-faint: #6399a8;
  --st-accent: #3da9fc;
  --st-accent-hover: #63bcff;
  --st-accent-soft: rgba(61, 169, 252, 0.18);
  --st-on-accent: #04202e;
  --st-scrim: rgba(2, 14, 21, 0.78);
  --st-danger: #ffb4a2;
  --st-danger-bg: rgba(255, 138, 120, 0.12);
  --st-danger-line: #ff8a78;
  --st-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.8);
}

html[data-theme="green"] {
  color-scheme: dark;
  --st-bg: #0d1f12;
  --st-card: #132a18;
  --st-raise: #0f2415;
  --st-line: #204a2a;
  --st-line-soft: rgba(232, 245, 233, 0.13);
  --st-text: #e8f5e9;
  --st-soft: #c6e2c8;
  --st-dim: #9dc4a1;
  --st-faint: #6f9a74;
  --st-accent: #4caf50;
  --st-accent-hover: #66bb6a;
  --st-accent-soft: rgba(76, 175, 80, 0.2);
  --st-on-accent: #06210c;
  --st-scrim: rgba(4, 12, 6, 0.78);
  --st-danger: #ffb4a2;
  --st-danger-bg: rgba(255, 138, 120, 0.12);
  --st-danger-line: #ff8a78;
  --st-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.8);
}

body.studio {
  background: var(--st-bg);
  color: var(--st-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* The modal still uses the older shared components, so they are pointed at
     the studio palette too instead of keeping their light editorial colours. */
  --paper: var(--st-bg);
  --card: var(--st-card);
  --ink: var(--st-text);
  --muted: var(--st-dim);
  --line: var(--st-line);
  --line-strong: color-mix(in srgb, var(--st-line) 65%, var(--st-text));
  --accent: var(--st-accent);
  --accent-hover: var(--st-accent-hover);
  --accent-soft: var(--st-accent-soft);
  --mark: var(--st-accent-soft);
  --mark-line: var(--st-accent);
  --shadow: var(--st-shadow);
  --card-raise: 0 1px 2px rgba(0, 0, 0, 0.18);
}

body.studio .skip {
  background: var(--st-accent);
  color: var(--st-on-accent);
}

.st-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  height: 3.5rem;
  border-bottom: 1px solid var(--st-line-soft);
  background: color-mix(in srgb, var(--st-bg) 82%, transparent);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.st-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--st-text);
}

.st-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.55rem;
  background: var(--st-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--st-on-accent);
  letter-spacing: 0.02em;
}

.st-name {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.st-nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.st-link,
.st-specs {
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--st-dim);
  cursor: pointer;
  text-decoration: none;
  padding: 0.25rem 0;
}

.st-link:hover,
.st-specs:hover { color: var(--st-text); }

.st-link[aria-current="page"] { color: var(--st-accent); }

.st-specs { color: color-mix(in srgb, var(--st-accent) 78%, var(--st-text)); }
.st-specs-short { display: none; }

.st-theme {
  font: inherit;
  font-size: 0.72rem;
  color: var(--st-soft);
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  border-radius: 0.45rem;
  padding: 0.22rem 0.35rem;
  cursor: pointer;
  max-width: 8.5rem;
}

.st-theme:hover { border-color: var(--st-accent); color: var(--st-text); }

.st-theme:focus-visible,
.st-select:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 1px; }

.st-main {
  flex: 1;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.st-modes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.st-pills {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: var(--st-card);
  border: 1px solid var(--st-line);
}

.st-pill {
  border: 0;
  background: none;
  color: var(--st-dim);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 0.55rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.st-pill:hover { color: var(--st-text); }

.st-pill.is-active {
  background: var(--st-accent);
  color: var(--st-on-accent);
  font-weight: 600;
}

.st-hint {
  font-size: 0.75rem;
  color: var(--st-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.st-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-height: 26rem;
}

@media (min-width: 900px) {
  .st-split { grid-template-columns: 1fr 1fr; }
}

.st-pane {
  display: flex;
  flex-direction: column;
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: 1rem;
  padding: 1rem;
}

.st-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--st-line-soft);
}

.st-pane-head h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--st-dim);
}

.st-tools { display: flex; gap: 0.25rem; }

.st-tool {
  background: none;
  border: 0;
  color: var(--st-faint);
  font: inherit;
  font-size: 0.72rem;
  padding: 0.25rem 0.4rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.st-tool:hover { color: var(--st-text); background: var(--st-raise); }

.st-copy {
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  color: var(--st-text);
  padding: 0.3rem 0.7rem;
}

/* ---- section picker above the source box ---- */

.st-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0 0;
  min-width: 0;
}

.st-section-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st-faint);
  flex: none;
}

.st-select {
  font: inherit;
  font-size: 0.74rem;
  color: var(--st-soft);
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  border-radius: 0.45rem;
  padding: 0.22rem 0.35rem;
  cursor: pointer;
  max-width: 12rem;
}

.st-section-tip {
  font-size: 0.7rem;
  color: var(--st-faint);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.studio #input {
  flex: 1;
  min-height: 15rem;
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  color: var(--st-text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.7;
  padding: 0.7rem 0;
}

body.studio #input::placeholder { color: var(--st-faint); }

.st-output {
  flex: 1;
  min-height: 15rem;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--st-soft);
  padding: 0.7rem 0;
  background: transparent;
  border: 0;
}

body.studio .st-output .empty { color: var(--st-faint); font-style: italic; }

.st-foot {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--st-line-soft);
  flex-wrap: wrap;
  row-gap: 0.25rem;
}

.st-count,
.st-limit {
  font-size: 0.72rem;
  color: var(--st-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.st-limit { margin-left: auto; }

.st-limit[data-tone="over"] { color: var(--st-danger); font-weight: 600; }

.st-lock {
  font-size: 0.68rem;
  color: var(--st-dim);
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: var(--st-accent-soft);
  cursor: help;
  white-space: nowrap;
}

.st-lock[hidden] { display: none; }

.st-summary { font-size: 0.72rem; color: var(--st-faint); }

body.studio .limit-warn {
  border-left-color: var(--st-danger-line);
  background: var(--st-danger-bg);
  color: var(--st-danger);
}

.st-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.st-run {
  background: var(--st-accent);
  color: var(--st-on-accent);
  border: 0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.85rem 2rem;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow: 0 10px 25px -12px color-mix(in srgb, var(--st-accent) 80%, transparent);
  transition: background 0.15s ease;
}

.st-run:hover { background: var(--st-accent-hover); }
.st-run:disabled {
  background: var(--st-raise);
  color: var(--st-faint);
  box-shadow: none;
  cursor: not-allowed;
}

.st-status {
  flex-basis: 100%;
  text-align: center;
  margin: 0;
  font-size: 0.78rem;
  color: var(--st-faint);
  min-height: 1.2em;
}

.st-status[data-tone="warn"] { color: var(--st-danger); }

.st-footer {
  padding: 1rem 1.5rem 1.5rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--st-faint);
}

.st-footer p { margin: 0.15rem 0; }
.st-footer a { color: var(--st-dim); }

.st-hidden-controls {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- methodology modal ---- */

.st-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.st-modal[hidden] { display: none; }

.st-modal-bg {
  position: absolute;
  inset: 0;
  background: var(--st-scrim);
  backdrop-filter: blur(4px);
}

.st-modal-card {
  position: relative;
  width: min(56rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: 1rem;
  box-shadow: var(--st-shadow);
  color: var(--st-soft);
}

.st-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--st-line);
}

.st-modal-head h2 { margin: 0 0 0.2rem; font-size: 1rem; color: var(--st-text); }

.st-modal-sub { margin: 0; font-size: 0.78rem; color: var(--st-faint); }

.st-close {
  background: none;
  border: 0;
  color: var(--st-faint);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.st-close:hover { color: var(--st-text); }

.st-modal-body {
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.st-spec h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--st-accent) 82%, var(--st-text));
}

.st-spec p { margin: 0 0 0.6rem; font-size: 0.82rem; line-height: 1.65; color: var(--st-dim); }

.st-limits { color: var(--st-faint); font-size: 0.78rem; }

.st-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }

@media (min-width: 720px) { .st-grid { grid-template-columns: 1fr 1fr; } }

body.studio .st-modal .aside-card {
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  color: var(--st-soft);
}

body.studio .st-modal .aside-card h3 { color: var(--st-text); }
body.studio .st-modal .muted { color: var(--st-faint); }
body.studio .st-modal .field { color: var(--st-dim); }

body.studio .st-modal select,
body.studio .st-modal textarea,
body.studio .st-modal input { color: var(--st-text); }

body.studio .st-modal .review { background: transparent; border: 0; padding: 0; }
body.studio .st-modal .summary-strip { border-radius: 0.75rem; background: var(--st-card); }
body.studio .st-modal .mode-row button { color: var(--st-dim); }

body.studio .st-modal .mode-pill[aria-pressed="true"],
body.studio .st-modal .review-tab[aria-selected="true"] { color: var(--st-on-accent); }

.st-mode-holder { margin-bottom: 0.4rem; }

/* Header and footers at phone width: keep the engine pills, the section
   picker and the specs link reachable without a broken wrap. */
@media (max-width: 780px) {
  .st-bar { padding: 0 0.85rem; gap: 0.5rem; flex-wrap: nowrap; }
  .st-nav { gap: 0.5rem; flex-wrap: nowrap; }
  .st-nav .st-link { display: none; }
  .st-theme { font-size: 0.68rem; padding: 0.2rem 0.25rem; max-width: 6.6rem; }
  .st-specs {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--st-line);
    border-radius: 0.5rem;
    white-space: nowrap;
  }
  .st-specs-long { display: none; }
  .st-specs-short { display: inline; }
  .st-name { font-size: 0.82rem; }
  .st-pills { width: 100%; justify-content: space-between; }
  .st-pill { padding: 0.45rem 0.5rem; font-size: 0.7rem; flex: 1; }
  .st-hint { width: 100%; }
  .st-section-tip { display: none; }
  .st-select { max-width: 11rem; }
}

/* The label above a textarea is for screen readers only. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The output stays clean: accepted sentences are not highlighted in the
   studio layout, since the change badge already reports the edit count. */
body.studio .st-output .sent,
body.studio .st-output .sent.changed,
body.studio .st-output .sent.kept {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

/* ---- workspace panels (mode, locked terms, before/after and below) ---- */

.st-panel {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: 1rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.st-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.st-panel-title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--st-dim);
}

.st-panel-sub { margin: 0; font-size: 0.72rem; color: var(--st-faint); }
.st-panel-note { margin: 0; font-size: 0.76rem; line-height: 1.55; color: var(--st-dim); }

/* ---- humanizer engine panel ---- */

.humanizer-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.humanizer-controls .option-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 20rem;
}

.humanizer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--st-line);
  border-radius: 0.6rem;
  background: var(--st-raise);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.humanizer-option:hover { border-color: var(--st-accent); }

.humanizer-option:has(input:checked) {
  border-color: var(--st-accent);
  background: var(--st-card);
}

.humanizer-option input {
  margin: 0.15rem 0 0;
  accent-color: var(--st-accent);
  flex: none;
}

.humanizer-copy { display: flex; flex-direction: column; gap: 0.1rem; }
.humanizer-copy strong { font-size: 0.8rem; font-weight: 600; color: var(--st-text); }
.humanizer-copy small { font-size: 0.72rem; line-height: 1.45; color: var(--st-faint); }
/* Pro is honest about what happens when the server has no AI step. */
.humanizer-copy .humanizer-pro-when { font-style: italic; }

/* Fast strength: three choices on one line, Medium selected by default. The row
   is hidden while Pro is the selected engine, because it only affects Fast. */
.humanizer-controls .humanizer-strength {
  flex: 1 1 100%;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.4rem;
}

.humanizer-strength[hidden] { display: none; }

.humanizer-strength-label {
  flex: 1 1 100%;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st-dim);
}

.humanizer-strength .humanizer-option { flex: 1 1 9rem; padding: 0.4rem 0.6rem; }

.humanizer-act {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  flex: 0 1 16rem;
}

.humanizer-act .st-run { width: 100%; }
.humanizer-act .st-hint { margin: 0; line-height: 1.5; }
.humanizer-act .st-hint[data-tone="warn"] { color: var(--st-danger); }
.humanizer-act .st-hint[data-tone="ok"] { color: var(--st-accent); }

.st-top-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .st-top-grid { grid-template-columns: 1fr 1fr; } }

body.studio #glossary {
  width: 100%;
  min-height: 4.2rem;
  resize: vertical;
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  border-radius: 0.6rem;
  color: var(--st-text);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 0.5rem 0.6rem;
}

body.studio .st-panel .mode-row { gap: 0.35rem; }
body.studio .st-panel .mode-pill {
  font-size: 0.74rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  color: var(--st-soft);
}
body.studio .st-panel .mode-pill:hover { border-color: var(--st-accent); color: var(--st-text); }
body.studio .st-panel .mode-pill[aria-pressed="true"] {
  background: var(--st-accent);
  border-color: var(--st-accent);
  color: var(--st-on-accent);
}

body.studio .st-panel .summary-strip {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
}
body.studio .st-panel .strip-label { color: var(--st-faint); }
body.studio .st-panel .strip-value { color: var(--st-text); }
body.studio .st-panel .strip-note { color: var(--st-faint); }

body.studio .st-panel .review {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

body.studio .st-panel .aside-card {
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  border-radius: 0.75rem;
  color: var(--st-soft);
  box-shadow: none;
}
body.studio .st-panel .aside-card h3 { color: var(--st-text); }
body.studio .st-panel .muted { color: var(--st-faint); }
body.studio .st-panel .field { color: var(--st-dim); }
body.studio .st-panel input { accent-color: var(--st-accent); }
body.studio .st-panel select {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  color: var(--st-text);
  border-radius: 0.45rem;
  padding: 0.3rem 0.4rem;
  font: inherit;
  font-size: 0.78rem;
}
body.studio .st-panel .ghost {
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  color: var(--st-soft);
  border-radius: 0.5rem;
}
body.studio .st-panel .ghost:hover { border-color: var(--st-accent); color: var(--st-text); }
body.studio .st-panel .review-tab {
  background: var(--st-raise);
  border: 1px solid var(--st-line);
  color: var(--st-dim);
  border-radius: 999px;
}
body.studio .st-panel .review-tab[aria-selected="true"] {
  background: var(--st-accent);
  border-color: var(--st-accent);
  color: var(--st-on-accent);
}
body.studio .st-panel .history-list { color: var(--st-soft); }
body.studio .st-panel .compare-col { background: var(--st-raise); border-color: var(--st-line); }

/* ------------------------------- home page ------------------------------ */

.home-main { gap: 1.25rem; }

.home-hero {
  padding: 2rem 0 0.25rem;
  max-width: 46rem;
}

.home-eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}

.home-hero h1 {
  margin: 0 0 0.7rem;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: -0.02em;
  color: var(--st-text);
}

.home-lede {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--st-dim);
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 900px) {
  .home-grid { grid-template-columns: repeat(3, 1fr); }
}

.home-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.25rem;
  border-radius: 1rem;
  background: var(--st-card);
  border: 1px solid var(--st-line);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.home-card:hover,
.home-card:focus-visible {
  border-color: var(--st-accent);
  transform: translateY(-2px);
  outline: none;
}

.home-badge {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--st-accent);
}

.home-card h2 {
  margin: 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--st-text);
}

.home-card p {
  margin: 0;
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--st-dim);
}

.home-go {
  font-size: 0.78rem;
  color: var(--st-soft);
}

.home-card:hover .home-go { color: var(--st-accent); }

.home-note {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--st-faint);
}

/* The two editorial pages keep their page links reachable at phone width. */
@media (max-width: 780px) {
  .st-bar-pages {
    height: auto;
    flex-wrap: wrap;
    padding: 0.55rem 0.85rem;
    row-gap: 0.45rem;
  }
  .st-bar-pages .st-nav { flex-wrap: wrap; row-gap: 0.35rem; gap: 0.55rem; }
  .st-bar-pages .st-nav .st-link { display: inline; font-size: 0.72rem; }
}

/* ---- journal voice: rulebook kept out of the way ---- */

.voice-extra {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  color: var(--muted);
}

.voice-extra > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
  list-style: none;
}

.voice-extra > summary::-webkit-details-marker { display: none; }

.voice-extra > summary::before {
  content: "+";
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
}

.voice-extra[open] > summary::before { content: "−"; }

.voice-extra-note {
  font-size: 0.75rem;
  color: var(--muted);
}

.voice-extra-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== Inline revisions: coloured changes and the per-sentence card ===== */

body.studio .st-pane { position: relative; }

body.studio .st-output p { white-space: pre-wrap; margin: 0; }

.rev-sent {
  border-radius: 3px;
  cursor: default;
  outline: none;
}
.rev-sent:hover,
.rev-sent:focus-visible {
  background: color-mix(in srgb, var(--st-accent) 7%, transparent);
}

/* A sentence Fast left alone for a reason worth pointing at. The pill is a
   button so the explanation is reachable without a mouse; the explanation is a
   sibling, never part of the sentence, and never part of the copied text. */
.rev-note-wrap {
  position: relative;
  display: inline-block;
  margin-left: .2rem;
  vertical-align: .08em;
}
.rev-note {
  display: inline-block;
  margin: 0;
  padding: 0 .35rem;
  border: 1px solid color-mix(in srgb, var(--st-faint) 45%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--st-faint);
  font: inherit;
  font-size: .62rem;
  letter-spacing: .04em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.rev-note:hover { color: var(--st-text); border-color: var(--st-faint); }
.rev-note:focus-visible {
  outline: 2px solid var(--st-accent);
  outline-offset: 2px;
}
.rev-note[aria-expanded="true"] {
  color: var(--st-text);
  border-color: var(--st-faint);
}
.rev-note-text {
  position: absolute;
  bottom: calc(100% + .4rem);
  left: 0;
  z-index: 6;
  width: max-content;
  max-width: min(17rem, 72vw);
  padding: .45rem .6rem;
  border: 1px solid var(--st-line);
  border-radius: 8px;
  background: var(--st-card);
  box-shadow: var(--st-shadow);
  color: var(--st-text);
  font-size: .72rem;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  user-select: none;
}
.rev-note-text.is-below {
  bottom: auto;
  top: calc(100% + .4rem);
}
.rev-note-text[hidden] { display: none; }
.rev-card-note {
  margin: 0 0 .4rem;
  color: var(--st-faint);
  font-size: .72rem;
  line-height: 1.45;
}

.rev-hunk {
  color: inherit;
  background: rgba(240, 180, 60, .22);
  border-bottom: 1px solid rgba(240, 180, 60, .65);
  border-radius: 3px;
  padding: 0 1px;
  cursor: pointer;
}
.rev-hunk.k2 { background: rgba(90, 160, 255, .2); border-bottom-color: rgba(90, 160, 255, .65); }
.rev-hunk.k3 { background: rgba(170, 140, 255, .22); border-bottom-color: rgba(170, 140, 255, .65); }
.rev-hunk.k4 { background: rgba(80, 200, 150, .2); border-bottom-color: rgba(80, 200, 150, .65); }
.rev-hunk:hover { filter: brightness(1.15); }

.rev-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  padding-top: .5rem;
  font-size: .68rem;
  color: var(--st-faint);
}
.rev-key {
  border-radius: 999px;
  padding: .1rem .45rem;
  border: 1px solid transparent;
}
.studio .rev-key.k1 { background: rgba(240, 180, 60, .22); border-color: rgba(240, 180, 60, .5); }
.studio .rev-key.k2 { background: rgba(90, 160, 255, .2); border-color: rgba(90, 160, 255, .5); }
.studio .rev-key.k3 { background: rgba(170, 140, 255, .22); border-color: rgba(170, 140, 255, .5); }
.studio .rev-key.k4 { background: rgba(80, 200, 150, .2); border-color: rgba(80, 200, 150, .5); }
.rev-legend-note { margin-left: auto; text-align: right; max-width: 26rem; }

.rev-card {
  position: absolute;
  z-index: 40;
  max-height: 42vh;
  overflow-y: auto;
  padding: .65rem .7rem .7rem;
  border-radius: .75rem;
  border: 1px solid var(--st-line);
  background: var(--st-card);
  box-shadow: 0 12px 34px -16px rgba(0, 0, 0, .55);
}
.rev-card[hidden] { display: none; }
.rev-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
}
.rev-card-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .68rem;
  color: var(--st-faint);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rev-card-why {
  font-size: .66rem;
  padding: .1rem .4rem;
  border-radius: 999px;
  border: 1px solid var(--st-line);
  color: var(--st-dim);
}
.rev-card-why.k1 { border-color: rgba(240, 180, 60, .55); }
.rev-card-why.k2 { border-color: rgba(90, 160, 255, .55); }
.rev-card-why.k3 { border-color: rgba(170, 140, 255, .55); }
.rev-card-why.k4 { border-color: rgba(80, 200, 150, .55); }
.rev-card-hint { margin: 0 0 .45rem; font-size: .68rem; color: var(--st-faint); }
.rev-options { display: grid; gap: .35rem; }
.rev-option {
  display: grid;
  gap: .15rem;
  text-align: left;
  width: 100%;
  padding: .45rem .55rem;
  border-radius: .5rem;
  border: 1px solid var(--st-line);
  background: var(--st-bg);
  color: var(--st-text);
  font: inherit;
  font-size: .78rem;
  line-height: 1.45;
  cursor: pointer;
}
.rev-option small {
  font-size: .62rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--st-faint);
}
.rev-option:hover { border-color: var(--st-accent); }
.rev-option.is-original { border-style: dashed; }

@media (max-width: 700px) {
  .rev-legend-note { margin-left: 0; text-align: left; max-width: none; }
  .rev-card { max-height: 55vh; }
}

/* The writer's own swaps, under the humanizer buttons. */
body.studio .swaps {
  display: grid;
  gap: .35rem;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid var(--st-line-soft);
}
.swaps-label {
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--st-dim);
  display: flex;
  align-items: center;
  gap: .45rem;
}
.swaps-label span {
  text-transform: none;
  letter-spacing: 0;
  font-size: .66rem;
  color: var(--st-faint);
}
body.studio .swaps textarea {
  width: 100%;
  min-height: 3.2rem;
  resize: vertical;
  padding: .5rem .6rem;
  border-radius: .55rem;
  border: 1px solid var(--st-line);
  background: var(--st-raise);
  color: var(--st-text);
  font: inherit;
  font-size: .78rem;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
body.studio .swaps textarea::placeholder { color: var(--st-faint); }
body.studio .swaps textarea:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 1px; }

/* Swap sets: a picker and three small actions above the list. */
.swaps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.swaps-tools {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}
body.studio .swaps-tools .st-select {
  max-width: 9.5rem;
  font-size: .72rem;
  padding: .22rem .3rem;
}
body.studio .swaps-tools .st-tool { padding: .22rem .45rem; font-size: .7rem; }

/* The Pro daily count under the humanize button. */
.st-hint[data-tone="over"] { color: var(--st-danger, #fca5a5); }

/* ------------------------------ consent -------------------------------- */

/* The analytics banner is built by analytics.js and sits above every page,
   in the same tokens as the cards so it follows the chosen palette. */
.ps-consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  background: var(--card, #fffdf7);
  color: var(--ink, #1c1b17);
  border: 1px solid var(--line, #e3ddcc);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 12px 30px -18px rgba(28, 27, 23, .4));
  font-size: 14px;
  line-height: 1.5;
}
.ps-consent h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .01em;
}
.ps-consent p { margin: 0; color: var(--muted, #6c6759); }
.ps-consent a { color: var(--accent, #17624a); text-underline-offset: 2px; }
.ps-consent-note { color: var(--bad, #b91c1c) !important; }
.ps-consent-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}
.ps-consent button {
  font: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong, #d3cbb4);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.ps-consent button:hover { border-color: var(--accent, #17624a); }
.ps-consent button:focus-visible { outline: 2px solid var(--accent, #17624a); outline-offset: 2px; }
.ps-consent button[data-consent="granted"] {
  background: var(--accent, #17624a);
  border-color: var(--accent, #17624a);
  color: var(--on-accent, #fffdf8);
}
.ps-consent button[data-consent="granted"]:hover { background: var(--accent-hover, #114b39); }

/* The footer control that reopens the choice. */
.ps-link-btn {
  font: inherit;
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent, #17624a);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

@media (max-width: 540px) {
  .ps-consent { left: 10px; right: 10px; bottom: 10px; padding: 14px; font-size: 13.5px; }
  .ps-consent-actions button { flex: 1 1 100%; }
}

/* ------------------------------ privacy -------------------------------- */

.privacy-body { display: grid; gap: 1.4rem; max-width: 68ch; }
.privacy-body h2 {
  margin: 0 0 .35rem;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: .01em;
}
.privacy-body p { margin: 0 0 .6rem; line-height: 1.65; color: var(--ink, #1c1b17); }
.privacy-body p:last-child { margin-bottom: 0; }
.privacy-body code {
  font-size: .85em;
  padding: .08em .35em;
  border-radius: 4px;
  background: var(--accent-soft, #e4efe7);
}
