:root {
  --night: #0d1716;
  --night-soft: #142321;
  --night-raised: #1a2b28;
  --paper: #f1eadc;
  --paper-bright: #fbf7ee;
  --paper-deep: #dcd0bb;
  --ink: #17211f;
  --ink-soft: #5e6764;
  --red: #c84b3c;
  --red-dark: #8d3028;
  --gold: #d0a45a;
  --teal: #4c9187;
  --line-dark: rgba(255, 255, 255, 0.12);
  --line-paper: rgba(23, 33, 31, 0.15);
  --sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  --display: "Bodoni 72", Didot, "Times New Roman", var(--serif);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--night); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--night);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { color: #fff; background: var(--red); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.review-skip {
  position: fixed;
  z-index: 300;
  top: 8px;
  left: 8px;
  padding: 9px 14px;
  color: #fff;
  background: var(--red);
  font-size: 12px;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}
.review-skip:focus { transform: translateY(0); }

.ambient-grid {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 74px 74px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent 75%);
  mask-image: linear-gradient(90deg, #000, transparent 75%);
}

/* Login */
.auth-screen {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 75% 35%, rgba(76,145,135,.13), transparent 28%),
    radial-gradient(circle at 13% 80%, rgba(200,75,60,.08), transparent 24%),
    var(--night);
}
.auth-screen::before {
  content: "审";
  position: absolute;
  right: -0.12em;
  bottom: -0.36em;
  color: rgba(255,255,255,.025);
  font-family: var(--serif);
  font-size: min(62vw, 820px);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}
.auth-header, .auth-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px clamp(22px, 5vw, 72px);
}
.auth-header { border-bottom: 1px solid var(--line-dark); }
.review-brand { display: inline-flex; align-items: center; gap: 12px; }
.review-brand svg { width: 38px; height: 38px; fill: none; stroke: var(--gold); stroke-width: 1.3; }
.review-brand .brand-seal { fill: var(--red); stroke: none; }
.review-brand span { display: grid; gap: 3px; }
.review-brand b { font-size: 10px; letter-spacing: .22em; }
.review-brand small { color: rgba(255,255,255,.37); font-size: 8px; letter-spacing: .18em; }
.back-home { color: rgba(255,255,255,.48); font-size: 10px; letter-spacing: .1em; transition: color .2s ease; }
.back-home span { margin-right: 7px; color: var(--gold); }
.back-home:hover { color: #fff; }

.auth-main {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(390px, 1.15fr) minmax(360px, .72fr);
  align-items: center;
  gap: clamp(60px, 10vw, 160px);
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(60px, 9vh, 110px) clamp(22px, 5vw, 72px);
}
.auth-statement { max-width: 730px; }
.auth-index {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 0 0 40px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .2em;
}
.auth-index span { padding: 6px 8px; color: #fff; border: 1px solid rgba(255,255,255,.16); }
.auth-index i { width: 42px; height: 1px; background: var(--gold); }
.auth-statement h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(58px, 6.1vw, 94px);
  font-weight: 600;
  letter-spacing: -.07em;
  line-height: 1.1;
}
.auth-statement h1 span, .auth-statement h1 em { display: block; }
.auth-statement h1 em { color: var(--red); font-style: normal; }
.auth-statement > p:not(.auth-index) {
  max-width: 610px;
  margin: 31px 0 0;
  color: rgba(255,255,255,.53);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.95;
}
.auth-statement dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 55px 0 0; }
.auth-statement dl div { padding-top: 15px; border-top: 1px solid var(--line-dark); }
.auth-statement dt { color: var(--red); font-family: var(--display); font-size: 18px; }
.auth-statement dd { margin: 5px 0 0; color: rgba(255,255,255,.47); font-size: 10px; letter-spacing: .06em; }

.login-card {
  position: relative;
  width: min(450px, 100%);
  justify-self: end;
  padding: clamp(35px, 4.5vw, 56px);
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: 0 35px 90px rgba(0,0,0,.34);
}
.login-card::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 42px;
  height: 42px;
  border-right: 1px solid var(--red);
  border-bottom: 1px solid var(--red);
}
.login-seal {
  position: absolute;
  top: -23px;
  right: 34px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  border: 5px solid var(--night);
  background: var(--red);
  transform: rotate(4deg);
}
.login-seal span { font-family: var(--serif); font-size: 27px; font-weight: 800; }
.card-kicker { margin: 0 0 17px; color: var(--red-dark); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.login-card h2 { margin: 0; font-family: var(--serif); font-size: 37px; font-weight: 600; letter-spacing: -.04em; }
.card-intro { margin: 12px 0 31px; color: var(--ink-soft); font-family: var(--serif); font-size: 12px; line-height: 1.8; }
.login-card label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.password-field { position: relative; }
.password-field input {
  width: 100%;
  height: 54px;
  padding: 0 64px 0 15px;
  border: 1px solid var(--line-paper);
  border-radius: 0;
  outline: 0;
  background: var(--paper);
  font-size: 15px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.password-field input:focus { border-color: var(--red); box-shadow: inset 3px 0 var(--red); }
.password-field button {
  position: absolute;
  top: 0;
  right: 0;
  height: 54px;
  padding: 0 15px;
  border: 0;
  color: var(--red-dark);
  background: none;
  font-size: 10px;
}
.login-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 57px;
  margin-top: 14px;
  padding: 0 19px;
  border: 0;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  transition: background .2s ease, transform .2s var(--ease);
}
.login-button:hover { background: #d35748; transform: translateY(-1px); }
.login-button:disabled { cursor: wait; opacity: .65; }
.login-button i { font-size: 17px; font-style: normal; }
.form-status { min-height: 21px; margin: 10px 0 0; color: var(--red-dark); font-size: 10px; }
.privacy-note { display: flex; align-items: center; gap: 8px; margin: 19px 0 0; padding-top: 18px; color: var(--ink-soft); border-top: 1px solid var(--line-paper); font-size: 9px; line-height: 1.6; }
.privacy-note i { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(76,145,135,.12); }
.auth-footer { color: rgba(255,255,255,.27); border-top: 1px solid var(--line-dark); font-size: 8px; letter-spacing: .15em; }

/* Editorial workspace */
.editor-app { height: 100svh; overflow: hidden; color: var(--ink); background: var(--paper); }
.desk-header {
  position: relative;
  z-index: 60;
  display: grid;
  grid-template-columns: 290px minmax(220px, 1fr) auto;
  align-items: center;
  height: 72px;
  color: #fff;
  border-bottom: 1px solid var(--line-dark);
  background: var(--night);
}
.desk-brand-group { display: flex; align-items: center; height: 100%; padding: 0 25px; border-right: 1px solid var(--line-dark); }
.desk-brand { display: flex; align-items: center; gap: 11px; }
.desk-brand svg { width: 34px; height: 34px; fill: none; stroke: var(--gold); stroke-width: 1.3; }
.desk-brand svg circle:last-child { fill: var(--red); stroke: none; }
.desk-brand span { display: flex; align-items: baseline; gap: 9px; }
.desk-brand b { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.desk-brand small { color: var(--gold); font-size: 8px; letter-spacing: .14em; }
.sidebar-toggle { display: none; }
.desk-document { display: grid; min-width: 0; gap: 2px; padding: 0 28px; }
.desk-document span { color: var(--red); font-family: var(--display); font-size: 10px; letter-spacing: .1em; }
.desk-document strong { overflow: hidden; font-family: var(--serif); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.desk-actions { display: flex; align-items: center; gap: 10px; height: 100%; padding-right: 18px; }
.view-switcher { display: flex; padding: 3px; border: 1px solid var(--line-dark); background: rgba(255,255,255,.025); }
.view-switcher button { min-width: 48px; height: 30px; padding: 0 9px; border: 0; color: rgba(255,255,255,.42); background: transparent; font-size: 9px; }
.view-switcher button.is-active { color: var(--night); background: var(--paper); }
.icon-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-dark);
  color: rgba(255,255,255,.6);
  background: transparent;
  font-size: 9px;
}
.icon-action span { color: var(--gold); font-size: 15px; }
.icon-action b { font-weight: 500; }
.save-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 136px;
  height: 40px;
  padding: 0 13px;
  border: 0;
  color: #fff;
  background: var(--red);
  font-size: 10px;
  transition: background .2s ease, opacity .2s ease;
}
.save-button:disabled { color: rgba(255,255,255,.55); background: rgba(255,255,255,.08); cursor: default; }
.save-button:not(:disabled):hover { background: #d25647; }
.save-button kbd { margin-left: auto; padding: 2px 5px; color: rgba(255,255,255,.54); border: 1px solid rgba(255,255,255,.18); font-family: var(--sans); font-size: 7px; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.save-button.is-dirty .save-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(208,164,90,.12); }
.save-button.is-saving .save-dot { border: 1px solid rgba(255,255,255,.35); border-top-color: #fff; background: transparent; animation: spin .7s linear infinite; }

.desk-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: calc(100svh - 72px); }
.chapter-sidebar {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: #fff;
  border-right: 1px solid var(--line-dark);
  background: var(--night-soft);
}
.sidebar-heading { padding: 31px 27px 25px; border-bottom: 1px solid var(--line-dark); }
.sidebar-heading p { margin: 0 0 8px; color: var(--gold); font-size: 7px; font-weight: 800; letter-spacing: .2em; }
.sidebar-heading h2 { margin: 0; font-family: var(--serif); font-size: 27px; font-weight: 600; }
.sidebar-heading span { display: block; margin-top: 9px; color: rgba(255,255,255,.32); font-size: 8px; letter-spacing: .06em; }
.chapter-sidebar nav { min-height: 0; overflow: auto; }
.chapter-list { margin: 0; padding: 0; list-style: none; }
.chapter-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 25px 10px;
  color: rgba(255,255,255,.82);
  border-bottom: 1px solid rgba(255,255,255,.055);
}
.chapter-group:not(:first-child) { margin-top: 7px; border-top: 1px solid var(--line-dark); }
.chapter-group span { color: var(--gold); font-size: 7px; font-weight: 800; letter-spacing: .18em; }
.chapter-group strong { font-family: var(--serif); font-size: 14px; font-weight: 600; }
.chapter-item { position: relative; border-bottom: 1px solid var(--line-dark); }
.chapter-item button {
  display: grid;
  grid-template-columns: 33px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 22px 25px;
  border: 0;
  color: rgba(255,255,255,.62);
  text-align: left;
  background: transparent;
  transition: color .25s ease, background .25s ease;
}
.chapter-item.is-nested button { padding-left: 31px; }
.chapter-item button:hover { color: #fff; background: rgba(255,255,255,.035); }
.chapter-item.is-active button { color: #fff; background: rgba(255,255,255,.06); }
.chapter-item.is-active::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--red); }
.chapter-number { color: var(--red); font-family: var(--display); font-size: 17px; }
.chapter-copy { display: grid; min-width: 0; gap: 5px; }
.chapter-copy strong { overflow: hidden; font-family: var(--serif); font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.chapter-copy small { color: rgba(255,255,255,.32); font-size: 8px; letter-spacing: .05em; }
.chapter-unsaved { position: absolute; top: 17px; right: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.chapter-skeleton { display: grid; grid-template-columns: 25px 1fr; gap: 15px; padding: 24px 27px; border-bottom: 1px solid var(--line-dark); }
.chapter-skeleton i, .chapter-skeleton span, .chapter-skeleton b { height: 8px; background: rgba(255,255,255,.06); animation: shimmer 1.6s ease-in-out infinite; }
.chapter-skeleton i { width: 20px; }
.chapter-skeleton b { grid-column: 2; width: 55%; }
.workflow-note { display: flex; gap: 12px; margin: auto 19px 19px; padding: 16px; border: 1px solid var(--line-dark); background: rgba(0,0,0,.1); }
.workflow-note > span { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; color: var(--red); border: 1px solid var(--red); font-family: var(--serif); font-weight: 800; }
.workflow-note p { margin: 0; color: rgba(255,255,255,.37); font-family: var(--serif); font-size: 10px; line-height: 1.65; }
.workflow-note b { color: rgba(255,255,255,.68); font-weight: 600; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 19px; border-top: 1px solid var(--line-dark); }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,.38); font-size: 8px; }
.connection-state i { width: 6px; height: 6px; border-radius: 50%; background: #65ad7a; box-shadow: 0 0 0 4px rgba(101,173,122,.09); }
.connection-state.is-offline i { background: var(--red); }
.sidebar-footer button { padding: 5px; border: 0; color: rgba(255,255,255,.36); background: none; font-size: 8px; }
.sidebar-footer button:hover { color: #fff; }
.sidebar-scrim { display: none; }

.workbench { display: grid; grid-template-rows: 46px minmax(0, 1fr); min-width: 0; min-height: 0; background: #d8d0c2; }
.document-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 20px; border-bottom: 1px solid rgba(23,33,31,.13); background: #e7dfd1; }
.document-meta { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 8px; letter-spacing: .05em; }
.document-meta span:first-child { color: var(--red-dark); font-weight: 800; }
.document-meta i { width: 2px; height: 2px; border-radius: 50%; background: var(--ink-soft); opacity: .45; }
.document-tools { display: flex; gap: 18px; }
.document-tools button { padding: 4px 0; border: 0; border-bottom: 1px solid transparent; color: var(--ink-soft); background: none; font-size: 8px; }
.document-tools button:hover { color: var(--red-dark); border-color: var(--red); }

.writing-stage { display: grid; min-width: 0; min-height: 0; overflow: hidden; }
.writing-stage[data-layout="split"] { grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr); }
.writing-stage[data-layout="preview"], .writing-stage[data-layout="edit"] { grid-template-columns: 1fr; }
.writing-stage[data-layout="preview"] .editing-pane, .writing-stage[data-layout="edit"] .reading-pane { display: none; }
.reading-pane, .editing-pane { min-width: 0; min-height: 0; overflow: auto; }
.reading-pane { position: relative; padding: 28px clamp(26px, 4vw, 62px) 70px; background: var(--paper-bright); }
.writing-stage[data-layout="split"] .reading-pane { border-right: 1px solid rgba(23,33,31,.18); }
.paper-ruler { display: flex; align-items: center; gap: 13px; max-width: 760px; margin: 0 auto 48px; color: var(--ink-soft); font-size: 7px; font-weight: 800; letter-spacing: .18em; }
.paper-ruler i { flex: 1; height: 1px; background: var(--line-paper); }
.paper-ruler b { color: var(--red); font-family: var(--display); font-size: 18px; font-weight: 400; }
.article-preview { max-width: 760px; margin: 0 auto; padding-bottom: 100px; color: var(--ink); font-family: var(--serif); }
.article-preview > h1 { margin: 0 0 44px; font-size: clamp(35px, 4vw, 55px); font-weight: 600; letter-spacing: -.05em; line-height: 1.25; }
.article-preview > h1::after { content: ""; display: block; width: 68px; height: 3px; margin-top: 24px; background: linear-gradient(90deg, var(--red), var(--gold)); }
.article-preview h2 {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 68px 0 30px;
  color: var(--red-dark);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.article-preview h2::after { content: ""; flex: 1; height: 1px; background: var(--line-paper); }
.article-preview h3 { margin: 50px 0 24px; font-size: 28px; font-weight: 600; letter-spacing: -.03em; }
.article-preview h4 { margin: 38px 0 18px; font-size: 20px; font-weight: 600; }
.article-preview p { margin: 0 0 1.05em; font-size: 17px; line-height: 2.02; }
.article-preview strong { color: var(--red-dark); font-weight: 700; }
.article-preview em { text-decoration: underline; text-decoration-color: rgba(200,75,60,.35); text-underline-offset: 4px; }
.article-preview code { padding: 2px 5px; color: var(--red-dark); background: rgba(200,75,60,.07); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82em; }
.article-preview blockquote { position: relative; margin: 30px 0 36px; padding: 20px 24px 20px 30px; color: var(--ink-soft); border-left: 3px solid var(--gold); background: rgba(208,164,90,.08); }
.article-preview blockquote p { margin: 0; font-size: 14px; line-height: 1.85; }
.article-preview ul, .article-preview ol { margin: 20px 0 28px; padding-left: 1.6em; }
.article-preview li { margin: 8px 0; font-size: 16px; line-height: 1.85; }
.article-preview hr { width: 90px; margin: 55px auto; border: 0; border-top: 1px solid var(--line-paper); }
.article-preview a { color: var(--red-dark); border-bottom: 1px solid rgba(141,48,40,.3); }
.loading-copy { display: grid; gap: 20px; }
.loading-copy i { display: block; width: 100%; height: 13px; background: rgba(23,33,31,.06); animation: shimmerPaper 1.7s ease-in-out infinite; }
.loading-copy i:nth-child(2) { width: 86%; }
.loading-copy i:nth-child(3) { width: 94%; }
.loading-copy i:nth-child(4) { width: 72%; }
.loading-copy i:nth-child(5) { width: 89%; }

.editing-pane { display: grid; grid-template-rows: 44px minmax(0, 1fr) 34px; color: rgba(255,255,255,.74); background: #111d1b; }
.editor-ruler { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; color: rgba(255,255,255,.28); border-bottom: 1px solid var(--line-dark); font-size: 7px; font-weight: 800; letter-spacing: .17em; }
.local-recovery { display: inline-flex; align-items: center; gap: 7px; color: var(--gold); letter-spacing: .05em; }
.local-recovery i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.editing-pane textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  padding: 30px clamp(22px, 3.2vw, 50px) 80px;
  border: 0;
  border-radius: 0;
  outline: 0;
  color: rgba(255,255,255,.78);
  background: transparent;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Noto Sans Mono CJK SC", monospace;
  font-size: 13px;
  line-height: 2;
  tab-size: 2;
  caret-color: var(--gold);
}
.editing-pane textarea:disabled { cursor: wait; opacity: .45; }
.editor-metrics { display: flex; align-items: center; gap: 16px; padding: 0 20px; color: rgba(255,255,255,.25); border-top: 1px solid var(--line-dark); font-size: 7px; letter-spacing: .05em; }
.editor-metrics span:last-child { margin-left: auto; }

/* Dialogs and notices */
dialog { color: var(--ink); border: 0; border-radius: 0; background: var(--paper-bright); box-shadow: 0 35px 100px rgba(0,0,0,.45); }
dialog::backdrop { background: rgba(5,12,11,.78); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.history-dialog { width: min(580px, calc(100% - 34px)); max-height: min(760px, calc(100svh - 42px)); padding: 0; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; padding: 30px 34px 23px; color: #fff; background: var(--night); }
.dialog-head p { margin: 0 0 7px; color: var(--gold); font-size: 7px; font-weight: 800; letter-spacing: .18em; }
.dialog-head h2 { margin: 0; font-family: var(--serif); font-size: 29px; font-weight: 600; }
.dialog-head button { width: 36px; height: 36px; border: 1px solid var(--line-dark); color: rgba(255,255,255,.55); background: transparent; font-size: 22px; }
.dialog-intro { margin: 0; padding: 22px 34px; color: var(--ink-soft); border-bottom: 1px solid var(--line-paper); font-family: var(--serif); font-size: 11px; line-height: 1.75; }
.history-list { max-height: 470px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.history-list li { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 17px; padding: 18px 34px; border-bottom: 1px solid var(--line-paper); }
.history-version { color: var(--red); font-family: var(--display); font-size: 22px; }
.history-copy { display: grid; gap: 4px; }
.history-copy b { font-family: var(--serif); font-size: 12px; font-weight: 600; }
.history-copy small { color: var(--ink-soft); font-size: 8px; }
.history-list button { padding: 8px 10px; border: 1px solid var(--line-paper); color: var(--red-dark); background: transparent; font-size: 8px; }
.history-list button:hover { color: #fff; border-color: var(--red); background: var(--red); }
.dialog-empty { padding: 40px; color: var(--ink-soft); text-align: center; font-family: var(--serif); }

.conflict-dialog { width: min(480px, calc(100% - 34px)); padding: 42px; text-align: center; }
.conflict-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 22px; color: #fff; border-radius: 50%; background: var(--red); font-family: var(--display); font-size: 30px; }
.conflict-dialog h2 { margin: 0; font-family: var(--serif); font-size: 30px; }
.conflict-dialog > p { color: var(--ink-soft); font-family: var(--serif); font-size: 12px; line-height: 1.8; }
.conflict-dialog > div:not(.conflict-mark) { display: flex; gap: 10px; margin-top: 24px; }
.conflict-dialog button { min-height: 42px; flex: 1; border: 1px solid var(--line-paper); background: transparent; font-size: 9px; }
.conflict-dialog .conflict-primary { color: #fff; border-color: var(--red); background: var(--red); }
.conflict-dialog .conflict-close { margin-top: 10px; min-height: 28px; color: var(--ink-soft); border: 0; }
.toast-region { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast {
  min-width: 230px;
  max-width: 360px;
  padding: 13px 16px;
  color: #fff;
  border-left: 3px solid var(--gold);
  background: rgba(13,23,22,.96);
  box-shadow: 0 14px 40px rgba(0,0,0,.28);
  font-family: var(--serif);
  font-size: 11px;
  animation: toastIn .35s var(--ease);
}
.toast.is-error { border-color: var(--red); }
.no-script { position: fixed; z-index: 500; inset: auto 18px 18px; margin: 0; padding: 13px 16px; color: #fff; background: var(--red-dark); font-size: 11px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 50% { background: rgba(255,255,255,.11); } }
@keyframes shimmerPaper { 50% { background: rgba(23,33,31,.11); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 1120px) {
  .desk-header { grid-template-columns: 260px minmax(150px, 1fr) auto; }
  .desk-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .desk-brand-group { padding-inline: 19px; }
  .view-switcher button { min-width: 43px; }
  .save-button { min-width: 112px; }
  .save-button kbd, .history-trigger b { display: none; }
  .writing-stage[data-layout="split"] { grid-template-columns: 1fr 1fr; }
  .article-preview p { font-size: 16px; }
}

@media (max-width: 920px) {
  .auth-main { grid-template-columns: 1fr; max-width: 720px; gap: 65px; }
  .auth-statement h1 { font-size: clamp(58px, 10vw, 86px); }
  .login-card { justify-self: start; }
  .desk-header { grid-template-columns: auto minmax(0, 1fr) auto; }
  .desk-brand-group { border-right: 0; }
  .sidebar-toggle { position: relative; display: block; width: 38px; height: 38px; margin-right: 8px; padding: 0; border: 1px solid var(--line-dark); background: transparent; }
  .sidebar-toggle i { position: absolute; left: 10px; width: 17px; height: 1px; background: #fff; transition: transform .25s ease, top .25s ease; }
  .sidebar-toggle i:first-of-type { top: 14px; }
  .sidebar-toggle i:last-of-type { top: 22px; }
  .sidebar-toggle[aria-expanded="true"] i:first-of-type { top: 18px; transform: rotate(45deg); }
  .sidebar-toggle[aria-expanded="true"] i:last-of-type { top: 18px; transform: rotate(-45deg); }
  .desk-layout { grid-template-columns: 1fr; }
  .chapter-sidebar { position: fixed; z-index: 55; top: 72px; bottom: 0; left: 0; width: min(330px, 88vw); transform: translateX(-102%); transition: transform .35s var(--ease); }
  .chapter-sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 50; inset: 72px 0 0; display: block; border: 0; background: rgba(5,12,11,.66); }
  .workbench { grid-column: 1; }
}

@media (max-width: 720px) {
  .auth-header { padding: 20px; }
  .review-brand small { display: none; }
  .back-home { font-size: 0; }
  .back-home span { font-size: 18px; }
  .auth-main { padding: 50px 20px 70px; }
  .auth-statement h1 { font-size: clamp(53px, 16vw, 76px); }
  .auth-statement dl { grid-template-columns: 1fr; gap: 13px; margin-top: 38px; }
  .auth-statement dl div { display: grid; grid-template-columns: 35px 1fr; align-items: center; }
  .auth-statement dd { margin: 0; }
  .login-card { padding: 38px 28px; }
  .auth-footer { padding-inline: 20px; }
  .auth-footer span:last-child { display: none; }
  .desk-header { height: 64px; }
  .desk-brand-group { padding-left: 11px; }
  .desk-brand svg { display: none; }
  .desk-brand span { display: grid; gap: 0; }
  .desk-brand b { font-size: 13px; }
  .desk-brand small { font-size: 6px; }
  .desk-document { padding: 0 10px; }
  .desk-document span { font-size: 7px; }
  .desk-document strong { font-size: 11px; }
  .desk-actions { gap: 6px; padding-right: 8px; }
  .view-switcher { position: fixed; z-index: 45; right: 13px; bottom: 13px; border-color: rgba(255,255,255,.18); background: rgba(13,23,22,.96); box-shadow: 0 10px 35px rgba(0,0,0,.3); }
  .view-switcher button { color: rgba(255,255,255,.52); }
  .view-switcher button[data-view="split"] { display: none; }
  .icon-action { display: none; }
  .save-button { min-width: 91px; height: 37px; padding-inline: 10px; }
  .chapter-sidebar { top: 64px; }
  .sidebar-scrim { top: 64px; }
  .desk-layout { height: calc(100svh - 64px); }
  .workbench { grid-template-rows: 42px minmax(0, 1fr); }
  .document-toolbar { padding-inline: 12px; }
  .document-meta i, .document-meta span:last-child { display: none; }
  .document-tools { gap: 12px; }
  .writing-stage[data-layout="split"] { grid-template-columns: 1fr; }
  .writing-stage[data-layout="split"] .editing-pane { display: none; }
  .reading-pane { padding: 22px 22px 60px; }
  .paper-ruler { margin-bottom: 33px; }
  .article-preview > h1 { font-size: 36px; }
  .article-preview p { font-size: 16px; line-height: 1.95; }
  .editing-pane textarea { padding: 22px 18px 70px; font-size: 12px; }
  .editor-metrics span:last-child { display: none; }
  .toast-region { right: 13px; bottom: 62px; left: 13px; }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 430px) {
  .desk-brand small { display: none; }
  .desk-document strong { max-width: 118px; }
  .document-tools button:first-child { display: none; }
  .save-button { min-width: 82px; }
  .save-button .save-dot { display: none; }
  .history-list li { grid-template-columns: 44px 1fr; padding-inline: 22px; }
  .history-list button { grid-column: 2; justify-self: start; }
  .conflict-dialog { padding: 34px 24px; }
  .conflict-dialog > div:not(.conflict-mark) { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .desk-header, .chapter-sidebar, .document-toolbar, .editing-pane, .view-switcher, .toast-region { display: none !important; }
  .editor-app, .desk-layout, .workbench, .writing-stage, .reading-pane { display: block; height: auto; overflow: visible; background: #fff; }
  .article-preview { max-width: 760px; }
}
