@font-face {
  font-family: Inter;
  src: url("/inter-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  --bg: #151815;
  --sidebar: #191d19;
  --surface: #202620;
  --control: #252d25;
  --line: #343e34;
  --text: #f0f1e9;
  --muted: #aeb9ae;
  --accent: #d6eca5;
  --on-accent: #252d18;
  --paper: #181c18;
  --ink: #e5e9dd;
  --paper-muted: #a4b19f;
  --font-size: 19px;
  --line-height: 1.75;
  --measure: 660px;
}
body[data-reading-theme="sepia"] { --paper: #eee1c8; --ink: #352b20; --paper-muted: #665744; }
body[data-reading-theme="light"] { --paper: #f3f1e9; --ink: #242923; --paper-muted: #4f5c4f; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 4px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, figure { margin: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; vertical-align: middle; flex: none; }
.button, .icon-button, .chip {
  min-height: 44px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; font-size: .85rem; font-weight: 615; line-height: 1.25;
}
.button:hover, .icon-button:hover, .chip:hover { background: var(--control); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: #e6f5bc; }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.danger { color: #ffc0b9; }
.icon-button { width: 43px; min-height: 43px; padding: 0; background: transparent; border-color: transparent; color: var(--muted); flex: none; }
.icon-button[aria-pressed="true"], .icon-button[aria-expanded="true"] { background: #2d392b; color: var(--accent); }
.button[aria-pressed="true"], .chip[aria-pressed="true"] { color: var(--accent); border-color: #7d916b; background: #2b3827; }
.button .icon, .chip .icon { width: 16px; height: 16px; }
.muted, .meta { color: var(--muted); line-height: 1.6; font-size: .87rem; }
.muted a, .link { color: var(--accent); text-underline-offset: 3px; }
.link:hover { text-decoration: underline; }
.boot { padding: 33px; color: var(--muted); }
.notice { padding: 10px 12px; border: 1px solid #6f5936; background: #332b1e; color: #f0d8a7; border-radius: 9px; font-size: .83rem; line-height: 1.5; }
.error { color: #ffc4b8; }
.toast {
  position: fixed; bottom: 16px; right: 16px; z-index: 20; max-width: calc(100% - 32px); padding: 10px 13px;
  background: #303e2c; border: 1px solid #687f61; border-radius: 9px; color: var(--text); font-size: .84rem;
}

.shell { display: grid; grid-template-columns: 188px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 22px;
  padding: 21px 12px 14px; border-right: 1px solid #2b342b; background: var(--sidebar); z-index: 2;
}
.brand { display: inline-flex; align-items: center; width: fit-content; gap: 9px; font-size: .98rem; font-weight: 720; letter-spacing: -.03em; }
.brand img { width: 35px; height: 35px; border-radius: 9px; }
.sidebar .brand { margin: 0 8px 5px; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 0 9px;
  border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-size: .82rem; font-weight: 580;
}
.nav a:hover, .nav a[aria-current] { background: var(--control); }
.nav a[aria-current] { color: var(--accent); border-color: #354431; }
.nav .icon { width: 17px; height: 17px; }
.sidebar-account { margin-top: auto; }
.sidebar-account .button { width: 100%; justify-content: flex-start; }
.mobile-nav, .mobile-brand, .mobile-settings { display: none; }
.workspace { min-width: 0; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 13px; min-height: 68px;
  max-width: 1340px; margin: auto; padding: 0 32px;
}
.top-tools { margin-left: auto; }
.search-link { display: inline-flex; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: .76rem; }
.search-link .icon { width: 16px; height: 16px; }
.content { max-width: 1340px; margin: auto; padding: 8px 32px 45px; }
.heading { display: grid; gap: 6px; margin-bottom: 19px; }
h1 { font-size: clamp(1.76rem, 4vw, 2.65rem); font-weight: 735; letter-spacing: -.06em; line-height: 1.1; }
h2 { font-size: 1.13rem; letter-spacing: -.028em; line-height: 1.3; }
.collection-title { display: flex; gap: 9px; flex-wrap: wrap; align-items: baseline; margin-bottom: 12px; }
.collection-title span { color: var(--muted); font-size: .76rem; }
.collection { margin-top: 22px; }
.chips, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chips { margin-bottom: 15px; }
.chip { min-height: 36px; font-size: .75rem; padding: 6px 11px; color: var(--muted); }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 146px), 188px)); gap: 21px 14px; }
.book { min-width: 0; }
.cover {
  position: relative; aspect-ratio: 2 / 3; min-width: 0; display: grid; place-items: center; text-align: center; overflow: hidden;
  padding: 17px; background: linear-gradient(145deg, #394b39, #263525); color: #e4efd7;
  border: 1px solid #c4d5bd32; border-radius: 6px 9px 9px 6px;
  font-size: 1.04rem; font-weight: 740; line-height: 1.1; letter-spacing: -.04em;
  box-shadow: inset 4px 0 #0a100a41, 0 7px 21px #0003;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book:hover .cover { border-color: #c2d8a2; }
.book h3 { margin-top: 9px; font-size: .85rem; line-height: 1.35; font-weight: 650; overflow-wrap: anywhere; }
.book p { margin-top: 4px; color: var(--muted); font-size: .74rem; overflow-wrap: anywhere; }
.book .resume { color: var(--accent); font-size: .7rem; }
.card-status { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.card-status .icon { width: 13px; height: 13px; color: var(--accent); }
.continue-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  min-height: 91px; max-width: 670px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.continue-row .cover { width: 46px; font-size: .51rem; padding: 4px; border-radius: 4px; }
.continue-row h3 { font-size: .91rem; line-height: 1.3; margin-bottom: 4px; }
.continue-row p { color: var(--muted); font-size: .75rem; }
.searchform { display: flex; align-items: center; gap: 7px; width: min(100%, 575px); margin: 0 0 18px; }
.searchform input { flex: 1; min-width: 0; }

.detail {
  display: grid; grid-template-columns: clamp(118px, 22%, 211px) minmax(0, 1fr);
  gap: clamp(13px, 4vw, 38px); align-items: start; max-width: 926px; margin: 6px 0 25px;
}
.detail .cover { width: 100%; }
.detail-copy { display: grid; gap: 8px; min-width: 0; }
.detail h1 { max-width: 22ch; }
.detail .subtitle { color: var(--muted); line-height: 1.45; }
.byline { color: var(--accent); font-size: .91rem; line-height: 1.6; }
.detail .actions { margin: 7px 0; }
.book-status { background: var(--surface); border-color: var(--line); }
.book-status[aria-pressed="true"] { border-color: #778d67; }
.like-status[aria-pressed="true"] .icon { fill: currentColor; }
.read-status[aria-pressed="true"] .icon circle { fill: currentColor; }
.read-status[aria-pressed="true"] .icon path { stroke: var(--on-accent); }
.detail .description { color: var(--muted); font-size: .92rem; line-height: 1.7; white-space: pre-line; max-width: 64ch; }
.crumb { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); margin-bottom: 12px; font-size: .77rem; }
.crumb .icon { width: 15px; height: 15px; }
.progress { width: min(100%, 310px); height: 4px; overflow: hidden; border-radius: 5px; background: #41513d; }
.progress span { display: block; width: var(--progress); height: 100%; background: var(--accent); }
.details-below { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; max-width: 926px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; min-width: 0; }
.panel h2 { margin-bottom: 11px; }
.panel + .panel { margin-top: 0; }
.panel-stack { display: grid; gap: 12px; max-width: 760px; }
.rows { display: grid; gap: 5px; }
.row {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 43px; padding: 7px 9px;
  background: var(--control); border: 1px solid var(--line); border-radius: 8px; text-align: left; font-size: .8rem;
}
.row:hover { border-color: #647463; }
.row > .icon { width: 16px; height: 16px; color: var(--accent); }
.row strong { overflow-wrap: anywhere; font-weight: 630; }
.row small { color: var(--muted); font-size: .71rem; }
.row span { display: grid; gap: 3px; flex: 1; min-width: 0; }
.row .jump { margin-left: auto; }
.note-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: center; }
.author-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; max-width: 800px; }
.portrait, .avatar { width: 87px; height: 87px; border-radius: 50%; flex: none; object-fit: cover; background: #2d3a2c; }
.avatar { display: grid; place-items: center; color: var(--accent); font-size: 1.45rem; font-weight: 690; }
.author-head p { margin-top: 7px; white-space: pre-line; }
.empty { max-width: 600px; padding: 36px 20px; display: grid; gap: 9px; justify-items: center; text-align: center; }
.empty > .icon { width: 25px; height: 25px; color: var(--accent); }

.login {
  min-height: 100dvh; display: grid; align-content: center; justify-items: center; padding: 28px 16px;
  background: radial-gradient(ellipse at 50% 12%, #243323 0, var(--bg) 57%);
}
.login-form { width: min(100%, 360px); display: grid; gap: 13px; }
.login-form .brand { margin-bottom: 6px; }
.login-form h1 { font-size: 2.18rem; }
.login-form .button { width: 100%; }
.stack { display: grid; gap: 11px; }
.form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.field { display: grid; gap: 6px; min-width: 0; font-size: .81rem; font-weight: 590; }
.field input, .field textarea, .field select, .searchform input {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; background: #242b24; border: 1px solid #414d40; border-radius: 8px; font-size: max(16px, 1em);
}
.field textarea { resize: vertical; min-height: 90px; }
.field input::placeholder, .field textarea::placeholder { color: #8d9a8b; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: .81rem; align-items: center; }
.slider output { color: var(--muted); }
.slider input { grid-column: 1/-1; width: 100%; accent-color: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.themes .chip { display: grid; gap: 4px; padding: 5px; text-align: left; }
.theme-sample { display: grid; place-items: center; min-height: 28px; min-width: 48px; border-radius: 4px; font-weight: 700; }
.theme-sample.dark { background: #181c18; color: #e5e9dd; }
.theme-sample.sepia { background: #eee1c8; color: #352b20; }
.theme-sample.light { background: #f3f1e9; color: #242923; }
.settings-sample { background: var(--paper); color: var(--ink); padding: 12px; border-radius: 7px; font-size: var(--font-size); line-height: var(--line-height); }
.admin-users { display: grid; gap: 5px; }
.account-line { display: flex; justify-content: space-between; gap: 11px; align-items: center; min-height: 44px; }

.reader {
  position: fixed; inset: 0; z-index: 5; display: grid; grid-template-rows: auto minmax(0,1fr) auto;
  background: var(--paper); color: var(--ink);
}
.reader-top, .reader-footer { background: #191e19; color: var(--text); }
.reader-top {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--line); padding: env(safe-area-inset-top) 15px 0; min-height: 57px;
}
.reader-back, .reader-actions { display: flex; align-items: center; gap: 3px; min-width: 0; }
.reader-actions { justify-content: flex-end; }
.reader-heading { display: grid; min-width: 0; gap: 3px; }
.reader-heading strong { font-size: .83rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reader-heading small { font-size: .7rem; color: var(--muted); }
.reader-scroll { overflow: auto; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; min-width: 0; scrollbar-width: thin; scrollbar-color: #81907965 transparent; }
.reader-body {
  margin: 0 auto; padding: clamp(30px, 6vh, 74px) 24px 38px; max-width: calc(var(--measure) + 48px);
  font-size: var(--font-size); line-height: var(--line-height);
}
.reader-body h1 { font-size: 2em; letter-spacing: -.055em; }
.reader-body h2 { font-size: 1.3em; margin: .6em 0 .43em; }
.reader-body [data-block] { margin-bottom: .95em; overflow-wrap: anywhere; }
.reader-body .book-run { font-size: calc(var(--font-size) * var(--run-scale)); }
.reader-body .centered { text-align: center; }
.reader-body figure { padding: .2em 0; }
.reader-body .book-figure { margin: 1.25em 0; }
.reader-body figure img { max-width: 100%; max-height: 70vh; margin: auto; object-fit: contain; border-radius: 6px; }
.reader-body figcaption { text-align: center; color: var(--paper-muted); font-size: .79em; }
.reader-empty { color: var(--paper-muted); text-align: center; }
.reader-body blockquote { margin-inline: 0; padding-left: 1em; border-left: 2px solid #899477; }
.reader-body mark { border-radius: 2px; background: #b8a54778; color: inherit; }
.reader-body mark[data-color="green"] { background: #73a67878; }
.reader-body mark[data-color="rose"] { background: #b5779978; }
.reader-body mark.with-note { text-decoration: underline dotted; text-underline-offset: .18em; }
.inline-note { display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--ink); vertical-align: .05em; margin-inline: .12em; cursor: pointer; }
.inline-note .icon { width: .95em; height: .95em; }
.inline-note:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.reader-body::selection, .reader-body ::selection { background: #acaf6680; color: inherit; }
.reader-footer { display: grid; grid-template-columns: 1fr minmax(175px,400px) 1fr; justify-content: center; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 5px 15px calc(6px + env(safe-area-inset-bottom)); }
.reader-paging { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; }
.reader-paging progress { appearance: none; min-width: 22px; width: 100%; height: 4px; overflow: hidden; border: 0; border-radius: 4px; background: #414f3d; accent-color: var(--accent); }
.reader-paging progress::-webkit-progress-bar { background: #414f3d; }
.reader-paging progress::-webkit-progress-value { border-radius: 4px; background: var(--accent); }
.reader-paging progress::-moz-progress-bar { border-radius: 4px; background: var(--accent); }
.reader-paging .page-open { white-space: nowrap; font-size: .78rem; min-height: 37px; padding: 3px 5px; }
.read-state { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loading-page { min-height: 100%; display: grid; place-content: center; padding: 16px; text-align: center; color: var(--paper-muted); font-size: .9rem; }
.reader .notice { margin: 10px auto; width: fit-content; }
.reader-scrim { position: absolute; inset: 57px 0 56px; border: 0; background: #080e0890; z-index: 2; width: 100%; }
.reader-drawer {
  position: absolute; z-index: 3; inset: 57px 0 55px auto; width: min(365px,100%); overflow: auto;
  padding: 13px; border-left: 1px solid var(--line); background: #1e251e; color: var(--text);
}
.drawer-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-title .icon-button { width: 35px; min-height: 35px; }
.selection-tools { position: absolute; z-index: 4; bottom: calc(70px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 3px; background: #263327; border: 1px solid #526451; color: var(--text); border-radius: 11px; padding: 4px; box-shadow: 0 8px 30px #0007; white-space: nowrap; }
.selection-tools .button { padding: 7px; font-size: .75rem; min-height: 44px; }
.selection-tools .icon-button { width: 41px; min-height: 44px; }
.selection-tools .gold { color: #f4d685; }.selection-tools .green { color: #b1da9c; }.selection-tools .rose { color: #efb2ce; }
dialog { width: min(100% - 24px, 460px); max-height: calc(100dvh - 24px); overflow: auto; padding: 15px; background: #252f25; border: 1px solid #596d58; color: var(--text); border-radius: 12px; }
dialog::backdrop { background: #101610b8; }
dialog blockquote { margin: 0; padding: 7px 9px; font-size: .81rem; border-left: 2px solid var(--accent); color: var(--muted); }

@media (max-width: 730px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .top { min-height: 58px; padding: env(safe-area-inset-top) 12px 0; gap: 6px; }
  .mobile-brand { display: block; }
  .mobile-settings { display: inline-flex; }
  .top-tools { display: flex; align-items: center; gap: 4px; }
  .search-link { min-height: 42px; padding-inline: 10px; }
  .search-link span { display: none; }
  .mobile-nav {
    position: fixed; z-index: 3; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 4px 5px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #191f19;
  }
  .mobile-nav a { display: grid; place-items: center; align-content: center; min-height: 45px; padding: 2px; gap: 4px; font-size: .66rem; line-height: 1; }
  .content { padding: 7px 13px calc(75px + env(safe-area-inset-bottom)); }
  .books { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px 8px; }
  .cover { padding: 7px; font-size: .84rem; }
  .book h3 { font-size: .74rem; }
  .book p { font-size: .68rem; }
  .detail { grid-template-columns: minmax(85px,31%) minmax(0,1fr); margin: 0 0 17px; }
  .detail h1 { font-size: clamp(1.4rem,6vw,2rem); }
  .detail-copy { display: contents; }
  .detail-top { grid-column: 2; align-self: center; }
  .detail-bottom { grid-column: 1 / -1; }
  .details-below, .form-columns { grid-template-columns: 1fr; }
  .author-head { gap: 10px; }
  .portrait, .avatar { width: 54px; height: 54px; font-size: 1rem; }
  .reader-top { padding-inline: 5px; }
  .reader-top .icon-button { width: 36px; min-height: 43px; }
  .reader-heading strong { font-size: .77rem; }
  .reader-heading small { font-size: .65rem; }
  .reader-body { padding-inline: 17px; }
  .reader-footer { grid-template-columns: minmax(0,1fr); padding-inline: 5px; }
  .reader-footer .read-state { display: none; }
  .reader-drawer { inset: auto 0 calc(51px + env(safe-area-inset-bottom)); width: 100%; max-height: 71dvh; border: 1px solid var(--line); border-radius: 15px 15px 0 0; }
  .toast { bottom: calc(65px + env(safe-area-inset-bottom)); }
}
@media (max-width: 355px) {
  .books { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
