@charset "UTF-8";

:root {
  --paper: #f3f1e8;
  --sheet: #fbfaf4;
  --ink: #26382e;
  --text: #4f5f55;
  --muted: #768178;
  --line: rgba(49, 73, 58, .16);
  --line-strong: rgba(49, 73, 58, .32);
  --green: #345b46;
  --green-dark: #274937;
  --green-soft: #e7ebe1;
  --seal: #a34e3d;
  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: Aptos, "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, .76), transparent 34rem),
    radial-gradient(circle at 92% 18%, rgba(219, 226, 209, .42), transparent 38rem),
    var(--paper);
  font: 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .045;
  background-image: radial-gradient(rgba(28, 49, 36, .7) .48px, transparent .55px);
  background-size: 5px 5px;
}
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { color: var(--ink); background: #e7cbbf; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
}

.wrap { width: min(1080px, calc(100% - 96px)); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 12px; background: var(--sheet); }

.header {
  display: flex;
  align-items: center;
  gap: 42px;
  height: 98px;
  border-bottom: 1px solid var(--line);
}
.brand { line-height: 1; margin-right: auto; }
.brand > span { font: 500 34px/1 var(--serif); letter-spacing: 3px; }
.brand-period { color: var(--seal); letter-spacing: 0; }
.header nav { display: flex; align-items: center; gap: 34px; }
.header nav a { position: relative; color: var(--muted); font-size: 14px; padding: 10px 0; transition: color .2s ease; }
.header nav a:hover, .header nav .nav-active { color: var(--ink); }
.header nav .nav-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--green);
}
.header-actions { display: flex; align-items: center; gap: 21px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 40px; padding: 7px; background: none; }
.icon-button svg { width: 20px; height: 20px; }
.primary-button, .outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 2px;
  font-size: 14px;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.primary-button { color: #fff; background: var(--green); box-shadow: 0 8px 20px rgba(42, 73, 54, .12); }
.primary-button:hover { background: var(--green-dark); }
.outline-button { border: 1px solid var(--line-strong); background: transparent; color: var(--green); }
.outline-button:hover { background: var(--green-soft); }
button:disabled { opacity: .55; cursor: wait; }
.text-button { padding: 3px 0; background: none; color: var(--green); font-size: 14px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 5px; }

/* One passage and one book lead the page. */
.reading-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center;
  gap: 82px;
  min-height: 500px;
  padding: 58px 0 68px;
  border-bottom: 1px solid var(--line);
  animation: settle .55s ease both;
}
.feature-copy { padding: 6px 0; }
.feature-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 26px;
  color: var(--text);
  font-size: 14px;
  letter-spacing: .02em;
}
.feature-source > span + span::before { content: "·"; padding-right: 9px; color: var(--muted); }
.sample-label {
  color: var(--seal);
  font-size: 12px;
  letter-spacing: .06em;
}
.sample-label::before { color: var(--muted) !important; }
.feature-copy h1 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font: 400 clamp(32px, 3.6vw, 49px)/1.72 var(--serif);
  letter-spacing: .035em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: keep-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
.feature-read {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  margin-top: 31px;
  padding: 7px 0;
  background: none;
  color: var(--green);
  font-size: 14px;
}
.feature-read span { font-size: 18px; transition: transform .2s ease; }
.feature-read:hover span { transform: translate(3px, -3px); }
.feature-art {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 380px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .52), rgba(221, 227, 213, .46)),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(43, 74, 53, .035) 39px 40px);
}
.feature-art::before {
  content: "";
  position: absolute;
  z-index: -2;
  width: 390px;
  height: 390px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .44);
  box-shadow: inset 0 0 0 1px rgba(57, 82, 62, .08);
}
.feature-art::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -11%;
  bottom: -28%;
  width: 80%;
  height: 60%;
  transform: rotate(-8deg);
  background: rgba(120, 145, 112, .13);
}
.art-window {
  position: absolute;
  z-index: -1;
  inset: -35% 45% -20% -12%;
  transform: rotate(27deg);
  border-right: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .23);
}
.feature-cover {
  width: 184px;
  height: 276px;
  object-fit: cover;
  border-radius: 1px 3px 3px 1px;
  box-shadow:
    18px 25px 30px rgba(42, 59, 45, .19),
    3px 4px 0 #fbfbf4,
    6px 7px 0 rgba(94, 115, 90, .48);
  transform: rotate(-6deg);
  transition: transform .28s ease, box-shadow .28s ease;
}
.feature-art:hover .feature-cover {
  transform: rotate(-3deg) translateY(-5px);
  box-shadow:
    21px 29px 34px rgba(42, 59, 45, .21),
    3px 4px 0 #fbfbf4,
    6px 7px 0 rgba(94, 115, 90, .48);
}
.feature-photo {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .42;
}
.feature-art.has-photo { background: #d7dfcf; }
.book-page-edge { display: none; }

.section-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 3px;
  padding-top: 45px;
}
.section-title { display: flex; align-items: baseline; gap: 13px; }
.section-top h1, .section-top h2 { margin: 0; font: 400 31px/1.4 var(--serif); letter-spacing: .02em; }
#entry-count { color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 23px; }
.filter {
  padding: 5px 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 14px;
}
.filter.active { color: var(--ink); border-color: var(--green); }
.category-filter {
  min-width: 54px;
  padding: 5px 16px 5px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.category-filter:focus { border-color: var(--green); }

.excerpts { padding-bottom: 72px; }
.entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
.reading-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 27px;
  align-items: start;
  min-width: 0;
  padding: 31px 0 33px;
  border-bottom: 1px solid var(--line);
  animation: settle .45s ease both;
}
.entry-grid .reading-row:nth-child(2) { animation-delay: .05s; }
.entry-grid .reading-row:nth-child(3) { animation-delay: .1s; }
.entry-grid .reading-row:nth-child(4) { animation-delay: .15s; }
.row-cover-button { margin-top: 3px; padding: 0; background: none; }
.row-cover-button img {
  width: 98px;
  height: 143px;
  object-fit: cover;
  box-shadow: 7px 10px 15px rgba(36, 53, 44, .13);
  transition: transform .22s ease, box-shadow .22s ease;
}
.row-cover-button:hover img {
  transform: translateY(-3px);
  box-shadow: 9px 13px 18px rgba(36, 53, 44, .16);
}
.row-copy { min-width: 0; }
.row-source {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 13px;
}
.row-source > span + span::before { content: "·"; padding-right: 7px; }
.row-source .sample-label { color: var(--seal); }
.quote-button { display: block; width: 100%; padding: 0; background: none; text-align: left; }
.quote-button:hover { color: var(--green); }
.reading-row blockquote {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font: 400 21px/1.82 var(--serif);
  letter-spacing: .025em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.empty-state { grid-column: 1/-1; padding: 68px 0 78px; text-align: center; color: var(--muted); }
.empty-state p { margin: 0 0 20px; font: 400 20px/1.8 var(--serif); }
.storage-error { color: #8d4538; font-size: 14px; }

.bookshelf { min-height: 65vh; padding: 10px 0 92px; }
.shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 44px 38px; }
.shelf-book { min-width: 0; padding: 22px 0; background: none; text-align: left; }
.shelf-book img {
  width: 112px;
  height: 161px;
  margin-bottom: 20px;
  object-fit: cover;
  box-shadow: 7px 10px 16px rgba(36, 53, 44, .15);
  transition: transform .22s ease;
}
.shelf-book:hover img { transform: translateY(-4px); }
.shelf-book strong { display: block; font: 400 20px/1.55 var(--serif); overflow-wrap: anywhere; }
.shelf-book small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.shelf-book .book-count { margin-top: 10px; }

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 25px 0 36px;
  border-top: 1px solid var(--line);
}
.footer-brand { color: var(--muted); font: 400 19px/1 var(--serif); }
.footer-actions { display: flex; align-items: center; gap: 22px; }
.footer .text-button { color: var(--muted); font-size: 12px; }

dialog {
  width: min(660px, calc(100% - 32px));
  max-height: 91dvh;
  padding: 32px 36px;
  border: 1px solid rgba(46, 72, 54, .12);
  border-radius: 2px;
  background:
    linear-gradient(rgba(255, 255, 255, .45), rgba(255, 255, 255, .18)),
    var(--sheet);
  box-shadow: 0 28px 110px rgba(24, 42, 31, .24);
  color: var(--ink);
}
dialog::backdrop { background: rgba(31, 48, 37, .44); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.dialog-heading h2 { margin: 0; font: 400 30px/1.4 var(--serif); letter-spacing: .04em; }
.close-button { align-self: flex-start; padding: 0 4px; background: none; color: var(--muted); font-size: 27px; line-height: 1; }
.close-button:hover { color: var(--ink); }

.search-label input {
  display: block;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: 18px/1.6 var(--serif);
}
.search-hit {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.search-hit img { width: 38px; height: 54px; flex: none; object-fit: cover; }
.search-hit strong {
  display: -webkit-box;
  overflow: hidden;
  font: 400 18px/1.7 var(--serif);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.search-hit small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.search-empty { padding: 24px 0; color: var(--muted); font-size: 14px; }

.settings-dialog section { margin: 24px 0 29px; }
.settings-dialog h3 { margin: 0 0 8px; font-size: 15px; font-weight: 500; }
.settings-dialog p { margin: 0 0 14px; color: var(--text); font-size: 14px; line-height: 1.9; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions .outline-button { min-height: 38px; padding: 7px 12px; font-size: 13px; }

.media-dialog { width: min(640px, calc(100% - 24px)); }
.media-scope { margin: -9px 0 22px; color: var(--text); font-size: 14px; }
.media-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 20px 0 24px; border-block: 1px solid var(--line); }
.media-totals dt { color: var(--text); font-size: 13px; }
.media-totals dd { margin: 7px 0 0; font: 400 clamp(21px, 4.8vw, 31px)/1.2 var(--serif); white-space: nowrap; }
.media-saving { margin: 14px 0 0; color: var(--green); font-size: 13px; }
.media-largest { margin: 27px 0 20px; }
.media-largest h3 { margin: 0 0 10px; font-size: 15px; font-weight: 500; }
.media-item { display: flex; align-items: center; gap: 15px; width: 100%; padding: 13px 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.media-item img { width: 48px; height: 60px; flex: none; object-fit: cover; }
.media-item > span:not(.media-item-size) { min-width: 0; }
.media-item strong { display: block; overflow-wrap: anywhere; font: 400 16px/1.5 var(--serif); }
.media-item small { display: block; margin-top: 3px; color: var(--text); font-size: 12px; }
.media-item-size { margin-left: auto; flex: none; color: var(--green); font-size: 13px; }
.media-item:hover strong { color: var(--green); }
.media-empty { margin: 15px 0 0; color: var(--text); font-size: 14px; line-height: 1.9; }
.media-notes { color: var(--text); font-size: 13px; }
.media-notes summary { width: fit-content; cursor: pointer; }
.media-notes p { margin: 10px 0 0; line-height: 1.9; }
.media-server { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 14px; margin: 25px 0 21px; padding: 16px 0; border-block: 1px solid var(--line); font-size: 13px; }
.media-server strong { color: var(--text); font-weight: 400; }
.media-server p { flex-basis: 100%; margin: 0; color: var(--text); line-height: 1.7; }
#media-back { font-size: 14px; }

.detail-dialog { width: min(800px, calc(100% - 32px)); padding: 0; }
.detail-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 244, .96);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(8px);
}
.detail-inner { padding: 38px 54px 43px; }
.detail-image { width: 100%; height: 250px; margin-bottom: 30px; object-fit: cover; }
.detail-source { display: flex; align-items: center; gap: 19px; margin-bottom: 30px; }
.detail-source img { width: 66px; height: 96px; flex: none; object-fit: cover; box-shadow: 5px 7px 13px rgba(36, 53, 44, .14); }
.detail-source h1 { margin: 0; font: 400 27px/1.55 var(--serif); overflow-wrap: anywhere; }
.detail-source p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.detail-quote {
  margin: 0;
  font: 400 27px/1.95 var(--serif);
  letter-spacing: .035em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail-location { margin: 19px 0 0; color: var(--muted); font-size: 13px; }
.detail-note {
  margin: 38px 0 0 36px;
  padding: 2px 0 2px 22px;
  border-left: 1px solid rgba(163, 78, 61, .6);
}
.detail-note h2 { margin: 0 0 10px; color: var(--seal); font-size: 12px; font-weight: 400; letter-spacing: .08em; }
.detail-note p { margin: 0; color: var(--text); font: 400 17px/1.95 var(--serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-foot {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.detail-actions-right { justify-content: flex-end; margin-left: auto; }
.danger-link { color: var(--seal); }
.detail-foot a, .catalog-credit a { text-decoration: underline; text-underline-offset: 4px; }
.catalog-credit { margin-top: 25px; color: var(--muted); font-size: 12px; line-height: 1.9; }

.share-dialog { width: min(560px, calc(100% - 26px)); }
.share-themes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}
.share-themes label { position: relative; flex: 1; cursor: pointer; }
.share-themes input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.share-themes span {
  display: block;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.share-themes input:checked + span { border-color: rgba(52, 91, 70, .55); background: var(--green-soft); color: var(--green); }
.share-themes input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 3px; }
.share-preview {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .38), transparent),
    rgba(54, 74, 60, .055);
}
#share-canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 45dvh;
  box-shadow: 0 18px 44px rgba(31, 51, 37, .2);
}
.share-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 17px;
}
#share-status { color: var(--muted); font-size: 12px; line-height: 1.7; }
.share-pagination { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 15px; font-size: 13px; }
.share-pagination .text-button { font-size: 13px; }
.share-pagination button:disabled { color: var(--muted); cursor: default; opacity: .6; }

.write-dialog { width: min(760px, calc(100% - 32px)); padding: 34px 45px 30px; }
.write-dialog::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 21px;
  width: 1px;
  background: rgba(163, 78, 61, .24);
  pointer-events: none;
}
.write-layout { display: block; }
.form-fields { min-width: 0; }
.field-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.quote-field { display: block; }
.form-fields label, .form-field label { color: var(--text); font-size: 13px; }
.form-fields input:not([type=file]), .form-fields textarea, .form-fields select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  transition: border-color .2s ease, background .2s ease;
}
.form-fields input:not([type=file]):focus, .form-fields textarea:focus, .form-fields select:focus {
  border-color: var(--green);
  outline-offset: 3px;
}
.form-fields input:not([type=file]):focus-visible, .form-fields textarea:focus-visible, .form-fields select:focus-visible {
  outline: 0;
  box-shadow: 0 2px 0 rgba(52, 91, 70, .42);
}
.form-fields input::placeholder, .form-fields textarea::placeholder { color: #929b92; }
#quote-input {
  min-height: 225px;
  margin-top: 0;
  padding: 13px 4px 13px 0;
  border-bottom-color: rgba(44, 76, 55, .24);
  font: 400 21px/1.92 var(--serif);
  letter-spacing: .02em;
}
#quote-input::placeholder { font-size: 20px; letter-spacing: 0; }
.source-fields { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; margin-top: 23px; }
.form-field { min-width: 0; }
.book-query-row { display: flex; align-items: flex-end; gap: 10px; }
.book-query-row #book-input { flex: 1; min-width: 0; }
.book-query-row .outline-button { min-width: 60px; min-height: 38px; margin-bottom: 1px; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line-strong); background: none; }
.book-query #recover-book { margin-top: 7px; text-align: left; font-size: 12px; }
.book-metadata {
  display: none;
  align-items: center;
  gap: 13px;
  margin-top: 18px;
}
.book-metadata.has-details { display: flex; }
#matched-cover { width: 42px; height: 60px; flex: none; object-fit: cover; box-shadow: 3px 4px 7px rgba(36, 53, 44, .13); }
.book-extras { display: flex; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
#catalog-link, #clear-cover { margin: 0; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.lookup-panel { margin-top: 15px; }
#lookup-status { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
#lookup-status:empty { display: none; }
.book-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 7px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.book-candidate > img { width: 34px; height: 48px; flex: none; object-fit: cover; }
.book-candidate > span { min-width: 0; }
.book-candidate strong { display: block; font-size: 14px; font-weight: 500; }
.book-candidate small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.book-candidate .candidate-select { margin-left: auto; flex: none; color: var(--green); font-size: 12px; }

.extra-fields, .appearance-fields, .preview-drawer { margin-top: 22px; border-top: 1px solid var(--line); }
.extra-fields summary, .appearance-fields summary, .preview-drawer > summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 15px 0 0;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}
.extra-fields summary::-webkit-details-marker, .appearance-fields summary::-webkit-details-marker, .preview-drawer > summary::-webkit-details-marker { display: none; }
.extra-fields summary::before, .appearance-fields summary::before, .preview-drawer > summary::before {
  content: "＋";
  color: var(--seal);
  font-size: 15px;
  line-height: 1;
}
.extra-fields[open] summary::before, .appearance-fields[open] summary::before, .preview-drawer[open] > summary::before { content: "－"; }
.extra-fields summary span { color: var(--muted); font-size: 12px; }
.extra-fields > label, .appearance-fields .image-label { display: block; margin-top: 21px; }
.extra-fields textarea { min-height: 98px; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 19px; }
.format-options { display: flex; gap: 7px; margin: 20px 0 0; padding: 0; border: 0; }
.format-options legend { margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.format-options label { position: relative; flex: 1; cursor: pointer; }
.format-options input { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.format-options span { display: block; padding: 8px; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); font-size: 13px; text-align: center; }
.format-options input:checked + span { border-color: rgba(52, 91, 70, .55); background: var(--green-soft); color: var(--green); }
.format-options input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 3px; }
.image-label input { display: block; width: 100%; margin-top: 9px; font-size: 12px; }
.image-label input::file-selector-button {
  margin-right: 9px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--green-soft);
  color: var(--green);
  cursor: pointer;
}
.image-label small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.photo-controls { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 21px; }
.photo-controls > label { color: var(--text); font-size: 13px; }
.form-fields .photo-controls select { min-height: 42px; margin: 0; font-size: 14px; }
.image-summary { display: flex; align-items: center; gap: 15px; margin-top: 17px; padding: 16px 0; border-block: 1px solid var(--line); }
.image-summary img { width: 62px; height: 72px; flex: none; object-fit: cover; }
.image-summary > div { min-width: 0; }
.image-summary p { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.image-summary span { color: var(--text); font-size: 12px; }
.image-summary button { margin-left: auto; flex: none; font-size: 13px; }
.image-status { margin: 8px 0 0; color: var(--text); font-size: 13px; line-height: 1.8; }
.image-status:empty { display: none; }
.preview-drawer > summary { padding-bottom: 15px; }
.preview-drawer[open] > summary { padding-bottom: 0; }
#live-preview { width: min(430px, 100%); margin: 23px auto 3px; }
.form-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
#form-status { color: var(--muted); font-size: 12px; line-height: 1.7; }
.form-bottom .primary-button { min-width: 118px; }

/* Live previews keep the same calm, paper-first language as the reading page. */
.entry { min-width: 0; }
.entry-body { min-height: 280px; padding: 25px; border: 1px solid var(--line); background: rgba(255, 255, 255, .5); }
.entry-source { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.entry-cover { width: 38px; height: 54px; flex: none; object-fit: cover; }
.entry-book { display: block; font-size: 14px; }
.entry-author { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.entry-quote {
  display: -webkit-box;
  margin: 0 0 16px;
  overflow: hidden;
  font: 400 20px/1.9 var(--serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}
.entry-location { color: var(--muted); font-size: 12px; }
.entry-note {
  display: -webkit-box;
  margin: 14px 0 0;
  padding-top: 13px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.entry-photo .entry-body { overflow: hidden; padding: 0; }
.entry-image { width: 100%; height: 135px; object-fit: cover; }
.entry-content { padding: 21px; }
.entry-photo .entry-source { margin: 0; }
.entry-note-layout .entry-body { background: #e9ecdf; }
.note-corner { display: none; }
.book-cover-photo { padding: 12px; object-fit: contain !important; background: radial-gradient(ellipse at 50% 85%, #dfe3d5, #eef0e6 75%); }

.toast {
  position: fixed;
  z-index: 99;
  bottom: 25px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 12px 19px;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 12px 35px rgba(30, 47, 36, .2);
  color: #fff;
  font-size: 13px;
  line-height: 1.7;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes settle {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1000px) {
  .wrap { width: calc(100% - 68px); }
  .reading-feature { grid-template-columns: 1.15fr .85fr; gap: 45px; min-height: 440px; padding: 45px 0 56px; }
  .feature-copy h1 { font-size: 37px; }
  .feature-art { height: 330px; }
  .feature-cover { width: 158px; height: 237px; }
  .entry-grid { gap: 0 34px; }
  .reading-row { grid-template-columns: 84px minmax(0, 1fr); gap: 21px; }
  .row-cover-button img { width: 84px; height: 123px; }
  .reading-row blockquote { font-size: 19px; }
  .shelf { gap: 36px 28px; }
  .write-dialog { padding-inline: 40px; }
}

@media (max-width: 760px) {
  .wrap { width: calc(100% - 40px); }
  .header { height: 84px; gap: 23px; }
  .header nav { gap: 22px; }
  .header-actions { gap: 12px; }
  .reading-feature { grid-template-columns: 1fr; gap: 32px; min-height: 0; padding: 34px 0 48px; }
  .feature-art { height: 290px; }
  .feature-copy h1 { font-size: 32px; }
  .section-top { padding-top: 35px; }
  .entry-grid { grid-template-columns: 1fr; gap: 0; }
  .reading-row { grid-template-columns: 94px minmax(0, 1fr); gap: 25px; padding-block: 27px; }
  .row-cover-button img { width: 94px; height: 137px; }
  .reading-row blockquote { font-size: 21px; }
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 24px; }
  .write-dialog { width: min(690px, calc(100% - 24px)); padding: 29px 32px 26px; }
  .write-dialog::before { left: 15px; }
  .detail-inner { padding: 32px; }
  .detail-quote { font-size: 24px; }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 36px); }
  .header { height: 78px; gap: 17px; }
  .brand > span { font-size: 29px; letter-spacing: 2px; }
  .header nav { gap: 17px; }
  .header nav a { font-size: 13px; }
  .header-actions { gap: 7px; }
  .header .primary-button { min-height: 38px; padding: 7px 10px; font-size: 13px; gap: 4px; }
  .icon-button { width: 29px; padding: 4px; }
  .reading-feature { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 26px; padding: 24px 0 40px; }
  .feature-art { height: 225px; }
  .feature-art::before { width: 275px; height: 275px; }
  .feature-cover { width: 116px; height: 174px; transform: rotate(-5deg); }
  .feature-copy { padding: 0; }
  .feature-source { margin-bottom: 17px; font-size: 13px; }
  .feature-copy h1 { font-size: 28px; line-height: 1.82; }
  .feature-read { margin-top: 19px; }
  .section-top { gap: 14px; padding-top: 31px; }
  .section-top h1, .section-top h2 { font-size: 26px; }
  .section-title { gap: 10px; }
  .filters { gap: 18px; }
  .reading-row { grid-template-columns: 76px minmax(0, 1fr); gap: 19px; }
  .row-cover-button img { width: 76px; height: 111px; }
  .row-source { margin-bottom: 9px; font-size: 12px; }
  .reading-row blockquote { font-size: 19px; line-height: 1.82; -webkit-line-clamp: 4; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px 28px; }
  .shelf-book img { width: 94px; height: 135px; }
  .bookshelf { padding-top: 0; }
  .footer { padding: 22px 0 27px; }
  .footer-actions { gap: 15px; }
  dialog { width: calc(100% - 12px); max-height: 96dvh; padding: 24px 22px; }
  .write-dialog { padding: 24px 22px 19px; }
  .write-dialog::before { left: 9px; }
  .dialog-heading { margin-bottom: 17px; }
  .dialog-heading h2 { font-size: 27px; }
  #quote-input { min-height: 220px; font-size: 19px; line-height: 1.9; }
  #quote-input::placeholder { font-size: 18px; }
  .source-fields { grid-template-columns: 1fr; gap: 17px; margin-top: 20px; }
  .book-query-row .outline-button { min-width: 54px; padding-inline: 9px; }
  .form-fields input:not([type=file]), .form-fields textarea, .form-fields select { font-size: 16px; }
  .form-fields .photo-controls select { font-size: 16px; }
  .field-pair { grid-template-columns: 1fr; gap: 17px; }
  .form-bottom {
    position: sticky;
    bottom: -19px;
    z-index: 3;
    margin: 22px -22px -2px;
    padding: 14px 22px 12px;
    background: var(--sheet);
    box-shadow: 0 -10px 22px rgba(243, 241, 232, .96);
  }
  #form-status { max-width: 44%; font-size: 11px; }
  .form-bottom .primary-button { flex: none; min-width: 116px; }
  .detail-inner { padding: 27px 24px 31px; }
  .detail-source img { width: 54px; height: 79px; }
  .detail-source h1 { font-size: 23px; }
  .detail-quote { font-size: 22px; line-height: 1.92; }
  .detail-note { margin-left: 10px; }
  .detail-foot { flex-wrap: wrap; }
  .detail-actions-right { margin-left: 0; }
  .detail-image { height: 190px; }
  .share-preview { padding: 10px; }
  #share-canvas { max-height: 43dvh; }
  .share-actions { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
