:root {
  --paper: #f5f2ec;
  --surface: #fffdf8;
  --ink: #263a33;
  --muted: #7d847d;
  --line: #e2e3da;
  --accent: #31594a;
  --accent-light: #e6ede4;
  --reader-bg: #f8f5ee;
  --reader-ink: #302e29;
  --read-size: 20px;
  --read-line: 1.8;
  --read-width: 760px;
  --read-gap: 1em;
  --read-font: system-ui;
  --read-align: left;
  --read-indent: 2em;
  font-family: Inter, "Segoe UI", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #92ad87;
  outline-offset: 3px;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
a {
  color: var(--accent);
}
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  letter-spacing: -0.04em;
}
small,
.muted {
  color: var(--muted);
}
.boot {
  padding: 25vh 20px;
  text-align: center;
}
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--line);
  padding: 34px 24px;
  display: flex;
  flex-direction: column;
  background: #efeee7;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  padding: 0;
  margin: 0 0 46px;
}
.brand img {
  width: 36px;
  height: 36px;
}
.brand strong {
  display: block;
  font-family: Georgia, serif;
  font-size: 19px;
  letter-spacing: -0.5px;
}
.brand span {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
}
.nav-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #899087;
  margin: 8px 14px 14px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 3px 0;
  font-size: 14px;
  text-align: left;
  color: #68746b;
}
.nav-item.active {
  background: #dce5d9;
  color: var(--ink);
  font-weight: 650;
}
.nav-item:hover {
  background: #e1e5da;
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dde5d7;
  font-size: 14px;
}
.profile strong {
  font-size: 12px;
}
.profile small {
  font-size: 10px;
}
.page {
  padding: 0 5.4vw 60px;
  max-width: 1550px;
  width: 100%;
  margin: auto;
}
.topbar {
  height: 90px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topbar .crumb {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.topbar .crumb b {
  color: var(--ink);
  font-weight: 500;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.btn.secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.ghost {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn.danger {
  background: #975247;
}
.icon-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 7px;
  border: 1px solid transparent;
}
.icon-btn:hover {
  background: var(--accent-light);
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 25px;
  padding: 42px 0 28px;
}
.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.7px;
  margin-bottom: 12px;
}
.intro h1 {
  font-size: 32px;
  font-weight: 650;
  margin-bottom: 12px;
}
.intro p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.8;
}
.stats {
  display: flex;
  gap: 32px;
  padding-bottom: 5px;
}
.stat strong {
  display: block;
  font-size: 26px;
  font-family: Georgia, serif;
  font-weight: 400;
}
.stat small {
  font-size: 11px;
}
.continue {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 28px;
  min-height: 200px;
  padding: 24px 32px;
  border: 1px solid #d8dfd1;
  border-radius: 12px;
  background: #e8eddf;
  margin-bottom: 36px;
  overflow: hidden;
  position: relative;
}
.continue:after {
  content: "";
  position: absolute;
  right: 10%;
  top: -160px;
  width: 380px;
  height: 380px;
  border: 1px solid #d5decb;
  border-radius: 50%;
  pointer-events: none;
}
.continue .mini-cover {
  width: 107px;
  height: 150px;
  margin: auto;
  transform: rotate(-7deg);
  box-shadow: 6px 9px 12px #213c3522;
}
.continue .eyebrow {
  font-size: 9px;
}
.continue h2 {
  font-family: Georgia, "Noto Serif TC", "PMingLiU", serif;
  font-size: 25px;
  margin-bottom: 10px;
}
.continue p {
  font-size: 12px;
  color: #75826e;
  line-height: 1.8;
  max-width: 500px;
  margin-bottom: 12px;
}
.continue .btn {
  position: relative;
  z-index: 1;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.section-heading h2 {
  font-size: 18px;
  letter-spacing: 0.5px;
  margin: 0;
}
.section-heading small {
  margin-left: 10px;
  font-size: 11px;
}
.filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.chip {
  min-height: 44px;
  padding: 9px 15px;
  border-radius: 25px;
  font-size: 12px;
  color: var(--muted);
}
.chip.active {
  background: var(--ink);
  color: var(--surface);
}
.tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 12px;
  border-radius: 7px;
  max-width: 290px;
  width: 100%;
}
.search-field svg {
  width: 16px;
  color: var(--muted);
}
.search-field input {
  height: 42px;
  border: 0;
  outline: 0;
  background: none;
  min-width: 0;
  width: 100%;
  font-size: 12px;
  color: var(--ink);
}
.select {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  max-width: 160px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
.book-card {
  min-width: 0;
  /* 書架可能上千本:畫面外的書卡先不排版,捲到附近才算(auto 會記住算過的真實高度) */
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}
.cover-wrap {
  display: flex;
  width: 100%;
  padding: 26px 22px;
  background: #ebe9e1;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  min-height: 255px;
  position: relative;
  overflow: hidden;
}
.cover-wrap:hover .book-cover {
  transform: translateY(-5px) rotate(-1deg);
}
.book-cover {
  height: 210px;
  aspect-ratio: 0.69;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--cover, #39534b);
  color: #fff7e8;
  box-shadow:
    3px 5px 0 #10271c33,
    8px 12px 18px #242b2420;
  overflow: hidden;
  transition: transform 0.25s;
  border-radius: 1px 4px 4px 1px;
  padding: 20px 14px;
}
.book-cover:before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #fff4d02e;
  pointer-events: none;
}
.book-cover:after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  border-left: 1px solid #ffffff24;
  box-shadow: 2px 0 2px #0003;
  pointer-events: none;
}
.book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-number {
  font-size: 8px;
  letter-spacing: 3px;
  opacity: 0.55;
  margin-bottom: 16px;
}
.cover-title {
  font-family: Georgia, "PMingLiU", serif;
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: 5px;
  writing-mode: vertical-rl;
  max-height: 135px;
  position: relative;
}
.cover-author {
  font-family: serif;
  letter-spacing: 3px;
  font-size: 8px;
  opacity: 0.6;
  margin-top: 16px;
}
.mini-cover .cover-title {
  font-size: 19px;
  letter-spacing: 4px;
}
.mini-cover .cover-number,
.mini-cover .cover-author {
  display: none;
}
.cover-wrap .badge {
  position: absolute;
  right: 12px;
  top: 12px;
}
.badge {
  font-size: 10px;
  background: #fffc;
  padding: 5px 8px;
  border-radius: 4px;
  color: #6b7c66;
  display: inline-flex;
  gap: 5px;
  align-items: center;
  line-height: 1.4;
}
.badge.original {
  color: #987758;
  background: #f7eddf;
}
.card-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-top: 17px;
  gap: 5px;
}
.card-title h3 {
  font-size: 16px;
  margin: 0;
  line-height: 1.5;
  letter-spacing: 0.5px;
}
.card-title .icon-btn {
  margin-top: -9px;
  margin-right: -9px;
  color: var(--muted);
}
.book-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 3px 0 12px;
  line-height: 1.8;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #92978e;
  gap: 8px;
}
.progress-track {
  height: 3px;
  background: #e1e4d9;
  border-radius: 2px;
  overflow: hidden;
  margin: 13px 0 9px;
}
.progress-fill {
  height: 100%;
  width: var(--progress, 0%);
  background: #879b75;
}
.library-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 45px 0 0;
  font-size: 10px;
  color: #99a091;
  letter-spacing: 2px;
}
.empty {
  grid-column: 1/-1;
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.empty h3 {
  font-size: 18px;
  font-weight: 500;
  margin: 20px 0 10px;
  color: var(--ink);
}
.empty p {
  font-size: 13px;
  line-height: 1.8;
}
.mobile-brand,
.mobile-nav {
  display: none;
}
.login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
}
.login-art {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: flex-start;
  padding: 10vw;
  background: #213c35;
  color: #eeeede;
  position: relative;
  overflow: hidden;
}
.login-art:after {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  border: 1px solid #ffffff18;
  border-radius: 50%;
  left: 25%;
  top: 35%;
}
.login-art img {
  width: 52px;
  margin-bottom: 60px;
}
.login-art .eyebrow {
  color: #afc6a1;
}
.login-art h1 {
  font-family: Georgia, "PMingLiU", serif;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 7px;
  font-size: 38px;
}
.login-art p {
  color: #a7b8a6;
  line-height: 2;
  font-size: 13px;
}
.login-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-form form {
  max-width: 340px;
  width: 100%;
}
.login-form h2 {
  font-size: 26px;
  margin: 14px 0;
}
.login-form p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
  font-size: 12px;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  min-height: 46px;
  border-radius: 6px;
  padding: 11px 12px;
  width: 100%;
}
.field textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.8;
}
.field .check {
  width: auto;
  min-height: 20px;
}
.full {
  width: 100%;
}
.error {
  color: #a24e3c;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.hint {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
}
.detail-header {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 38px;
  margin: 40px 0;
}
.detail-header .book-cover {
  height: 260px;
}
.detail-header h1 {
  font-family: Georgia, "PMingLiU", serif;
  font-weight: 500;
  font-size: 31px;
  margin: 15px 0;
}
.detail-header p {
  line-height: 1.9;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}
.meta-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}
.tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 10px 0 20px;
}
.tag {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 10px;
  color: var(--muted);
}
.toc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 30px;
}
.toc-row {
  border-bottom: 1px solid var(--line);
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 13px 7px;
  gap: 12px;
  font-size: 12px;
  min-height: 49px;
}
.toc-row.current {
  background: var(--accent-light);
  border-radius: 5px;
  color: var(--accent);
}
.toc-row small {
  font-size: 10px;
  flex-shrink: 0;
}
.toc-group {
  margin: 10px 0 18px;
}
.toc-group summary {
  padding: 14px 7px;
  font-weight: 650;
  font-size: 12px;
  cursor: pointer;
}
.reader {
  background: var(--reader-bg);
  color: var(--reader-ink);
  min-height: 100dvh;
  padding-bottom: 130px;
}
.reader-tools {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--reader-bg);
  border-bottom: 1px solid #8882;
  z-index: 10;
  transition: transform 0.2s;
  padding: env(safe-area-inset-top) 22px 0;
}
.reader-top {
  max-width: 1100px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto;
  gap: 15px;
}
.reader-top .reader-label {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 50vw;
  color: inherit;
  opacity: 0.6;
}
.reader .icon-btn:hover {
  background: #8882;
}
.reader-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 18px calc(8px + env(safe-area-inset-bottom));
  background: var(--reader-bg);
  border-top: 1px solid #8882;
  z-index: 10;
  transition: transform 0.2s;
}
.reader-bottom-inner {
  max-width: 760px;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}
.reader-bottom button {
  min-height: 44px;
  min-width: 44px;
}
.reader-status {
  font-size: 10px;
  opacity: 0.55;
  text-align: center;
  line-height: 1.6;
}
.reader-hide .reader-tools {
  transform: translateY(-100%);
}
.reader-hide .reader-bottom {
  transform: translateY(100%);
}
.reveal-tools {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 9;
  background: var(--reader-bg);
  border: 1px solid #8883;
  box-shadow: 0 3px 12px #0001;
  opacity: 0.8;
}
.reader-article {
  max-width: calc(var(--read-width) + 48px);
  margin: auto;
  padding: 112px 24px 20px;
  font-size: var(--read-size);
  line-height: var(--read-line);
  font-family: var(--read-font);
  overflow-wrap: anywhere;
}
.reader-article h1 {
  font-size: 1.4em;
  line-height: 1.7;
  font-weight: 500;
  margin: 20px 0 44px;
  letter-spacing: 0.06em;
}
.reader-article .chapter-eyebrow {
  font: 10px system-ui;
  letter-spacing: 2px;
  opacity: 0.45;
  margin-bottom: 10px;
}
.reader-article p {
  margin: 0 0 var(--read-gap);
  text-align: var(--read-align);
  text-indent: var(--read-indent);
  white-space: pre-wrap;
  scroll-margin-top: 100px;
}
.reader-article p.highlight {
  background: #c6aa4a38;
  border-radius: 3px;
}
.reader-article mark {
  background: #d0b54e66;
  color: inherit;
}
.chapter-end {
  border-top: 1px solid #8883;
  margin-top: 45px;
  padding: 30px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font: 13px system-ui;
}
.reader-note {
  font: 12px system-ui;
  line-height: 1.8;
  color: #9d7145;
  background: #bfa66820;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 24px;
}
.reader-note:empty {
  display: none;
}
.return-point {
  position: fixed;
  bottom: 100px;
  right: 20px;
  z-index: 11;
  background: var(--reader-bg);
  color: var(--reader-ink);
  border: 1px solid #8883;
  box-shadow: 0 5px 20px #0001;
}
.loading {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(660px, calc(100vw - 32px));
  max-height: 85dvh;
  box-shadow: 0 25px 100px #15231833;
}
dialog::backdrop {
  background: #18261f66;
  backdrop-filter: blur(3px);
}
.panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 13px 22px;
}
.panel-head h2 {
  font-size: 17px;
  margin: 0;
}
.panel-body {
  padding: 20px 24px 28px;
}
.panel-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 22px;
}
.panel-body .tools {
  margin-bottom: 10px;
}
.panel-body .toc-grid {
  display: block;
}
.panel-body .toc-group {
  margin-bottom: 5px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.swatch {
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 6px;
  font-size: 12px;
  min-height: 44px;
}
.swatch.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.bookmark-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.bookmark-item .jump {
  display: block;
  text-align: left;
  width: 100%;
  padding: 0;
}
.bookmark-item h3 {
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 7px;
}
.bookmark-item p {
  font-size: 12px;
  line-height: 1.9;
  margin: 0 0 8px;
  color: var(--muted);
}
.bookmark-item .actions {
  justify-content: flex-end;
  font-size: 11px;
}
.note-text {
  white-space: pre-wrap;
}
.search-result {
  display: block;
  text-align: left;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  font-size: 12px;
  line-height: 1.8;
}
.search-result strong {
  display: block;
  font-size: 13px;
  margin-bottom: 5px;
}
.search-result span {
  color: var(--muted);
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(30px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  border-radius: 8px;
  background: #253c33;
  color: #fff;
  padding: 13px 19px;
  box-shadow: 0 5px 24px #0002;
  font-size: 12px;
  max-width: calc(100vw - 30px);
  line-height: 1.8;
  display: none;
  align-items: center;
  gap: 14px;
}
#toast.show {
  display: flex;
}
#toast button {
  color: #d2e2a3;
  white-space: nowrap;
  font-weight: 700;
  min-height: 28px;
}
.import-book {
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  margin: 18px 0;
}
.import-book h3 {
  font-size: 16px;
  margin-bottom: 8px;
}
.import-book small {
  line-height: 1.8;
}
.import-chapter {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  display: grid;
  grid-template-columns: 1fr 80px auto;
  gap: 8px;
  align-items: center;
  font-size: 11px;
}
.import-chapter input,
.import-chapter select {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 4px;
  min-height: 35px;
  font-size: 11px;
}
.import-chapter .icon-btn {
  width: 33px;
  min-width: 33px;
  height: 35px;
}
.import-chapter .actions {
  gap: 1px;
}
.import-chapter .actions svg {
  width: 15px;
}
.import-list {
  max-height: 350px;
  overflow: auto;
}
.import-chapter code {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}
.switch-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  line-height: 1.8;
  margin: 16px 0;
}
.switch-row input {
  width: 18px;
  height: 18px;
}
.split-content {
  font-family: monospace;
  white-space: pre-wrap;
}
.import-editor textarea {
  min-height: 260px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.conflict-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin: 8px 0;
  min-height: 75px;
}
.conflict-option strong {
  display: block;
  font-size: 14px;
  margin-bottom: 7px;
}
.conflict-option small {
  line-height: 1.8;
}
.conflict-option:hover {
  background: var(--accent-light);
}
.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}
.install-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 10px;
}
.code {
  font: 11px monospace;
  background: #e5e7dd;
  padding: 2px 5px;
  border-radius: 3px;
}
@media (min-width: 1500px) {
  .page {
    padding-left: 75px;
    padding-right: 75px;
  }
  .book-grid {
    gap: 38px;
  }
  .cover-wrap {
    min-height: 295px;
  }
  .cover-wrap .book-cover {
    height: 240px;
  }
}
@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sidebar {
    padding: 30px 16px;
  }
  .brand strong {
    font-size: 16px;
  }
  .page {
    padding: 0 28px 50px;
  }
  .continue {
    grid-template-columns: 110px 1fr;
    gap: 20px;
    padding: 22px;
  }
  .continue > .btn {
    grid-column: 2;
    justify-self: start;
    margin-top: -10px;
  }
  .continue .mini-cover {
    grid-row: 1/3;
  }
  .continue h2 {
    font-size: 22px;
  }
  .book-grid {
    gap: 20px;
  }
  .cover-wrap {
    padding: 22px 12px;
    min-height: 220px;
  }
  .cover-wrap .book-cover {
    height: 180px;
  }
  .cover-title {
    font-size: 20px;
  }
  .stats {
    gap: 18px;
  }
  .intro h1 {
    font-size: 28px;
  }
}
@media (max-width: 760px) {
  .shell {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .page {
    padding: 0 20px 100px;
  }
  .topbar {
    height: 76px;
  }
  .topbar .crumb {
    display: none;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: Georgia, serif;
    font-size: 18px;
  }
  .mobile-brand img {
    width: 32px;
    height: 32px;
  }
  .topbar .actions .btn {
    padding: 10px 12px;
    font-size: 11px;
  }
  .intro {
    padding: 30px 0 24px;
    display: block;
  }
  .intro h1 {
    font-size: 28px;
  }
  .intro p {
    font-size: 12px;
  }
  .intro .stats {
    margin-top: 22px;
    gap: 28px;
  }
  .stat {
    display: flex;
    align-items: baseline;
    gap: 7px;
  }
  .stat strong {
    font-size: 23px;
  }
  .stat small {
    font-size: 10px;
  }
  .eyebrow {
    font-size: 9px;
    margin-bottom: 10px;
  }
  .continue {
    padding: 22px 18px;
    grid-template-columns: 80px 1fr;
    gap: 15px;
    margin-bottom: 30px;
    border-radius: 8px;
    min-height: 170px;
  }
  .continue .mini-cover {
    width: 72px;
    height: 108px;
  }
  .mini-cover .cover-title {
    font-size: 16px;
    letter-spacing: 2px;
  }
  .continue h2 {
    font-size: 20px;
    margin-bottom: 6px;
  }
  .continue p {
    font-size: 10px;
    margin-bottom: 10px;
  }
  .continue > .btn {
    font-size: 11px;
    min-height: 40px;
    padding: 8px 13px;
  }
  .continue:after {
    right: -150px;
  }
  .section-heading {
    margin-bottom: 12px;
  }
  .section-heading h2 {
    font-size: 17px;
  }
  .section-heading small {
    display: none;
  }
  .filters {
    gap: 0;
  }
  .chip {
    font-size: 11px;
    padding: 8px 10px;
  }
  .tools {
    margin-bottom: 20px;
    gap: 8px;
  }
  .search-field {
    max-width: none;
  }
  .select {
    font-size: 11px;
    max-width: 108px;
    padding: 0 6px;
  }
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 25px 16px;
  }
  .cover-wrap {
    padding: 22px 10px;
    min-height: 207px;
    border-radius: 7px;
  }
  .cover-wrap .book-cover {
    height: 165px;
  }
  .cover-wrap .badge {
    right: 6px;
    top: 6px;
    font-size: 8px;
    padding: 4px 6px;
  }
  .cover-title {
    font-size: 19px;
    letter-spacing: 3px;
    max-height: 115px;
  }
  .cover-number {
    font-size: 7px;
    margin-bottom: 10px;
  }
  .cover-author {
    font-size: 7px;
    margin-top: 9px;
  }
  .card-title {
    padding-top: 12px;
  }
  .card-title h3 {
    font-size: 14px;
  }
  .book-card p {
    font-size: 10px;
    margin-bottom: 9px;
  }
  .card-footer {
    font-size: 9px;
    align-items: flex-start;
  }
  .library-foot {
    margin-top: 35px;
    font-size: 8px;
    letter-spacing: 1px;
  }
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: #f9f8f1f2;
    border-top: 1px solid var(--line);
    padding: 7px 0 calc(5px + env(safe-area-inset-bottom));
    z-index: 8;
    backdrop-filter: blur(12px);
  }
  .mobile-nav button {
    min-height: 45px;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 9px;
    color: var(--muted);
  }
  .mobile-nav button.active {
    color: var(--accent);
    font-weight: 700;
  }
  .mobile-nav svg {
    width: 19px;
    height: 19px;
  }
  .login {
    display: block;
  }
  .login-art {
    padding: 34px 30px;
    min-height: 235px;
  }
  .login-art img {
    width: 34px;
    margin-bottom: 18px;
  }
  .login-art h1 {
    font-size: 25px;
    letter-spacing: 4px;
    margin-bottom: 0;
  }
  .login-art p {
    display: none;
  }
  .login-form {
    padding: 30px 25px;
  }
  .login-form h2 {
    font-size: 22px;
  }
  .detail-header {
    grid-template-columns: 105px 1fr;
    gap: 20px;
    margin: 30px 0;
  }
  .detail-header .book-cover {
    height: 153px;
  }
  .detail-header .cover-title {
    font-size: 18px;
  }
  .detail-header h1 {
    font-size: 24px;
    margin: 5px 0 10px;
  }
  .detail-header p {
    font-size: 12px;
  }
  .detail-header .btn {
    padding: 9px 13px;
    min-height: 42px;
    font-size: 11px;
  }
  .detail-header .description {
    grid-column: 1/-1;
  }
  .toc-grid {
    grid-template-columns: 1fr;
  }
  .reader-article {
    padding: 98px 22px 20px;
  }
  .reader-article h1 {
    margin: 12px 0 32px;
    font-size: 1.25em;
  }
  .reader-tools {
    padding-left: 10px;
    padding-right: 10px;
  }
  .reader-top {
    height: 59px;
    gap: 5px;
  }
  .reader-top .reader-label {
    max-width: 46vw;
    font-size: 10px;
  }
  .reader-top .actions {
    gap: 0;
  }
  .reader-bottom-inner {
    gap: 6px;
    font-size: 10px;
  }
  .reader-status {
    font-size: 9px;
  }
  .reader-bottom {
    padding-left: 10px;
    padding-right: 10px;
  }
  .panel-head {
    padding: 10px 16px;
  }
  .panel-body {
    padding: 16px 18px 24px;
  }
  dialog {
    max-height: 89dvh;
    width: calc(100vw - 20px);
    border-radius: 10px;
  }
  .settings-grid {
    gap: 0 12px;
  }
  .form-row {
    gap: 10px;
  }
  .import-chapter {
    grid-template-columns: 1fr 68px auto;
    gap: 4px;
  }
  .import-chapter .actions {
    flex-wrap: wrap;
    width: 65px;
  }
  .import-chapter .icon-btn {
    width: 30px;
    min-width: 30px;
  }
  .return-point {
    bottom: 90px;
    right: 10px;
    font-size: 11px;
  }
  .reader-bottom .icon-btn {
    width: 36px;
    min-width: 36px;
  }
  .intro .stats {
    flex-wrap: wrap;
  }
  .topbar .actions {
    gap: 0;
  }
  .panel-actions .btn {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* The public reading site keeps a portrait layout on every screen. */
.public-mode .shell {
  display: block;
  max-width: 480px;
  margin: auto;
  border-inline: 1px solid var(--line);
  min-height: 100dvh;
}
.public-mode .sidebar {
  display: none;
}
.public-mode .page {
  max-width: 480px;
  padding: 0 20px 100px;
}
.public-mode .topbar {
  height: 76px;
}
.public-mode .topbar .crumb {
  display: none;
}
.public-mode .mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font:
    18px Georgia,
    serif;
}
.public-mode .mobile-brand img {
  width: 32px;
  height: 32px;
}
.public-mode .intro {
  display: block;
  padding: 30px 0 24px;
}
.public-mode .intro h1 {
  font-size: 28px;
}
.public-mode .intro p {
  font-size: 12px;
}
.public-mode .stats {
  margin-top: 22px;
  gap: 28px;
  flex-wrap: wrap;
}
.public-mode .stat {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.public-mode .stat strong {
  font-size: 23px;
}
.public-mode .stat small {
  font-size: 10px;
}
.public-mode .continue {
  grid-template-columns: 80px 1fr;
  gap: 15px;
  padding: 22px 18px;
  min-height: 170px;
  margin-bottom: 30px;
}
.public-mode .continue .mini-cover {
  width: 72px;
  height: 108px;
  grid-row: 1/3;
}
.public-mode .mini-cover .cover-title {
  font-size: 16px;
  letter-spacing: 2px;
}
.public-mode .continue h2 {
  font-size: 20px;
}
.public-mode .continue p {
  font-size: 10px;
}
.public-mode .continue > .btn {
  grid-column: 2;
  justify-self: start;
  font-size: 11px;
  min-height: 40px;
  padding: 8px 13px;
  margin-top: -10px;
}
.public-mode .section-heading {
  gap: 5px;
}
.public-mode .section-heading h2 {
  font-size: 17px;
  white-space: nowrap;
}
.public-mode .section-heading small {
  display: none;
}
.public-mode .filters {
  gap: 0;
  flex-wrap: nowrap;
}
.public-mode .chip {
  padding: 8px 9px;
  font-size: 11px;
  white-space: nowrap;
}
.public-mode .tools {
  gap: 8px;
}
.public-mode .tools .actions {
  gap: 8px;
}
.public-mode .select {
  max-width: 100px;
  padding: 0 6px;
  font-size: 11px;
}
.public-mode .search-field {
  min-width: 0;
}
.public-mode .search-field input {
  font-size: 11px;
}
.public-mode .book-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 25px 16px;
}
.public-mode .cover-wrap {
  padding: 22px 10px;
  min-height: 207px;
}
.public-mode .cover-wrap .book-cover {
  height: 165px;
}
.public-mode .cover-title {
  font-size: 19px;
  letter-spacing: 3px;
  max-height: 115px;
}
.public-mode .card-title h3 {
  font-size: 14px;
}
.public-mode .book-card p {
  font-size: 10px;
}
.public-mode .card-footer {
  font-size: 9px;
}
.public-mode .mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: max(0px, calc((100% - 480px) / 2));
  width: min(100%, 480px);
  justify-content: space-around;
  background: #f9f8f1f2;
  border-top: 1px solid var(--line);
  padding: 7px 0 calc(5px + env(safe-area-inset-bottom));
  z-index: 8;
  backdrop-filter: blur(12px);
}
.public-mode .mobile-nav button {
  min-height: 45px;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
}
.public-mode .mobile-nav button.active {
  color: var(--accent);
  font-weight: 700;
}
.public-mode [data-action="book-menu"],
.public-mode [data-action="import"],
.public-mode [data-action="logout"],
.public-mode [data-action="archives"] {
  display: none !important;
}
.public-mode .detail-header {
  grid-template-columns: 105px 1fr;
  gap: 20px;
  margin: 30px 0;
}
.public-mode .detail-header .book-cover {
  height: 153px;
}
.public-mode .detail-header h1 {
  font-size: 24px;
  margin: 5px 0 10px;
}
.public-mode .detail-header p {
  font-size: 12px;
}
.public-mode .detail-header .description {
  grid-column: 1/-1;
}
.public-mode .detail-header .btn {
  padding: 9px 13px;
  font-size: 11px;
}
.public-mode .toc-grid {
  grid-template-columns: 1fr;
}
.public-mode .reader {
  max-width: 480px;
  margin: auto;
}
.public-mode .reader-article {
  max-width: 480px;
  padding: 98px 22px 20px;
}
.public-mode .reader-article h1 {
  font-size: 1.25em;
}
.public-mode .reader-tools,
.public-mode .reader-bottom {
  left: max(0px, calc((100% - 480px) / 2));
  right: auto;
  width: min(100%, 480px);
}
.public-mode .reader-tools {
  padding-inline: 10px;
}
.public-mode .reader-top {
  height: 59px;
  gap: 5px;
}
.public-mode .reader-top .reader-label {
  max-width: 46%;
  font-size: 10px;
}
.public-mode .reader-top .actions {
  gap: 0;
}
.public-mode .reader-bottom-inner {
  gap: 6px;
  font-size: 10px;
}
.public-mode .reader-status {
  font-size: 9px;
}
.public-mode dialog {
  width: min(440px, calc(100vw - 20px));
}
.public-mode .return-point {
  right: max(10px, calc((100% - 460px) / 2));
}

body.paged-reading {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--reader-bg);
}
.paged-reading:not(.reader-hide) .reveal-tools {
  display: none;
}
.paged-reading .reader {
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
  overflow: hidden;
}
.paged-reading .reader-article {
  position: relative;
  top: calc(76px + env(safe-area-inset-top));
  height: calc(
    100dvh - 148px - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
  padding: 0 22px;
  margin: 0 auto;
  overflow: hidden;
  touch-action: pinch-zoom; /* 上下滑也用來翻頁,不讓瀏覽器拿去捲動 */
  cursor: grab;
}
.reader-page-content {
  display: flow-root;
  transform: translateX(var(--page-drag-x, 0px));
  transition: transform 120ms ease-out;
}
.reader-page-content #paragraphs > p:last-child {
  margin-bottom: 0;
}
.reader-page-content .paragraph-continuation {
  text-indent: 0 !important;
}
.paged-article.page-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}
.page-dragging .reader-page-content {
  transition: none;
  will-change: transform;
}
.paged-reading .reader-status {
  min-width: 94px;
}

.length-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0 6px;
  border-top: 1px solid var(--line);
}
.length-overview > div {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.length-overview span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.length-overview b {
  margin-left: 5px;
  color: var(--ink);
  font-weight: 600;
}
.text-button {
  font-size: 11px;
  min-height: 44px;
  padding: 4px 0;
  color: var(--accent);
  white-space: nowrap;
}
.library-summary {
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.8;
}
.library-filterbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: -8px 0 24px;
}
.library-filterbar .select {
  max-width: none;
  width: 100%;
  min-width: 0;
  font-size: 11px;
  padding: 0 8px;
}
.cover-wrap .length-badge {
  left: 8px;
  right: auto;
  top: 8px;
  font-size: 10px;
}
.length-short {
  background: #ecf0e7;
  color: #5c7750;
}
.length-medium {
  background: #e5edf1;
  color: #526d7d;
}
.length-long {
  background: #f3eadb;
  color: #8c7147;
}
.length-epic {
  background: #eee6ed;
  color: #7b5c7a;
}
.length-description {
  color: var(--accent) !important;
  font-size: 10px !important;
  line-height: 1.8;
}
.book-personal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
}
.book-rating {
  text-align: left;
  min-height: 44px;
  min-width: 0;
  padding: 5px 0;
  font-size: 17px;
  letter-spacing: 1px;
}
.book-rating small {
  display: block;
  letter-spacing: 0;
  font-size: 10px;
  margin-top: 2px;
}
.rated-stars {
  color: #ad863b;
}
.empty-stars {
  color: #a6aea0;
}
.mark-delete {
  width: 36px;
  min-width: 36px;
  color: #93998f;
}
.mark-delete:hover {
  color: #975b4e;
  background: #f3e5df;
}
.marked-book .cover-wrap {
  opacity: 0.68;
}
.deleted-badge {
  background: #f4e5df;
  color: #975b4e;
  margin-top: 5px;
  font-size: 9px;
}
.detail-personal {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 30px;
  background: var(--surface);
}
.detail-personal > .actions {
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}
.detail-personal .hint {
  margin: 8px 0;
}
.length-badge-inline {
  background: var(--accent-light);
  color: var(--accent);
}
.preference-title {
  font-size: 18px;
  line-height: 1.7;
  font-family: Georgia, "PMingLiU", serif;
}
.rating-choices {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 12px;
}
.rating-choice {
  width: 44px;
  height: 48px;
  min-width: 44px;
  font-size: 34px;
  color: #c4c9be;
  padding: 0;
}
.rating-choice.selected,
.rating-choice:hover {
  color: #ad863b;
}
.rating-caption {
  text-align: center;
}
.length-rules {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 20px 0;
}
.length-rules th,
.length-rules td {
  border-bottom: 1px solid var(--line);
  padding: 14px 7px;
  text-align: left;
}
.length-rules th {
  width: 85px;
  color: var(--accent);
}
.deleted-note {
  color: #975b4e !important;
}
.public-mode .book-rating {
  font-size: 16px;
  letter-spacing: 0;
}
.public-mode .length-overview > div {
  gap: 9px;
}
.public-mode .length-overview span {
  font-size: 10px;
}
.public-mode .length-overview b {
  margin-left: 3px;
}
.paged-reading:has(.return-point) .reader-label {
  visibility: hidden;
}
.paged-reading .return-point {
  top: calc(10px + env(safe-area-inset-top));
  bottom: auto;
  left: 50%;
  right: auto;
  width: 150px;
  min-height: 38px;
  transform: translateX(-50%);
  padding: 7px 8px;
  font-size: 11px;
  box-shadow: none;
}
@media (max-height: 400px) {
  .paged-reading .reader-article {
    top: 60px;
    height: calc(100dvh - 132px);
  }
  .reader-page-content h1 {
    font-size: 1em;
    margin: 5px 0 12px;
  }
  .reader-page-content .chapter-eyebrow {
    margin-bottom: 5px;
  }
}

/* [claude code] 2026-10-30 開書先下載整本 · 設定頁離線書 */
.download-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.download-card {
  width: min(360px, 100%);
  text-align: center;
}
.download-card .cover {
  width: 120px;
  margin: 0 auto 14px;
}
.download-card h2 {
  margin: 0 0 6px;
}
.download-card .progress-track {
  height: 6px;
  margin: 18px 0 8px;
}
.download-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}
.download-card .actions {
  justify-content: center;
}
.panel-subtitle {
  margin: 22px 0 6px;
  font-size: 15px;
}
.offline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.offline-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.offline-row small {
  color: var(--muted);
  margin-left: 6px;
}
#offline-books > .btn.danger {
  margin-top: 12px;
  width: 100%;
}

/* [claude code] 2026-10-30 翻書:紙沿左邊書脊翻(reader-pages.js 的 createLeaf / flipController) */
.paged-reading .reader-article {
  perspective: 1800px;
}
.flip-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.flip-under,
.flip-leaf,
.leaf-face {
  position: absolute;
  inset: 0;
}
.flip-under,
.leaf-face {
  padding: 0 22px;
  background: var(--reader-bg);
  color: var(--reader-ink);
}
.flip-shade {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.08) 45%, transparent 75%);
}
.flip-leaf {
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
}
.leaf-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.leaf-front {
  box-shadow: 6px 0 18px rgba(0, 0, 0, 0.18);
}
.leaf-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent 22%);
}
.leaf-back {
  transform: rotateY(180deg);
  background: linear-gradient(to left, rgba(0, 0, 0, 0.14), transparent 35%), var(--reader-bg);
}
.leaf-paragraphs > p:last-child {
  margin-bottom: 0;
}

/* [claude code] 2026-10-30 我的最愛愛心按鈕 */
.favorite-btn {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--muted);
}
.favorite-btn.on {
  color: #d6455d;
}
.btn.favorite-btn {
  font-size: inherit;
}
/* [claude code] 2026-10-30 v1.5 單人書房、橫向書排、閱讀統計。 */
.study-home { margin-bottom: 32px; }
.study-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; width: 100%; padding: 22px; text-align: left; border: 1px solid #d7ddd4; background: #eef2eb; border-radius: 14px; color: #354d41; }
.study-stats strong { font-size: 1.5rem; }
.study-stats svg { width: 18px; height: 18px; vertical-align: middle; }
.study-shelf { margin: 28px 0; min-width: 0; }
.study-shelf h2 { font-size: 1.2rem; margin-bottom: 16px; }
.shelf-row { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x proximity; padding: 0 0 14px; -webkit-overflow-scrolling: touch; }
.shelf-book { flex: 0 0 132px; min-width: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; scroll-snap-align: start; }
.shelf-book .book-cover { width: 132px; height: 176px; min-height: 0; }
.shelf-book strong { width: 100%; font-size: 14px; overflow-wrap: anywhere; }
.shelf-book small { color: #667367; }
.reading-summary { display: flex; flex-wrap: wrap; gap: 20px; padding: 20px 0; }
.reading-summary .stat { min-width: 92px; }
.reading-chart { margin: 24px 0; padding: 20px 12px; border: 1px solid #d7ddd4; border-radius: 12px; }
.reading-chart h2 { font-size: 1.2rem; }
.chart-bars { height: 160px; display: flex; gap: 3px; margin-top: 24px; border-bottom: 1px solid #ccd4c9; }
.chart-day { flex: 1; min-width: 0; display: flex; align-items: flex-end; }
.chart-day > div { width: 100%; background: #67826a; border-radius: 3px 3px 0 0; }
.chart-labels { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; color: #667367; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mobile-nav [data-action="filter-favorite"] > span { font-size: 23px; line-height: 24px; }
@media (max-width: 767px) { .mobile-nav { grid-template-columns: repeat(5, 1fr); } }
/* [claude code] 2026-10-30 一律手機直式:拿掉 v1.5 寬螢幕側欄版面(專案紅線,static_test 守門) */

/* [claude code] 2026-10-30 書卡「✓ 已下載 / 有更新」:放封面左下,不跟篇幅 / 來源標籤搶位置 */
.cover-wrap .offline-badge,
.shelf-book .offline-badge {
  position: absolute;
  left: 8px;
  right: auto;
  top: auto;
  bottom: 8px;
  background: #2f5a43;
  color: #fff;
}
.cover-wrap .offline-badge.partial,
.shelf-book .offline-badge.partial {
  background: #b7791f;
}
.shelf-book {
  position: relative;
}
.shelf-book .offline-badge {
  bottom: auto;
  top: 146px;
}

/* [claude code] 2026-10-31 個人分類 */
.library-filterbar #category-filter {
  grid-column: span 2;
}
.library-filterbar .btn {
  min-height: 0;
  padding: 0 8px;
  font-size: 11px;
  justify-content: center;
}
.book-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 4px;
}
.book-categories .tag {
  padding: 2px 6px;
}
.category-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 12px 0;
}
.category-manage {
  display: grid;
  gap: 8px;
  margin: 12px 0 20px;
}
.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 6px;
}
.category-row input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
}
.category-row small {
  color: var(--muted);
  white-space: nowrap;
}
/* 書卡多了分類鈕:評分自成一行,三顆圖示鈕排下一行,避免「未評分」被擠成直排 */
.book-personal {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0 4px;
}
.book-personal .book-rating {
  flex: 1 0 100%;
  min-height: 0;
}
.book-personal .book-rating small {
  display: inline;
  margin-left: 6px;
  white-space: nowrap;
}
.book-personal .icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
}
/* 聽書維持手機直式；控制列獨立於閱讀選單，暫停時也保留。 */
.tts-bar[hidden], .tts-help[hidden] { display: none; }
.tts-bar {
  position: fixed;
  left: max(0px, calc((100% - 480px) / 2));
  width: min(100%, 480px);
  bottom: calc(62px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: var(--reader-bg);
  color: var(--reader-ink);
  border-top: 1px solid #8883;
  z-index: 11;
  box-sizing: border-box;
}
.tts-bar button, .tts-bar select {
  font: 12px system-ui;
  color: inherit;
  background: var(--reader-bg);
  border: 1px solid #8884;
  border-radius: 6px;
  min-height: 44px;
  padding: 4px;
}
.tts-bar button { flex: 0 0 auto; }
.tts-bar select[data-tts="rate"] { width: 64px; }
.tts-bar select[data-tts="voice"] { flex: 1; min-width: 0; width: 0; }
.reader-top .reader-label { min-width: 0; flex: 1; }
.reader-top > .icon-btn, .reader-top .actions { flex-shrink: 0; }
.library-search { position: sticky; top: 0; z-index: 9; background: var(--bg, #fff); padding: 6px 0; }
.search-line { display: flex; gap: 6px; align-items: center; }
.search-line .search-field { flex: 1; min-width: 0; }
.search-line button, .view-switch button, .continue-book { min-height: 44px; }
#search-suggest { position: absolute; top: 100%; left: 0; right: 0; max-height: 60vh; overflow: auto; background: #fff; box-shadow: 0 5px 20px #0003; z-index: 2; }
#search-suggest button { display: block; width: 100%; min-height: 44px; padding: 8px; text-align: left; border-bottom: 1px solid #ddd; }
#search-suggest small { display: block; }
.filter-panel { max-height: 65vh; overflow: auto; background: #fff; padding: 8px; }
.filter-panel summary { min-height: 44px; cursor: pointer; }
.filter-panel .actions, .filter-panel .library-filterbar { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-panel select { min-height: 44px; }
.view-switch { display: flex; justify-content: flex-end; gap: 8px; }
.book-grid.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.book-grid.list { display: block; }
.grid-2 .book-card { contain-intrinsic-size: auto 205px; border: 1px solid #dce2d9; border-radius: 8px; padding: 6px; }
.grid-2 .cover-wrap { min-height: 74px; height: 74px; padding: 0; }
.grid-2 .cover-wrap .book-cover { height: 70px; min-height: 0; width: 50px; }
.grid-2 .cover-wrap .badge, .grid-2 .book-categories, .grid-2 .length-description, .grid-2 .book-personal, .grid-2 .progress-track, .grid-2 .card-footer { display: none; }
.grid-2 .card-title h3 { margin: 0; font-size: 14px; line-height: 1.2; }
.grid-2 .card-title h3 button { min-height: 44px; }
.grid-2 .book-card p { margin: 0; line-height: 1.2; }
.continue-book { padding: 0 5px; color: #315b42; font-size: 12px; }
.book-row { display: flex; align-items: center; border-bottom: 1px solid #ddd; height: 62px; contain-intrinsic-size: auto 62px; }
.row-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; min-height: 60px; text-align: left; }
.row-main .book-cover { width: 35px; height: 50px; min-height: 0; flex: none; }
.row-main .book-cover span { display: none; }
.row-main > span { min-width: 0; }
.row-main strong, .row-main small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-main small { color: #667367; }
.random-result { display: flex; gap: 12px; margin: 12px 0; }
.random-result .book-cover { width: 80px; height: 115px; min-height: 0; flex: none; }
.random-result p { max-height: 7em; overflow: auto; }
.reader-top { gap: 0; }
.reader-top .actions { gap: 0; }
.reader-top .icon-btn { min-width: 44px; width: 44px; }
.reader-rating-slot[hidden] { display: none; }
.reader-rating-slot .rating-choices { margin: 0; background: var(--reader-bg); }
.reader-article p.tts-current { background: #c6aa4a48; border-radius: 3px; }
.tts-open .reader { padding-bottom: 190px; }
.tts-open.paged-reading .reader-article {
  height: calc(100dvh - 208px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.tts-help {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  left: max(0px, calc((100% - 480px) / 2));
  width: min(100%, 480px);
  margin: 0;
  padding: 4px 12px;
  box-sizing: border-box;
  font: 11px/1.4 system-ui;
  color: var(--reader-ink);
  background: var(--reader-bg);
  z-index: 10;
}
.tts-unavailable.paged-reading .reader-article {
  top: calc(112px + env(safe-area-inset-top));
  height: calc(100dvh - 184px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.tts-unavailable.tts-open.paged-reading .reader-article {
  height: calc(100dvh - 244px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
body.tts-unavailable:not(.paged-reading) .reader-article { padding-top: 134px; }
