/* 学易 · 高级国风 · 墨金描金 · 衬线卦象 */
* { 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: 8px; color: var(--text);
  text-shadow: 0 0 18px rgba(227, 194, 117, .25);
}
.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: 11px; letter-spacing: 2px; color: var(--text-dim); }
.header .date .d-name { font-size: 15px; letter-spacing: 4px; color: var(--gold); font-weight: 600; margin-top: 3px; 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); }

/* ---------- 卦象 SVG ---------- */
.hero { text-align: center; padding: 28px 16px 22px; }
.gua-svg { display: block; margin: 0 auto; }
.gua-svg .yb { animation: yaoIn .55s cubic-bezier(.2, .7, .3, 1) both; }
.gua-name {
  font-family: var(--serif);
  font-size: 44px; font-weight: 700; letter-spacing: 12px; margin: 18px 0 0 12px;
  color: var(--gold-bright);
  text-shadow: 0 0 22px rgba(227, 194, 117, .35);
}
.gua-full { font-size: 13px; color: var(--text-dim); letter-spacing: 4px; margin-top: 4px; }
.gua-tagline {
  font-family: var(--serif);
  font-size: 15px; color: var(--gold); margin-top: 14px; letter-spacing: 2px;
}

/* ---------- 文本 ---------- */
.yuanwen { font-family: var(--serif); font-size: 26px; color: var(--gold); letter-spacing: 3px; line-height: 2; }
/* 卦辞拼音标注 */
.tuan-py { font-size: 28px; letter-spacing: 3px; line-height: 2.4; padding-top: 14px; }
.tuan-py ruby, .yao-py ruby { ruby-position: over; -webkit-ruby-position: before; }
.tuan-py rt, .yao-py rt { font-family: var(--sans); font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--gold-deep); opacity: .95; text-transform: none; }
/* 爻辞注音：爻辞字号小于卦辞，拼音易与邻字粘连 —— 缩小注音字号，并给每个「字+拼音」单元留间距（标点不占位） */
.yao-item .body b.yao-py { line-height: 2.3; }
.yao-py rt { font-size: 12.5px; }
.yao-py ruby { margin-right: 6px; }
.yao-py ruby:last-child { margin-right: 0; }
.baihua { font-size: 14.5px; color: var(--text); line-height: 1.95; opacity: .92; text-indent: 0; }
.baihua p { text-indent: 2em; }
.baihua p + p { margin-top: 10px; }
.baihua .bh-more { opacity: .9; }
.baihua .bh-key { color: var(--gold); opacity: .95; font-size: 14px; padding-left: 10px; border-left: 2px solid var(--line2); text-indent: 0; margin-top: 14px; }

/* ---------- 六爻 ---------- */
.yao-grid { display: flex; flex-direction: column; margin-top: 4px; }
.yao-item { padding: 16px 6px; border-bottom: 1px dashed var(--line); }
.yao-item:last-child { border-bottom: none; }
.yao-item .label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--gold-deep); letter-spacing: 3px; }
.yao-item .label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.yao-item b.yao-py { display: block; text-align: center; margin-top: 10px; font-family: var(--serif); font-size: 21px; color: var(--text); font-weight: 600; }
.yao-item p { font-size: 13px; color: var(--text-dim); margin-top: 8px; line-height: 1.7; }

/* ---------- 场景卡 ---------- */
.scene-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.scene-story { font-size: 14px; color: var(--text); opacity: .9; line-height: 1.8; }
.scene-point {
  margin-top: 12px; padding: 11px 13px;
  background: linear-gradient(90deg, rgba(227, 194, 117, .12), rgba(227, 194, 117, .03));
  border-left: 2px solid var(--gold);
  font-size: 13px; color: var(--gold); border-radius: 0 10px 10px 0; line-height: 1.7;
}

/* ---------- 反思 ---------- */
.reflect-q { font-family: var(--serif); font-size: 16px; color: var(--text); font-weight: 600; margin-bottom: 12px; line-height: 1.8; }
.reflect-q::before { content: "「 "; color: var(--gold); }
.reflect-q::after { content: " 」"; color: var(--gold); }
textarea {
  width: 100%; background: rgba(12, 14, 19, .6); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-family: inherit;
  font-size: 14px; padding: 12px; min-height: 72px; resize: vertical; line-height: 1.7;
}
textarea:focus { outline: none; border-color: var(--line2); }
.btn-save {
  margin-top: 10px; width: 100%; padding: 11px; border-radius: 10px;
  background: rgba(12, 14, 19, .5); border: 1px solid var(--line);
  color: var(--text-dim); font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn-save.saved { color: var(--gold); border-color: var(--line2); }

/* ---------- 打卡 / 分享 按钮 ---------- */
.btn-check {
  width: 100%; padding: 15px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #e3c275, #b8933e);
  color: #17130a; font-size: 15px; font-weight: 700; letter-spacing: 4px;
  cursor: pointer; font-family: inherit;
  box-shadow: 0 8px 24px rgba(227, 194, 117, .25);
}
.btn-check:active { transform: scale(.98); }
.btn-check.done { background: rgba(12, 14, 19, .5); color: var(--gold); border: 1px solid var(--line2); box-shadow: none; }
.btn-share {
  width: 100%; margin-top: 10px; padding: 13px; border-radius: 12px;
  background: transparent; border: 1px solid var(--line2);
  color: var(--gold); font-size: 14px; letter-spacing: 3px; cursor: pointer; font-family: inherit;
}
.btn-share:active { transform: scale(.98); background: rgba(227, 194, 117, .08); }

/* ---------- 图鉴 ---------- */
.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: 8px 2px 6px; 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.learned { border-color: var(--line2); background: linear-gradient(160deg, rgba(227, 194, 117, .14), rgba(20, 23, 31, .6)); }
.gcell.learned .nm { color: var(--gold); }
.grid-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 14px; letter-spacing: 1px; }

/* ---------- 进度 ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; backdrop-filter: blur(10px); }
.stat .num { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--gold); }
.stat .lbl { font-size: 12px; color: var(--text-dim); margin-top: 4px; letter-spacing: 2px; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; color: var(--text-dim); text-align: center; padding-bottom: 4px; }
.cal .day {
  aspect-ratio: 1; border-radius: 8px; background: rgba(12, 14, 19, .5);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-dim);
}
.cal .day.hit { background: linear-gradient(135deg, #e3c275, #b8933e); color: #17130a; font-weight: 700; }
.cal .day.today { border: 1px solid var(--gold); color: var(--gold); }
.cal .day.hit.today { border: none; }

.note-item { padding: 11px 0; border-bottom: 1px dashed var(--line); }
.note-item:last-child { border-bottom: none; }
.note-item .d { font-size: 11px; color: var(--gold-deep); letter-spacing: 1px; }
.note-item .t { font-size: 13px; color: var(--text); opacity: .85; margin-top: 3px; line-height: 1.7; }
.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; } }
@keyframes yaoIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 弹层 ---------- */
.modal-mask, .share-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, .share-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;
}

/* ---------- 分享弹层 ---------- */
.share-card {
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.share-card canvas {
  width: 100%; height: auto; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6); border: 1px solid var(--line);
}
.share-actions { display: flex; gap: 10px; width: 100%; }
.btn-share-save, .btn-share-close {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 14px; cursor: pointer; font-family: inherit; letter-spacing: 2px;
}
.btn-share-save { background: linear-gradient(135deg, #e3c275, #b8933e); border: none; color: #17130a; font-weight: 700; }
.btn-share-close { background: transparent; border: 1px solid var(--line2); color: var(--text-dim); }

/* 桌面打开时 */
@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(8, 1fr); gap: 7px; }
}

/* 正文段落首行缩进两格（中文排版） */
.scene-story, .yao-item p { text-indent: 2em; }

@media (min-width: 760px) {
  .yao-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 36px; align-items: start; }
  .yao-item:nth-last-child(-n+2) { border-bottom: none; }
}
