/* 配色：白底，主色取自牌面的赤陶红，学完的关卡用牌面的金色，按钮带底边，夜色页面用深蓝灰 */
:root {
  --bg-outer: #F0F0F0;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #33292A;
  --ink-2: #4A3F3F;
  --mut: #76696A;
  --line: #EEE8DC;
  --lock: #F2EDE4;
  --lock-d: #E1DACD;
  --lock-ink: #857A6D;
  --fill: #F7F2EB;

  --accent: #B9543A;
  --accent-t: #F8E8E1;
  --btn: #B9543A;
  --btn-on: #FFFFFF;
  --btn-lip: #954029;
  --accent-ink: #94402A;

  --ch1: #B9543A; --ch1-d: #954029; --ch1-t: #F8E8E1; --ch1-on: #FFFFFF;
  --ch2: #B9543A; --ch2-d: #954029; --ch2-t: #F8E8E1; --ch2-on: #FFFFFF;
  --ch3: #B9543A; --ch3-d: #954029; --ch3-t: #F8E8E1; --ch3-on: #FFFFFF;
  --ch4: #B9543A; --ch4-d: #954029; --ch4-t: #F8E8E1; --ch4-on: #FFFFFF;

  --ok: #4A8045; --ok-t: #E9F2E3; --ok-ink: #2F5A2B; --ok-lip: #3A6636;
  --bad: #E8466B; --bad-t: #FDE6EC; --bad-ink: #AE1F47; --bad-lip: #C8325A;
  --flame: #E0AE3A;
  --star: #E0AE3A;
  --star-d: #BE8F27;
  --star-ink: #6B4E10;
  --goal: #E0AE3A;
  --icon-card: #B9543A;

  --night: #1F1618;
  --night-2: #2A1D1E;
  --night-d: #120C0D;
  --glow: #4A2B26;
  --moon: #FFFFFF;
  --dim: #A8978F;
  --gold: #E0AE3A;
  --gold-t: rgba(224, 174, 58, .16);
  --halo: rgba(224, 174, 58, .3);

  --r-btn: 999px;
  --r-opt: 12px;
  --shadow-card: 0 0 0 1px rgba(51, 41, 42, .06), 0 6px 14px -8px rgba(60, 30, 20, .4);

  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --num: "Outfit", "Noto Sans SC", system-ui, sans-serif;
}

.th-yellow { --c: var(--ch1); --cd: var(--ch1-d); --ct: var(--ch1-t); --con: var(--ch1-on); }
.th-blue { --c: var(--ch2); --cd: var(--ch2-d); --ct: var(--ch2-t); --con: var(--ch2-on); }
.th-red { --c: var(--ch3); --cd: var(--ch3-d); --ct: var(--ch3-t); --con: var(--ch3-on); }
.th-green { --c: var(--ch4); --cd: var(--ch4-d); --ct: var(--ch4-t); --con: var(--ch4-on); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-outer); }
body { font-family: var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--num); }

#app { position: relative; max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; background: var(--bg); }
#app.night { background: var(--night); color: var(--moon); }

/* ---------- 按钮 ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  border-radius: var(--r-btn);
  background: var(--btn);
  color: var(--btn-on);
  box-shadow: 0 4px 0 var(--btn-lip);
  font-weight: 700;
  font-size: 17px;
  transition: transform .1s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--btn-lip); }
.btn:disabled { background: var(--lock); color: var(--mut); box-shadow: none; cursor: default; }
.btn.gold { background: var(--gold); color: var(--night); box-shadow: 0 4px 0 var(--star-d); }
.btn.gold:active { box-shadow: 0 2px 0 var(--star-d); }
.btn.chapter { background: var(--c); color: var(--con); box-shadow: 0 4px 0 var(--cd); }
.btn-ghost { display: block; width: 100%; height: 46px; color: var(--mut); font-weight: 700; font-size: 15px; }
.night .btn-ghost, .ritual .btn-ghost { color: var(--dim); }
.iconbtn { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }

/* ---------- 学习页顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; background: var(--bg); }
.stat { display: inline-flex; align-items: center; gap: 4px; font-family: var(--num); font-weight: 700; font-size: 15px; }
.stat svg { width: 20px; height: 20px; }
.stat.off { color: var(--lock-ink); }
.stat.off svg path { fill: var(--lock-d) !important; }
.goal-stat { color: var(--ink); }

/* ---------- 多邻国式学习路线 ---------- */
.page { padding: 0 16px 128px; }
.chapter + .chapter { margin-top: 26px; }
.unit {
  position: sticky;
  top: 56px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 16px;
  border-radius: 20px;
  background: var(--c);
  color: var(--con);
  box-shadow: 0 4px 0 var(--cd);
}
.unit small { display: block; font-size: 12px; font-weight: 700; opacity: .9; }
.unit-name { display: block; color: inherit; text-align: left; cursor: pointer; }
.unit-name b { display: flex; align-items: center; gap: 4px; margin-top: 1px; font-size: 20px; font-weight: 700; }
.unit-name svg { width: 14px; height: 14px; }
.unit p { margin: 3px 0 0; font-size: 12px; opacity: .95; }
.guide { margin-left: auto; width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .24); color: inherit; }
.guide svg { width: 20px; height: 20px; }
.road { position: relative; }
.nd {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--num);
  font-weight: 700;
  font-size: 20px;
  color: var(--con);
  background: var(--c);
  box-shadow: 0 7px 0 var(--cd);
}
.nd:active { transform: translate(-50%, calc(-50% + 5px)); box-shadow: 0 2px 0 var(--cd); }
.nd.lock { background: var(--lock); box-shadow: 0 7px 0 var(--lock-d); color: var(--lock-ink); }
.nd.lock:active { box-shadow: 0 2px 0 var(--lock-d); }
.start {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -100%);
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 15px;
  line-height: 18px;
  white-space: nowrap;
  box-shadow: inset 0 0 0 2px var(--line);
  pointer-events: none;
  animation: bob 1.6s ease-in-out infinite;
}
.start::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--surface); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
@keyframes bob { 50% { margin-top: -5px; } }
.night-fab {
  position: fixed;
  z-index: 25;
  right: max(16px, calc(50% - 224px));
  bottom: calc(80px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--night);
  box-shadow: 0 4px 0 var(--night-d);
}
.night-fab svg { width: 26px; height: 26px; }

/* ---------- 底部导航 ---------- */
.tabs {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  display: flex;
  align-items: stretch;
  background: var(--bg);
  border-top: 2px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--mut); font-size: 12px; font-weight: 700; line-height: 1; }
.tab svg { width: 24px; height: 24px; flex: none; }
.tab svg .f { transition: fill .15s; }
.tab.on { color: var(--accent); }
.tab.on svg .f { fill: currentColor; }
.night .tabs { background: var(--night); border-top-color: rgba(255, 255, 255, .07); }
.night .tab { color: var(--dim); }
.night .tab.on { color: var(--gold); }

/* ---------- 课程 ---------- */
.lesson { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.l-top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 4px; }
.seg { flex: 1; display: flex; gap: 4px; }
.seg i { flex: 1; height: 8px; border-radius: 999px; background: var(--lock); transition: background .3s; }
.seg i.on { background: var(--accent); }
.l-body { flex: 1; padding: 6px 16px 20px; }
.l-body.enter { animation: slide-in .32s cubic-bezier(.2, .8, .3, 1); }
@keyframes slide-in { from { opacity: 0; transform: translateX(26px); } }
.prompt { margin: 14px 0; font-size: 22px; line-height: 1.36; font-weight: 700; }
.prompt small { display: block; margin-top: 4px; font-family: var(--num); font-size: 15px; font-weight: 600; color: var(--mut); }
.tag { display: inline-block; margin-top: 12px; padding: 3px 10px; border-radius: 999px; background: var(--ct); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.story { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.stage { display: grid; place-items: center; margin-bottom: 14px; padding: 16px 0; border-radius: 20px; background: var(--ct); }
.cardw { width: min(200px, 24vh, 56vw); }
.rws, .card-back { display: block; width: 100%; height: auto; border-radius: 12px; }
.rws-hit { fill: transparent; stroke: transparent; stroke-linejoin: round; cursor: pointer; outline: none; transition: fill .15s; }
.rws.interactive:not(.has-focus) .rws-hit:hover, .rws-hit:focus-visible { fill: rgba(224, 174, 58, .25); }
.rws-dim { opacity: .58; animation: fade-in .35s ease-out; }
.rws-glow { animation: fade-in .35s ease-out; }
.rws-line { animation: fade-in .35s ease-out; }
.rws-line.marching { animation: fade-in .35s ease-out, march 1.2s linear infinite; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes march { to { stroke-dashoffset: -26; } }
.note { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); font-size: 15px; line-height: 1.7; }
.note b { display: block; font-weight: 700; }
.note.hint { background: none; text-align: center; color: var(--mut); }
.note.hint b { display: inline; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.center { justify-content: center; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 700; }
.chip.rev { background: none; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--mut); }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt, .tile {
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--r-opt);
  background: var(--surface);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .08s;
}
.opts.two .opt { text-align: center; }
.opt:active:not(:disabled), .tile:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.opt.sel, .tile.sel { background: var(--accent-t); color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); animation: pop .2s ease-out; }
@keyframes pop { 45% { transform: scale(1.03); } }
.opt.right { background: var(--ok-t); color: var(--ok-ink); box-shadow: inset 0 0 0 2px var(--ok); }
.opt.wrong { background: var(--bad-t); color: var(--bad-ink); box-shadow: inset 0 0 0 2px var(--bad); }
.opt:disabled { cursor: default; }
.ask { padding: 12px 14px; border-radius: 20px 20px 20px 6px; background: var(--surface); font-size: 15px; line-height: 1.65; }
.drawn { margin: 10px 0 14px auto; width: max-content; max-width: 82%; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 20px 20px 6px 20px; background: var(--c); color: var(--con); font-size: 13px; font-weight: 700; }
.drawn .t { width: 30px; height: 50px; flex: none; border-radius: 8px; overflow: hidden; }
.thumb { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.tile { text-align: center; }
.tile.gone { opacity: .4; box-shadow: none; background: var(--ok-t); cursor: default; }
.tile.bad { background: var(--bad-t); color: var(--bad-ink); animation: shake .3s; }
@keyframes shake { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }

.l-foot { position: sticky; bottom: 0; padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); background: var(--bg); }
.foot-hint { margin: 8px 0; text-align: center; color: var(--mut); font-size: 15px; font-weight: 700; }
.fb { position: sticky; bottom: 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; animation: rise .25s ease-out; }
.fb.ok { background: var(--ok-t); }
.fb.bad { background: var(--bad-t); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.fb-head { display: flex; align-items: center; gap: 10px; }
.fb-head > svg { width: 28px; height: 28px; flex: none; }
.fb.ok .fb-head > svg { color: var(--ok); }
.fb.bad .fb-head > svg { color: var(--bad); }
.fb h3 { margin: 0; font-size: 22px; font-weight: 700; }
.fb.ok h3 { color: var(--ok-ink); }
.fb.bad h3 { color: var(--bad-ink); }
.combo { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .72); font-size: 12px; font-weight: 700; }
.combo svg { width: 14px; height: 14px; }
.fb p { margin: 8px 0 4px; font-size: 15px; line-height: 1.65; }
.fb .why { font-weight: 700; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.fb .more { margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.fb .btn { margin-top: 14px; }

/* ---------- 仪式（深夜色） ---------- */
.ritual {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 16px calc(28px + env(safe-area-inset-bottom));
  overflow: hidden;
  text-align: center;
  color: var(--moon);
  background: radial-gradient(90% 60% at 50% 34%, var(--glow) 0%, var(--night-2) 40%, var(--night) 100%);
}
.starfield { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.altar { position: relative; width: 170px; }
.altar .halo { position: absolute; left: 50%; top: 50%; width: 340px; height: 340px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, var(--halo) 0%, transparent 66%); pointer-events: none; }
.altar .cardw { position: relative; width: 100%; border-radius: 12px; overflow: hidden; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .7); }
.altar .s1 { position: absolute; right: -28px; top: -12px; width: 28px; }
.altar .s2 { position: absolute; left: -24px; top: 54%; width: 16px; }
.lit-in { animation: light-up 1s cubic-bezier(.3, 1.2, .5, 1) both; }
@keyframes light-up { from { transform: scale(.7) rotateY(80deg); filter: brightness(.3); } to { transform: none; filter: none; } }
.fan { position: relative; width: 220px; height: 200px; }
.fan > div { position: absolute; left: 50%; top: 50%; width: 104px; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7); }
.r-title { position: relative; margin: 28px 0 0; font-size: 28px; font-weight: 700; }
.r-sub { position: relative; margin-top: 6px; font-size: 13px; color: var(--dim); }
.r-kw { position: relative; display: flex; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.r-kw span { padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 12px; font-weight: 700; }
.stats3 { position: relative; display: flex; width: 100%; margin-top: 24px; }
.stats3 div { flex: 1; }
.stats3 b { display: block; font-family: var(--num); font-size: 28px; font-weight: 700; }
.stats3 span { font-size: 12px; color: var(--dim); }
.perfect { position: relative; margin-top: 14px; padding: 4px 12px; border-radius: 999px; background: var(--gold-t); color: var(--gold); font-size: 13px; font-weight: 700; }
.ritual .actions { position: relative; width: 100%; margin-top: auto; padding-top: 28px; }

/* ---------- 牌组 ---------- */
.page-h { padding-top: 22px; }
.page-h h1 { margin: 0; font-size: 28px; font-weight: 700; }
.page-h p { margin: 6px 0 0; color: var(--mut); font-size: 15px; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-family: var(--num); font-weight: 700; font-size: 15px; color: var(--mut); }
.pbar { flex: 1; height: 10px; border-radius: 999px; background: var(--lock); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.segctl { display: flex; margin-top: 16px; padding: 4px; border-radius: 12px; background: var(--lock); }
.segctl button { flex: 1; height: 36px; border-radius: 8px; color: var(--mut); font-weight: 700; font-size: 15px; }
.segctl .on { background: var(--surface); color: var(--ink); }
.group { margin-top: 24px; }
.group-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.group-h i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.group-h b { font-size: 17px; font-weight: 700; }
.group-h span { margin-left: auto; color: var(--mut); font-family: var(--num); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 10px; }
.dcard { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dcard .face { width: 100%; aspect-ratio: 572 / 960; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-card); }
.dcard .nm { font-size: 12px; font-weight: 700; }
.dcard.dark .nm { color: var(--mut); }
.pips { display: flex; gap: 3px; }
.pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--lock); }
.pips i.on { background: var(--c); }
.empty-msg { margin: 30px 0; text-align: center; color: var(--mut); line-height: 1.7; }

/* ---------- 每日（夜色页面） ---------- */
.daily { position: relative; padding: 22px 16px 130px; }
.daily > * { position: relative; }
.daily > .starfield { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: min(480px, 100%); height: 100vh; }
.daily-h { display: flex; align-items: flex-end; justify-content: space-between; }
.daily-h small { display: block; margin-top: 6px; color: var(--dim); font-size: 15px; }
.daily-h h1 { margin: 0; font-size: 28px; font-weight: 700; }
.pill-dark { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-family: var(--num); font-weight: 700; font-size: 13px; }
.pill-dark svg { width: 15px; height: 15px; }
.week { display: flex; justify-content: space-between; margin-top: 20px; }
.week span { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.week i { width: 32px; height: 32px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.week .on i { background: var(--gold); }
.week .today i { box-shadow: 0 0 0 2px var(--gold); }
.daily .altar { margin: 34px auto 0; }
.daily .lead { margin: 30px 10px 0; text-align: center; font-size: 15px; line-height: 1.7; }
.daily .lead small { display: block; margin-top: 4px; font-size: 12px; color: var(--dim); }
.daily .btn { margin-top: 22px; }
.daily-name { margin: 22px 0 0; text-align: center; font-size: 22px; font-weight: 700; }
.flip3d { perspective: 900px; }
.flip3d .inner { position: relative; transform-style: preserve-3d; animation: flip3d 1s cubic-bezier(.3, 1.2, .5, 1) both; }
.flip3d .face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flip3d .face.back { position: absolute; inset: 0; transform: rotateY(180deg); }
.flip3d .face.back .card-back { height: 100%; }
@keyframes flip3d { from { transform: rotateY(180deg) translateY(-14px); } to { transform: rotateY(0); } }
.jfield { display: block; width: 100%; min-height: 54px; margin-top: 22px; padding: 15px 16px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .07); color: var(--moon); font: 500 15px/1.6 var(--sans); resize: none; transition: min-height .2s; }
.jfield:focus { outline: none; min-height: 130px; background: rgba(255, 255, 255, .1); }
.jfield::placeholder { color: var(--dim); }
.j-h { display: flex; align-items: baseline; justify-content: space-between; margin-top: 28px; }
.j-h b { font-size: 17px; font-weight: 700; }
.j-h span { color: var(--dim); font-size: 13px; }
.entry { display: flex; gap: 12px; margin-top: 12px; padding: 12px; border-radius: 20px; background: rgba(255, 255, 255, .05); }
.entry .t { width: 40px; height: 66px; flex: none; border-radius: 8px; overflow: hidden; }
.entry small { display: block; color: var(--dim); font-size: 12px; font-weight: 700; }
.entry p { margin: 4px 0 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.daily .empty-msg { color: var(--dim); }

/* ---------- 我的 ---------- */
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.me-stats div { padding: 14px 12px; border-radius: 20px; background: var(--surface); }
.me-stats b { display: block; font-family: var(--num); font-size: 28px; font-weight: 700; }
.me-stats span { font-size: 12px; color: var(--mut); font-weight: 700; }
.panel { margin-top: 12px; padding: 16px; border-radius: 20px; background: var(--surface); }
.panel h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 96px; }
.bars div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bars i { width: 100%; max-width: 28px; min-height: 6px; border-radius: 8px; background: var(--lock-d); }
.bars i.on { background: var(--accent); }
.bars span { font-size: 12px; color: var(--mut); font-weight: 700; }
.bars .today span { color: var(--ink); }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.set-row + .set-row { border-top: 1px solid var(--lock-d); }
.set-row b { font-weight: 700; font-size: 15px; }
.set-row small { display: block; margin-top: 2px; color: var(--mut); font-size: 12px; }
.set-row .end { margin-left: auto; color: var(--mut); font-family: var(--num); font-weight: 700; }
.switch { position: relative; margin-left: auto; width: 50px; height: 30px; flex: none; border-radius: 999px; background: var(--lock-d); transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.link-danger { display: block; width: 100%; margin-top: 18px; text-align: center; color: var(--bad-ink); font-weight: 700; font-size: 15px; }

/* ---------- 底部弹层 ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(40, 24, 22, .45); animation: fade-in .2s; }
.sheet {
  position: fixed;
  z-index: 41;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  color: var(--ink);
  animation: slide .25s ease-out;
}
.scrim.still, .sheet.still { animation: none; }
@keyframes slide { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet-close { position: absolute; top: 16px; right: 16px; }
.sheet h3 { margin: 0; padding-right: 44px; font-size: 22px; font-weight: 700; }
.sheet .desc { margin: 6px 0 20px; color: var(--mut); line-height: 1.65; font-size: 15px; }
.sheet h4 { margin: 22px 0 10px; font-size: 15px; font-weight: 700; }
.detail { display: flex; gap: 16px; align-items: flex-start; }
.detail-card { width: 132px; flex: none; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h3 { margin-top: 4px; padding: 0; font-size: 22px; }
.detail-info .en { margin: 2px 0 10px; color: var(--mut); font-family: var(--num); font-weight: 600; font-size: 13px; }
.detail-info .note { margin-top: 12px; font-size: 13px; }
.note-field { display: block; width: 100%; min-height: 90px; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--surface); color: var(--ink); font: 500 15px/1.6 var(--sans); resize: vertical; }
.note-field:focus { outline: 2px solid var(--accent-t); }
.list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; text-align: left; }
.list-row + .list-row { border-top: 1.5px solid var(--line); }
.list-row .t { width: 36px; height: 60px; flex: none; border-radius: 8px; overflow: hidden; background: var(--lock); display: grid; place-items: center; font-family: var(--num); font-weight: 700; color: var(--lock-ink); font-size: 12px; }
.list-row b { display: block; font-weight: 700; font-size: 15px; }
.list-row small { display: block; margin-top: 2px; color: var(--mut); font-size: 12px; }
.list-row .end { margin-left: auto; flex: none; color: var(--mut); font-family: var(--num); font-weight: 700; font-size: 13px; }
.list-row .dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--c); }

/* ---------- 提示 ---------- */
.toast { position: fixed; z-index: 60; left: 50%; bottom: 100px; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--sans); font-weight: 700; font-size: 15px; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 白底上的边框、底边和金色关卡 ---------- */
.opt, .tile { box-shadow: inset 0 0 0 2px var(--line), 0 2px 0 var(--line); }
.opt.sel, .tile.sel { box-shadow: inset 0 0 0 2px var(--accent), 0 2px 0 var(--accent); }
.tile.gone { box-shadow: none; }
.iconbtn, .note:not(.hint), .me-stats div, .panel { background: var(--fill); box-shadow: none; }
.nd.done { --c: var(--star); --cd: var(--star-d); color: var(--star-ink); }
.fb.ok .btn { background: var(--ok); box-shadow: 0 4px 0 var(--ok-lip); }
.fb.bad .btn { background: var(--bad); box-shadow: 0 4px 0 var(--bad-lip); }

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

/* ---------- 能力解锁、比较题、复习入口 ---------- */
.skill-box { margin: 12px 0; padding: 12px 14px; border-radius: var(--r-opt); background: var(--accent-t); text-align: left; }
.skill-box b { display: block; margin-bottom: 4px; color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.skill-box p { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.6; }
.unlock { position: relative; width: 100%; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-opt); background: rgba(255, 255, 255, .08); text-align: left; }
.unlock b { display: block; margin-bottom: 4px; color: var(--gold); font-size: 13px; font-weight: 700; }
.unlock p { margin: 0; font-size: 15px; line-height: 1.6; }
.stage.cmp { grid-template-columns: 1fr 1fr; gap: 10px; padding: 22px 12px; }
.copts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.copt { display: flex; flex-direction: column; align-items: center; gap: 6px; width: calc((100% - 20px) / 3); padding: 8px 4px; text-align: center; font-size: 15px; }
.copt .thumb { display: block; width: min(76%, 10vh); height: auto; border-radius: 8px; }
.copts.cmp { gap: 12px; margin-top: 20px; }
.copts.cmp .copt { width: calc((100% - 12px) / 2); padding: 12px 8px 10px; gap: 8px; font-size: 17px; }
.copts.cmp .copt .thumb { width: min(82%, 25vh); box-shadow: var(--shadow-card); }

/* 没有大牌面的题目垂直居中；配对题的反馈条高度固定，盖住下方留白，完成时内容不跳动 */
.l-body.center { display: flex; flex-direction: column; justify-content: center; }
.l-body.still + .fb { margin-top: -103px; }
.l-body.center .tag { align-self: flex-start; }

/* ---------- 新牌页 ---------- */
.l-body .chip, .sheet .chip:not(.rev) { background: var(--ct); color: var(--accent-ink); }
.l-body .chips { margin-bottom: 12px; }
.stage.intro { padding: 12px 0; }
.stage.intro .cardw { width: min(170px, 20vh, 50vw); }
.rws-pad { fill: transparent; cursor: pointer; }
.syms + .note { scroll-margin-bottom: 96px; }
@keyframes rws-hint { 0%, 100% { fill: transparent; } 50% { fill: rgba(224, 174, 58, .45); } }
.hinting .rws-hit { animation: rws-hint 1.1s ease-in-out 2; }
.hinting .rws-hit:nth-of-type(2) { animation-delay: .25s; }
.hinting .rws-hit:nth-of-type(3) { animation-delay: .5s; }
.hinting .rws-hit:nth-of-type(4) { animation-delay: .75s; }
.hinting .rws-hit:nth-of-type(5) { animation-delay: 1s; }
.hinting .rws-hit:nth-of-type(6) { animation-delay: 1.25s; }

/* ---------- 横幅上的复习入口、结算和每日页的按钮不再被挡 ---------- */
.unit-go { display: block; margin-top: 8px; padding: 6px 14px; border-radius: 999px; background: #fff; color: var(--accent-ink); font: 700 13px var(--sans); cursor: pointer; }
.chapter { scroll-margin-top: 56px; }
.ritual .altar { width: min(150px, 20vh); }
.opts.explain .opt { padding-top: 12px; padding-bottom: 12px; line-height: 1.5; }

/* ---------- 每日解一张牌 ---------- */
.daily .altar { width: min(170px, 26vh); }
.daily .altar.small { width: 110px; }
.daily:has(.recall) .altar { width: min(116px, 16vh); margin-top: 22px; }
.daily .btn { scroll-margin-bottom: 96px; }
.tab { position: relative; }
.tab .dot { position: absolute; top: 12px; left: calc(50% + 7px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.recall { display: flex; gap: 12px; margin-top: 18px; padding: 14px; border-radius: 20px; background: rgba(255, 255, 255, .08); }
.recall .t { width: 44px; height: 73px; flex: none; border-radius: 8px; overflow: hidden; }
.recall-b { flex: 1; min-width: 0; }
.recall-b small { display: block; color: var(--dim); font-size: 12px; font-weight: 700; }
.recall-b p { margin: 4px 0 8px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; }
.recall-b b { display: block; color: var(--gold); font-size: 13px; font-weight: 700; }
.felt-row { display: flex; gap: 6px; margin-top: 8px; }
.felt-row button { flex: 1; height: 36px; border-radius: 12px; background: rgba(255, 255, 255, .12); color: var(--moon); font: 700 13px var(--sans); cursor: pointer; }
.entry .felt { margin-top: 6px; color: var(--gold); }

/* ---------- 路线上的牌名 ---------- */
.nd-name { position: absolute; z-index: 2; transform: translateX(-50%); color: var(--ink-2); font-size: 12px; font-weight: 700; line-height: 16px; white-space: nowrap; pointer-events: none; }
.nd-name.current { color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.nd-name.locked { color: var(--mut); }
.chapter.closed .nd-name { opacity: .6; }
.brand { color: var(--accent-ink); font-family: var(--num); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- 点亮、章节挑战、待复习 ---------- */
.nd.just-lit { animation: nd-lit .7s .15s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes nd-lit { 0% { transform: translate(-50%, -50%) scale(.75); box-shadow: 0 0 0 3px var(--c), 0 5px 0 3px var(--cd), 0 0 0 0 rgba(224, 174, 58, .75); } 60% { transform: translate(-50%, -50%) scale(1.14); } 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 3px var(--c), 0 5px 0 3px var(--cd), 0 0 0 26px rgba(224, 174, 58, 0); } }
.nd-due { position: absolute; right: -4px; top: -4px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 0 0 2px var(--bg); }
.nd-due svg { width: 14px; height: 14px; }
.nd.review svg { width: 36px; height: 36px; }
.nd.review.lock svg { opacity: .5; filter: grayscale(1); }
.fan-nd { position: relative; display: block; width: 112px; height: 96px; flex: none; }
.fc { position: absolute; left: 50%; top: 50%; width: 52px; height: 87px; margin: -44px 0 0 -26px; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 2px var(--surface), var(--shadow-card); }
.fc:nth-child(1) { transform: translateX(-27px) rotate(-12deg); }
.fc:nth-child(2) { z-index: 1; }
.fc:nth-child(3) { transform: translateX(27px) rotate(12deg); }
.fc .thumb { border-radius: 8px; }
.fc .card-back { height: 100%; border-radius: 8px; }
.node-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.node-head small { display: block; margin-top: 4px; color: var(--mut); font-family: var(--num); font-size: 13px; font-weight: 600; }
.node-head h3 { padding-right: 0; }
.node-card { display: block; flex: none; width: 76px; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-card); }
.node-card .thumb { aspect-ratio: 572 / 960; height: auto; border-radius: 8px; }
.node-card .card-back { border-radius: 8px; }
.node-head.done { --c: var(--star); --cd: var(--star-d); }
.dcard .face .card-back { height: 100%; }
.list-row .t .card-back { height: 100%; border-radius: 0; }

/* ---------- 星座路线：特写徽章、金色连线、故事旁白 ---------- */
.nd { width: 72px; height: 72px; border-radius: 50%; background-color: var(--c); background-repeat: no-repeat; box-shadow: 0 0 0 3px var(--c), 0 5px 0 3px var(--cd); }
.nd:active { transform: translate(-50%, calc(-50% + 3px)); box-shadow: 0 0 0 3px var(--c), 0 2px 0 3px var(--cd); }
.nd.lock { --c: var(--lock); --cd: var(--lock-d); background: var(--lock); color: var(--lock-ink); font-size: 17px; }
.nd.lock:active { box-shadow: 0 0 0 3px var(--c), 0 2px 0 3px var(--cd); }
.nd.badge { background-color: var(--surface); }
.nd-halo { position: absolute; z-index: 0; width: 170px; height: 170px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(224, 174, 58, .38), transparent); pointer-events: none; animation: nd-breathe 2.8s ease-in-out infinite; }
@keyframes nd-breathe { 50% { opacity: .55; } }
.trail { position: absolute; z-index: 0; left: 50%; top: 0; width: 1px; overflow: visible; pointer-events: none; }
.trail path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.trail .walked { stroke: var(--star); }
.trail .ahead { stroke: var(--lock-d); stroke-dasharray: 2 8; }
.nd-name { padding: 0 4px; border-radius: 8px; background: var(--bg); }
.nd-beat { position: absolute; z-index: 1; width: 120px; text-wrap: balance; transform: translateY(-50%); color: var(--mut); font-size: 12px; line-height: 1.5; pointer-events: none; }
.nd-beat.l { text-align: right; }
.nd-beat.current { color: var(--accent-ink); font-weight: 700; }
.chapter.closed .nd { opacity: .6; }

/* ---------- 章节挑战徽章、每日目标 ---------- */
.nd-fan { position: relative; display: block; width: 62px; height: 40px; }
.nd-fan i { position: absolute; top: 3px; width: 34px; height: 34px; border-radius: 50%; background-repeat: no-repeat; box-shadow: 0 0 0 2px var(--surface); }
.nd-fan i:nth-child(1) { left: 0; }
.nd-fan i:nth-child(2) { left: 14px; z-index: 1; top: 0; }
.nd-fan i:nth-child(3) { left: 28px; }
.goal-pick { margin-left: auto; height: 34px; padding: 0 12px; border-radius: 12px; background: var(--surface); color: var(--ink); font: 700 15px var(--sans); cursor: pointer; }
.bars-note { margin: 10px 0 0; color: var(--mut); font-size: 12px; text-align: center; }

/* ---------- 牌组 · 待复习 ---------- */
.rv-hero { margin-top: 16px; padding: 22px 16px 16px; border-radius: 20px; background: var(--accent-t); text-align: center; }
.rv-hero h2 { margin: 14px 0 6px; font-size: 20px; font-weight: 700; }
.rv-hero p { margin: 0 0 16px; color: var(--mut); font-size: 13px; line-height: 1.6; text-wrap: balance; }
.rv-hero.calm h2 { margin-top: 0; }
.rv-hero.calm p { margin-bottom: 0; }
.rv-fan { display: flex; justify-content: center; padding-top: 4px; }
.rv-fan button { width: 66px; margin: 0 -10px; aspect-ratio: 572 / 960; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 3px var(--surface), var(--shadow-card); }
.rv-fan button:only-child { width: 84px; }
.rv-h { margin: 24px 0 8px; font-size: 17px; font-weight: 700; }
.rv-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; border-top: 1px solid var(--line); }
.rv-row b { width: 72px; flex: none; font-size: 15px; font-weight: 700; }
.rv-thumbs { display: flex; flex: 1; min-width: 0; }
.rv-thumbs i { width: 26px; height: 44px; flex: none; margin-right: -6px; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 2px var(--surface); }
.rv-row em { color: var(--mut); font-size: 13px; font-style: normal; font-weight: 700; }

/* ---------- 新牌的图案按钮、退出确认 ---------- */
.syms { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 12px; }
.sym { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 15px var(--sans); box-shadow: inset 0 0 0 2px var(--line), 0 2px 0 var(--line); transition: transform .08s; }
.sym svg { width: 14px; height: 14px; margin-left: -2px; }
.sym:active { transform: translateY(2px); box-shadow: inset 0 0 0 2px var(--line); }
.sym.seen { color: var(--accent-ink); box-shadow: inset 0 0 0 2px var(--accent-t), 0 2px 0 var(--accent-t); }
.sym.on { background: var(--accent); color: #fff; box-shadow: 0 2px 0 var(--btn-lip); }
.btn-ghost.danger { color: var(--bad-ink); }
.btn.danger { background: var(--bad); box-shadow: 0 4px 0 var(--bad-lip); }
.sheet .btn + .btn-ghost { margin-top: 8px; }

/* ---------- 第一次打开 ---------- */
.ob-welcome { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.ob-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px 8px; text-align: center; }
.ob-hero .brand { font-size: 22px; }
.ob-fan { position: relative; width: 240px; height: 210px; margin: 28px 0 8px; }
.ob-fan span { position: absolute; left: 50%; top: 8px; width: 112px; aspect-ratio: 572 / 960; margin-left: -56px; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 3px var(--surface), var(--shadow-card); }
.ob-fan span:nth-child(1) { transform: translateX(-62px) rotate(-12deg); }
.ob-fan span:nth-child(2) { z-index: 1; top: 0; }
.ob-fan span:nth-child(3) { transform: translateX(62px) rotate(12deg); }
.ob-hero h1 { margin: 24px 0 0; font-size: 28px; font-weight: 700; line-height: 1.3; }
.ob-hero p { max-width: 300px; margin: 8px 0 0; color: var(--mut); font-size: 15px; line-height: 1.6; }
.ob-note { margin: 12px 0 0; color: var(--mut); font-size: 12px; text-align: center; }
.ob-opts .opt { min-height: 56px; }
.ob-opts .opt b { font-size: 17px; font-weight: 700; }
.ob-opts .opt small { display: block; margin-top: 2px; color: var(--mut); font-size: 13px; font-weight: 400; }
.ob-opts .opt.sel small { color: var(--accent-ink); }
.test-id { margin: 8px 0 0; color: var(--mut); font-size: 12px; text-align: center; }
