/* ---------------- tokens ---------------- */
:root {
  --bg: #faf6ee;
  --bg-2: #fffdf8;
  --bg-3: #f3ecdd;
  --ink: #332f27;
  --ink-2: #5d5749;
  --muted: #93897a;
  --clay: #c2604a;
  --clay-deep: #a94f3c;
  --clay-soft: #f5e3db;
  --sage: #718a69;
  --sage-soft: #e7eddf;
  --sky: #6f8ba0;
  --sky-soft: #e3ebf1;
  --sun: #c39240;
  --sun-soft: #f8edd6;
  --line: rgba(84, 70, 48, 0.13);
  --line-strong: rgba(84, 70, 48, 0.26);
  --shadow: 0 16px 40px rgba(90, 72, 46, 0.08);
  --radius: 18px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --poem-size: 30px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

html[data-size="sm"] { --poem-size: 25px; }
html[data-size="md"] { --poem-size: 30px; }
html[data-size="lg"] { --poem-size: 37px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  overscroll-behavior-y: none;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(194, 96, 74, 0.06), transparent 62%),
    radial-gradient(820px 460px at 104% -4%, rgba(195, 146, 64, 0.1), transparent 58%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(194, 96, 74, 0.18); }

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

a, button, input, select, .line { touch-action: manipulation; }
button, .btn, .back, .chip, .tab, .poem-card, .segmented, .switch, .speed, .line {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  background: rgba(250, 246, 238, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-seal {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--clay);
  color: #fff8ec;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 236, 0.4);
}
.brand-text {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.top-meta { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }

#app {
  flex: 1 0 auto;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) calc(var(--tab-h) + var(--safe-b) + 34px) max(20px, env(safe-area-inset-left));
}
body.detail-open #app { padding-bottom: 46px; }

/* ---------------- tabbar ---------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 0 max(10px, env(safe-area-inset-left)) var(--safe-b) max(10px, env(safe-area-inset-right));
  background: rgba(255, 253, 248, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(170%) blur(18px);
  -webkit-backdrop-filter: saturate(170%) blur(18px);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.24s ease;
}
.tabbar-inner {
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  height: var(--tab-h);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  border-radius: 14px;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 30px;
  border-radius: 999px;
  transition: background 0.22s, transform 0.22s;
}
.tab-label { font-size: 10.5px; letter-spacing: 0.1em; }
.tab.active { color: var(--clay); }
.tab.active .tab-icon { background: var(--clay-soft); transform: translateY(-1px); }
.tab.active .tab-label { font-weight: 600; }
.nav-badge {
  position: absolute;
  top: -3px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--clay);
  color: #fff;
  font-size: 9.5px;
  line-height: 16px;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0;
}
body.detail-open .tabbar { transform: translateY(115%); opacity: 0; pointer-events: none; }

/* ---------------- home hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 18px;
  padding: 34px 0 22px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: 0.32em;
  color: var(--sun);
}
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--sun); opacity: 0.7; }
.hero h1 {
  margin: 13px 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 42px);
  line-height: 1.22;
  letter-spacing: 0.05em;
}
.hero h1 em { font-style: normal; color: var(--clay); }
.hero p {
  max-width: 33em;
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.9;
}
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.stat b { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.hero-art { align-self: center; }
.hero-art svg { display: block; width: 100%; height: auto; }

/* ---------------- resume ---------------- */
.resume {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 20px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.resume-art { width: 42px; height: 42px; border-radius: 13px; }
.resume-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.resume .label { font-size: 10.5px; letter-spacing: 0.2em; color: var(--muted); }
.resume .title {
  font-family: var(--serif);
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resume .arrow { margin-left: auto; color: var(--clay); font-size: 18px; }

/* ---------------- search ---------------- */
.searchbar { position: relative; margin-top: 4px; }
.searchbar svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbar input {
  width: 100%;
  height: 48px;
  padding: 0 44px 0 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.searchbar input::placeholder { color: #a89d8b; }
.searchbar input:focus { border-color: rgba(194, 96, 74, 0.45); box-shadow: 0 0 0 4px rgba(194, 96, 74, 0.08); }
.search-clear {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  display: none;
}
.search-clear.show { display: block; }
.searchbar.compact { margin: 0 0 16px; }

/* ---------------- chips ---------------- */
.chips {
  display: flex;
  gap: 7px;
  margin: 14px 0 2px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  transition: all 0.18s;
}
.chip.active {
  background: var(--clay-soft);
  border-color: rgba(194, 96, 74, 0.35);
  color: var(--clay-deep);
  font-weight: 600;
}

/* ---------------- list ---------------- */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 2px 14px;
}
.list-head .count { font-size: 11.5px; color: var(--muted); letter-spacing: 0.05em; }

.genre-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 2px 12px;
}
.genre-block:first-of-type .genre-head { margin-top: 14px; }
.genre-badge { width: 34px; height: 34px; border-radius: 11px; }
.genre-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
.genre-head .num { margin-left: auto; font-size: 11.5px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 11px; }

.poem-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.poem-card:active { background: var(--bg-3); }
.card-art { width: 44px; height: 44px; border-radius: 14px; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-top h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-top .idx { font-size: 9.5px; color: #b8ad99; letter-spacing: 0.07em; }
.card-body .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.card-body .first {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
}
.flags { display: inline-flex; flex: 0 0 auto; gap: 5px; margin-left: auto; padding-left: 6px; }
.flag { font-size: 10px; color: var(--clay); }
.flag.done { color: var(--sage); display: inline-flex; }
.flag svg { width: 11px; height: 11px; }

/* ---------------- art tiles ---------------- */
.art-tile { display: inline-grid; place-items: center; flex: 0 0 auto; }
.art-clay { background: var(--clay-soft); color: var(--clay); }
.art-sage { background: var(--sage-soft); color: var(--sage); }
.art-sky { background: var(--sky-soft); color: var(--sky); }
.art-sun { background: var(--sun-soft); color: var(--sun); }
.art-tile svg { width: 60%; height: 60%; }

/* ---------------- collection pages ---------------- */
.collection-head {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 28px 4px 20px;
}
.collection-art { width: 62px; height: 62px; border-radius: 20px; }
.collection-art svg { width: 30px; height: 30px; }
.collection-copy { min-width: 0; }
.collection-head h1 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.collection-head p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.collection-count {
  margin-left: auto;
  flex: 0 0 auto;
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
}
.collection-count b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.1; }

/* ---------------- empty ---------------- */
.empty {
  margin-top: 14px;
  padding: 40px 22px 44px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.55);
}
.empty .art { width: 110px; height: 110px; margin: 0 auto 14px; }
.empty .art svg { width: 100%; height: 100%; }
.empty .big { font-family: var(--serif); font-size: 18px; color: var(--ink-2); }
.empty p { margin: 7px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.empty .btn { margin-top: 18px; }

/* ---------------- settings ---------------- */
.settings-card {
  margin-top: 12px;
  padding: 2px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-2);
}
.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.setting:last-child { border-bottom: 0; }
.s-label { font-size: 14px; color: var(--ink); }
.s-sub { margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(84, 70, 48, 0.06);
}
.segmented button {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  transition: all 0.18s;
}
.segmented button.on {
  background: var(--bg-2);
  color: var(--clay);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(84, 70, 48, 0.13);
}
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: rgba(84, 70, 48, 0.18);
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(60, 45, 25, 0.22);
  transition: transform 0.22s;
}
.switch.on { background: var(--clay); }
.switch.on::after { transform: translateX(20px); }

.stats-card { padding: 16px; }
.stats-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.stats-num { font-size: 12px; color: var(--muted); }
.stats-num b { font-family: var(--serif); font-size: 20px; color: var(--ink); font-weight: 600; }
.progress {
  height: 8px;
  margin-top: 11px;
  border-radius: 999px;
  background: rgba(84, 70, 48, 0.09);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sage), #a0b697);
  transition: width 0.5s ease;
}
.stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 10px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.stats-row b { color: var(--ink-2); font-weight: 600; }
.stats-actions { display: inline-flex; gap: 14px; }
.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}
.linkbtn.danger { color: var(--clay); }

.about-card { padding: 16px; }
.about-row { display: flex; align-items: center; gap: 12px; }
.mini { width: 40px; height: 40px; border-radius: 13px; font-family: var(--serif); font-size: 19px; }
.settings-note {
  margin: 14px 0 0;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 13px;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn.primary { background: var(--clay); border-color: var(--clay); color: #fff8ee; }
.btn.active { border-color: var(--clay); color: var(--clay); background: var(--clay-soft); }
.btn svg { flex: 0 0 auto; }

/* ---------------- detail ---------------- */
.detail { max-width: 820px; margin: 0 auto; padding: 18px 0 40px; }
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 90px 0;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.08em;
}
.loading span {
  width: 15px;
  height: 15px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--clay);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 35px;
  padding: 0 13px 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: border-color 0.2s, color 0.2s;
}

.poem-head { text-align: center; padding: 16px 0 2px; }
.poem-medallion { display: grid; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 18px; }
.poem-medallion svg { width: 30px; height: 30px; }
.poem-head .genre {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--sun);
  padding: 4px 12px;
  border: 1px solid rgba(195, 146, 64, 0.36);
  border-radius: 999px;
}
.poem-head h1 {
  margin: 12px 0 8px;
  font-family: var(--serif);
  font-size: clamp(27px, 4.6vw, 36px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.06em;
}
.poem-head .writer { color: var(--muted); font-size: 13.5px; letter-spacing: 0.16em; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 18px 0 16px; }
.speed {
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  font-size: 16px;
  color: var(--ink-2);
  outline: none;
}

.paper-card {
  position: relative;
  overflow: hidden;
  padding: 34px 22px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #fffefa, #fcf7ec);
  box-shadow: var(--shadow);
}
.paper-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(195, 146, 64, 0.16);
  border-radius: 16px;
  pointer-events: none;
}
.paper-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -52px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(195, 146, 64, 0.14), transparent 70%);
  pointer-events: none;
}
.lines { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 3px 0.1em;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 10px;
  border-bottom: 1px dashed transparent;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}
.seg { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0 0.14em; max-width: 100%; }
.ch { display: inline-flex; flex-direction: column; align-items: center; min-width: 1.02em; }
.py {
  height: 1.32em;
  font-family: var(--sans);
  font-size: calc(var(--poem-size) * 0.4);
  line-height: 1.25;
  color: #a2957e;
  letter-spacing: 0;
  white-space: nowrap;
  transition: opacity 0.18s, color 0.18s;
}
.hz {
  font-family: var(--serif);
  font-size: var(--poem-size);
  line-height: 1.42;
  color: var(--ink);
  transition: opacity 0.18s, color 0.2s;
}
.ch.cur .hz { color: var(--clay); }
.ch.cur .py { color: var(--clay-deep); opacity: 0.9; }
.no-pinyin .py { display: none; }

.recite .py { opacity: 0.55; }
.recite .line:not(.revealed) .hz { opacity: 0; }
.recite .line:not(.revealed) { border-bottom-color: var(--line-strong); }
.recite .line.revealed { background: rgba(195, 146, 64, 0.07); }

.recite-bar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}
.recite .recite-bar { display: flex; }
.recite-bar .btn { height: 31px; font-size: 12px; padding: 0 12px; }
.hint { display: none; }
.recite .hint { display: inline; }

.content-card {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-2);
}
.content-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--clay);
}
.content-card h2::before { content: ""; width: 15px; height: 2px; border-radius: 2px; background: var(--clay); opacity: 0.75; }
.content-card h2 .sub {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 400;
  margin-left: auto;
}

.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px 24px; }
.note { display: flex; align-items: baseline; gap: 9px; font-size: 13.5px; line-height: 1.75; color: var(--ink-2); }
.note .term { flex: 0 0 auto; color: var(--clay); font-family: var(--serif); font-weight: 600; font-size: 14px; }

.trans p { margin: 0 0 0.5em; font-size: 14.5px; line-height: 1.95; color: var(--ink-2); }
.trans p:last-child { margin-bottom: 0; }

.rich { font-size: 14.5px; line-height: 1.95; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.content-card .brief {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-left: 2px solid rgba(195, 146, 64, 0.55);
  background: rgba(195, 146, 64, 0.06);
  border-radius: 0 10px 10px 0;
  color: var(--ink-2);
  font-size: 14px;
}
.rich.collapsed {
  max-height: 14.5em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 62%, transparent 100%);
  mask-image: linear-gradient(#000 62%, transparent 100%);
}
.more {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--clay);
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

.variants { margin: 0; padding: 0; list-style: none; }
.variants li { position: relative; padding-left: 16px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.variants li::before { content: "异"; position: absolute; left: 0; top: 0; color: var(--sun); font-size: 10.5px; }

.tagrow { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; justify-content: center; }
.tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 253, 248, 0.6);
}

.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 20px; }
.pn a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
  transition: border-color 0.2s, transform 0.2s;
}
.pn .dir { font-size: 10.5px; letter-spacing: 0.16em; color: var(--muted); }
.pn .t { font-family: var(--serif); font-size: 15px; }
.pn a.next { text-align: right; align-items: flex-end; }
.pn a.disabled { visibility: hidden; }

/* ---------------- footer ---------------- */
.footer {
  max-width: 960px;
  margin: 22px auto 0;
  padding: 26px max(20px, env(safe-area-inset-right)) calc(var(--tab-h) + var(--safe-b) + 26px) max(20px, env(safe-area-inset-left));
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.9;
  border-top: 1px solid var(--line);
}
body.detail-open .footer { padding-bottom: 34px; }
.footer p { margin: 2px 0; }
.footer-sub { opacity: 0.72; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 20px);
  transform: translate(-50%, 14px);
  padding: 10px 17px;
  border-radius: 999px;
  background: rgba(45, 40, 33, 0.92);
  color: #fff8ec;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s, bottom 0.32s;
  z-index: 60;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.detail-open .toast { bottom: calc(28px + var(--safe-b)); }

/* ---------------- pointer-specific feedback ---------------- */
@media (hover: hover) and (pointer: fine) {
  .resume:hover { border-color: rgba(194, 96, 74, 0.4); transform: translateY(-1px); box-shadow: var(--shadow); }
  .chip:hover { border-color: var(--line-strong); }
  .poem-card:hover { transform: translateY(-2px); border-color: rgba(194, 96, 74, 0.32); box-shadow: var(--shadow); }
  .btn:hover { border-color: var(--line-strong); }
  .btn.primary:hover { background: var(--clay-deep); }
  .linkbtn:hover { color: var(--ink-2); text-decoration: underline; }
  .linkbtn.danger:hover { color: var(--clay-deep); }
  .back:hover { border-color: var(--clay); color: var(--clay); }
  .line:hover { background: rgba(195, 146, 64, 0.07); }
  .more:hover { text-decoration: underline; }
  .pn a:hover { border-color: var(--clay); transform: translateY(-1px); }
}

@media (hover: none) {
  .btn:active, .chip:active { background: rgba(84, 70, 48, 0.06); }
  .btn.primary:active { background: var(--clay-deep); }
  .tab:active .tab-icon { background: rgba(84, 70, 48, 0.07); }
  .line:active { background: rgba(195, 146, 64, 0.1); }
}

/* ---------------- responsive ---------------- */
@media (max-width: 760px) {
  html[data-size="sm"] { --poem-size: 22px; }
  html[data-size="md"] { --poem-size: 27px; }
  html[data-size="lg"] { --poem-size: 33px; }

  #app { padding: 0 max(15px, env(safe-area-inset-right)) calc(var(--tab-h) + var(--safe-b) + 28px) max(15px, env(safe-area-inset-left)); }
  .hero { grid-template-columns: 1fr; gap: 2px; padding: 20px 0 16px; }
  .hero-art { order: -1; margin: -4px -8px 8px; }
  .hero-art svg { max-height: 172px; }
  .hero h1 { font-size: 31px; }
  .hero p { font-size: 13.5px; }
  .hero-stats { margin-top: 16px; }
  .stat { padding: 6px 11px; }

  .grid { grid-template-columns: minmax(0, 1fr); }
  .poem-card { padding: 12px 13px; }
  .card-art { width: 42px; height: 42px; }

  .collection-head { padding: 22px 2px 16px; gap: 12px; }
  .collection-art { width: 54px; height: 54px; border-radius: 17px; }
  .collection-head h1 { font-size: 22px; }

  .paper-card { padding: 28px 10px 24px; border-radius: 18px; }
  .paper-card::before { inset: 6px; }
  .poem-head { padding-top: 12px; }
  .toolbar { gap: 6px; }
  .btn { height: 36px; padding: 0 11px; font-size: 12.5px; }
  .speed { height: 36px; }
  .notes { grid-template-columns: 1fr; gap: 7px; }
  .content-card { padding: 17px 15px; }
  .pn { grid-template-columns: 1fr; }
  .pn a.next { text-align: left; align-items: flex-start; }
  .top-meta { display: none; }
  .settings-card { padding: 0 14px; }
  .stats-card, .about-card { padding: 15px 14px; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: 28px; }
  .hero-art svg { max-height: 150px; }
  .stat b { font-size: 15px; }
  .segmented button { padding: 0 10px; }
}

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