/* 道德经 · 每天一章 · 墨金描金 · 水墨风 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0a0c10;
  --card: rgba(20, 23, 31, .72);
  --card-solid: #14171f;
  --line: rgba(227, 194, 117, .14);
  --line2: rgba(227, 194, 117, .30);
  --gold: #e3c275;
  --gold-bright: #f6e2b0;
  --gold-deep: #a9823a;
  --text: #ece9e0;
  --text-dim: #8b90a0;
  --radius: 16px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

html { height: 100%; }
body { min-height: 100vh; }
body {
  background:
    radial-gradient(120% 55% at 50% -8%, rgba(227, 194, 117, .12), transparent 58%),
    radial-gradient(90% 45% at 50% 112%, rgba(227, 194, 117, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 760px;
  min-height: 100vh;
  padding: 20px 16px 110px;
  position: relative;
}

/* ---------- 头部 ---------- */
.header {
  padding: 8px 4px 18px;
  display: flex; justify-content: space-between; align-items: flex-end;
}
.header .logo {
  font-family: var(--serif);
  font-size: 26px; font-weight: 700; letter-spacing: 6px; color: var(--text);
  text-shadow: 0 0 18px rgba(227, 194, 117, .25);
}
.logo em { font-style: normal; font-size: 11px; color: var(--text-dim); letter-spacing: 1px; vertical-align: baseline; margin-left: 4px; font-family: var(--sans); font-weight: 400; }
.header .logo span { color: var(--gold); }
.header .sub { font-size: 11px; letter-spacing: 3px; color: var(--text-dim); margin-top: 4px; }
.header .date { text-align: right; line-height: 1.5; }
.header .date .d-num { font-size: 16px; letter-spacing: 3px; color: var(--gold); font-weight: 600; font-family: var(--serif); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 10px 30px rgba(0, 0, 0, .35);
}
.card .tag {
  font-size: 11px; letter-spacing: 3px; color: var(--gold-deep);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.card .tag::before { content: ""; width: 16px; height: 1px; background: var(--gold-deep); }

/* ---------- 头牌 ---------- */
.hero { text-align: center; padding: 30px 16px 24px; }
.dao-seal {
  width: 92px; height: 92px; margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line2);
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 38%, rgba(227,194,117,.16), rgba(227,194,117,.03) 70%);
  animation: sealIn .8s cubic-bezier(.2, .7, .3, 1) both;
}
.dao-seal span {
  font-family: var(--serif);
  font-size: 46px; font-weight: 700; color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(227, 194, 117, .4);
}
@keyframes sealIn { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }
.chap-name {
  font-family: var(--serif);
  font-size: 34px; font-weight: 700; letter-spacing: 10px; margin: 20px 0 0 10px;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(227, 194, 117, .35);
}
.chap-theme { font-size: 14px; color: var(--gold); letter-spacing: 6px; margin-top: 6px; }
.chap-tagline { font-family: var(--serif); font-size: 14px; color: var(--text-dim); margin-top: 14px; letter-spacing: 2px; }

/* ---------- 文本 ---------- */
.yuanwen { font-family: var(--serif); font-size: 24px; color: var(--gold); letter-spacing: 3px; line-height: 2.2; }
.yuanwen ruby { ruby-position: over; -webkit-ruby-position: before; }
.yuanwen rt { font-family: var(--sans); font-size: 13.5px; font-weight: 400; letter-spacing: 0; color: var(--gold-deep); opacity: .95; }
.yuanwen ruby { margin-right: 2px; }

.baihua { font-size: 16.5px; color: var(--text); line-height: 1.95; opacity: .92; }
.baihua p { text-indent: 2em; }
.baihua b { color: var(--gold); font-weight: 600; }
.baihua-more { margin-top: 18px; padding-top: 16px; border-top: 1px dashed rgba(227, 194, 117, .16); }
.more-label {
  display: inline-block; margin-bottom: 8px; padding: 3px 10px;
  border: 1px solid rgba(227, 194, 117, .45); border-radius: 20px;
  font-size: 12.5px; color: var(--gold); letter-spacing: 1px;
}

.lizi-item { display: flex; gap: 10px; }
.lizi-item + .lizi-item { margin-top: 16px; padding-top: 16px; border-top: 1px dashed rgba(227, 194, 117, .16); }
.lizi-no {
  flex: 0 0 22px; height: 22px; margin-top: 3px;
  border: 1px solid var(--gold); border-radius: 50%;
  color: var(--gold); font-size: 12px; line-height: 20px; text-align: center; opacity: .85;
}
.lizi-story { font-size: 16.5px; color: var(--text); opacity: .92; line-height: 1.85; text-indent: 2em; }


/* ---------- 图鉴 ---------- */
.gx-search-wrap { margin-bottom: 12px; }
.gx-search {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: rgba(12, 14, 19, .6); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; font-size: 14px; letter-spacing: 1px;
}
.gx-search::placeholder { color: var(--text-dim); }
.gx-search:focus { outline: none; border-color: var(--line2); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gcell {
  background: rgba(20, 23, 31, .6); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 2px 8px; text-align: center; cursor: pointer; position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.gcell:active { transform: scale(.94); }
.gcell:hover { border-color: var(--line2); transform: translateY(-2px); }
.gcell .nm { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; margin-top: 4px; }
.gcell .nm i { font-style: normal; font-size: 10px; color: var(--gold-deep); margin-right: 3px; font-family: var(--sans); opacity: .9; }
.grid-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 14px; letter-spacing: 1px; }
.empty { font-size: 13px; color: var(--text-dim); text-align: center; padding: 22px 0; }

/* ---------- 详情视图 ---------- */
.detail-view { display: none; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim); cursor: pointer; margin-bottom: 14px;
  background: none; border: none; font-family: inherit; padding: 4px 0;
}
.back::before { content: "‹"; font-size: 22px; line-height: 1; color: var(--gold); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 760px;
  background: rgba(10, 12, 16, .9); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; padding: 9px 0 16px; z-index: 50;
}
.tab {
  flex: 1; text-align: center; font-size: 11px; color: var(--text-dim);
  cursor: pointer; letter-spacing: 2px; padding-top: 4px;
}
.tab .ico { font-size: 20px; display: block; margin-bottom: 2px; filter: grayscale(1) opacity(.6); }
.tab.active { color: var(--gold); }
.tab.active .ico { filter: none; }

.page { display: none; }
.page.active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-in { animation: heroIn .6s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes heroIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .66); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(4px);
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 22px; max-width: 300px; width: 100%; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.modal .big { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.modal .sub { font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.modal button {
  margin-top: 18px; padding: 9px 30px; border-radius: 10px;
  background: var(--gold); border: none; color: #17130a; font-weight: 600; cursor: pointer; font-family: inherit;
}

/* 桌面打开时 */
@media (min-width: 560px) {
  body { padding: 30px 0; }
  .app { min-height: auto; border: 1px solid var(--line); border-radius: 26px; background: rgba(20, 23, 31, .35); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
  .tabbar { border-radius: 0 0 26px 26px; }
  .grid { grid-template-columns: repeat(9, 1fr); gap: 7px; }
}

/* ---------- 系列 · 天瑜出品 ---------- */
.series-strip {
  margin: 26px 0 18px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.series-strip .ss-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--serif); font-size: 14px; letter-spacing: 3px;
  color: var(--gold); font-weight: 600;
}
.series-strip .ss-logo { width: 20px; height: 20px; border-radius: 5px; }
.series-strip .ss-items {
  margin-top: 10px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  font-size: 12px; letter-spacing: 1px;
}
.series-strip .ss-items a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dashed rgba(139,144,160,.5); padding-bottom: 1px; }
.series-strip .ss-items a:active { color: var(--gold); }
.series-strip .ss-cur { color: var(--gold-bright); }
.series-strip .ss-more { margin-top: 8px; font-size: 10px; letter-spacing: 2px; color: var(--text-dim); opacity: .7; }

/* 头部 logo 图 */
.head-left { display: flex; align-items: center; gap: 12px; }
.head-logo {
  width: 46px; height: 46px; border-radius: 10px; display: block; flex: none;
  box-shadow: 0 0 16px rgba(227, 194, 117, .18);
}

/* ---------- 下一章长按钮 ---------- */
.next-chap {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  width: 100%; margin: 4px 0 6px; padding: 16px;
  font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: 4px;
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(227,194,117,.16), rgba(227,194,117,.06));
  border: 1px solid var(--line2); border-radius: var(--radius);
  cursor: pointer;
  transition: transform .15s ease;
}
.next-chap:active { transform: scale(.98); }
.next-chap .nc-sub { font-size: 12px; letter-spacing: 1px; color: var(--text-dim); font-family: var(--sans); font-weight: 400; }
.next-chap::after { content: "→"; color: var(--gold); font-size: 18px; align-self: center; }

/* ---------- tabbar 中间 · 藏经阁 ---------- */
.tb-hub {
  flex: 1.7; text-align: center;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 0 6px;
}
.tb-hub .tb-brand { font-family: var(--serif); font-size: 11px; letter-spacing: 2px; color: var(--gold); }
.tb-hub .tb-brand img { width: 14px; height: 14px; vertical-align: -3px; margin-right: 4px; }
.tb-hub .tb-books { margin-top: 4px; line-height: 1; }
.tb-hub .tb-books a, .tb-hub .tb-cur { font-size: 10px; letter-spacing: 1px; margin: 0 4px; text-decoration: none; }
.tb-hub .tb-books a { color: var(--text-dim); border-bottom: 1px dashed rgba(139,144,160,.5); padding-bottom: 1px; }
.tb-hub .tb-cur { color: var(--gold-bright); }
.app { padding-bottom: 140px; }
/* iPhone 底部安全区适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .tabbar { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .app { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
}

/* ---------- 底栏垂直居中修正 ---------- */
.tabbar { align-items: center; }
.tab { padding-top: 0; }
.tb-hub { display: flex; flex-direction: column; justify-content: center; }
