:root {
  color-scheme: light;
  --paper: #f4efe4;
  --paper-deep: #e7decd;
  --sheet: #fffdf8;
  --ink: #182126;
  --ink-soft: #3f4b4f;
  --muted: #748084;
  --line: rgba(24, 33, 38, 0.14);
  --line-strong: rgba(24, 33, 38, 0.25);
  --accent: #bd5b3d;
  --accent-dark: #8f3d28;
  --accent-soft: #f3ddd3;
  --sage: #61776d;
  --gold: #bd9655;
  --danger: #a33838;
  --success: #3e715b;
  --shadow-sm: 0 8px 24px rgba(35, 30, 20, 0.08);
  --shadow-lg: 0 28px 70px rgba(35, 30, 20, 0.16);
  --sans: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --serif: Iowan Old Style, "Noto Serif KR", "Nanum Myeongjo", Batang, Georgia, serif;
  --header-height: 78px;
}

html[data-display="dark"] {
  color-scheme: dark;
  --paper: #182024;
  --paper-deep: #10171a;
  --sheet: #222c30;
  --ink: #f3eee2;
  --ink-soft: #cfd6d4;
  --muted: #99a7a8;
  --line: rgba(243, 238, 226, 0.13);
  --line-strong: rgba(243, 238, 226, 0.25);
  --accent: #e17957;
  --accent-dark: #ef9a7e;
  --accent-soft: #4a2b24;
  --sage: #8eaaa0;
  --gold: #d8b16d;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(circle at 9% 7%, color-mix(in srgb, var(--accent) 8%, transparent) 0, transparent 26rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--sheet);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 68%, white);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 60;
  top: 0;
  min-height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 5px 11px 11px 5px;
  background: var(--accent);
  color: #fffaf0;
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--accent-dark) 55%, transparent);
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  letter-spacing: -0.035em;
  font-family: var(--serif);
  font-size: 21px;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sheet) 55%, transparent);
}

.site-nav a {
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--sheet);
}

.round-button {
  justify-self: end;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--sheet);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

#app {
  min-height: calc(100vh - var(--header-height));
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 25px;
  height: 2px;
  background: currentColor;
  content: "";
}

.hero {
  min-height: min(720px, calc(100vh - var(--header-height)));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  align-items: center;
  gap: clamp(44px, 8vw, 110px);
  padding-block: clamp(70px, 10vw, 130px);
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 92px);
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: -0.065em;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.hero-lead {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--ink-soft);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.75;
  word-break: keep-all;
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 19px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--ink);
  color: var(--sheet);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 18%, transparent);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--ink) 22%, transparent);
}

.button.accent {
  background: var(--accent);
  color: #fff;
}

.button.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

.button.ghost {
  min-height: 38px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}

.button.danger {
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: transparent;
  color: var(--danger);
  box-shadow: none;
}

.button.small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

.hero-object {
  position: relative;
  min-height: 500px;
  display: grid;
  place-items: center;
}

.hero-object::before {
  position: absolute;
  inset: 10% 0 0 8%;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
}

.hero-cover {
  position: relative;
  z-index: 2;
  width: min(320px, 72vw);
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  padding: 42px 34px 30px;
  border-radius: 4px 15px 15px 4px;
  background: #23343a;
  color: #fffaf0;
  box-shadow: -12px 0 0 #172428, 28px 36px 70px rgba(25, 31, 30, 0.3);
  transform: rotate(4deg);
}

.hero-cover::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 9px;
  border-radius: 0 0 14px 3px;
  background: var(--accent);
  content: "";
}

.hero-cover .cover-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.hero-cover h2 {
  margin: 70px 0 18px;
  font-family: var(--serif);
  font-size: 39px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.045em;
  word-break: keep-all;
}

.hero-cover p {
  margin: 0;
  color: #c9d4d1;
  line-height: 1.6;
}

.hero-cover .cover-author {
  margin-top: auto;
  font-size: 13px;
  font-weight: 700;
}

.format-ticket {
  position: absolute;
  z-index: 3;
  right: -8px;
  bottom: 38px;
  width: 178px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sheet);
  box-shadow: var(--shadow-lg);
  transform: rotate(-4deg);
}

.format-ticket small,
.format-ticket span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.format-ticket strong {
  display: block;
  margin-block: 7px 4px;
  font-family: var(--serif);
  font-size: 24px;
}

.section {
  padding-block: clamp(70px, 9vw, 120px);
}

.section.tinted {
  border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--sheet) 48%, transparent);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}

.section-heading h2,
.format-hero h1,
.empty-state h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.section-heading p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 34px);
}

.book-card {
  display: grid;
  grid-template-columns: minmax(115px, 0.74fr) minmax(0, 1.26fr);
  gap: 20px;
  min-height: 260px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--sheet);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.book-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.mini-cover {
  position: relative;
  min-height: 205px;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 17px;
  overflow: hidden;
  border-radius: 3px 10px 10px 3px;
  background: var(--cover, var(--accent));
  color: #fff;
  box-shadow: -5px 0 0 color-mix(in srgb, var(--cover, var(--accent)) 62%, black), 9px 13px 24px rgba(0, 0, 0, 0.18);
}

.mini-cover::before {
  position: absolute;
  width: 130px;
  height: 130px;
  top: -56px;
  right: -48px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  content: "";
}

.mini-cover small {
  position: relative;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mini-cover strong {
  position: relative;
  margin-top: 32px;
  font-family: var(--serif);
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 600;
  line-height: 1.25;
  word-break: keep-all;
}

.mini-cover span {
  position: relative;
  margin-top: auto;
  font-size: 10px;
}

.book-card-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.book-card-copy .meta {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.book-card-copy h3 {
  margin: 11px 0 7px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.book-card-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.book-card-stats {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--ink-soft);
  font-size: 11px;
}

.progress-track {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.principle-grid,
.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--line);
}

.principle,
.format-card {
  min-height: 250px;
  padding: clamp(25px, 4vw, 42px);
  background: var(--sheet);
}

.principle .number {
  color: var(--accent);
  font-family: var(--serif);
  font-size: 16px;
}

.principle h3,
.format-card h2 {
  margin: 54px 0 13px;
  font-family: var(--serif);
  font-size: 25px;
}

.principle p,
.format-card p,
.format-card li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.site-footer {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 30px clamp(18px, 4vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.site-footer div {
  display: grid;
  gap: 5px;
}

.site-footer strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: min(390px, calc(100vw - 44px));
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  background: var(--sheet);
  box-shadow: var(--shadow-lg);
  color: var(--ink-soft);
  font-size: 13px;
  animation: toast-in 180ms ease both;
}

.toast.error {
  border-left-color: var(--danger);
}

.loading-state,
.empty-state,
.error-state {
  min-height: 55vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 60px 20px;
  text-align: center;
}

.loading-mark {
  width: 48px;
  height: 58px;
  border: 2px solid var(--accent);
  border-radius: 3px 12px 12px 3px;
  animation: book-breathe 1.2s ease-in-out infinite alternate;
}

.reader-shell {
  width: min(1460px, 100%);
  min-height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  margin-inline: auto;
}

.reader-sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 34px 24px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-deep) 45%, transparent);
}

.reader-book-label {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.reader-sidebar h1 {
  margin: 12px 0 6px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.reader-sidebar .author {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 12px;
}

.toc-label {
  margin: 10px 0 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.toc-list,
.outline-list,
.book-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-list button,
.outline-item,
.book-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  line-height: 1.45;
}

.toc-list button:hover,
.toc-list button[aria-current="true"],
.outline-item:hover,
.outline-item[aria-current="true"],
.book-list button:hover,
.book-list button[aria-current="true"] {
  background: var(--sheet);
  color: var(--ink);
}

.toc-list button[aria-current="true"]::before {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.reader-sidebar-footer {
  margin-top: auto;
  padding-top: 30px;
}

.reader-stage {
  min-width: 0;
  background: color-mix(in srgb, var(--paper) 88%, var(--sheet));
}

.reader-toolbar {
  position: sticky;
  z-index: 20;
  top: var(--header-height);
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(16px);
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reader-controls button,
.icon-button {
  min-width: 35px;
  min-height: 35px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sheet);
  cursor: pointer;
  font-weight: 800;
}

.reader-position {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.reading-page {
  --reader-size: 18px;
  width: min(750px, calc(100% - 40px));
  min-height: 900px;
  margin: clamp(34px, 6vw, 78px) auto;
  padding: clamp(44px, 8vw, 88px) clamp(30px, 8vw, 84px);
  border: 1px solid rgba(65, 52, 31, 0.11);
  background: var(--sheet);
  box-shadow: var(--shadow-lg);
}

.reading-page .chapter-kicker {
  display: block;
  margin-bottom: 17px;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.reading-page h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(31px, 5vw, 47px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.045em;
  word-break: keep-all;
}

.reading-page .chapter-subtitle {
  margin: 15px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
}

.reading-body {
  margin-top: 58px;
  font-family: var(--serif);
  font-size: var(--reader-size);
  line-height: 1.92;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

.reading-body p {
  margin: 0 0 1.15em;
  text-indent: 0.8em;
}

.reading-body h2 {
  margin: 2.4em 0 1em;
  font-size: 1.38em;
  line-height: 1.4;
}

.reading-body blockquote {
  margin: 2em 0;
  padding: 0.8em 0 0.8em 1.3em;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

.scene-break {
  margin: 2.8em auto;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.6em;
}

.reader-navigation {
  width: min(750px, calc(100% - 40px));
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: -35px auto 75px;
}

.reader-navigation button {
  flex: 1;
  max-width: 280px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 12px;
}

.reader-navigation button:last-child {
  text-align: right;
}

.reader-navigation button:disabled {
  opacity: 0.3;
  cursor: default;
}

.format-hero {
  max-width: 880px;
  padding-block: clamp(80px, 12vw, 150px) 65px;
}

.format-hero p {
  max-width: 730px;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.8;
}

.format-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 100px;
}

.format-card h2 {
  margin-top: 0;
}

.format-value {
  margin: 25px 0;
  color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1;
}

.format-card a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.studio-shell {
  height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: 250px minmax(480px, 1fr) 320px;
  overflow: hidden;
}

.studio-pane {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-deep) 40%, var(--paper));
}

.studio-pane:last-child {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.studio-pane-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(14px);
}

.studio-pane-header strong {
  font-family: var(--serif);
  font-size: 17px;
}

.studio-sidebar-section {
  padding: 18px 14px;
  border-bottom: 1px solid var(--line);
}

.studio-sidebar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 6px 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.book-list button {
  display: grid;
}

.book-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.book-list small {
  color: var(--muted);
  font-size: 10px;
}

.outline-item {
  justify-content: space-between;
  padding: 9px 8px;
}

.outline-item-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.outline-item-main span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-kind {
  width: 20px;
  color: var(--accent-dark);
  font-family: var(--serif);
  font-size: 11px;
  text-align: center;
}

.outline-actions {
  display: flex;
  opacity: 0;
}

.outline-item:hover .outline-actions,
.outline-item:focus-within .outline-actions {
  opacity: 1;
}

.outline-actions button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
}

.studio-editor {
  min-width: 0;
  overflow: auto;
  background:
    linear-gradient(90deg, transparent 31px, var(--line) 32px, transparent 33px),
    color-mix(in srgb, var(--paper-deep) 45%, var(--paper));
  background-size: 64px 64px;
}

.studio-toolbar {
  position: sticky;
  z-index: 15;
  top: 0;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(14px);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.save-state::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.save-state.saving::before {
  background: var(--gold);
  animation: pulse 800ms ease infinite alternate;
}

.save-state.error::before {
  background: var(--danger);
}

.paper-wrap {
  width: 100%;
  min-width: 660px;
  display: grid;
  justify-items: center;
  padding: 48px 42px 90px;
}

.paper-ruler {
  width: var(--book-trim-width);
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
}

.writing-sheet {
  width: var(--book-trim-width);
  min-height: var(--book-trim-height);
  padding: 0.72in 0.68in 0.75in 0.78in;
  border: 1px solid rgba(62, 47, 30, 0.17);
  background: #fffdf8;
  color: #171a1b;
  box-shadow: 0 24px 60px rgba(46, 38, 24, 0.18);
}

.chapter-fields {
  margin-bottom: 30px;
}

.chapter-title-input,
.chapter-subtitle-input {
  width: 100%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: #171a1b;
  font-family: var(--serif);
}

.chapter-title-input {
  font-size: var(--book-chapter-title-size);
  font-weight: 600;
  line-height: 1.3;
}

.chapter-subtitle-input {
  margin-top: 9px;
  color: #74716b;
  font-size: var(--book-body-size);
  font-style: italic;
}

.chapter-title-input:focus,
.chapter-subtitle-input:focus {
  border-bottom-color: var(--accent);
}

.manuscript-editor {
  width: 100%;
  min-height: calc(var(--book-trim-height) - 2.1in);
  padding: 0;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: #171a1b;
  font-family: var(--serif);
  font-size: var(--book-body-size);
  line-height: var(--book-body-leading);
  letter-spacing: -0.01em;
}

.manuscript-editor::placeholder {
  color: #a9a59c;
}

.frontmatter-sheet {
  min-height: 7.5in;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.frontmatter-sheet h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--book-title-size);
  line-height: 1.2;
}

.frontmatter-sheet .subtitle {
  margin: 18px 0;
  color: #655f58;
  font-family: var(--serif);
  font-size: 16pt;
  font-style: italic;
}

.frontmatter-sheet .author {
  margin-top: 90px;
  font-size: 12pt;
}

.toc-preview {
  width: 100%;
  display: grid;
  gap: 14px;
  margin-top: 50px;
  text-align: left;
}

.toc-preview-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: end;
  font-family: var(--serif);
  font-size: var(--book-body-size);
}

.toc-dots {
  height: 1em;
  overflow: hidden;
  border-bottom: 1px dotted #aaa49a;
}

.inspector {
  padding: 19px;
}

.inspector h2 {
  margin: 10px 0 22px;
  font-family: var(--serif);
  font-size: 22px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field label,
.field-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  font-size: 13px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.55;
}

.field-hint {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.stat {
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--sheet) 60%, transparent);
  text-align: center;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-family: var(--serif);
  font-size: 19px;
}

.stat span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
}

.status-pill.published {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.login-shell {
  min-height: calc(100vh - var(--header-height));
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-story {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(45px, 8vw, 120px);
  background: #22343a;
  color: #fffaf0;
}

.login-story h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(47px, 7vw, 88px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.06em;
}

.login-story p {
  max-width: 540px;
  color: #cbd5d1;
  font-size: 17px;
  line-height: 1.8;
}

.login-card-wrap {
  display: grid;
  place-items: center;
  padding: 35px;
}

.login-card {
  width: min(420px, 100%);
  padding: clamp(28px, 6vw, 50px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--sheet);
  box-shadow: var(--shadow-lg);
}

.login-card h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 31px;
}

.login-card > p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.dialog-backdrop {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 20, 22, 0.64);
  backdrop-filter: blur(8px);
}

.dialog {
  width: min(540px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 27px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--sheet);
  box-shadow: var(--shadow-lg);
}

.dialog h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 27px;
}

.dialog > p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.revision-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.revision-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.revision-item strong,
.revision-item small {
  display: block;
}

.revision-item small {
  margin-top: 4px;
  color: var(--muted);
}

.print-view {
  padding: 50px 20px;
  background: #d9d5cd;
  color: #171a1b;
}

.print-actions {
  position: sticky;
  z-index: 20;
  top: 95px;
  width: min(var(--book-trim-width), 100%);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 25px;
}

.print-page {
  width: var(--book-trim-width);
  min-height: var(--book-trim-height);
  margin: 0 auto 28px;
  padding: 0.72in 0.68in 0.75in 0.78in;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.18);
  font-family: var(--serif);
  font-size: var(--book-body-size);
  line-height: var(--book-body-leading);
}

.print-title-page,
.print-dedication-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.print-title-page h1 {
  margin: 0;
  font-size: var(--book-title-size);
  line-height: 1.2;
}

.print-title-page .subtitle {
  margin-top: 18pt;
  font-size: 16pt;
  font-style: italic;
}

.print-title-page .author {
  margin-top: 70pt;
}

.print-copyright-page {
  display: flex;
  flex-direction: column;
  justify-content: end;
  font-family: var(--sans);
  font-size: 9pt;
  line-height: 1.6;
}

.print-toc-page h1,
.print-chapter-page > h1 {
  margin: 0 0 42pt;
  font-size: var(--book-chapter-title-size);
  line-height: 1.3;
}

.print-chapter-page .reading-body {
  margin-top: 0;
  font-size: var(--book-body-size);
  line-height: var(--book-body-leading);
}

.print-chapter-page {
  overflow: visible;
}

.mobile-toc-button {
  display: none;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes book-breathe {
  to { transform: rotate(3deg) scale(1.04); }
}

@keyframes pulse {
  to { opacity: 0.35; }
}

@media (max-width: 1100px) {
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-shell {
    grid-template-columns: 225px minmax(480px, 1fr);
  }

  .studio-pane:last-child {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 68px;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding-inline: 16px;
  }

  .brand-copy small,
  .round-button {
    display: none;
  }

  .site-nav {
    justify-self: end;
  }

  .site-nav a {
    padding: 8px 11px;
    font-size: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-block: 70px;
  }

  .hero-object {
    min-height: 460px;
  }

  .section-heading {
    display: grid;
  }

  .book-grid,
  .principle-grid,
  .format-grid {
    grid-template-columns: 1fr;
  }

  .reader-shell {
    grid-template-columns: 1fr;
  }

  .reader-sidebar {
    position: fixed;
    z-index: 80;
    inset: var(--header-height) auto 0 0;
    width: min(330px, 88vw);
    height: auto;
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .reader-sidebar.open {
    transform: translateX(0);
  }

  .mobile-toc-button {
    display: inline-flex;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-story {
    min-height: 390px;
  }

  .studio-shell {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .studio-pane {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .studio-editor {
    overflow-x: auto;
  }

  .paper-wrap {
    justify-items: start;
    transform-origin: top left;
  }
}

@media (max-width: 580px) {
  .brand-mark {
    width: 35px;
    height: 39px;
    font-size: 20px;
  }

  .brand-copy strong {
    font-size: 17px;
  }

  .site-nav a {
    padding-inline: 9px;
  }

  .site-nav a[data-nav="format"] {
    display: none;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-object {
    min-height: 400px;
  }

  .hero-cover {
    width: 240px;
    padding: 30px 26px 24px;
  }

  .hero-cover h2 {
    margin-top: 47px;
    font-size: 31px;
  }

  .format-ticket {
    right: 4px;
    width: 150px;
  }

  .book-card {
    grid-template-columns: 115px minmax(0, 1fr);
    padding: 14px;
  }

  .reading-page {
    width: 100%;
    min-height: 75vh;
    margin: 0;
    padding: 42px 24px 70px;
    border: 0;
    box-shadow: none;
  }

  .reader-navigation {
    width: calc(100% - 30px);
    margin-top: 20px;
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
  }
}

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

@media print {
  html,
  body,
  #app {
    width: auto;
    min-width: 0;
    background: #fff !important;
  }

  .site-header,
  .site-footer,
  .print-actions,
  .toast-region {
    display: none !important;
  }

  .print-view {
    padding: 0;
    background: #fff;
  }

  .print-page {
    width: var(--book-trim-width);
    min-height: var(--book-trim-height);
    margin: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .print-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
