:root {
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --ink: #18202b;
  --muted: #5e6877;
  --border: #d6dce6;
  --action-primary: #2457d6;
  --warning: #a56712;
  --warning-bg: #fff7e8;
  --error: #c44133;
  --error-bg: #fff0ed;
  --success: #287a55;
  --success-bg: #edf9f3;
  --code-surface: #f1f4f8;
  --surface-low: #eff4ff;
  --font-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.55; letter-spacing: 0; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a, input, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--action-primary); }
a { color: var(--action-primary); }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header { height: 58px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: var(--surface); }
.header-left { display: flex; align-items: center; gap: 36px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand img { width: 28px; height: 28px; }
.main-nav { display: flex; align-items: stretch; gap: 24px; height: 58px; }
.main-nav a { display: flex; align-items: center; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent; }
.main-nav a[aria-current="page"] { color: var(--action-primary); border-bottom-color: var(--action-primary); }
.container { width: min(1440px, calc(100% - 48px)); margin-inline: auto; }
.tool-main { flex: 1; padding-block: 14px 56px; }
.intro { min-height: 80px; display: grid; grid-template-columns: minmax(0, 52fr) minmax(0, 48fr); gap: 24px; align-items: center; }
h1, h2 { font-family: var(--font-display); font-weight: 600; }
.intro h1 { min-height: 80px; margin: 0; display: flex; align-items: center; font-size: 30px; line-height: 1.2; }
.intro-copy { min-width: 0; padding-top: 2px; }
.intro p { max-width: 900px; margin: 0; color: var(--muted); }
.intro-copy > p:first-child { font-size: 15px; line-height: 1.45; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; color: #465366; font-size: 13px; }
.intro .privacy-note { margin-top: 6px; }
@media (min-width: 1200px) {
  .intro-copy .privacy-note { font-size: 11px; white-space: nowrap; }
}
.icon-button, .secondary-button, .source-actions button { min-height: 40px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; cursor: pointer; }
.icon-button { width: 40px; padding: 8px; }
.secondary-button:hover, .source-actions button:hover { background: var(--surface-low); }
.mobile-tabs { display: none; }
.workbench { min-height: clamp(700px, calc(100svh - 150px), 760px); display: grid; grid-template-columns: minmax(0, 52fr) minmax(0, 48fr); gap: 24px; margin-top: 8px; align-items: stretch; }
.source-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.panel-bar { min-height: 52px; padding: 5px 6px 5px 16px; background: var(--surface-low); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.source-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.panel-title-short { display: none; }
.source-actions .compact-action { min-height: 40px; padding: 7px 10px; color: var(--ink); font-size: 12px; font-weight: 600; text-transform: none; }
#markdown-source { flex: 1; width: 100%; min-height: 0; resize: none; border: 0; padding: 18px; background: var(--surface); color: var(--ink); font: 14px/1.6 var(--font-mono); }
.source-helper { padding: 8px 16px; border-top: 1px solid var(--border); display: grid; gap: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.legal-use-notice { color: #6b7482; }
.legal-use-notice a { color: var(--action-primary); }
.preview-column { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.settings-panel { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 6px; padding: 14px 16px; background: var(--surface); }
.settings-panel h2 { margin: 0 0 10px; font-family: var(--font-ui); font-size: 15px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.field { container-type: inline-size; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.segmented { height: 40px; padding: 3px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border: 1px solid var(--border); border-radius: 4px; background: var(--surface-low); }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 3px; color: var(--muted); font-size: 13px; font-weight: 600; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); border-color: var(--border); }
.paper-options { height: 52px; }
.paper-options label { cursor: pointer; }
.paper-options .paper-choice { height: 44px; gap: 8px; padding: 4px 7px; justify-content: flex-start; pointer-events: none; }
.paper-options input:checked + .paper-choice { border-color: var(--action-primary); box-shadow: inset 0 0 0 1px var(--action-primary); }
.paper-shape { display: block !important; flex: 0 0 auto; height: 30px !important; border: 1.5px solid currentColor !important; border-radius: 1px !important; background: transparent !important; }
.paper-shape::after { content: ""; display: block; width: 5px; height: 5px; margin-left: auto; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; background: var(--surface); }
.paper-shape-letter { width: 23px; }
.paper-shape-a4 { width: 21px; }
.paper-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.paper-copy strong { color: currentColor; font-size: 12px; text-transform: uppercase; }
.paper-copy small { margin-top: 3px; color: #465366; font: 11px var(--font-mono); white-space: nowrap; }
@container (max-width: 360px) {
  .paper-options { height: 96px; grid-template-columns: 1fr; }
  .paper-options .paper-choice { height: 44px; }
}

.warning-summary { min-height: 42px; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; display: flex; align-items: center; gap: 9px; font-size: 13px; }
.warning-summary.is-clear { color: var(--success); background: var(--success-bg); border-color: #b8dec9; }
.warning-summary.is-neutral { color: var(--muted); background: var(--surface-low); }
.warning-summary.has-warnings { color: var(--warning); background: var(--warning-bg); border-color: #ead2a8; }
.warning-summary.is-blocking { color: var(--error); background: var(--error-bg); border-color: #efbdb4; }
.warning-summary .text-button { margin-left: auto; }
.primary-button { min-height: 44px; padding: 10px 18px; border: 1px solid var(--action-primary); border-radius: 4px; background: var(--action-primary); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.primary-button:hover { background: #183fa7; }
.primary-button:disabled { opacity: .5; cursor: not-allowed; }
.download-ready-note { min-height: 36px; margin-top: 10px; padding: 7px 10px; display: flex; align-items: center; gap: 8px; border: 1px solid #b8dec9; border-radius: 4px; background: var(--success-bg); color: var(--success); font-size: 13px; font-weight: 700; }
.convert-row { min-height: 44px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.preview-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.preview-label svg { color: var(--success); }
.paper-wrapper { flex: 1 1 260px; min-height: 230px; padding: 20px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: #eef0f3; }
.preview-pages { --preview-scale: 1; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.preview-staging { position: absolute; left: -10000px; width: 460px; visibility: hidden; }
.preview-page-shell { position: relative; flex: 0 0 auto; width: calc(560px * var(--preview-scale)); }
.shell-letter { height: calc(724.7px * var(--preview-scale)); }
.shell-a4 { height: calc(792px * var(--preview-scale)); }
.paper { position: absolute; inset: 0 auto auto 0; width: 560px; margin: 0; padding: 48px; overflow: hidden; border: 1px solid #d5d9df; background: #fff; box-shadow: 0 7px 12px rgb(24 32 43 / 11%); transform: scale(var(--preview-scale)); transform-origin: top left; font-family: var(--font-display); color: var(--ink); }
.paper-letter { height: 724.7px; }
.paper-a4 { height: 792px; }
.paper h1, .paper h2, .paper h3, .paper h4, .paper h5, .paper h6 { margin: var(--preview-heading-before) 0 var(--preview-heading-after); }
.paper h1, .paper h2, .paper h3, .paper h4, .paper h5, .paper h6, .paper p, .paper li, .paper blockquote, .paper th, .paper td { overflow-wrap: anywhere; word-break: break-word; }
.paper h1:first-child, .paper h2:first-child, .paper h3:first-child, .paper h4:first-child, .paper h5:first-child, .paper h6:first-child { margin-top: 0; }
.paper h1 { font-size: 30px; }
.paper h2 { font-size: 23px; }
.paper h3 { font-size: 19px; }
.paper p { margin: 0 0 var(--preview-paragraph-after); }
.paper ul, .paper ol { margin-block: 0 var(--preview-list-after); }
.paper p, .paper li { line-height: var(--preview-body-line-height); }
.paper blockquote { margin: 18px 0; padding-left: 14px; border-left: 3px solid #7f8997; color: var(--muted); font-style: italic; }
.paper pre { padding: 12px; overflow: auto; background: var(--code-surface); font: 13px/1.55 var(--font-mono); }
.paper code { padding: 1px 4px; border-radius: 2px; background: var(--code-surface); font-family: var(--font-mono); }
.paper table { width: 100%; border-collapse: collapse; }
.paper th, .paper td { padding: 8px; border: 1px solid var(--border); text-align: left; }
.paper th { background: var(--surface-low); }
.preview-empty { margin-top: 120px; text-align: center; color: var(--muted); }
.stats { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-low); color: var(--muted); }
.stat-line { display: flex; flex-wrap: wrap; gap: 8px 20px; font: 12px var(--font-mono); }
.stats p { margin: 5px 0 0; font-size: 11px; }
.warning-list { display: grid; gap: 8px; }
.warning-item { padding: 14px; border: 1px solid #ead2a8; border-left: 4px solid var(--warning); border-radius: 4px; background: var(--warning-bg); }
.warning-item.warning-blocking { border-color: #efbdb4; border-left-color: var(--error); background: var(--error-bg); }
.warning-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.warning-heading code { font-size: 11px; }
.warning-heading span { margin-left: auto; color: var(--muted); }
.warning-item p { margin: 8px 0 0; font-size: 13px; }
.warning-recovery { font-weight: 600; }
.state-panel { min-height: 112px; margin-top: 14px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); display: flex; align-items: center; }
.state-panel h2 { margin: 0 0 6px; font-size: 22px; }
.state-panel p { margin: 0; color: var(--muted); }
.state-panel small { color: var(--muted); }
.state-progress, .state-ready, .state-error { width: 100%; display: flex; align-items: flex-start; gap: 14px; }
.state-ready > svg { color: var(--success); width: 28px; height: 28px; }
.state-error > svg { color: var(--error); width: 28px; height: 28px; }
.state-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.text-button { min-height: 36px; padding: 6px 8px; border: 0; background: transparent; color: currentColor; font-weight: 700; text-decoration: underline; cursor: pointer; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.info-section { margin-top: 48px; padding-top: 38px; border-top: 1px solid var(--border); }
.info-section h2 { margin: 0 0 16px; font-size: 26px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; }
.step { counter-increment: step; padding-top: 14px; border-top: 2px solid var(--border); }
.step h3::before { content: counter(step) ". "; color: var(--action-primary); }
.support-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.support-grid ul { padding-left: 20px; }
.faq-list { border-top: 1px solid var(--border); }
details { border-bottom: 1px solid var(--border); }
summary { padding: 16px 0; font-weight: 700; cursor: pointer; }
details p { color: var(--muted); }
.site-footer { margin-top: auto; padding: 24px max(24px, calc((100vw - 1392px)/2)); border-top: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: flex-end; gap: 24px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px 20px; }
.footer-nav a { color: var(--muted); font-size: 12px; }
dialog { width: min(480px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgb(24 32 43 / 42%); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 900px) {
  .site-header { height: 54px; padding-inline: 16px; }
  .main-nav { display: none; }
  .container { width: min(100% - 32px, 680px); }
  .tool-main { padding-top: 12px; }
  .intro { min-height: 0; display: block; }
  .intro h1 { min-height: 0; }
  .intro-copy { padding-top: 6px; }
  .intro h1 { font-size: 26px; }
  .source-actions .compact-action span { display: none; }
  .source-actions .compact-action { width: 40px; padding: 8px; }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 18px; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-low); }
  .mobile-tabs button { min-height: 40px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-weight: 700; }
  .mobile-tabs button[aria-selected="true"] { border-color: var(--border); background: var(--surface); color: var(--action-primary); }
  .workbench { display: block; min-height: 0; margin-top: 12px; }
  .source-pane, .preview-column { display: none; }
  .source-pane.mobile-active, .preview-column.mobile-active { display: flex; }
  .source-pane { min-height: 430px; height: 430px; }
  .settings-panel { order: 2; margin-top: 6px; }
  .preview-label { order: 0; }
  .paper-wrapper { order: 1; height: 440px; padding: 16px; }
  .stats { order: 1; }
  .preview-pages { gap: 22px; }
  .settings-grid { grid-template-columns: 1fr; }
  .convert-row > button { width: 100%; }
  #download-button { order: 1; }
  #convert-again { order: 2; }
  .warning-list { order: 3; }
  .state-panel { order: 4; }
  .steps, .support-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; text-align: center; padding: 28px 16px; }
  .footer-nav { justify-content: center; }
}
@media (max-width: 390px) {
  .container { width: calc(100% - 24px); }
  .panel-bar { padding-left: 10px; }
  .source-actions { gap: 4px; }
  .source-actions > * { flex: 0 0 40px; width: 40px !important; }
  .panel-title-full { display: none; }
  .panel-title-short { display: inline; }
  .settings-panel { padding: 16px; }
  .paper-wrapper { height: 400px; padding: 12px; }
  .paper { padding: 22px; }
  .paper h1 { font-size: 25px; }
  .stat-line { gap: 8px 12px; }
  .warning-heading span { width: 100%; margin-left: 0; }
  .state-actions > * { width: 100%; }
}

.static-main{flex:1}.article-content{width:min(760px,calc(100% - 40px));margin:0 auto;padding:64px 0 96px}.article-content h1,.legal-content h1,.not-found h1{font:600 38px/1.2 var(--font-display);margin:0 0 24px}.article-content h2{margin:42px 0 12px;font-size:24px}.lead{font:20px/1.6 var(--font-display);color:var(--muted)}.article-content .primary-button{margin:16px 0 24px;text-decoration:none}.notice{margin:24px 0;padding:18px;border-left:4px solid var(--warning);background:var(--warning-bg)}.legal-layout{display:grid;grid-template-columns:260px minmax(0,900px);gap:64px;width:min(1280px,calc(100% - 48px));margin:0 auto;padding:56px 0 96px}.legal-sidebar{position:sticky;top:32px;align-self:start}.legal-sidebar strong{display:block;margin-bottom:12px}.legal-sidebar a{display:block;padding:5px 0;color:var(--muted);font-size:12px;text-decoration:none}.legal-content{min-width:0}.legal-content h2{margin:36px 0 12px;font:700 18px/1.35 var(--font-ui)}.legal-content p,.legal-content li{color:#525d6c;font-size:14px;line-height:1.7}.legal-content code{overflow-wrap:anywhere}.not-found{flex:1;display:grid;place-items:center;padding:64px 20px;text-align:center}.not-found article{max-width:560px}.not-found img{width:72px;height:72px}.not-found .primary-button{margin-top:16px;text-decoration:none}@media(max-width:900px){.legal-layout{grid-template-columns:1fr;width:min(100% - 40px,720px);gap:28px;padding-top:36px}.legal-sidebar{position:static}.article-content{padding-top:40px}.article-content h1,.legal-content h1,.not-found h1{font-size:30px}}
