:root {
  --paper: #eceae4;
  --panel: #faf7f1;
  --ink: #1c1917;
  --muted: #6f6860;
  --line: #d7d1c7;
  --gold: #8b6b3a;
  --vermilion: #b42318;
  --harbour: #3f5a52;
  --neon: #b42318;
  --cover: #f7f1e8;
  --cream: #faf7f1;
  --wash: #e8d5c4;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 20px 140px;
  position: relative;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.brand {
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 18px;
  font-weight: 700;
}
.top-links { color: var(--muted); font-size: 13px; display: flex; gap: 14px; }

.cover-card {
  background: var(--panel);
  border: 1.5px solid var(--ink);
  box-shadow: 0 12px 28px rgba(28,25,23,.1);
  overflow: hidden;
  position: relative;
  color: var(--ink);
}
.cover-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 8px;
  background: #8b3a3a;
  z-index: 2;
}
.cover-mast {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 14px 22px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--panel);
}
.mast-en {
  font-size: 9px;
  letter-spacing: .22em;
  color: #8b3a3a;
  font-weight: 700;
}
.mast-zh {
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 4px;
  color: var(--ink);
}
.mast-tag {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
}
.mast-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.chop {
  width: 36px;
  height: 36px;
  border: 2px solid var(--vermilion);
  color: var(--vermilion);
  display: grid;
  place-items: center;
  font-family: "Source Han Serif CN", serif;
  font-size: 16px;
  font-weight: 700;
  transform: rotate(-8deg);
  background: rgba(180,35,24,.05);
}
.cover-hero {
  min-height: 248px;
  padding: 28px 20px 30px 22px;
  background:
    linear-gradient(180deg, #f7f1e8 0%, #e8d5c4 100%) !important;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(28,25,23,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,25,23,.05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 35%, #000 75%, transparent);
  opacity: .45;
  pointer-events: none;
}
.hero-skyline {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 54px;
  background:
    linear-gradient(180deg, transparent, rgba(28,25,23,.06)),
    repeating-linear-gradient(
      90deg,
      transparent 0 10px,
      rgba(139,58,58,.22) 10px 12px,
      transparent 12px 22px,
      rgba(28,25,23,.1) 22px 26px,
      transparent 26px 38px
    );
  opacity: .8;
  pointer-events: none;
}
.hero-skyline::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%; bottom: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,58,58,.45), transparent);
}
.hero-neon {
  position: absolute;
  right: 18px;
  top: 22px;
  width: 72px;
  height: 96px;
  border: 2px solid #8b3a3a;
  box-shadow: none;
  color: #8b3a3a;
  font-family: "Source Han Serif CN", serif;
  font-size: 42px;
  display: grid;
  place-items: center;
  letter-spacing: .08em;
  background: rgba(250,247,241,.55);
  transform: rotate(3deg);
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 70%;
}
.hero-kicker {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .14em;
  color: #8b3a3a;
  border-bottom: 1px solid rgba(139,58,58,.4);
  padding-bottom: 4px;
  margin-bottom: 12px;
  font-weight: 700;
}
.cover-hero h1 {
  margin: 0 0 12px;
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 36px;
  line-height: 1.12;
  color: var(--ink);
  text-shadow: none;
}
.cover-hero .author {
  color: #8b3a3a;
  font-size: 14px;
  margin-bottom: 8px;
  letter-spacing: .04em;
  font-weight: 600;
}
.cover-hero .sub { font-size: 12px; color: var(--muted); }
.cover-foot {
  padding: 14px 18px 16px;
  font-size: 12px;
  background: #f3eee6;
  color: var(--ink);
  border-top: 1px solid rgba(28,25,23,.12);
}
.cover-foot .meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(28,25,23,.22);
  color: var(--muted);
  opacity: 1;
}

.cta {
  display: block;
  width: 100%;
  margin: 14px 0 22px;
  border: 0;
  background: var(--ink);
  color: #f7fafe;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.section-title {
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 15px;
  margin: 0 0 12px;
}

.others {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.other {
  background: #f7f1e8;
  color: var(--ink);
  min-height: 118px;
  padding: 10px 8px;
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 1px 3px 8px rgba(28,25,23,.08);
  border: 1px solid rgba(28,25,23,.35);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.other::after {
  content: "港";
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 10px;
  color: var(--vermilion);
  border: 1px solid var(--vermilion);
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  background: rgba(250,247,241,.85);
}

.cats {
  display: flex;
  gap: 14px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  font-size: 13px;
  color: var(--muted);
}
.cats .on { color: var(--ink); font-weight: 700; }

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(430px, 100%);
  background: #f3eee6;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 12px 8px 18px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.tabbar .on { color: var(--ink); font-weight: 700; }

.player {
  margin-top: 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: none;
}
.player.show { display: block; }
.player audio { width: 100%; margin-top: 8px; }

.err { color: #8b3a3a; font-size: 13px; padding: 20px 0; }

.page { display: none; }
.page.on { display: block; }

.tabbar a {
  color: inherit;
  text-decoration: none;
}
.tabbar a.on { color: var(--ink); font-weight: 700; }

.cta.ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}
.detail-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  margin: 14px 0 18px;
}
.detail-actions .cta { margin: 0; }

.back {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 0 12px;
  cursor: pointer;
  font-size: 13px;
}

.detail-hero {
  background: linear-gradient(180deg, #f7f1e8 0%, #e8d5c4 100%) !important;
  color: var(--ink);
  padding: 28px 22px;
  border: 1.5px solid var(--ink);
  box-shadow: 0 8px 20px rgba(28,25,23,.08);
  position: relative;
  overflow: hidden;
  min-height: 220px;
}
.detail-hero > *:not(.hero-photo):not(.hero-grid):not(.hero-skyline) {
  position: relative;
  z-index: 1;
}
.detail-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .12em;
  color: #8b3a3a;
  border: 1px solid rgba(139,58,58,.45);
  padding: 4px 8px;
  margin-bottom: 14px;
  font-weight: 700;
}
.detail-hero h1 {
  margin: 0 0 10px;
  font-family: "Source Han Serif CN", "Noto Serif TC", serif;
  font-size: 30px;
  line-height: 1.15;
  max-width: 72%;
  color: var(--ink);
}
.detail-hero .author { color: #8b3a3a; font-size: 14px; margin-bottom: 8px; font-weight: 600; }
.detail-hero .sub { font-size: 12px; color: var(--muted); opacity: 1; margin-bottom: 14px; }
.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  opacity: 1;
}
.hero-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .22;
  pointer-events: none;
}
.cover-hero .hero-photo { opacity: .18; }

.chapters { display: flex; flex-direction: column; gap: 8px; }
.chapter {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}
.chapter.on { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); }
.chapter .no {
  font-family: "Source Han Serif CN", serif;
  color: var(--muted);
  font-size: 13px;
}
.chapter .t { font-size: 14px; font-weight: 600; }
.chapter .d { font-size: 12px; color: var(--muted); }

.shelf-list, .book-list { display: flex; flex-direction: column; gap: 10px; }
.shelf-item, .book-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.shelf-item .cover, .book-item .cover {
  width: 56px;
  height: 72px;
  background: #2f3e46;
}
.shelf-item .t, .book-item .t {
  font-family: "Source Han Serif CN", serif;
  font-size: 15px;
  font-weight: 700;
}
.shelf-item .s, .book-item .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.badge {
  font-size: 11px;
  color: #1f6b5a;
  background: #e6f4ef;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}
.me-card {
  background: var(--panel);
  border: 1.5px solid var(--ink);
  padding: 20px;
  margin-bottom: 20px;
}
.me-name {
  font-family: "Source Han Serif CN", serif;
  font-size: 22px;
  margin-bottom: 6px;
}
.muted { color: var(--muted); font-size: 12px; }
.other { border: 0; cursor: pointer; text-align: left; color: #f5f2eb; }
.minibar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 58px;
  width: min(430px, 100%);
  background: #1a2330;
  color: #f7fafc;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid #2a3544;
  z-index: 15;
}
.minibar[hidden] { display: none !important; }
.mini-title { font-size: 13px; font-weight: 600; }
.mini-sub { font-size: 11px; color: #a8b4c0; margin-top: 2px; }
.mini-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--gold); color: #1a2330;
  font-weight: 700; cursor: pointer;
}
.shelf-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.shelf-actions .linkish {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; padding: 0;
}
.shelf-actions .linkish.danger { color: #8b3a3a; }
.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan-card {
  background: var(--panel);
  border: 1.5px solid var(--ink);
  padding: 18px 16px;
  text-align: left;
}
.plan-card h3 {
  margin: 0 0 6px;
  font-family: "Source Han Serif CN", serif;
  font-size: 20px;
}
.plan-card .price {
  font-size: 22px;
  font-weight: 700;
  margin: 10px 0;
}
.plan-card .desc { color: var(--muted); font-size: 13px; }
.chapter.locked { opacity: .55; }
.chapter .lock { font-size: 11px; color: #8a6d3b; }
.field { margin: 10px 0; }
.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  font: inherit;
  background: #fff;
}
.badge.warn { background: #f5efe0; color: #8a6d3b; }
.cats span, .cats button {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
}
