/* 观象播放器 · 苹果风格（与河图洛书应用同一套视觉：浅灰底、白卡片、大圆角、黑色胶囊按钮、朱色强调）
   变量名沿用旧版，便于图示组件复用：--celadon 现在是主色（墨），--gamboge 是强调色（朱）。 */
:root {
  --paper: #f5f5f7; --surface: #ffffff; --ink: #1d1d1f; --muted: #6e6e73; --faint: #a1a1a6;
  --line: #e8e8ed; --fill: rgba(118, 118, 128, 0.12);
  --celadon: #1d1d1f; --celadon-soft: rgba(118, 118, 128, 0.12);
  --gamboge: #c4302b; --gamboge-soft: rgba(196, 48, 43, 0.09); --danger: #c4302b; --ok: #248a3d;
  --link: #0066cc;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.02), 0 24px 60px rgba(0, 0, 0, 0.07);
  --canvas-bg: radial-gradient(90% 70% at 50% 55%, #fdfdfe 0%, #eeeef1 55%, #dfdfe4 100%);
  --display: -apple-system, "SF Pro SC", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --body: -apple-system, "SF Pro SC", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000; --surface: #1c1c1e; --ink: #f5f5f7; --muted: #98989d; --faint: #636366; --line: #38383a; --fill: rgba(120, 120, 128, 0.24);
    --celadon: #f5f5f7; --celadon-soft: rgba(120, 120, 128, 0.24); --gamboge: #ff6b5e; --gamboge-soft: rgba(255, 107, 94, 0.14); --danger: #ff6b5e; --ok: #30d158;
    --link: #2997ff; --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --canvas-bg: radial-gradient(90% 70% at 50% 55%, #2c2c2e 0%, #1c1c1e 60%, #111 100%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #000000; --surface: #1c1c1e; --ink: #f5f5f7; --muted: #98989d; --faint: #636366; --line: #38383a; --fill: rgba(120, 120, 128, 0.24);
  --celadon: #f5f5f7; --celadon-soft: rgba(120, 120, 128, 0.24); --gamboge: #ff6b5e; --gamboge-soft: rgba(255, 107, 94, 0.14); --danger: #ff6b5e; --ok: #30d158;
  --link: #2997ff; --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --canvas-bg: radial-gradient(90% 70% at 50% 55%, #2c2c2e 0%, #1c1c1e 60%, #111 100%);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.7; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1rem; color: var(--muted); }
a { color: var(--link); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ───── 框架：顶栏、手机底部标签栏 ───── */
.nav { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 24px; padding: 0 max(20px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--paper) 82%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); font-size: 13px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--ink); }
.brand i { width: 20px; height: 20px; border-radius: 6px; background: var(--gamboge); }
.nav .links { display: flex; gap: 24px; margin-left: auto; }
.nav .links a { color: var(--muted); }
.nav .links a.on { color: var(--ink); font-weight: 500; }
.tabbar { display: none; }
.music-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--muted); display: grid; place-items: center; flex: none; }
.nav .music-btn { margin-left: 4px; }
@media (max-width: 760px) { .nav .music-btn { margin-left: auto; } }
[data-music][aria-pressed="true"] { background: var(--gamboge-soft); color: var(--gamboge); }
[data-music][aria-pressed="true"] svg { animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 50% { transform: translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { [data-music] svg { animation: none !important; } }
.music-toggle { display: inline-grid; place-items: center; width: 44px; padding: 0; }
@media (max-width: 760px) {
  .nav .links { display: none; }
  body.has-tabs .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 8px 20px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; font-size: 10px; color: var(--faint); }
  .tabbar a.on { color: var(--gamboge); }
  .tabbar svg { width: 26px; height: 26px; }
}

.app { max-width: 600px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 22px; padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.app.wide { max-width: 1040px; }
.app.lesson-app { max-width: 640px; }
.back { align-self: flex-start; color: var(--link); font-size: 15px; display: inline-flex; align-items: center; gap: 2px; }
.eyebrow { color: var(--gamboge); font-size: 14px; font-weight: 600; }
.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-head h1 { font-size: 2.6rem; letter-spacing: -0.025em; }
.page-head p { font-size: 1.1rem; color: var(--muted); font-weight: 500; }
@media (max-width: 520px) { .page-head h1 { font-size: 2rem; } }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--muted); white-space: nowrap; letter-spacing: 0; }
.chip.warn { background: var(--gamboge-soft); color: var(--gamboge); }
.error { background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 18px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 24px; border-radius: 999px; background: var(--ink); color: var(--paper) !important; font-size: 15px; font-weight: 500; border: 0; min-height: 44px; }
.pill.light { background: var(--fill); color: var(--ink) !important; }
.pill:disabled { opacity: .45; cursor: not-allowed; }
.cardbox { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); }

/* ───── 首页 ───── */
.hero { display: grid; grid-template-columns: 1fr; gap: 22px; }
.hero h1 { font-size: 2.9rem; line-height: 1.04; letter-spacing: -0.025em; }
.hero .lead { font-size: 1.2rem; color: var(--muted); font-weight: 500; margin-top: 10px; }
.hero .cta { display: flex; align-items: center; gap: 20px; margin-top: 22px; flex-wrap: wrap; }
.canvas { position: relative; border-radius: 28px; overflow: hidden; background: var(--canvas-bg); box-shadow: var(--shadow); touch-action: pan-y; }
.tool-grid .canvas { touch-action: none; }
.canvas canvas { display: block; }
.canvas .tag { position: absolute; right: 18px; bottom: 14px; font-size: 13px; color: var(--muted); pointer-events: none; z-index: 2; }
.canvas .cap { position: absolute; left: 20px; top: 16px; right: 20px; z-index: 2; pointer-events: none; background: none; padding: 0; }
.canvas .cap b { display: block; font-size: 1.3rem; color: var(--ink); }
.canvas .cap span { color: var(--muted); font-size: .9rem; }
.hero .canvas { aspect-ratio: 1 / 0.9; }
@media (min-width: 900px) {
  .hero { grid-template-columns: 1fr 1.05fr; align-items: center; gap: 40px; padding: 20px 0 8px; }
  .hero h1 { font-size: 4.2rem; }
  .hero .lead { font-size: 1.5rem; }
}
.resume { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); color: inherit; transition: transform .2s; }
.resume:hover { transform: translateY(-1px); }
.resume .no { width: 50px; height: 50px; border-radius: 14px; background: var(--gamboge-soft); color: var(--gamboge); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 1.05rem; }
.resume .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.resume small { color: var(--muted); font-size: 13px; }
.resume b { font-size: 1.1rem; }
.resume .go-pill { flex: none; }
.sec-title { font-size: 1.7rem; letter-spacing: -0.015em; }
.sec-title small { display: block; font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-top: 4px; }
.tracks { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .tracks { grid-template-columns: repeat(3, 1fr); } }
.track { display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); color: inherit; transition: transform .25s; min-height: 190px; }
a.track:hover { transform: scale(1.01); }
.track .k { color: var(--gamboge); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.track h2 { font-size: 1.9rem; letter-spacing: -0.015em; }
.track p { color: var(--muted); font-size: 15px; margin-bottom: auto; }
.track .more { color: var(--link); font-size: 15px; margin-top: 14px; }
.track.dark { background: #1d1d1f; color: #f5f5f7; }
.track.dark p { color: #a1a1a6; }
.track.dark .k { color: #ff6b5e; }
.track.dark .more { color: #2997ff; }
.track.off { opacity: .55; }
.track .mark { display: none; }

/* 基础选择（首次访问） */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.32); display: grid; place-items: center; padding: 16px; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; padding: 30px; border-radius: 22px; background: var(--paper); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
.sheet h3 { font-size: 1.6rem; color: var(--ink); margin-bottom: 6px; }
.sheet > p { color: var(--muted); font-size: 15px; margin-bottom: 20px; }
.grab { display: none; width: 36px; height: 5px; border-radius: 3px; background: var(--faint); margin: 0 auto 14px; opacity: .6; }
.lv { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 18px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); border: 2px solid transparent; text-align: left; }
.lv.on { border-color: var(--gamboge); }
.lv .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 18px; background: var(--gamboge-soft); color: var(--gamboge); flex: none; }
.lv .t { flex: 1; display: flex; flex-direction: column; }
.lv .t b { font-size: 17px; }
.lv .t small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.lv .chk { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--faint); flex: none; }
.lv.on .chk { border: 7px solid var(--gamboge); }
.sheet .actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 12px; }
.textbtn { background: none; border: 0; color: var(--link); font-size: 15px; padding: 8px 0; }
@media (max-width: 760px) {
  .scrim { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
  .grab { display: block; }
}
.level-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); box-shadow: var(--shadow); border: 0; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--muted); }
.level-chip b { color: var(--ink); font-weight: 600; }

/* ───── 学习地图（方向页） ───── */
.path { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.path .hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.path .hd b { font-size: 1.05rem; }
.path ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.path li a, .path li > span { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; }
.path li:last-child a, .path li:last-child > span { border-bottom: 0; }
.path .n { width: 26px; height: 26px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; color: var(--muted); }
.path li.now .n { background: var(--gamboge); color: #fff; }
.path li.done .n { background: var(--ink); color: var(--paper); }
.path .tt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.path .tt small { color: var(--muted); font-size: 13px; }
.stages { display: flex; flex-direction: column; gap: 12px; }
.stage-link { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); color: inherit; transition: transform .2s; }
.stage-link:hover { transform: translateY(-1px); }
.stage-link .no { font-size: 2.2rem; font-weight: 700; width: 46px; letter-spacing: -0.03em; color: var(--faint); flex: none; text-align: center; }
.stage-link.started .no { color: var(--ink); }
.stage-link .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-link .st { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.stage-link .t small { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.stage-link .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.stage-link.skip { opacity: .55; }
.ring { width: 40px; height: 40px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--ink); stroke-linecap: round; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 阶段页的课列表 */
.lessons { display: flex; flex-direction: column; }
.card-list { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 4px 18px; }
.lesson { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); color: inherit; }
.card-list .lesson:last-child { border-bottom: 0; }
a.lesson:hover b, a.lesson:hover > span:nth-child(2) { color: var(--gamboge); }
.lesson .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--faint); color: var(--muted); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.lesson.done .dot { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lesson.rec .dot { border: 7px solid var(--gamboge); color: transparent; }
.lesson.soon { color: var(--faint); }
.lesson .sub { font-size: .85rem; color: var(--muted); }

/* 六十四卦卦格 */
.hexbar { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 52px; z-index: 5; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); padding: 10px 0; }
.hexq { font: inherit; font-size: 16px; color: var(--ink); background: var(--fill); border: 0; border-radius: 12px; padding: 10px 14px; min-height: 44px; width: 100%; }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--fill); border-radius: 999px; padding: 6px 14px; min-height: 36px; font-size: .88rem; }
.fchip.on { background: var(--ink); color: var(--paper); }
.fchip .hx.xs { --w: 16px; --lh: 2.5px; }
.fchip.on .hx .ln i { background: var(--paper); }
.tri-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.tri-row .lbl { font-size: .8rem; color: var(--muted); }
.filters.tri { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; overflow: visible; }
.filters.tri .fchip { flex-direction: column; gap: 3px; border-radius: 10px; padding: 6px 0; min-height: 48px; justify-content: center; font-size: .78rem; line-height: 1; }
.count { font-size: .82rem; }
.hexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
@media (min-width: 720px) { .hexgrid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; } }
.hx-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: inherit; text-align: center; min-width: 0; transition: transform .2s; }
.hx-tile:hover { transform: translateY(-2px); }
.hx-tile .hx.sm { --w: 36px; --lh: 4px; }
.hx-tile .nm { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.hx-tile .n { font-weight: 400; font-size: .7rem; color: var(--muted); margin-right: 3px; }
.hx-tile .tt { font-size: .72rem; color: var(--muted); line-height: 1.35; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.hx-tile .badge { position: absolute; top: 6px; right: 6px; font-size: .6rem; line-height: 1; padding: 3px 5px; border-radius: 6px; background: var(--gamboge-soft); color: var(--gamboge); font-weight: 600; }
.hx-tile .badge.ok { background: var(--ink); color: var(--paper); }
.hx-tile.done .nm { color: var(--muted); }

/* ───── 卦象台 ───── */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 900px) { .tool-grid { grid-template-columns: minmax(0, 1fr) 340px; } }
.tool-grid .canvas { aspect-ratio: 1 / 0.92; }
.panel { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.panel .gname { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.panel .gname b { font-size: 2rem; letter-spacing: -0.01em; }
.panel .ops { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.panel .ops .btn { min-height: 46px; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; padding: 6px; }
.panel .ops .btn small { font-size: 11px; color: var(--muted); }
.panel .log { font-size: .88rem; color: var(--muted); min-height: 2.6em; }
.panel select { width: 100%; }
.chain3d { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.chain3d a, .chain3d span.lk { padding: 4px 10px; border-radius: 999px; background: var(--fill); color: var(--ink); }
.chain3d .op { color: var(--gamboge); font-weight: 600; }

/* ───── 账号与会员 ───── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--muted); }
.field input { font: inherit; font-size: 17px; color: var(--ink); background: var(--fill); border: 0; border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%; }
.form-msg { font-size: .9rem; color: var(--muted); min-height: 1.4em; }
.form-msg.bad { color: var(--danger); }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .plans { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.plan { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); border: 2px solid transparent; text-align: left; }
.plan.on { border-color: var(--gamboge); }
.plan .pt { font-weight: 600; }
.plan .pp { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.plan .pp small { font-size: 1rem; margin-right: 1px; }
.plan s { font-size: .82rem; }
.plan .pm { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.plan.trial { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; background: linear-gradient(120deg, var(--gamboge-soft), var(--surface) 70%); }
.plan.trial .pm { flex-basis: 100%; margin: 0; }
.plan .badge { position: absolute; top: -9px; right: 12px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--gamboge); color: #fff; }
.pay-channels { display: flex; gap: 10px; flex-wrap: wrap; }
.paych { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 2px solid transparent; background: var(--fill); min-height: 46px; }
.paych.on { border-color: var(--ink); background: var(--surface); }
.paych .dot { width: 18px; height: 18px; border-radius: 5px; background: var(--faint); }
.paych .dot.alipay { background: #1677ff; }
.paych .dot.wechat { background: #07c160; }
.pay-sheet { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pay-sheet .actions { width: 100%; }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
.qr svg { width: 100%; height: 100%; display: block; }
.order { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.order small.num { grid-column: 1 / -1; font-size: .75rem; }
.legal { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }

/* ───── 原文、下一课 ───── */
.classic { display: flex; flex-direction: column; gap: 8px; }
.cl-row { display: grid; grid-template-columns: 3em 1fr; gap: 10px; font-family: var(--serif); font-size: 1rem; line-height: 1.6; }
.cl-row b { font-family: var(--body); font-size: .8rem; color: var(--gamboge); font-weight: 600; padding-top: 3px; }
.cl-src { font-size: .75rem; }
.next-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: inherit; }
.next-card small { color: var(--gamboge); font-weight: 600; font-size: .8rem; }
.next-card b { font-size: 1.2rem; }
.next-card b::after { content: " ›"; color: var(--muted); }
.next-card .xg { font-family: var(--serif); font-size: .95rem; color: var(--muted); }
.hx-tile .tt.hit { color: var(--gamboge); }
.gua-text { display: flex; flex-direction: column; gap: 8px; }
.gua-text .gq { font-family: var(--serif); font-size: 1rem; line-height: 1.6; }
.gua-text .gq b { font-family: var(--body); font-size: .78rem; color: var(--gamboge); margin-right: 8px; }
.gua-text details { box-shadow: none; background: var(--fill); }

/* ───── 成长：打卡、徽章、卦卡、庆祝 ───── */
.growth-line a { display: inline-flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 14px; }
.growth-line b { color: var(--gamboge); font-size: 1.05rem; }
.daily { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); color: inherit; }
.daily small { color: var(--gamboge); font-weight: 600; font-size: 12.5px; }
.daily .dx { font-family: var(--serif); font-size: 1.2rem; line-height: 1.6; }
.prof { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--gamboge-soft); color: var(--gamboge); font-size: 1.5rem; font-weight: 700; flex: none; }
.prof .who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.prof .who b { font-size: 1.2rem; }
.lvbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lvbar i { display: block; height: 100%; background: var(--gamboge); border-radius: 4px; }
.checkin .big { font-size: 2.6rem; letter-spacing: -0.02em; line-height: 1; }
.checkin .pill:disabled { background: var(--fill); color: var(--muted) !important; opacity: 1; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week i { width: 30px; height: 30px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; }
.week .on i { background: var(--gamboge); }
.week .on i::after { content: "✓"; color: #fff; font-size: 14px; font-style: normal; }
.week .today small { color: var(--ink); font-weight: 700; }
.week small { font-size: 12px; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .badges { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.badge-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 10px 4px; border-radius: 16px; background: var(--fill); opacity: .55; }
.badge-item.got { background: var(--gamboge-soft); opacity: 1; }
.badge-item b { font-size: .92rem; }
.badge-item small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.bd-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--faint); color: #fff; font-weight: 700; flex: none; font-family: var(--serif); }
.badge-item.got .bd-ic, .celebrate .bd-ic { background: var(--gamboge); }
.hexcards { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.hc { aspect-ratio: 1 / 1.2; border-radius: 8px; background: var(--fill); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11px; }
.hc.got { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.hc .hx.xs { --w: 20px; --lh: 2.6px; }
.hc small { font-size: 10px; }
.tcode { font-size: 2.2rem; font-weight: 700; letter-spacing: .12em; display: flex; flex-direction: column; }
.tcode:empty { display: none; }
.tcode small { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.big-input { font: inherit; font-size: 20px; letter-spacing: .2em; color: var(--ink); background: var(--fill); border: 0; border-radius: 12px; padding: 10px 14px; min-height: 52px; }
.celebrate { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(420px, calc(100% - 32px)); z-index: 70; padding: 16px 18px; border-radius: 20px; background: var(--ink); color: var(--paper); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 8px; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 20px) scale(.96); } }
.celebrate .cb-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.celebrate .cb-main b { font-size: 1.15rem; }
.celebrate .pts { color: #ffb4ab; font-weight: 700; font-size: 1.15rem; }
.celebrate .nb { display: flex; gap: 10px; align-items: center; }
.celebrate .nb span:last-child { display: flex; flex-direction: column; }
.celebrate small { opacity: .75; font-size: 12.5px; }
.celebrate a { color: #8ec5ff; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .celebrate { animation: none; } }

/* ───── 卡片播放器 ───── */
.bar { display: flex; align-items: center; gap: 12px; height: 44px; }
.icon { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; color: var(--muted); flex: none; }
.icon:hover { background: var(--fill); color: var(--ink); }
.icon:disabled { visibility: hidden; }
.steps { flex: 1; display: flex; gap: 4px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .3s; }
.steps i.on { background: var(--ink); }
.stage-card { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.card { display: flex; flex-direction: column; gap: 18px; animation: in .35s ease-out; }
@keyframes in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card, .pop, .fb, .scrim { animation: none !important; } }
/* 卡片很长时“继续”吸在屏幕底部，不用先往下翻才能找到 */
.foot { display: flex; flex-direction: column; gap: 8px; position: sticky; bottom: 0; z-index: 4; padding: 14px 0 calc(6px + env(safe-area-inset-bottom)); margin-bottom: calc(-6px - env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--paper) 22px); }
.go { border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; min-height: 52px; font-weight: 600; font-size: 1.05rem; }
.go:disabled { background: var(--fill); color: var(--faint); cursor: not-allowed; }
.hint { text-align: center; font-size: .82rem; color: var(--muted); min-height: 1.3em; }
.skip-story { align-self: center; background: none; border: 0; color: var(--link); font-size: 14px; padding: 6px 10px; }

/* 名词小卡（零基础时出现） */
.terms { display: flex; flex-direction: column; gap: 8px; }
.term { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); font-size: .92rem; }
.term b { color: var(--gamboge); white-space: nowrap; }
.terms .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }

/* 长文 */
.article { display: flex; flex-direction: column; gap: 30px; }
.article section { display: flex; flex-direction: column; gap: 16px; }
.article h2 { font-size: 1.5rem; }

/* 三维卦 */
.g3d { width: 100%; aspect-ratio: 1 / 0.82; max-height: 46dvh; }
.g3d-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.g3d-wrap figcaption { font-size: 1.35rem; }
.g3d-tip { font-size: 12px; color: var(--faint); }

/* 内容块 */
.kicker { font-size: .8rem; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kicker.story { color: var(--gamboge); }
.para { font-size: 1.06rem; }
.scene { background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.scene .who { font-size: .82rem; color: var(--gamboge); font-weight: 600; }
.idiom { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.idiom .word { font-family: var(--serif); font-weight: 900; font-size: 3rem; letter-spacing: .1em; line-height: 1.15; }
.idiom .py { color: var(--muted); letter-spacing: .08em; }
.idiom .py b { color: var(--gamboge); }
.callout { background: var(--fill); border-radius: 16px; padding: 14px 16px; font-size: .96rem; }
.callout b { color: var(--ink); }
.callout.note { background: var(--gamboge-soft); }
.callout.note b { color: var(--gamboge); }
.quote { margin: 0; border-left: 3px solid var(--gamboge); padding: 2px 0 2px 14px; display: flex; flex-direction: column; gap: 2px; }
.quote .t { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; }
.quote cite { font-style: normal; font-size: .8rem; color: var(--muted); }
.quote .gloss { font-size: .94rem; color: var(--muted); margin-top: 4px; }
.quote .annot { font-size: .85rem; color: var(--muted); }
.tbl { overflow-x: auto; }
.tbl-title { font-weight: 600; margin: 0 0 8px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 500; }
.tbl tr.em td { color: var(--gamboge); font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; }
.checklist li::before { content: "✓"; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: .75rem; display: grid; place-items: center; margin-top: 3px; }
.diagram { border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); box-shadow: var(--shadow); }
.diagram.real { background: var(--surface); }
.diagram .hint-line { font-size: .9rem; }
.unknown { font-size: .8rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); padding: 8px; }

/* 交互图示通用 */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 0; background: var(--fill); padding: 8px 16px; border-radius: 999px; min-height: 40px; }
.btn:hover { background: var(--line); }
.row select {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); min-height: 40px; max-width: 100%;
  padding: 7px 32px 7px 12px; background: var(--surface) no-repeat right 12px center / 10px 6px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235B6864' stroke-width='1.5'/%3E%3C/svg%3E");
}
.row select:focus-visible { outline: 2px solid var(--celadon); outline-offset: 1px; }
.row .btn { font: inherit; font-size: 15px; color: var(--ink); }
.note { font-size: .82rem; color: var(--muted); }
.plabel { font-size: .82rem; color: var(--muted); }
.cap { background: var(--paper); border-radius: var(--r); padding: 12px 14px; font-size: .93rem; display: flex; flex-direction: column; gap: 6px; }
.cap b { color: var(--celadon); }

/* 重卦 */
.picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.picker button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .82rem; }
.picker button[aria-pressed="true"] { border-color: var(--celadon); background: var(--celadon-soft); color: var(--celadon); font-weight: 700; }
@media (min-width: 720px) { .picker { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.cg-res { display: flex; gap: 20px; align-items: center; justify-content: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); flex-wrap: wrap; }
.cg-fig { display: flex; flex-direction: column; gap: 16px; }
.cg-half { display: flex; align-items: center; gap: 10px; }
.cg-half span { font-size: .8rem; color: var(--muted); width: 4.5em; }
.cg-name { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.cg-name .big { font-family: var(--display); font-size: 2rem; font-weight: 900; line-height: 1.1; }

/* 爻位 */
.yw { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 16px; align-items: start; }
.yrows { display: flex; flex-direction: column; gap: 4px; }
.yrow { display: grid; grid-template-columns: 3em 112px auto; gap: 10px; align-items: center; padding: 4px 6px; border-radius: var(--r); border: 1px solid transparent; }
.yrow.split { margin-bottom: 8px; }
.yrow .yp { font-family: var(--display); font-weight: 600; font-size: .95rem; }
.yrow .yline { border: 0; background: none; padding: 6px 0; min-height: 32px; display: flex; align-items: center; }
.yrow .yline .ln { --lh: 11px; width: 112px; }
.yrow .ok { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.yrow.sel { border-color: var(--celadon); background: var(--celadon-soft); }
.yrow.ying { border-color: var(--gamboge); border-style: dashed; }
.yrow.bi { background: var(--paper); }
.ydetail { display: flex; flex-direction: column; gap: 8px; font-size: .93rem; }
.ydetail .ybig { font-family: var(--display); font-size: 1.2rem; }
.ydetail dt { font-weight: 700; color: var(--celadon); }
.ydetail dd { margin: 0 0 4px; }
.ydetail dl { margin: 0; }
@media (max-width: 640px) { .yw { grid-template-columns: minmax(0, 1fr); } }

.hx { --w: 88px; --lh: 10px; width: var(--w); display: flex; flex-direction: column; gap: calc(var(--lh) * .75); }
.hx.sm { --w: 52px; --lh: 6px; }
.hx.xs { --w: 30px; --lh: 4px; }
.hx.lg { --w: 110px; --lh: 12px; }
.ln { display: flex; gap: 20%; height: var(--lh); }
.ln i { flex: 1; background: var(--ink); border-radius: 1px; }
.ln.mark i { background: var(--gamboge); }
.ln.yang i:nth-child(2) { display: none; }
.hx.split .ln:nth-last-child(4) { margin-bottom: calc(var(--lh) * .9); }
.figures { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.figures:has(> :nth-child(3)) { gap: 20px; }
figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
figcaption { font-family: var(--display); font-weight: 700; font-size: 1.3rem; text-align: center; line-height: 1.3; }
figcaption small { display: block; font-family: var(--body); font-weight: 400; font-size: .8rem; color: var(--muted); }
.legend { display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; align-items: center; }
.legend .hx { justify-self: center; }

.choice { display: flex; flex-direction: column; gap: 12px; }
.choice .prompt { font-weight: 700; font-size: 1.05rem; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opts.figs { flex-direction: row; justify-content: center; gap: 16px; }
.opt { border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 14px 16px; text-align: left; min-height: 52px; font-size: 1.02rem; }
.opts.figs .opt { padding: 18px 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.opt:hover:not(:disabled) { border-color: var(--celadon); }
.opt.right { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.opt.wrong { border-color: var(--danger); color: var(--danger); }
.opt:disabled { cursor: default; }
.fb { border-radius: 14px; padding: 12px 14px; font-size: .95rem; animation: in .25s ease-out; }
.fb.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.fb.no { background: var(--gamboge-soft); }
.fb b { display: block; margin-bottom: 2px; }
.sort { display: flex; flex-direction: column; gap: 12px; }
.sort .prompt { font-weight: 700; font-size: 1.05rem; }
.sort-pool { display: flex; flex-direction: column; gap: 8px; }
.sort-picked, .sort-answer { margin: 0; padding-left: 1.6em; display: flex; flex-direction: column; gap: 6px; }
.sort-picked:empty { display: none; }
.sort-picked li { padding: 8px 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.sort-picked li.right { color: var(--ok); }
.sort-picked li.wrong { color: var(--danger); }
.sort-answer { margin: 6px 0; }
.reveal-btn { border: 0; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 14px; font-weight: 600; min-height: 50px; }
.pop { animation: in .3s ease-out; display: flex; flex-direction: column; gap: 12px; }
details { background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 0 18px; }
summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "展开"; font-weight: 400; font-size: .85rem; color: var(--link); }
details[open] summary::after { content: "收起"; }
details > .inner { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }

/* 错综互卦 */
.cz-stage { display: flex; gap: 24px; align-items: center; justify-content: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); flex-wrap: wrap; }
.cz-fig { transition: transform .45s ease-in-out; }
.cz-fig .ln { transition: transform .45s ease-in-out, opacity .45s ease-in-out; }
.cz-fig.turn { transform: rotate(180deg); }
.cz-fig.cuo .ln { transform: scaleY(0); }
.cz-fig.instant, .cz-fig.instant .ln { transition: none; }
.cz-name { display: flex; flex-direction: column; gap: 2px; }
.cz-name .big { font-family: var(--display); font-size: 2rem; font-weight: 900; line-height: 1.1; }
.chain { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .82rem; }
.chain .lk { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 44px; }
.chain .lk b { font-family: var(--display); }
.chain .op { color: var(--gamboge); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .cz-fig, .cz-fig .ln { transition: none; } }

/* 太极树 */
.tree { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px 4px; }
.tnode { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-size: .8rem; line-height: 1.3; text-align: center; transition: opacity .3s, transform .3s, border-color .2s, background .2s; }
.tnode.off { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.tnode.on { border-color: var(--gamboge); background: var(--gamboge-soft); }
.tnode .nm { font-family: var(--display); font-weight: 900; font-size: .95rem; }
.tnode.root { font-family: var(--display); font-weight: 900; font-size: 1rem; padding: 10px; }
button.tnode { cursor: pointer; color: inherit; font: inherit; }
/* 八卦取象卡 */
.cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cats button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: .88rem; }
.cats button[aria-pressed="true"] { background: var(--celadon-soft); border-color: var(--celadon); color: var(--celadon); font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fcard { perspective: 600px; aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; }
.fcard .in { position: relative; display: block; width: 100%; height: 100%; transition: transform .3s ease-out; transform-style: preserve-3d; }
.fcard.flip .in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 4px; }
.face.back { transform: rotateY(180deg); background: var(--celadon-soft); border-color: transparent; visibility: hidden; }
.fcard.flip .face { visibility: hidden; }
.fcard.flip .face.back { visibility: visible; }
.face.back .big { font-family: var(--display); font-size: 1.7rem; font-weight: 900; color: var(--celadon); line-height: 1.1; }
.face.back .sub { font-size: .75rem; color: var(--muted); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
/* 方位 SVG */
.svgbox { width: 100%; max-width: 380px; align-self: center; }
.svgbox svg { width: 100%; height: auto; display: block; overflow: visible; }
svg text { font-family: var(--display); }
svg .frame { fill: none; stroke: var(--line); stroke-width: 1; }
svg .dir { fill: var(--muted); font-family: var(--body); font-size: 12px; }
svg .spin, svg .tn { transition: transform .8s cubic-bezier(.4, 0, .2, 1); }
svg .tg { cursor: pointer; }
svg .tg.sel .bar { fill: var(--gamboge); }
svg .tn { font-size: 15px; font-weight: 900; fill: var(--ink); }
svg .tn.sel { fill: var(--gamboge); }
svg .center { font-size: 22px; font-weight: 900; fill: var(--celadon); }
svg .bar { fill: var(--ink); transition: fill .2s; }
@media (prefers-reduced-motion: reduce) { svg .spin, svg .tn { transition: none; } }
