/* 論文整理 — ink on paper; one working surface, no fine print. */
:root {
  --bg: #f4f2ec; --surface: #fff; --surface-2: #faf9f6; --sunken: #efece5;
  --ink: #1b1e22; --ink-2: #3f454d; --muted: #646a73;
  --line: #e3e0d8; --line-2: #cfcbc1;
  --primary: #1b1e22; --primary-ink: #fff; --primary-hover: #343a41;
  --accent: #b3261e; --accent-soft: #f8e8e6;
  --ok: #1d6b43; --ok-soft: #e5f1e9; --warn: #855000; --warn-soft: #fbf0d8; --danger: #b3261e; --danger-soft: #fbeae8;
  --focus: #2563eb; --shadow: 0 1px 2px rgb(30 25 15 / .05), 0 8px 24px rgb(30 25 15 / .05);
  --paper: #fffefb; --paper-ink: #1d1f22; --paper-muted: #6b6f75; --paper-line: #dedad0; --paper-hover: #f7f5ef; --ok-print: #1d6b43;
  --radius: 14px; --radius-sm: 9px;
  --grid: rgb(30 25 15 / .045); --closing-bg: #1b1e22; --closing-ink: #fff; --lift: 0 18px 48px rgb(30 25 15 / .08);
  --sans: -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --serif: "Noto Serif TC", "Source Han Serif TC", "Songti TC", "PMingLiU", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416; --surface: #1a1d20; --surface-2: #1f2226; --sunken: #16181b;
    --ink: #ecebe6; --ink-2: #c8cac7; --muted: #9ca2a9; --line: #2c3035; --line-2: #3c4147;
    --primary: #ecebe6; --primary-ink: #141618; --primary-hover: #d4d3ce; --accent: #f07167; --accent-soft: #3a201e;
    --ok: #74cf9c; --ok-soft: #173326; --warn: #e8b552; --warn-soft: #382c12; --danger: #f07167; --danger-soft: #3a201e;
    --focus: #7aa7ff; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
    --grid: rgb(255 255 255 / .035); --closing-bg: #0b0c0e; --closing-ink: #ecebe6; --lift: 0 18px 48px rgb(0 0 0 / .35);
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --surface: #1a1d20; --surface-2: #1f2226; --sunken: #16181b;
  --ink: #ecebe6; --ink-2: #c8cac7; --muted: #9ca2a9; --line: #2c3035; --line-2: #3c4147;
  --primary: #ecebe6; --primary-ink: #141618; --primary-hover: #d4d3ce; --accent: #f07167; --accent-soft: #3a201e;
  --ok: #74cf9c; --ok-soft: #173326; --warn: #e8b552; --warn-soft: #382c12; --danger: #f07167; --danger-soft: #3a201e;
  --focus: #7aa7ff; --shadow: 0 1px 2px rgb(0 0 0 / .3); color-scheme: dark;
  --grid: rgb(255 255 255 / .035); --closing-bg: #0b0c0e; --closing-ink: #ecebe6; --lift: 0 18px 48px rgb(0 0 0 / .35);
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--sans); }
main { flex: 1; }
h1, h2, h3, p, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button, select, label, summary { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), select:not(:disabled), summary, input[type=checkbox], input[type=radio] { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); }
.skip-link:focus { top: 12px; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Buttons and controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; line-height: 1.3; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn.primary:disabled { background: var(--line-2); color: var(--muted); cursor: not-allowed; }
.btn.ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn.link { min-height: 36px; padding: 6px 8px; background: none; color: var(--ink-2); font-weight: 500; }
.btn.link:hover { color: var(--ink); background: var(--sunken); }
.btn.wide { width: 100%; }
.btn .icon { width: 18px; height: 18px; }

select, input[type=search] { min-height: 44px; width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); font-size: 15px; }
select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; text-overflow: ellipsis; }
select:hover, input[type=search]:hover { border-color: var(--ink-2); }
select:disabled { opacity: .55; }
input[type=file] { width: 100%; font-size: 15px; }
input[type=file]::file-selector-button { margin-right: 12px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2); font: inherit; font-size: 14px; cursor: pointer; }
input[type=checkbox] { appearance: none; display: inline-grid; place-content: center; flex-shrink: 0; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--line-2); border-radius: 5px; background: var(--surface); transition: background-color .12s, border-color .12s; }
input[type=checkbox]::after { content: ""; width: 10px; height: 6px; border: solid var(--primary-ink); border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); opacity: 0; }
input[type=checkbox]:checked { background: var(--primary); border-color: var(--primary); }
input[type=checkbox]:checked::after { opacity: 1; }

.field { display: grid; gap: 6px; font-size: 15px; }
.field > span:first-child { color: var(--ink-2); font-weight: 500; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; }

.seg { display: flex; padding: 3px; border-radius: 11px; background: var(--sunken); gap: 2px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 10px; border-radius: 8px; font-size: 15px; color: var(--ink-2); text-align: center; line-height: 1.3; white-space: nowrap; transition: background-color .15s, color .15s; }
.seg input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px var(--line); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg input:disabled + span { opacity: .45; }
.seg span b { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg.small span { min-height: 34px; padding: 4px 12px; }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.switch input { appearance: none; position: relative; width: 40px; height: 24px; margin: 0; flex-shrink: 0; border: 0; border-radius: 99px; background: var(--line-2); transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transform: none; opacity: 1; transition: left .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 19px; }
.switch input:disabled { opacity: .4; cursor: not-allowed; }
.switch-label { flex: 1; }
.switch-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.banner { display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 15px; line-height: 1.6; }
.banner.error { background: var(--danger-soft); color: var(--danger); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
#connection-error { margin-top: 20px; }

/* Top bar */
.topbar { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 19px/1 var(--serif); letter-spacing: .06em; text-decoration: none; }
.seal { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; background: var(--accent); color: #fff; font: 600 17px/1 var(--serif); letter-spacing: 0; }
.topnav { display: flex; gap: 8px; margin-left: auto; }
.topnav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-size: 15px; text-decoration: none; }
.topnav a:hover { background: var(--sunken); color: var(--ink); }
.privacy { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 15px; white-space: nowrap; }
.privacy .icon { width: 18px; height: 18px; }

/* Landing: a hero with the start card, three numbered sections, a notice and a closing band. */
.landing { display: block; }
.hero { border-bottom: 1px solid var(--line); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 32px 32px; }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; padding-top: clamp(48px, 8vh, 96px); padding-bottom: clamp(56px, 9vh, 104px); }
.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--accent); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: currentColor; }
.hero h1 { margin-top: 16px; font: 700 clamp(48px, 7vw, 88px)/1.08 var(--serif); letter-spacing: .06em; }
.lede { max-width: 30em; margin-top: 20px; color: var(--ink-2); font-size: clamp(17px, 1.8vw, 20px); line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-actions .btn { min-height: 48px; padding: 12px 22px; font-size: 16px; cursor: pointer; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 14px; }
.start-card { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--lift); }
.start-head { display: flex; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.start-head strong { font-size: 17px; }
.start-head span:last-child { margin-left: auto; color: var(--muted); font-size: 14px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dropzone { position: relative; display: grid; justify-items: center; gap: 6px; width: 100%; margin-top: 18px; padding: 36px 20px; border: 2px dashed var(--line-2); border-radius: 16px; background: var(--surface-2); cursor: pointer; text-align: center; transition: border-color .15s, background-color .15s, transform .15s; }
.dropzone:hover, .dropzone.dragging { border-color: var(--ink-2); background: var(--sunken); }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 10px; border-radius: 16px; background: var(--primary); color: var(--primary-ink); }
.drop-icon .icon { width: 26px; height: 26px; }
.drop-title { font-size: 20px; font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 15px; }
.dropzone.busy .drop-title::after { content: "…"; }
.start-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.start-stats div { padding: 14px 0 14px 16px; }
.start-stats div:first-child { padding-left: 0; }
.start-stats div + div { border-left: 1px solid var(--line); }
.start-stats dt { color: var(--muted); font-size: 14px; }
.start-stats dd { margin: 4px 0 0; color: var(--ink); font: 600 28px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.start-steps { display: grid; gap: 8px; margin-top: 16px; color: var(--ink-2); font-size: 15px; }
.start-steps li { display: flex; align-items: center; gap: 8px; }
.start-steps .icon { flex: none; width: 18px; height: 18px; color: var(--ok); }
.home-section { padding: clamp(64px, 9vw, 104px) 0; }
.home-section.band { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--sunken); }
.section-tag { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 15px; font-weight: 600; }
.section-tag b { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border: 1px solid currentColor; border-radius: 6px; font-size: 14px; }
.section-title { margin-top: 14px; font: 700 clamp(28px, 4vw, 44px)/1.3 var(--serif); letter-spacing: .02em; }
.feature-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 40px; }
.feature-card { display: grid; align-content: start; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.feature-card .chip { justify-self: start; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; }
.feature-card .art { justify-content: flex-start; }
.feature-card .art-text { align-items: flex-start; }
.feature-card h3 { font: 700 22px/1.35 var(--serif); }
.feature-card p { color: var(--ink-2); font-size: 15px; }
.feature-card ul { display: grid; gap: 8px; color: var(--ink-2); font-size: 15px; }
.feature-card li { position: relative; padding-left: 18px; }
.feature-card li::before { content: ""; position: absolute; left: 2px; top: .66em; width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }
.flow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; margin-top: 44px; }
.flow-steps li { padding-top: 22px; border-top: 2px solid var(--ink); }
.flow-no { display: block; color: var(--accent); font: 600 40px/1 var(--serif); }
.flow-steps h3 { margin-top: 14px; font-size: 18px; font-weight: 700; }
.flow-steps p { margin-top: 10px; color: var(--ink-2); font-size: 15px; line-height: 1.8; }
.demo { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 56px; align-items: start; }
.demo-text { margin-top: 18px; color: var(--ink-2); font-size: 16px; line-height: 1.85; }
.demo-files { margin-top: 26px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.demo-files-head { display: flex; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px dashed var(--line-2); color: var(--muted); font-size: 14px; font-weight: 600; }
.demo-file { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; font-size: 15px; overflow-wrap: anywhere; }
.demo-file .icon, .demo-out .icon { flex: none; width: 18px; height: 18px; }
.demo-file .icon { color: var(--muted); }
.demo-findings { display: grid; gap: 6px; padding: 0 0 12px 26px; border-bottom: 1px dashed var(--line-2); color: var(--ink-2); font-size: 15px; list-style: disc; }
.demo-out { display: flex; align-items: center; gap: 8px; padding-top: 12px; color: var(--ok); font-size: 15px; font-weight: 600; }
.text-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 22px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }
.text-link .icon { width: 18px; height: 18px; }
.demo-viewer { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--sunken); }
.demo-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.demo-tabs button { min-height: 40px; padding: 0 18px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font: 600 15px var(--sans); cursor: pointer; }
.demo-tabs button:hover { color: var(--ink); }
.demo-tabs [aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }
.demo-tabs [aria-selected="true"]:hover { color: var(--primary-ink); }
.demo-tabs button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.demo-panel { margin: 18px 0 0; }
.demo-page { overflow: hidden; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; box-shadow: 0 14px 36px rgb(30 25 15 / .12); }
.demo-page { display: block; cursor: zoom-in; }
.demo-page:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.demo-page img { display: block; width: 100%; height: auto; }
.demo-panel figcaption { margin-top: 12px; color: var(--muted); font-size: 14px; text-align: center; }
.home-notice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; margin-bottom: clamp(64px, 9vw, 104px); padding: 22px 26px; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 14px; background: var(--surface); }
.home-notice .icon { width: 22px; height: 22px; margin-top: 2px; color: var(--warn); }
.home-notice h2 { font-size: 17px; font-weight: 700; }
.home-notice p { margin-top: 6px; color: var(--ink-2); font-size: 15px; }
.faq-list { display: grid; gap: 12px; max-width: 900px; margin-top: 36px; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 14px 20px; font-size: 17px; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; flex: none; color: var(--muted); font-size: 22px; font-weight: 400; line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 20px 18px; color: var(--ink-2); font-size: 15px; line-height: 1.85; }
.home-closing { background-color: var(--closing-bg); background-image: linear-gradient(rgb(255 255 255 / .04) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .04) 1px, transparent 1px); background-size: 32px 32px; color: var(--closing-ink); }
.closing-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding-top: 72px; padding-bottom: 72px; }
.home-closing h2 { font: 700 clamp(28px, 4vw, 44px)/1.3 var(--serif); }
.closing-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.closing-actions .btn { min-height: 48px; padding: 12px 22px; font-size: 16px; cursor: pointer; }
.closing-primary { background: #fff; color: #1b1e22; }
.closing-primary:hover { background: #e7e5df; }
.closing-ghost { border-color: rgb(255 255 255 / .4); color: #fff; }
.closing-ghost:hover { border-color: #fff; }
body.working .topnav .home-link { display: none; }
.art { display: flex; align-items: center; justify-content: center; gap: 6px; height: 64px; }
.art-pages b { display: grid; place-items: end center; width: 34px; height: 46px; padding-bottom: 4px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); font: 600 14px/1 var(--serif); color: var(--ink-2); }
.art-pages b:nth-child(2) { color: var(--accent); }
.art-text { flex-direction: column; gap: 2px; font: 14px/1.3 ui-monospace, Consolas, monospace; }
.art-text s { color: var(--muted); }
.art-text b { color: var(--ok); font-weight: 600; }
/* A page with Word's change bar, a deletion and an insertion. */
.art-track-page { position: relative; display: grid; gap: 4px; width: 72px; padding: 8px 10px 8px 14px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); font-size: 14px; line-height: 1.2; text-align: left; }
.art-track-page::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--accent); }
.art-track del { padding: 0 2px; background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-thickness: 2px; }
.art-track ins { padding: 0 2px; background: var(--ok-soft); color: var(--ok); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.art-track i { display: block; height: 3px; border-radius: 2px; background: var(--line-2); }

/* Workbench */
.workbench { padding-top: 24px; padding-bottom: 48px; }
.docbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.doc-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; background: var(--sunken); color: var(--ink-2); flex-shrink: 0; }
.doc-name { display: grid; min-width: 0; line-height: 1.4; }
.doc-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.doc-name span { color: var(--muted); font-size: 14px; }
.doc-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.doc-stats li { padding: 4px 11px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-stats li.loading { color: var(--muted); }
.replace { position: relative; flex-shrink: 0; }
.replace input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

.bench { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; margin-top: 20px; }
.bench-main { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.bench-side { position: sticky; top: 12px; display: grid; gap: 16px; min-width: 0; max-height: calc(100vh - 24px); margin: -6px; padding: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); font-size: 16px; font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button:hover { color: var(--ink); }
.count { min-width: 24px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 14px; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.panel { padding: 20px; }

.outline-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.outline-bar .seg { flex: 0 0 auto; }
.search { position: relative; flex: 1 1 220px; }
.search .icon { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
.adjusted { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 6px 6px 6px 14px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--ink-2); font-size: 15px; }
#structure-warnings { margin-top: 14px; }

/* Preview: page strip and directory sheets. Paper stays light in both themes. */
.plan { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 14px; margin-bottom: 4px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.plan.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent); }
.plan-zone { display: grid; align-content: start; gap: 8px; flex-shrink: 0; scroll-snap-align: start; }
.plan-pages { display: flex; gap: 8px; padding: 10px; border-radius: 12px; background: var(--sunken); }
.plan-zone.front .plan-pages { background: color-mix(in srgb, var(--accent) 9%, var(--sunken)); }
.plan-zone.body .plan-pages { background: color-mix(in srgb, var(--ok) 9%, var(--sunken)); }
.mini { position: relative; display: flex; flex-direction: column; align-items: center; width: 86px; height: 120px; padding: 12px 7px 24px; border: 1px solid var(--paper-line); border-radius: 3px; background: var(--paper); color: var(--paper-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.mini::after { content: ""; width: 70%; flex: 1; margin-top: 8px; background: repeating-linear-gradient(var(--paper-line) 0 2px, transparent 2px 9px); opacity: .9; }
.mini-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; font: 600 14px/1.3 var(--serif); text-align: center; overflow-wrap: anywhere; }
.mini-num { position: absolute; left: 0; right: 0; bottom: 5px; font: 14px/1 var(--serif); text-align: center; color: var(--paper-ink); }
.mini.new { border: 1.5px dashed var(--ok); }
.mini.new .mini-title { color: var(--ok-print); }
.mini.more { justify-content: center; border-style: dashed; background: transparent; color: var(--muted); box-shadow: none; }
.mini.more::after { display: none; }
.plan-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 0 4px; font-size: 14px; color: var(--muted); }
.plan-label strong { color: var(--ink); font-size: 15px; }
.plan-label .numbering { font-family: var(--serif); }

.outline-bar { margin-top: 6px; }
.sheet { margin-top: 16px; }
.sheet[aria-busy="true"] { opacity: .55; transition: opacity .2s .15s; }
.sheet.off .paper-cell { opacity: .45; }
.sheet-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); }
.gutter { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 12px; min-height: 42px; }
.paper-cell { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 2px clamp(18px, 6%, 64px); border-inline: 1px solid var(--paper-line); background: var(--paper); color: var(--paper-ink); }
.sheet-title .paper-cell { justify-content: center; padding-top: 36px; padding-bottom: 18px; border-top: 1px solid var(--paper-line); border-radius: 6px 6px 0 0; font: 700 21px/1.3 var(--serif); letter-spacing: .25em; }
.sheet-title.latin .paper-cell { letter-spacing: .02em; }
.sheet-end .paper-cell { min-height: 40px; border-bottom: 1px solid var(--paper-line); border-radius: 0 0 6px 6px; }
.sheet-empty .paper-cell { justify-content: center; min-height: 120px; color: var(--paper-muted); font-family: var(--sans); font-size: 15px; }
.entry-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 16px/1.5 var(--serif); }
.sheet-row[data-level="1"] .entry-text { font-weight: 700; }
.sheet-row[data-level="2"] .entry-text { padding-left: 1.5em; }
.sheet-row[data-level="3"] .entry-text { padding-left: 3em; }
.sheet-row[data-level="4"] .entry-text { padding-left: 4.5em; }
.sheet-row[data-level="5"] .entry-text { padding-left: 6em; }
.sheet-row[data-level="6"] .entry-text { padding-left: 7.5em; }
.sheet-row[data-level="7"] .entry-text { padding-left: 9em; }
.sheet-row[data-level="8"] .entry-text { padding-left: 10.5em; }
.sheet-row[data-level="9"] .entry-text { padding-left: 12em; }
.sheet-row.muted .entry-text { color: var(--paper-muted); font-family: var(--sans); font-size: 15px; }
.sheet-row.new .entry-text { color: var(--ok-print); }
.sheet-row:hover .paper-cell { background: var(--paper-hover); }
.lvl { width: 88px; min-height: 34px; padding: 4px 24px 4px 10px; border-radius: 8px; border-color: transparent; background-color: transparent; background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; color: var(--muted); font-size: 14px; }
.sheet-row:hover .lvl, .lvl:hover, .lvl:focus-visible { border-color: var(--line-2); background-color: var(--surface); color: var(--ink); }
.lvl.changed { border-color: var(--ink); background-color: var(--surface); font-weight: 600; }
.tag { padding: 2px 9px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.tag.new { background: var(--ok-soft); color: var(--ok); }
.tag.manual { background: var(--accent-soft); color: var(--accent); }
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 16px; color: var(--muted); text-align: center; }
.empty .icon { width: 32px; height: 32px; }
.skeleton { display: grid; gap: 14px; padding: 8px 0; }
.skeleton i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken), var(--surface-2), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton i:nth-child(3n+2) { margin-left: 24px; width: 70%; }
.skeleton i:nth-child(3n) { margin-left: 48px; width: 55%; }
.more { width: 100%; margin-top: 8px; }

/* References */
.ref-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ref-bar strong { font-size: 16px; }
.ref-bulk { display: flex; gap: 4px; }
.ref-list { display: grid; gap: 12px; margin-top: 14px; }
.ref-card { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .15s; }
.ref-card:has(input:checked) { border-color: var(--ok); }
.ref-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: pointer; }
.ref-head strong { flex: 1; font-size: 15px; font-weight: 600; }
.ref-head .toggle-text { color: var(--muted); font-size: 14px; }
.ref-card:has(input:checked) .toggle-text { color: var(--ok); font-weight: 600; }
.ref-diff { display: grid; grid-template-columns: 1fr 1fr; }
.ref-diff p { padding: 12px 14px; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.ref-diff p + p { border-left: 1px solid var(--line); }
.ref-diff .label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.ref-diff del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-thickness: 1px; }
.ref-diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; }
.notes { margin-top: 20px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.notes h3 { font-size: 15px; }
.notes ul { display: grid; gap: 8px; margin-top: 8px; font-size: 15px; }
.notes li span { display: block; color: var(--ink-2); overflow-wrap: anywhere; }
.ref-options { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.order-preview { margin-top: 12px; font-size: 15px; }
.order-preview summary { min-height: 40px; padding: 8px 0; color: var(--ink-2); font-weight: 600; }
.order-preview ol { display: grid; gap: 6px; padding-left: 24px; list-style: decimal; color: var(--ink-2); overflow-wrap: anywhere; }

/* Figure and table checks */
.caption-check-header { display: grid; gap: 6px; }
.caption-check-summary { font-size: 17px; font-weight: 700; }
.caption-check-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 2px; }
.caption-check-types li { display: inline-flex; align-items: center; gap: 8px; padding: 3px 4px 3px 12px; border-radius: 99px; font-size: 14px; font-weight: 600; line-height: 1.6; }
.caption-check-types li.is-issue { background: var(--warn-soft); color: var(--warn); }
.caption-check-types li.is-notice { background: var(--sunken); color: var(--ink-2); }
.caption-check-types strong { min-width: 26px; padding: 0 8px; border-radius: 99px; background: var(--surface); color: var(--ink); text-align: center; font-variant-numeric: tabular-nums; }
.caption-check-note { color: var(--muted); font-size: 14px; line-height: 1.7; }
.caption-issue-type { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 500; line-height: 1.6; }
.caption-editor { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 16px; }
.caption-editor label { display: block; font-weight: 600; margin-bottom: 6px; }
.caption-editor-hint { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 8px 0; }
.caption-editor textarea { display: block; box-sizing: border-box; width: 100%; min-height: 120px; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 16px/1.8 var(--serif); resize: vertical; }
.caption-editor-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.caption-editor-buttons .btn { min-height: 44px; }
.caption-editor-error { color: var(--warn); margin-top: 8px; }
.caption-edit-status { font-size: 14px; color: var(--ink-2); line-height: 1.7; margin-top: 12px; }
.caption-edit-status:empty { display: none; }
.caption-history { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.caption-history summary { cursor: pointer; color: var(--ok); font-size: 14px; }
.caption-history-item { border-bottom: 1px solid var(--line); padding: 12px 0; font-size: 14px; line-height: 1.8; }
.caption-history-item p { white-space: pre-wrap; margin-top: 6px; }
.caption-auto { margin-top: 16px; }
.caption-diff { display: block; overflow-wrap: anywhere; margin-top: 8px; }
.caption-diff-window { display: grid; grid-template-columns: 1fr 1fr; }
.caption-diff-window + .caption-diff-window { margin-top: 12px; }
.caption-diff .label { white-space: nowrap; }
@media (max-width: 600px) { .caption-diff-window { grid-template-columns: 1fr; } }
.caption-review-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between; padding:14px 16px; border:1px solid var(--line-2); border-radius:var(--radius-sm); background:var(--surface); margin-bottom:16px; }
.caption-review-actions strong { font-size:16px; }
.caption-review-actions p { margin-top:4px; color:var(--ink-2); font-size:14px; line-height:1.6; }
.caption-review-actions .btn { min-height:44px; white-space:normal; }
.caption-review-text { flex:1 1 220px; min-width:0; }
.caption-review-buttons { display:flex; flex-wrap:wrap; gap:8px; }
.btn.suggest { background:var(--ok-soft); border-color:color-mix(in srgb,var(--ok) 45%,transparent); color:var(--ok); }
.btn.suggest:hover:not(:disabled) { border-color:var(--ok); }
.btn.suggest:disabled, .btn.ghost:disabled { opacity:.55; cursor:not-allowed; }
.caption-plan { margin-bottom:16px; border:1px solid var(--line-2); border-radius:var(--radius-sm); background:var(--surface); overflow:hidden; }
.caption-plan > summary { padding:14px 16px; cursor:pointer; font-size:15px; font-weight:600; background:var(--surface-2); }
.caption-plan-item { padding:14px 16px; border-top:1px solid var(--line); min-width:0; }
.caption-plan-item > strong { display:block; font-size:14px; margin-bottom:6px; }
.caption-plan .caption-diff-window { border:1px solid var(--line); border-radius:6px; }
.space-mark { display:inline-block; margin:0 2px; padding:0 5px !important; border-radius:4px; font:600 14px/1.5 var(--sans); vertical-align:1px; }
.caption-case { margin-top:16px; border:1px solid var(--line-2); border-radius:var(--radius); background:var(--surface); overflow:hidden; min-width:0; }
.caption-case-header { display:flex; gap:12px; padding:18px 18px 12px; align-items:flex-start; }
.caption-case-number { display:grid; place-items:center; flex-shrink:0; width:34px; height:34px; border-radius:9px; background:var(--sunken); color:var(--muted); font:600 14px/1 var(--sans); }
.caption-case h3 { font-size:18px; font-weight:700; }
.caption-case-tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.caption-case-problems { padding:0 18px 0 38px; list-style:disc; color:var(--ink-2); font-size:14px; line-height:1.8; }
.caption-case-problems li { padding:4px 0; }
.caption-case-problems strong { color:var(--ink); margin-right:8px; }
.caption-case-problems span { color:var(--ink-2); }
.caption-case-method { padding:14px 18px; display:grid; gap:8px; }
.caption-case-method label { font-size:14px; font-weight:600; }
.caption-case-method select, .caption-reference-choice select { width:100%; min-width:0; min-height:44px; white-space:normal; }
.caption-case-note { margin:0 18px 14px; color:var(--ink-2); font-size:14px; line-height:1.7; }
.caption-reference-choice { margin:0 18px 14px; padding:12px; background:var(--warn-soft); border-radius:var(--radius-sm); display:grid; gap:8px; }
.caption-reference-choice label { font-weight:600; font-size:14px; }
.caption-reference-choice p { color:var(--ink-2); font-size:14px; line-height:1.7; }
.caption-reference-choice.is-chosen { background:var(--ok-soft); }
.caption-reference-choice blockquote { margin:0; padding:8px 12px; border-left:3px solid var(--line-2); background:var(--surface); color:var(--ink); font:15px/1.8 var(--serif); overflow-wrap:anywhere; }
.caption-reference-choice .caption-suggestion { display:flex; gap:8px; align-items:flex-start; color:var(--ok); font-weight:600; }
.caption-suggestion .icon { flex-shrink:0; width:18px; height:18px; margin-top:3px; }
.caption-case[data-type="notice"] { border-style:dashed; }
.caption-plain-row { display:grid; gap:10px; margin:12px 0 0; padding:12px; border:1px solid var(--line); border-radius:var(--radius-sm); min-width:0; }
.caption-plain-label { color:var(--muted); font-size:14px; font-weight:600; }
.caption-plain-row .caption-object-title { margin:0; text-align:center; }
.caption-object-single .caption-object-image { max-height:360px; }
.caption-case-details { border-top:1px solid var(--line); }
.caption-case-details > summary { padding:15px 18px; cursor:pointer; font-size:14px; font-weight:600; color:var(--ink-2); background:var(--surface-2); }
.caption-case-context { padding:16px; min-width:0; }
.caption-case h4 { margin:0; font-size:15px; font-weight:600; }
.caption-context-note { color:var(--ink-2); font-size:14px; line-height:1.7; margin:6px 0 12px; }
.caption-sequence-scroll { overflow-x:auto; border:1px solid var(--line-2); border-radius:var(--radius-sm); }
.caption-sequence-table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:14px; }
.caption-sequence-table th, .caption-sequence-table td { padding:10px; border-bottom:1px solid var(--line); vertical-align:top; text-align:left; overflow-wrap:anywhere; line-height:1.8; }
.caption-sequence-table th { background:var(--surface-2); font-size:14px; font-weight:600; }
.caption-sequence-table th:first-child { width:42px; }
.caption-sequence-table th:last-child { width:84px; }
.caption-sequence-table td + td { border-left:1px solid var(--line); }
.caption-sequence-table tr:last-child td { border-bottom:0; }
.caption-sequence-table .is-changed { box-shadow:inset 3px 0 var(--ok); }
.caption-sequence-table .is-changed .after { background:var(--ok-soft); }
.caption-sequence-table .had-duplicate .before { background:var(--danger-soft); }
.caption-row-result { font-size:14px; }
.caption-row-result small { display:block; color:var(--warn); line-height:1.5; margin-top:5px; }
.caption-row-changed { color:var(--ok); font-size:14px; white-space:nowrap; font-weight:700; }
.caption-row-unchanged { color:var(--muted); font-size:14px; white-space:nowrap; }
.caption-case del, .caption-manual-preview del, .caption-plan del { background:var(--danger-soft); color:var(--danger); text-decoration-thickness:2px; font-weight:700; padding:0 2px; }
.caption-case ins, .caption-manual-preview ins, .caption-plan ins { background:var(--ok-soft); color:var(--ok); text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:3px; font-weight:700; padding:0 2px; outline:1px solid color-mix(in srgb,var(--ok) 35%,transparent); }
.caption-object-detail { margin-top:14px; border:1px solid var(--line); border-radius:var(--radius-sm); overflow:hidden; }
.caption-object-detail > summary { padding:12px; color:var(--ink-2); cursor:pointer; font-size:14px; font-weight:600; background:var(--surface-2); }
.caption-object-pair { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr)); gap:12px; padding:12px; }
.caption-object-pane { padding:12px; border:1px solid var(--line); border-radius:6px; min-width:0; }
.caption-object-pane.changed.after { border:2px solid var(--ok); }
.caption-object-pane h5, .caption-full-diff h5 { font-size:14px; color:var(--muted); font-weight:600; margin:0 0 8px; }
.caption-object-title { font:15px/1.8 var(--serif); margin-bottom:12px; overflow-wrap:anywhere; }
.caption-native-scroll { overflow-x:auto; width:100%; }
.caption-native-table { width:100%; border-collapse:collapse; font-size:14px; line-height:1.7; white-space:pre-wrap; }
.caption-native-table th, .caption-native-table td { padding:7px 9px; border:1px solid var(--line-2); min-width:62px; vertical-align:middle; overflow-wrap:anywhere; }
.caption-native-table th { background:var(--sunken); color:var(--ink); text-align:left; font-weight:600; }
.caption-native-table td.cell-changed { background:var(--ok-soft); }
.caption-object-image { display:block; width:auto; max-width:100%; height:auto; margin:auto; }
.caption-case-references { margin-top:22px; }
.caption-reference-context { margin-top:12px; padding:12px; border:1px solid var(--line); border-radius:var(--radius-sm); }
.caption-reference-context.is-changed { border-left:3px solid var(--ok); }
.caption-reference-title { display:flex; justify-content:space-between; gap:8px; font-size:14px; margin-bottom:10px; }
.caption-reference-title span { color:var(--muted); }
.caption-full-diff { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr)); gap:12px; }
.caption-full-diff section { min-width:0; padding:12px; background:var(--surface-2); border-radius:6px; }
.caption-full-diff section.changed.after { background:var(--ok-soft); }
.caption-full-diff p { white-space:pre-wrap; overflow-wrap:anywhere; font:15px/1.85 var(--serif); }
/* Citation check: the matched reference entry and deleted entries. */
.citation-entry { margin:0 18px 14px; padding:10px 14px; border-left:3px solid var(--line-2); border-radius:0 6px 6px 0; background:var(--surface-2); color:var(--ink); font:15px/1.8 var(--serif); overflow-wrap:anywhere; }
.citation-entry .label { display:block; margin-bottom:2px; color:var(--muted); font:600 14px/1.6 var(--sans); }
.citation-removed { white-space:pre-wrap; overflow-wrap:anywhere; color:var(--danger); text-decoration:line-through; text-decoration-thickness:2px; font:15px/1.85 var(--serif); }
.caption-case-method .caption-suggestion { display:flex; gap:8px; align-items:flex-start; color:var(--ok); font-size:14px; font-weight:600; line-height:1.7; }
.caption-manual-list { margin:0 18px 16px; }
.caption-manual-row { padding:10px 0; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:12px; }
.caption-manual-row p { flex:1; min-width:0; overflow-wrap:anywhere; color:var(--ink-2); font:14px/1.8 var(--serif); }
.caption-manual-row .btn { min-height:44px; }
.caption-manual-preview { margin-top:16px; }
.caption-manual-preview h4 { margin:0 0 10px; }
@media (max-width:600px) {
 .caption-case-header { padding:14px 12px 10px; }
 .caption-case-method { padding:12px; }
 .caption-case-problems { padding-left:32px; padding-right:12px; }
 .caption-case-context { padding:10px; }
 .caption-reference-choice { margin-left:12px; margin-right:12px; }
 .citation-entry { margin-left:12px; margin-right:12px; }
 .caption-sequence-table th, .caption-sequence-table td { padding:7px 5px; font-size:14px; }
 .caption-sequence-table th:first-child { width:30px; }
 .caption-sequence-table th:last-child { width:64px; }
 .caption-object-pair { padding:8px; }
 .caption-manual-row { flex-wrap:wrap; }
 .caption-manual-row .btn { width:100%; }
}
.caption-check-scope { margin-top: 10px; color: var(--muted); font-size: 14px; }
.caption-check-scope summary { cursor: pointer; padding: 6px 0; }
.caption-check-scope ul { margin: 6px 0 0; padding-left: 20px; list-style: disc; }
.caption-check-scope li + li { margin-top: 6px; }
.caption-check-empty { margin-top: 18px; padding: 36px 16px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--ok); }
.caption-check-empty p { color: var(--ink-2); }

/* Settings */
.settings { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.setting { display: grid; gap: 12px; padding: 18px 20px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting h2 { font-size: 16px; font-weight: 700; }
.setting-help { color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.setting-help.invalid { color: var(--danger); }
.starts { display: grid; gap: 10px; }
.odd-pages { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.toggles { display: grid; }
.sub-settings { display: grid; gap: 12px; padding-top: 4px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.check.confirm { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.submit-bar { position: sticky; bottom: 0; z-index: 2; padding: 16px 20px 20px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); }
.submit-bar .btn { width: 100%; min-height: 52px; font-size: 17px; }
#form-error { margin: 0 20px 20px; }

/* Result */
.result { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
#result-progress { display: grid; justify-items: center; gap: 14px; padding: 12px 0; text-align: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .9s linear infinite; }
.progress-message { font-size: 16px; }
.result-title { display: flex; align-items: center; gap: 10px; font-size: 19px; }
.ok-dot, .err-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.err-dot { background: var(--danger-soft); color: var(--danger); }
.result.pending .ok-dot { background: var(--warn-soft); color: var(--warn); }
.completed-downloads { display: grid; gap: 8px; }
.completed-downloads .btn { white-space: normal; }
.report-download { margin-top: 10px; }
.tracked-download { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.tracked-hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.result-facts { display: grid; gap: 4px; margin: 14px 0 18px; color: var(--ink-2); font-size: 15px; }
.result-facts li::before { content: "·"; margin-right: 8px; color: var(--muted); }
.requirement code { padding: 1px 6px; border-radius: 5px; background: var(--sunken); font: 14px ui-monospace, Consolas, monospace; }
.requirement { margin-top: 14px; color: var(--muted); font-size: 15px; }
.notices { display: grid; gap: 8px; margin-top: 16px; }
.notices:empty { display: none; }
.notices li { display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 15px; line-height: 1.6; }
.notices li .icon { width: 18px; height: 18px; margin-top: 3px; }
.job-error { margin-top: 12px; color: var(--ink-2); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Footer and drag overlay */
.footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; min-height: 64px; color: var(--muted); font-size: 14px; }
.footer-inner a { color: var(--muted); }
.visits { margin-left: auto; font-variant-numeric: tabular-nums; }
.visits strong { color: var(--ink-2); font-weight: 600; }
.drop-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(3px); pointer-events: none; }
.drop-overlay > div { display: flex; align-items: center; gap: 12px; padding: 28px 40px; border: 2px dashed var(--ink-2); border-radius: 20px; background: var(--surface); font-size: 20px; font-weight: 600; }
.drop-overlay .icon { width: 28px; height: 28px; }

@keyframes spin { to { rotate: 360deg; } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Layout breakpoints */
@media (max-width: 1080px) {
  .bench { grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
  .sheet-row { grid-template-columns: 96px minmax(0, 1fr); }
  .lvl { width: 84px; }
}
@media (max-width: 900px) {
  .hero-inner, .demo { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .feature-cards { grid-template-columns: minmax(0, 1fr); }
  .flow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bench { grid-template-columns: minmax(0, 1fr); }
  .bench-side { position: static; max-height: none; margin: 0; padding: 0; overflow: visible; }
  .docbar { flex-wrap: wrap; }
  .doc-stats { order: 3; width: 100%; margin-left: 0; }
  .replace { margin-left: auto; }
  body.working { padding-bottom: 84px; }
  .submit-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-radius: 0; background: var(--surface); box-shadow: 0 -6px 20px rgb(0 0 0 / .06); }
  .submit-bar .btn { max-width: 720px; margin: 0 auto; display: flex; }
  .result { scroll-margin-top: 16px; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { gap: 12px; min-height: 58px; }
  .brand { font-size: 18px; }
  .topnav { margin-left: auto; }
  .topnav a { padding: 0 8px; }
  .privacy span, .privacy { font-size: 14px; }
  .topnav .home-link { display: none; }
  .hero-inner { padding-top: 36px; padding-bottom: 48px; }
  .start-card { padding: 16px; border-radius: 16px; }
  .dropzone { padding: 28px 16px; }
  .start-stats dd { font-size: 24px; }
  .start-stats div { padding-left: 12px; }
  .home-section { padding: 56px 0; }
  .feature-cards { margin-top: 28px; }
  .feature-card { padding: 22px; }
  .flow-steps { grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 32px; }
  .demo-viewer { padding: 14px; }
  .demo-tabs { display: flex; }
  .demo-tabs button { flex: 1; padding: 0 8px; }
  .home-notice { padding: 18px; }
  .faq-list { margin-top: 28px; }
  .faq-item summary { padding: 12px 16px; font-size: 16px; }
  .faq-item p { padding: 0 16px 16px; }
  .closing-inner { padding-top: 56px; padding-bottom: 56px; }
  .closing-actions, .closing-actions .btn { width: 100%; }
  .workbench { padding-top: 16px; }
  .docbar { padding: 12px; gap: 10px; }
  .doc-icon { width: 38px; height: 38px; }
  .panel { padding: 16px 14px; }
  .tabs { gap: 0; padding: 0 4px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs.more-right { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }
  .tabs button { flex: 0 0 auto; justify-content: center; gap: 5px; padding: 0 10px; font-size: 14px; white-space: nowrap; }
  .tabs .count { min-width: 20px; padding: 0 5px; font-size: 14px; line-height: 20px; }
  .outline-bar .seg { flex: 1 1 100%; }
  .sheet-row { grid-template-columns: 88px minmax(0, 1fr); }
  .gutter { padding-right: 6px; }
  .lvl { width: 82px; padding-left: 8px; }
  .paper-cell { padding: 4px 14px; }
  .entry-text { white-space: normal; line-height: 1.45; }
  .sheet-row[data-level="2"] .entry-text { padding-left: 1em; }
  .sheet-row[data-level="3"] .entry-text { padding-left: 2em; }
  .sheet-row[data-level="4"] .entry-text, .sheet-row[data-level="5"] .entry-text, .sheet-row[data-level="6"] .entry-text, .sheet-row[data-level="7"] .entry-text, .sheet-row[data-level="8"] .entry-text, .sheet-row[data-level="9"] .entry-text { padding-left: 3em; }
  .mini { width: 76px; height: 106px; }
  .ref-diff { grid-template-columns: 1fr; }
  .ref-diff p + p { border-left: 0; border-top: 1px solid var(--line); }
  .ref-options { grid-template-columns: 1fr; }
  .setting { padding: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .visits { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media (forced-colors: active) {
  input[type=checkbox], .switch input { appearance: auto; }
  .seg input { position: static; opacity: 1; }
  .btn, .tag, .count { border: 1px solid ButtonText; }
}

/* What a browser-driving AI agent just did, shown to the person watching the tab. */
.agent-toast { position: fixed; right: 16px; bottom: 16px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--lift); font-size: 14px; line-height: 1.5; pointer-events: none; }
.agent-toast[hidden] { display: none; }
