:root {
  --paper: #f3efe4;
  --ink: #211c16;
  --muted: #5e564c;
  --line: rgba(33, 28, 22, 0.14);
  --seal: #8e3226;
  --soft: rgba(142, 50, 38, 0.07);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f7f3ea 0%, var(--paper) 220px);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(142, 50, 38, 0.16); }

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

a { color: inherit; }

.wrap {
  width: min(40rem, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.5rem 0 3.5rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-family: "Songti SC", "Noto Serif SC", "STSong", "PMingLiU", serif;
  font-size: 1.28rem;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.seal {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  margin-right: 0.5rem;
  border: 1px solid var(--seal);
  color: var(--seal);
  font-size: 0.86rem;
  letter-spacing: 0;
  line-height: 1;
}

.top nav a {
  color: var(--muted);
  text-decoration: none;
}

.top nav a:hover { color: var(--ink); }

.lede {
  max-width: 28rem;
  margin: 1.7rem 0 0;
  color: #3a342c;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 1.22rem;
  line-height: 1.85;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.15rem;
  margin: 1.7rem 0 0.2rem;
}

.filters a {
  color: var(--muted);
  text-decoration: none;
}

.filters a.on { color: var(--ink); }

.find {
  margin-left: auto;
  flex: 1 1 14rem;
  min-width: 10rem;
}

input[type="search"],
input[type="text"],
textarea {
  width: 100%;
  margin: 0;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 252, 246, 0.72);
  resize: vertical;
}

textarea#text {
  min-height: 8.5rem;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 1.25rem;
  line-height: 1.75;
}

textarea#note { min-height: 4.6rem; }

.field { display: block; margin-top: 1.3rem; }

.field > span,
.counter,
.hint,
.by,
.foot,
.booklink em,
.pick small {
  color: var(--muted);
}

.field > span,
.counter,
.hint { display: block; }

.field > span { margin-bottom: 0.3rem; font-size: 0.82rem; }

.counter {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  text-align: right;
}

.hint { margin: 0.55rem 0; font-size: 0.88rem; }

.hint a,
.empty a,
.banner { color: var(--seal); }

.error,
.banner { margin: 0 0 0.8rem; }

.quote { padding: 1.55rem 0; border-top: 1px solid var(--line); }

blockquote { margin: 0; }

.sentence {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "STSong", "PMingLiU", serif;
  font-size: 1.48rem;
  font-weight: 500;
  line-height: 1.75;
}

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

.sentence a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.booklink {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
  color: inherit;
  text-decoration: none;
}

.booklink span { min-width: 0; }

.booklink strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booklink strong { font-weight: 600; }

.booklink em {
  display: block;
  font-style: normal;
  font-size: 0.85rem;
}

.cover,
.placeholder {
  width: 2.4rem;
  height: 3.4rem;
  flex: none;
  border-radius: 2px;
  background: #e6dfd2;
}

.cover { display: block; object-fit: cover; }

.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: "Songti SC", "STSong", serif;
}

.cover.lg,
.placeholder.lg {
  width: 4.2rem;
  height: 6rem;
  font-size: 1.4rem;
}

.like-form { margin: 0; }

.like {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
  padding: 0.28rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.like.on {
  border-color: rgba(142, 50, 38, 0.35);
  background: var(--soft);
  color: var(--seal);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

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

.stores a:hover,
.hit-links a:hover,
.picked-links a:hover { color: var(--ink); }

.stores .spacer { flex: 1; min-width: 1rem; }

.stores .who,
.stores time { margin-left: 0.75rem; }

.quote-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.quote-foot .spacer { flex: 1; }

.single .quote { border-top: 0; padding-top: 0.2rem; }

.single .sentence { font-size: 1.7rem; }

.linkish,
.primary,
.pick,
.like { font: inherit; }

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  cursor: pointer;
}

.book-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.3rem 0 0.4rem;
}

h1 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.by { margin: 0.25rem 0 0.45rem; }

.sub {
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.empty { margin: 1.4rem 0; }

.pager {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.pager a { color: var(--muted); text-decoration: none; }

.primary {
  margin-top: 1.5rem;
  padding: 0.7rem 1.15rem;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}

.primary:hover { background: #3a3128; }

.primary:disabled,
.like:disabled { cursor: default; opacity: 0.65; }

.hit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem 0.8rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.pick {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.7rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pick strong { display: block; font-weight: 600; }

.pick small { display: block; font-size: 0.82rem; }

.hit-links,
.picked-links {
  display: flex;
  gap: 0.65rem;
  font-size: 0.78rem;
}

.hit-links a,
.picked-links a { color: var(--muted); text-decoration: none; }

.picked[hidden] { display: none; }

.picked {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
  margin: 0.8rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 6px;
  background: var(--soft);
}

.picked strong { font-weight: 600; }

.foot { margin-top: 3rem; font-size: 0.78rem; }

@media (max-width: 640px) {
  .wrap { width: min(40rem, calc(100% - 1.8rem)); }
  .hit { grid-template-columns: 1fr; }
  .hit-links { padding-bottom: 0.65rem; }
  .lede { font-size: 1.08rem; }
  .sentence,
  .single .sentence { font-size: 1.28rem; }
  .find { margin-left: 0; flex-basis: 100%; }
  h1 { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
