@font-face {
  font-family: "Special Elite";
  src: url("fonts/SpecialElite-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  font-family: "Courier Prime", "Courier New", monospace;
  color-scheme: light;
  background: #f1ede3;
  --print-size: clamp(19px, 1.68vw, 27px);
  --cell-ratio: .65;
  --line-height: clamp(26px, 2.2vw, 35px);
  --line-width: min(40vw, 630px);
  --rail-y: 55.2%;
  --rail-gap: clamp(53px, 9.2vh, 92px);
  --paper-crown: clamp(66px, 10vh, 116px);
  --paper: #f1ede3;
  --ink: #191612;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
button:disabled { cursor: default; }

.instrument {
  /* The paper, rail and lamp use the same carriage coordinate. */
  --head-x: calc((100% - var(--line-width)) / 2);
  --paper-shift: 0px;
  --carriage-time: 82ms;
  --carriage-curve: cubic-bezier(.17,.78,.3,1);
  --controls: #37342e;
  --chrome-surface: #e7e0d2ac;
  --chrome-border: #746e614d;
  --chrome-hover: #332e2220;
  --chrome-mark: #645942;
  position: relative;
  isolation: isolate;
  z-index: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  color: var(--controls);
  background: #2b2925;
}
.instrument.spotlight {
  color-scheme: dark;
  --controls: #eee6d4;
  --chrome-surface: #3b3934d9;
  --chrome-border: #e9d9ba56;
  --chrome-hover: #f2e2bc22;
  --chrome-mark: #e5cc97;
}
.paper {
  position: absolute;
  inset: 0;
  cursor: text;
  font-size: var(--print-size);
  color: var(--ink);
  touch-action: manipulation;
}
.paper-stock {
  --sheet-lift: 0px;
  --curl-left: 0px;
  --curl-right: 0px;
  --left-curl-depth: clamp(55px, 8.5vh, 94px);
  --right-curl-depth: clamp(75px, 11.5vh, 126px);
  --curl-motion: 310ms cubic-bezier(.2,.68,.24,1);
  position: absolute;
  inset: var(--sheet-lift) 0 calc(0px - var(--sheet-lift));
  pointer-events: none;
  background: var(--paper);
  overflow: hidden;
  border-radius: var(--curl-left) var(--curl-right) 0 0 / var(--left-curl-depth) var(--right-curl-depth) 0 0;
  transition: top var(--curl-motion), bottom var(--curl-motion), border-radius var(--curl-motion);
}
.editor-focused.has-writing .paper-stock {
  --sheet-lift: var(--paper-crown);
  --curl-left: clamp(52px, 8vw, 155px);
  --curl-right: clamp(84px, 11vw, 205px);
}
.paper-stock::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: clamp(25px, 6vh, 55px);
  background: linear-gradient(#634f3330, #fff9e522 24%, transparent);
  opacity: 0;
  transition: opacity 220ms ease;
}
.editor-focused.has-writing .paper-stock::after { opacity: 1; }
.spotlight.editor-focused.has-writing .paper-stock::after { opacity: .34; }
.paper-texture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .87;
}
.feeding .paper-texture { animation: paper-ratchet 180ms ease-out; }
@keyframes paper-ratchet {
  25% { transform: translateY(-2.5px) scale(1.012); }
  65% { transform: translateY(.4px) scale(1.003); }
  to { transform: none; }
}
.paper-tear {
  position: absolute;
  inset: 0 0 calc(100% - var(--rail-y));
  pointer-events: none;
  overflow: hidden;
  background:
    linear-gradient(0deg, #9a80653a, transparent 10%),
    url("paper.webp") center / cover, var(--paper);
  clip-path: polygon(
    0 0, 100% 0, 100% 98.6%, 94% 99.1%, 89% 98.7%, 84% 99.4%,
    78% 98.8%, 73% 99.5%, 68% 99.2%, 63% 99.7%, 58% 99.3%, 52% 99.8%,
    47% 99.2%, 42% 99.7%, 36% 99.2%, 30% 99.8%, 24% 99.3%, 18% 99.7%,
    12% 99.2%, 6% 99.9%, 0 99.4%
  );
  transform-origin: 85% 100%;
  animation: tear-away 455ms cubic-bezier(.36,.06,.29,1) both;
}
.paper-tear.curled {
  top: var(--paper-crown);
  border-radius: clamp(52px, 8vw, 155px) clamp(84px, 11vw, 205px) 0 0
    / clamp(55px, 8.5vh, 94px) clamp(75px, 11.5vh, 126px) 0 0;
}
.paper-tear .viewport { bottom: var(--rail-gap); }
.paper-tear.curled .viewport {
  top: max(3px, calc(clamp(65px, 11vh, 109px) - var(--paper-crown)));
}
.spotlight .paper-tear {
  background-image:
    radial-gradient(ellipse 34% 68% at var(--tear-head, 50%) 100%, #fff0cd36, #16151182 63%, #171613cb),
    linear-gradient(#1514129e, #1514129e), url("paper.webp");
}
@keyframes tear-away {
  0% { transform: none; }
  18% { transform: translate(1%, -4%) rotate(-1.5deg); }
  50% { transform: translate(8%, -32%) rotate(5deg); opacity: .95; }
  100% { transform: translate(25%, -93%) rotate(13deg); opacity: 0; }
}
.paper-shade, .paper-light { position: absolute; opacity: 0; pointer-events: none; }
.paper-shade {
  inset: 0;
  background: #121210cf;
  transition: opacity .34s ease;
}
.paper-light {
  --light-width: clamp(420px, 62vw, 1040px);
  left: var(--head-x);
  /* Keep the beam origin on the carriage while the sheet rises. */
  bottom: calc(100% - var(--rail-y) + 17px + var(--sheet-lift));
  width: var(--light-width);
  height: clamp(180px, 34vh, 355px);
  transform: translateX(-50%);
  border-radius: 42% 42% 47% 47% / 58% 58% 38% 38%;
  background: radial-gradient(ellipse 48% 95% at 50% 102%, #ffe9c2 3%, #e9d1a9e6 22%, #e2c69ca3 40%, #c9aa7877 55%, #ba9e5618 81%, transparent 100%);
  mask-image: conic-gradient(from -63deg at 50% 105%, transparent, #000 12deg 114deg, transparent 126deg);
  transition: left var(--carriage-time) var(--carriage-curve), bottom var(--curl-motion), opacity .36s;
}
.spotlight .paper-shade, .spotlight .paper-light { opacity: 1; }
.spotlight .paper { --ink: #17130f; }

.utility {
  position: absolute;
  z-index: 2;
  top: clamp(14px, 3.35vh, 37px);
  inset-inline: clamp(13px, 2.45vw, 44px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(8px, 1.55vw, 25px);
}
.editor-focused.has-writing .utility {
  --chrome-hover: #f2e2bc22;
  color: #efe6d4;
}
.book-context { min-width: 0; }
.book-tab {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: clamp(12px, 1.05vw, 16px);
  text-align: left;
}
.book-tab:hover:enabled { background: var(--chrome-hover); }
#active-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-icon {
  width: 13px;
  height: 15px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-left-width: 3px;
  border-radius: 2px;
  opacity: .83;
}
.writing-status {
  margin: 1px 6px 0;
  font-size: clamp(10px, .86vw, 13px);
  white-space: nowrap;
  opacity: .8;
}
#save-state[data-error=true] { color: #a03924; font-weight: bold; }
.spotlight #save-state[data-error=true], .editor-focused.has-writing #save-state[data-error=true] { color: #f7ae93; }
.utility-actions { display: flex; align-items: center; gap: clamp(4px, .9vw, 14px); flex: 0 0 auto; }
.account-tab { padding: 6px 7px; min-height: 34px; border-radius: 5px; font-size: 12px; white-space: nowrap; }
.account-tab:hover { background: var(--chrome-hover); }
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
}
.icon-button:hover:enabled { background: var(--chrome-hover); }
.icon-button:disabled { opacity: .48; }
.counts {
  min-width: 8ch;
  text-align: center;
  font-size: clamp(13px, 1.05vw, 17px);
  letter-spacing: .075em;
  font-variant-numeric: tabular-nums;
}
.export-icon { display: block; font: 300 25px/1 system-ui, sans-serif; }
.export-icon { width: 20px; text-align: center; border-bottom: 1px solid; }
.find-icon { position: relative; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; }
.find-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 10px;
  width: 7px;
  height: 1px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

.viewport {
  position: absolute;
  top: max(calc(var(--paper-crown) + 3px), clamp(65px, 11vh, 109px));
  bottom: calc(100% - var(--rail-y) + var(--rail-gap));
  left: calc((100% - var(--line-width)) / 2);
  width: var(--line-width);
  line-height: var(--line-height);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent, #000 1.3em);
  pointer-events: none;
}
.track {
  position: relative;
  flex: 1;
  height: var(--line-height);
  transform: translateY(var(--paper-shift));
  transition: transform 180ms cubic-bezier(.21,.74,.3,1);
}
.print-line {
  position: absolute;
  inset-inline: 0;
  height: var(--line-height);
  white-space: pre;
}
.print-cell {
  --ink-drift: 0px;
  --ink-pressure: 1;
  position: relative;
  top: var(--ink-drift);
  display: inline-block;
  width: calc(1em * var(--cell-ratio) * var(--cells, 1));
  white-space: pre;
  text-shadow: -.23px .28px #21181180, .22px -.16px #3a292176;
  -webkit-text-stroke: .17px currentColor;
  font-family: "Special Elite", "Courier Prime", "Courier New", monospace;
  font-weight: 600;
  text-align: center;
  vertical-align: top;
  opacity: var(--ink-pressure);
}
.print-cell[data-ink="1"] { --ink-pressure: .94; --ink-drift: -.3px; }
.print-cell[data-ink="2"] { --ink-pressure: .84; --ink-drift: .36px; }
.print-cell[data-ink="3"] { --ink-pressure: .91; --ink-drift: -.12px; }
.print-cell.selected { background: #aa774f65; border-radius: 1px; opacity: 1; top: 0; }
.spotlight .print-cell.selected { background: #f0d4ab9c; }
.print-cell.impression { animation: ink-hit 142ms ease-out both; }
@keyframes ink-hit {
  from { transform: translateY(1px) scale(1.06,.91); opacity: .46; }
  25% { opacity: 1; }
  to { transform: none; opacity: var(--ink-pressure); }
}
.paper-placeholder {
  position: absolute;
  left: .5em;
  top: 0;
  color: #62594b;
  opacity: .88;
  white-space: nowrap;
}
.spotlight .paper-placeholder { color: #251e15; }
.print-caret {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.5px;
  height: var(--line-height);
  border-block: .15em solid transparent;
  background: #62513e content-box;
  opacity: .24;
  z-index: 2;
}
.editor-focused .print-caret { opacity: .88; }
#editor {
  position: absolute;
  left: calc((100% - var(--line-width)) / 2);
  bottom: calc(100% - var(--rail-y) + var(--rail-gap));
  width: 1em;
  height: var(--line-height);
  font: inherit;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  resize: none;
  overflow: hidden;
}

.roller {
  --rail-thickness: clamp(11px, 1.3vw, 20px);
  position: absolute;
  top: var(--rail-y);
  inset-inline: 0;
  height: var(--rail-thickness);
  border: 1px solid #343430;
  transform: translateY(-50%);
  background: linear-gradient(#5f615e, #a3a8a5 25%, #4c504e 55%, #242625 88%, #383934);
  box-shadow: 0 5px 10px #302e2a52, inset 0 1px #e4e7db60;
  pointer-events: none;
}
.roller i {
  position: absolute;
  top: 50%;
  left: clamp(6px, .8vw, 13px);
  transform: translateY(-50%);
  width: clamp(9px, 1vw, 15px);
  height: calc(var(--rail-thickness) + 6px);
  border: 1px solid #2d2f2c;
  border-radius: 3px;
  background: linear-gradient(#4f5250, #343632 56%, #232420);
  box-shadow: inset 0 1px 2px #ffffff33, 0 2px 4px #201c187a;
}
.roller i + i { left: auto; right: clamp(6px, .8vw, 13px); }
.spotlight .roller { background: linear-gradient(#323332, #52534d 25%, #2a2c29 53%, #10110f 88%); }
.feeding .roller { animation: feed-rail 230ms ease-out; }
@keyframes feed-rail {
  26% { filter: brightness(1.32); transform: translateY(calc(-50% + 1px)); }
  55% { transform: translateY(calc(-50% - .6px)); }
}

.carriage {
  --head-height: clamp(32px, 3.5vw, 50px);
  position: absolute;
  z-index: 1;
  left: var(--head-x);
  top: calc(var(--rail-y) - var(--head-height) / 2);
  width: clamp(82px, 9.7vw, 140px);
  height: var(--head-height);
  transform: translateX(-50%);
  transition: left var(--carriage-time) var(--carriage-curve);
  pointer-events: none;
  filter: drop-shadow(0 4px 5px #1c1a1461);
}
.carriage-face {
  position: absolute;
  inset: 0;
  border: 1px solid #a29b89;
  border-radius: 999px;
  background: linear-gradient(#f4efe2, #e9e2d2 46%, #d7cdb8 84%, #bcb29a);
  box-shadow: inset 0 2px 3px #fffaf0, inset 0 -2px 5px #6e63473b;
}
.indicators {
  position: absolute;
  right: 19%;
  top: 50%;
  display: flex;
  gap: clamp(3px, .4vw, 6px);
  transform: translateY(-50%);
}
.indicator {
  width: clamp(4px, .46vw, 7px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #8d806a;
  box-shadow: inset 0 0 0 1px #4e41385e;
}
.strike-light { background: #876347; }
.bell-light { background: #8f645b; }
.editor-focused .ready-light { background: #8fba74; box-shadow: 0 0 3px #91b67da6, inset 0 0 0 1px #658951; }
.striker {
  position: absolute;
  bottom: 89%;
  left: 50%;
  width: clamp(7px, .85vw, 13px);
  height: clamp(22px, 4.65vh, 47px);
  transform: translateX(-50%);
  transform-origin: center bottom;
  background: linear-gradient(90deg, #6e706c, #cacfca 28%, #a9aba5 65%, #656a64);
  border: 1px solid #676a624b;
  border-radius: 2px 2px 0 0;
  box-shadow: 1px 0 4px #1615124f;
}
.striker i {
  position: absolute;
  top: 0;
  inset-inline: -1px;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(#e4e6e1, #767b76);
}
.spotlight .carriage-face {
  border-color: #5a5143;
  background: linear-gradient(#a79c86, #8c806d 52%, #645a4c);
  box-shadow: inset 0 1px 2px #c8bba2aa, inset 0 -2px 5px #231c1588;
}
.spotlight .striker { background: linear-gradient(90deg, #424540, #a3a69d 48%, #51564e); }
.striking .striker { animation: strike 123ms cubic-bezier(.19,.6,.32,1); }
.striking .strike-light { animation: flash 123ms ease-out; }
.correcting .striker { animation: correction 123ms ease-out; }
.margin-bell .bell-light { animation: flash 380ms steps(2, jump-none); }
@keyframes strike {
  23% { transform: translate(-50%,-8px) scaleY(1.09); filter: brightness(1.34); }
  55% { transform: translate(-50%,2px) scaleY(.94); }
  78% { transform: translate(-50%,-1px) scaleY(1.02); }
}
@keyframes correction { 22% { transform: translate(-50%,2px) scaleY(.9); } }
@keyframes flash { 26%, 68% { background: #fff1c4; box-shadow: 0 0 7px 2px #ffb657; } }

.switches {
  z-index: 2;
  position: absolute;
  bottom: clamp(19px, 5.15vh, 56px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--chrome-border);
  border-radius: 12px;
  background: var(--chrome-surface);
  box-shadow: inset 0 1px #fff5;
}
.switch {
  position: relative;
  padding: 8px clamp(10px, 2.05vw, 33px);
  border-radius: 8px;
  font-size: clamp(12px, 1.05vw, 17px);
  line-height: 1.35;
  min-height: 36px;
}
.switch:hover { background: var(--chrome-hover); }
.switch::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 3px;
  height: 3px;
  transform: translateX(-50%);
  background: var(--chrome-mark);
  border-radius: 50%;
  opacity: .16;
}
.switch[aria-pressed=true]::after { opacity: .9; }
.switch:active, .icon-button:active { transform: translateY(1px); }

dialog:not([open]) { display: none; }
dialog {
  --panel-ink: #302920;
  --panel-muted: #6b6050;
  --panel-fill: #f4efe3;
  --panel-rule: #80725c65;
  --panel-hover: #7b63431a;
  --panel-selected: #d4c5ad6b;
  z-index: 4;
  position: fixed;
  inset: 50% auto auto 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  color: var(--panel-ink);
  background: var(--panel-fill);
  border: 1px solid var(--panel-rule);
  border-radius: 12px;
  padding: 23px;
  box-shadow: 0 22px 60px #29241f54;
}
#remove-dialog { z-index: 5; }
.instrument.spotlight ~ dialog {
  color-scheme: dark;
  --panel-ink: #eee3cc;
  --panel-muted: #c1b39a;
  --panel-fill: #302d27;
  --panel-rule: #d0bb9361;
  --panel-hover: #eadacf16;
  --panel-selected: #a8957452;
}
dialog::backdrop { background: #27241f6a; }
dialog h2 { font-size: 19px; margin: 0 0 12px; }
dialog p { font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; }
.dialog-actions button { padding: 9px 12px; border: 1px solid #63594978; border-radius: 6px; font-size: 13px; }
.dialog-actions .confirm { background: #494436; border-color: #494436; color: #fff8ea; }

.library-panel {
  width: min(445px, 100%);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  inset: 0 auto 0 0;
  position: fixed;
  transform: none;
  border-radius: 0 12px 12px 0;
  padding: clamp(17px, 4vw, 30px);
  overflow: auto;
  overscroll-behavior: contain;
}
.panel-heading, .section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}
.panel-heading h2, .section-heading h3 { margin: 0; overflow-wrap: anywhere; }
.panel-heading h2 { font-size: clamp(18px, 2vw, 23px); }
.section-heading h3 { font-size: 16px; }
.close-panel { width: 34px; height: 34px; border-radius: 5px; font: 400 23px/1 system-ui, sans-serif; }
.book-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 13px;
}
.field { display: grid; gap: 6px; color: var(--panel-muted); font-size: 12px; min-width: 0; }
.field input, .field select {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--panel-rule);
  border-radius: 5px;
  padding: 8px 9px;
  color: var(--panel-ink);
  background: var(--panel-fill);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}
.field :is(input, select):focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.panel-button, .quiet-button {
  min-height: 37px;
  padding: 7px 9px;
  border: 1px solid var(--panel-rule);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}
.quiet-button { border-color: transparent; }
.panel-button:disabled, .quiet-button:disabled { opacity: .4; }
.panel-button:hover:enabled, .quiet-button:hover:enabled, .close-panel:hover { background: var(--panel-hover); }
dialog .panel-note { margin: 8px 0 0; font-size: 12px; color: var(--panel-muted); }
.chapter-section { margin-top: 20px; padding-block: 17px 13px; border-block: 1px solid var(--panel-rule); }
.chapter-section .section-heading { margin-bottom: 11px; }
.chapter-list, .find-results { list-style: none; padding: 0; margin: 0 0 16px; }
.chapter-list { border-top: 1px solid var(--panel-rule); }
.chapter-list li { border-bottom: 1px solid var(--panel-rule); }
.chapter-link {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 2.2ch minmax(0, 1fr) auto;
  align-items: center;
  text-align: left;
  gap: 11px;
  padding: 7px 8px;
  font-size: 13px;
}
.chapter-link span:nth-child(2) { overflow-wrap: anywhere; }
.chapter-link[aria-current=true] { background: var(--panel-selected); font-weight: bold; }
.chapter-link:hover { background: var(--panel-hover); }
.chapter-order, .chapter-words { color: var(--panel-muted); font-size: 11px; }
.inline-actions, .library-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.library-actions { margin-top: 14px; justify-content: space-between; }
dialog .panel-message { margin: 11px 0 7px; font-size: 12px; font-weight: bold; }
.panel-message:empty, #find-feedback:empty { display: none; }
.find-panel { width: min(560px, calc(100vw - 32px)); max-height: 80dvh; overflow: auto; }
.find-results { display: grid; gap: 5px; margin: 10px 0 0; }
.search-hit, .export-choice {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid var(--panel-rule);
  border-radius: 5px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.search-hit:hover, .export-choice:hover { background: var(--panel-hover); }
.search-hit span:first-child { font-weight: bold; }
.search-hit span + span, .export-choice span { color: var(--panel-muted); line-height: 1.4; }
.export-options { display: grid; gap: 8px; }
.page-layout-panel { width: min(1020px, calc(100vw - 30px)); }
.page-layout {
  display: grid;
  grid-template-columns: minmax(205px, 235px) minmax(0, 1fr);
  gap: clamp(14px, 2.4vw, 26px);
  align-items: start;
}
.page-layout-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.page-layout-author, .layout-check, .page-layout-fields > button, .page-layout-fields > p { grid-column: 1 / -1; }
.layout-check { display: flex; align-items: center; gap: 6px; min-height: 23px; font-size: 12px; }
.layout-check input { accent-color: currentColor; }
.page-layout-fields > button { margin-top: 3px; }
.page-layout-fields > .panel-note { margin-top: 0; }
.book-preview {
  color-scheme: light;
  min-width: 0;
  max-height: min(71dvh, 700px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #e3ded2;
  border: 1px solid #80725c65;
  border-radius: 6px;
  padding: clamp(8px, 2vw, 18px);
}
.book-proof {
  font-family: var(--book-font);
  font-size: var(--book-font-size);
  line-height: var(--book-line-height);
  color: #211e18;
  overflow-wrap: anywhere;
  tab-size: 4;
}
.book-preview .book-proof {
  background: #fffcf4;
  max-width: var(--book-width);
  width: 100%;
  min-height: 420px;
  margin-inline: auto;
  padding: clamp(13px, 5vw, var(--book-margin));
  box-shadow: 0 2px 8px #4b3e2a1f;
}
.book-title-page, .book-imprint { text-align: center; }
.book-preview .book-title-page {
  padding-block: clamp(32px, 15vh, 120px) clamp(42px, 21vh, 168px);
  border-bottom: 1px solid #80725c65;
}
.book-proof h1, .book-proof h2 { line-height: 1.2; margin: 0; }
.book-proof h1 { font-size: 1.9em; }
.book-imprint h1 { font-size: 1.55em; }
.book-proof h2 { font-size: 1.27em; margin-bottom: .85em; }
.book-proof :is(header, section) > p { font: inherit; margin: 0; }
.book-proof header > p { margin-top: .6em; }
.book-proof section { margin-top: 2.2em; }
.book-preview .chapter-page-breaks .book-proof-chapter + .book-proof-chapter {
  border-top: 1px solid #80725c65;
  padding-top: 1.8em;
}
.book-proof-chapter > p { white-space: pre-wrap; orphans: 3; widows: 3; }
.book-proof[data-paragraphs=indent] .book-proof-chapter > p + p { text-indent: 1.3em; }
.book-proof[data-paragraphs=spaced] .book-proof-chapter > p + p { margin-top: .72em; }
.print-book-output { display: none; }
@media (max-width: 680px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); }
  .book-preview { max-height: 55dvh; }
}
@media print {
  :root:has(body[data-print-book]), body[data-print-book] { background: white; }
  body[data-print-book] > :not(.print-book-output) { display: none !important; }
  body[data-print-book] .print-book-output { display: block; }
  body[data-print-book] dialog::backdrop { display: none; }
  .print-book-output .book-proof { color: black; }
  .print-book-output .book-title-page {
    page: ribbonTitle;
    break-after: page;
    padding-top: var(--book-title-top);
  }
  .print-book-output .book-title-page + section { margin-top: 0; }
  .print-book-output .chapter-page-breaks .book-proof-chapter + .book-proof-chapter {
    break-before: page;
    margin-top: 0;
  }
  .print-book-output .book-proof h2 { break-after: avoid; }
}
.account-form { display: grid; gap: 11px; }
.account-links { display: flex; flex-wrap: wrap; gap: 5px; }
.account-identity { overflow-wrap: anywhere; }
#account-settings .account-links { margin: 13px 0 7px; }
.review-panel { width: min(820px, calc(100vw - 30px)); max-height: calc(100dvh - 25px); }
#review-editor #editor {
  position: static;
  display: block;
  width: 100%;
  height: min(66dvh, 620px);
  padding: clamp(13px, 3vw, 28px);
  border: 1px solid var(--panel-rule);
  border-radius: 6px;
  color: var(--panel-ink);
  background: var(--panel-fill);
  opacity: 1;
  pointer-events: auto;
  overflow: auto;
  font: 18px/1.65 "Courier Prime", "Courier New", monospace;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
@media (max-width: 800px) {
  :root { --line-width: min(64vw, 540px); --rail-gap: clamp(50px, 8.2vh, 80px); }
}
@media (max-width: 480px) {
  :root { --line-width: 70vw; }
  .utility-actions .icon-button { width: 30px; height: 36px; }
  .utility-actions .counts { font-size: 11px; letter-spacing: 0; }
  .account-tab { padding-inline: 4px; font-size: 11px; }
  .book-tab { padding-inline: 3px; gap: 5px; }
  .writing-status { margin-inline: 3px; }
}
@media (max-height: 500px) {
  :root { --rail-y: 61%; --rail-gap: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .paper-tear { display: none; }
}
