/* 法硕背诵 · 样式 */
:root {
  --bg: #f5f3ec; --card: #ffffff; --ink: #1f2430; --sub: #6b7280; --line: #e7e4da;
  --brand: #2f6fdb; --brand-ink: #ffffff; --gold: #d9a400;
  --g0: #d23f6b; --g1: #e0942f; --g2: #159a78;
  --note-bg: #fff4d6; --note-bd: #d9a400; --note-ink: #7a5200;
  --case-bg: #e8f1fd; --case-bd: #2f6fdb; --case-ink: #1d4f9c;
  --shadow: 0 1px 2px rgba(31, 36, 48, .06), 0 4px 14px rgba(31, 36, 48, .05);
  --fs: 1;
  --w: 620px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121419; --card: #1b1e26; --ink: #e8eaf0; --sub: #98a0ae; --line: #2a2e38;
    --brand: #6ea0ff; --brand-ink: #0b1220; --gold: #f0c040;
    --note-bg: #3a3118; --note-bd: #b58f1a; --note-ink: #f1d58a;
    --case-bg: #16263d; --case-bd: #3f78d4; --case-ink: #a9c8ff;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #121419; --card: #1b1e26; --ink: #e8eaf0; --sub: #98a0ae; --line: #2a2e38;
  --brand: #6ea0ff; --brand-ink: #0b1220; --gold: #f0c040;
  --note-bg: #3a3118; --note-bd: #b58f1a; --note-ink: #f1d58a;
  --case-bg: #16263d; --case-bd: #3f78d4; --case-ink: #a9c8ff;
  --shadow: none;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 -apple-system, "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
h1, h2, h3, p { margin: 0; }
b { font-weight: 700; }
small { font-size: .75em; color: var(--sub); font-weight: 500; }

#app { max-width: var(--w); margin: 0 auto; padding: 14px 16px calc(84px + env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; }
body.studying #app { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
#boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--sub); }
.sub { color: var(--sub); font-size: .82rem; }
.empty { text-align: center; color: var(--sub); padding: 48px 0; }
.pad-x { padding-left: 2px; padding-right: 2px; }
.wrap { flex-wrap: wrap; }

/* 底部导航 */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 0;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
body.studying #nav { display: none; }
#nav a {
  flex: 1; max-width: 155px; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 8px 0 7px; font-size: .72rem; color: var(--sub);
}
#nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav a.on { color: var(--brand); font-weight: 700; }

/* 通用组件 */
.panel { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); margin: 10px 0; overflow: hidden; }
.panel.pad { padding: 14px 16px; }
.panel.list > * + * { border-top: 1px solid var(--line); }
.ptitle { font-size: 1.45rem; margin: 6px 2px 10px; }
.sec { font-size: .9rem; color: var(--sub); margin: 18px 4px 4px; font-weight: 600; }
.sec3 { font-size: .95rem; margin: 16px 4px 2px; color: var(--ink); }
.tip2 { margin: 2px 4px 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; text-align: center;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; border-radius: 14px; }
.btn.danger { color: var(--g0); }
.btn-row { display: flex; gap: 10px; margin: 12px 0; align-items: center; justify-content: space-between; }
.btn-row > .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.link { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.icon {
  width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center;
  font-size: 1.15rem; color: var(--sub);
}
.icon.on { color: var(--gold); }
.icon.dis { opacity: .35; }

.stack { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: flex; margin-top: 6px; }
.stack i { display: block; height: 100%; }
.stack .m { background: var(--g2); }
.stack .r { background: var(--brand); }
.stack .l { background: var(--g1); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .8rem; color: var(--sub); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.legend .m { background: var(--g2); } .legend .r { background: var(--brand); } .legend .l { background: var(--g1); } .legend .n { background: var(--line); }

.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.row .bar { width: 4px; align-self: stretch; border-radius: 2px; }
.grow { flex: 1; min-width: 0; }
.r1 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.link-row { display: flex; align-items: center; gap: 12px; }

.chip { display: inline-block; font-size: .72rem; padding: 1px 9px; border-radius: 99px; font-weight: 600; }
.chip.new { background: #e8f1fd; color: #2f6fdb; }
.chip.rev { background: #e6f6f1; color: #159a78; }
.chip.again { background: #fde8ee; color: #d23f6b; }
.chip.cram { background: #fff0dc; color: #b8700a; }
.tag { display: inline-block; font-size: .7rem; font-weight: 500; color: var(--sub); background: var(--line); border-radius: 6px; padding: 0 6px; margin-left: 2px; vertical-align: 2px; white-space: nowrap; }
.star { color: var(--gold); margin-right: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 2px solid var(--line); }
.dot.learning { background: var(--g1); border-color: var(--g1); }
.dot.review { background: var(--brand); border-color: var(--brand); }
.dot.mastered { background: var(--g2); border-color: var(--g2); }

.seg { display: inline-flex; background: var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 8px; font-size: .85rem; color: var(--sub); font-weight: 600; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.sw { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; z-index: 1; cursor: pointer; }
.sw i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .15s; }
.sw i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.sw input:checked + i { background: var(--g2); }
.sw input:checked + i::after { transform: translateX(18px); }

/* 首页 */
.hero { display: flex; justify-content: space-between; align-items: flex-end; padding: 6px 2px 4px; }
.hello { font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; }
.date { color: var(--sub); font-size: .85rem; }
.streak { background: var(--card); box-shadow: var(--shadow); padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: .9rem; }
.panel.today { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dasharray .4s; }
.ring-t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-t b { font-size: 1.15rem; }
.ring-t span { font-size: .72rem; color: var(--sub); }
.today-r { flex: 1; display: grid; gap: 8px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; }
.kv span { color: var(--sub); font-size: .88rem; }
.kv b { font-size: 1.25rem; }
.done-msg { text-align: center; font-weight: 700; padding: 14px 0 2px; }
.scope { display: flex; justify-content: space-between; font-size: .82rem; color: var(--sub); padding: 4px 4px; }
.scope a { color: var(--brand); }

/* 目录 */
.search {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); padding: 0 14px; font: inherit; outline: none;
}
.search:focus { border-color: var(--brand); }
.chips-row { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.chip-link { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; padding: 5px 13px; font-size: .85rem; font-weight: 600; }
.back { display: flex; align-items: center; gap: 4px; margin: 2px 0 8px; }
.back .icon { font-size: 1.8rem; color: var(--ink); }
.back h1 { font-size: 1.1rem; line-height: 1.35; border-left: 4px solid var(--accent); padding-left: 10px; }
.crow { display: flex; align-items: center; padding: 0 12px 0 0; }
.crow-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px; }
.recite-btn { flex: none; min-width: 58px; height: 34px; padding: 0 14px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 700; font-size: .88rem; }
.recite-btn:active { background: var(--brand); color: var(--brand-ink); }
.ct { font-weight: 600; line-height: 1.45; }

/* 导图视图 */
.mm-wrap { position: relative; margin-top: 10px; }
#mm { background: #fbfaf7; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }
.mm-vp { position: relative; height: calc(100vh - 290px); height: calc(100dvh - 290px); min-height: 380px; overflow: hidden; touch-action: none; cursor: grab; }
.mm-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; color: #1f2430; font-family: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
.mm-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.mm-stage .n { position: absolute; white-space: normal; overflow-wrap: anywhere; line-break: auto; line-height: 1.45; }
.mm-stage .R { background: #1f2a44; color: #fff; font-size: 26px; font-weight: 700; padding: 16px 26px; border-radius: 16px; letter-spacing: 1px; max-width: 460px; }
.mm-stage .S { color: #fff; font-size: 19px; font-weight: 700; padding: 10px 18px; border-radius: 12px; white-space: nowrap; }
.mm-stage .M { font-size: 16px; font-weight: 700; padding: 7px 14px; border-radius: 10px; border: 2px solid; white-space: nowrap; }
.mm-stage .Q { font-size: 14.5px; font-weight: 700; padding: 7px 12px; border-radius: 9px; border: 1.8px solid; background: #fff; max-width: 300px; }
.mm-stage .Q.tap { cursor: pointer; }
.mm-stage .Q.st-mastered { background: #e6f6f1; }
.mm-stage .Q.st-review { background: #eaf1fd; }
.mm-stage .Q.st-learning { background: #fff3e0; }
.mm-stage .Q .star { color: #d9a400; margin-right: 2px; }
.mm-stage .Q .tag { font-size: 11px; color: #6b7280; background: #eef0f3; border-radius: 6px; padding: 0 6px; margin-left: 4px; line-height: 18px; }
.mm-stage .P { font-size: 13px; padding: 4px 10px 4px 9px; border-radius: 6px; background: #fff; border: 1px solid #e3e5ea; border-left: 3.5px solid; max-width: 440px; color: #2b3140; }
.mm-stage .P.d2 { font-size: 12.5px; max-width: 360px; background: #fafbfc; }
.mm-stage .N { font-size: 12.5px; padding: 4px 10px; border-radius: 6px; background: #fff4d6; border: 1px dashed #d9a400; color: #7a5200; max-width: 380px; }
.mm-stage .N::before { content: "记忆 "; font-weight: 700; }
.mm-stage .C { font-size: 12.5px; padding: 4px 10px; border-radius: 6px; background: #e8f1fd; border: 1px dashed #2f6fdb; color: #1d4f9c; max-width: 380px; }
.mm-stage .C::before { content: "案例 "; font-weight: 700; }
.mm-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mm-ctl button { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); border-radius: 10px; min-width: 42px; height: 38px; font-weight: 700; font-size: .85rem; padding: 0 8px; }

/* 背诵页 */
.study-top { display: flex; align-items: center; gap: 8px; margin: -4px 0 0; }
.prog { flex: 1; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.cnt { font-weight: 800; min-width: 62px; text-align: right; }
.study-sub { display: flex; gap: 12px; font-size: .78rem; color: var(--sub); padding: 0 4px 6px 52px; }
.study-sub span:last-child { margin-left: auto; padding-right: 2px; }

.sc { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; border-top: 5px solid var(--accent, var(--brand)); }
.sc.in { animation: cardIn .18s ease-out; }
.sc.plain { margin-top: 4px; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.sc-head { padding: 14px 18px 8px; }
.crumb { font-size: .74rem; color: var(--sub); line-height: 1.5; }
.path { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.path span { font-size: .74rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; padding: 1px 8px; }
.sc-head h1 { font-size: calc(1.28rem * var(--fs)); line-height: 1.4; margin: 6px 0 4px; }
.sc-meta { margin: 6px 0 0; }
.sc-body { padding: 4px 18px 20px; font-size: calc(1rem * var(--fs)); }
.tip { background: var(--bg); color: var(--sub); border-radius: 10px; padding: 8px 12px; font-size: .85rem; margin: 6px 0 10px; }
.recall { text-align: center; padding: 26px 0 10px; }
.recall-t { font-size: 1.1rem; font-weight: 700; }
.recall-s { color: var(--sub); font-size: .85rem; margin: 6px 0 16px; }
.hint-list { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: 8px; }
.hint-list span { background: var(--bg); border-radius: 10px; padding: 6px 14px; font-weight: 600; }
.hint-empty { color: var(--sub); font-size: .85rem; }

.pt { margin: 7px 0; padding-left: 12px; border-left: 3px solid color-mix(in srgb, var(--accent, var(--brand)) 55%, transparent); line-height: 1.65; }
.pt .pt { margin: 5px 0 2px; border-left-width: 2px; }
.pt-t { word-break: break-word; }
.mk { background: var(--line); color: transparent; border-radius: 6px; cursor: pointer; user-select: none; padding: 0 4px; display: inline; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.mk.on { background: transparent; color: inherit; padding: 0; user-select: auto; }
.nb { border-radius: 10px; padding: 8px 12px; margin: 9px 0; font-size: .93em; line-height: 1.6; }
.nb em { font-style: normal; font-weight: 800; margin-right: 6px; }
.nb.note { background: var(--note-bg); border: 1px dashed var(--note-bd); color: var(--note-ink); }
.nb.case { background: var(--case-bg); border: 1px dashed var(--case-bd); color: var(--case-ink); }

.study-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 14px calc(12px + env(safe-area-inset-bottom));
}
.study-bar > * { max-width: var(--w); margin-left: auto; margin-right: auto; }
.tools { display: flex; justify-content: space-around; margin-bottom: 4px; }
.tb { display: flex; flex-direction: column; align-items: center; min-width: 58px; padding: 2px 4px; color: var(--sub); font-size: .68rem; line-height: 1.2; border-radius: 10px; }
.tb i { font-style: normal; font-size: 1.25rem; line-height: 1.3; }
.tb.on { color: var(--gold); }
.tb.dis { opacity: .35; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.g { border-radius: 14px; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: #fff; }
.g b { font-size: 1.05rem; }
.g span { font-size: .75rem; opacity: .9; }
.g0 { background: var(--g0); } .g1 { background: var(--g1); } .g2 { background: var(--g2); }

/* 总结页 */
.summary { text-align: center; padding: 28px 0; }
.big-emoji { font-size: 3rem; }
.summary h1 { font-size: 1.5rem; margin: 6px 0 18px; }
.sum-grid, .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum-grid div, .grid3 div { display: flex; flex-direction: column; align-items: center; }
.sum-grid b, .grid3 b { font-size: 1.7rem; }
.sum-grid span, .grid3 span { font-size: .78rem; color: var(--sub); }
.sum-bars { margin: 22px 0 8px; }
.sum-bars > div { display: flex; height: 10px; border-radius: 99px; overflow: hidden; }
.sum-bars i.g2 { background: var(--g2); } .sum-bars i.g1 { background: var(--g1); } .sum-bars i.g0 { background: var(--g0); }
.sum-bars p { font-size: .85rem; color: var(--sub); margin-top: 8px; }

/* 统计 */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 130px; }
.bcol { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bcol .b { width: 100%; background: var(--brand); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; opacity: .85; }
.bcol.f .b { background: var(--g1); }
.bcol .b em { position: absolute; top: -17px; left: 0; right: 0; text-align: center; font-size: .68rem; font-style: normal; color: var(--sub); }
.bcol span { font-size: .66rem; color: var(--sub); }

/* 设置 */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; gap: 12px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row.col { flex-direction: column; align-items: flex-start; }
.step { display: flex; align-items: center; gap: 4px; }
.step button { width: 38px; height: 38px; border-radius: 10px; background: var(--bg); font-size: 1.2rem; font-weight: 700; }
.step b { min-width: 50px; text-align: center; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.meta div { display: flex; justify-content: space-between; font-size: .88rem; }
.meta span { color: var(--sub); }

#toast {
  position: fixed; left: 50%; bottom: 120px; transform: translate(-50%, 10px); z-index: 99;
  background: rgba(20, 22, 28, .9); color: #fff; padding: 9px 16px; border-radius: 10px;
  font-size: .88rem; opacity: 0; pointer-events: none; transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  #app { padding-top: 28px; }
  .mm-vp { height: calc(100vh - 250px); }
}

/* ===== 段位系统 ===== */
.btn.wide { width: 100%; margin-top: 10px; }
.badge { flex: none; display: block; }
.rank-panel { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.rank-r { flex: 1; min-width: 0; }
.rank-name { font-size: 1.12rem; font-weight: 800; }
.rank-pct { font-size: 1.45rem; font-weight: 800; line-height: 1.25; }
.rank-pct small { margin-left: 8px; }
.obar { position: relative; height: 10px; border-radius: 99px; background: var(--line); margin: 8px 0 6px; overflow: hidden; }
.obar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width .5s; }
.obar b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(255, 255, 255, .7); }
:root[data-theme="dark"] .obar b { background: rgba(0, 0, 0, .45); }
.rank-next { font-size: .78rem; color: var(--sub); }

.rank-strip { position: relative; display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 6px 12px 7px 8px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); }
.rs-m { flex: 1; min-width: 0; }
.rs-t { display: flex; justify-content: space-between; font-size: .8rem; }
.rs-t span { color: var(--sub); }
.rs-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 3px; }
.rs-bar i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }
.gain { position: absolute; right: 14px; top: -4px; font-weight: 900; font-size: 1.15rem; color: var(--g2); animation: gainUp 1.2s ease-out forwards; pointer-events: none; text-shadow: 0 1px 6px rgba(0, 0, 0, .15); }
@keyframes gainUp { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: translateY(-4px) scale(1.25); } 100% { opacity: 0; transform: translateY(-26px) scale(1); } }

.rankup { position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 18, .84); display: grid; place-items: center; animation: fadeIn .25s; cursor: pointer; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
.ru-card { position: relative; text-align: center; color: #fff; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: pop .55s cubic-bezier(.2, 1.3, .4, 1); }
.ru-glow { position: absolute; top: 0; width: 280px; height: 280px; background: radial-gradient(circle, var(--rc) 0%, transparent 65%); opacity: .55; filter: blur(10px); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ru-card .badge { position: relative; }
.ru-t { font-size: .95rem; letter-spacing: 8px; opacity: .85; margin-top: 8px; }
.ru-n { font-size: 2.1rem; font-weight: 900; }
.ru-s { font-size: .85rem; opacity: .75; margin-bottom: 16px; }
.subup { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 90; background: rgba(20, 22, 30, .95); color: #fff; border-radius: 16px; padding: 8px 18px 8px 10px; display: flex; align-items: center; gap: 10px; animation: dropIn .3s ease-out; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); white-space: nowrap; }
.subup b { display: block; }
.subup span { font-size: .75rem; opacity: .7; }
@keyframes dropIn { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }

.rank-hero { text-align: center; padding: 22px 18px 18px; display: flex; flex-direction: column; align-items: center; }
.rh-name { font-size: 1.55rem; font-weight: 900; margin-top: 6px; }
.rh-pct { font-size: 2.3rem; font-weight: 900; line-height: 1.15; }
.rank-hero .obar { width: 100%; }
.rules { text-align: left; margin-top: 12px; line-height: 1.65; }
.tier { display: flex; align-items: center; gap: 12px; padding: 10px 14px; opacity: .45; }
.tier.got, .tier.cur { opacity: 1; }
.tier.cur { background: color-mix(in srgb, var(--tc) 12%, transparent); }
.subs { display: flex; gap: 6px; margin-top: 5px; }
.sl { flex: 1; text-align: center; font-weight: 800; font-size: .8rem; border-radius: 8px; padding: 2px 0 3px; background: var(--line); color: var(--sub); line-height: 1.25; }
.sl small { display: block; font-size: .62rem; font-weight: 500; }
.sl.got { background: color-mix(in srgb, var(--tc) 55%, var(--card)); color: var(--ink); }
.sl.now { outline: 2px solid var(--tc); }
.sum-rank { margin: 16px 0 6px; text-align: left; }
.sum-rank .sub { text-align: center; margin-top: -4px; }

/* ===== 自选考点背诵 ===== */
body.picking #nav { display: none; }
body.picking #app { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }
button.chip-link { font: inherit; font-size: .85rem; font-weight: 600; }
.chip-link.on { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.pk-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; }
.pk-row.node.d1 { padding-left: 30px; }
.pk-row.node.d2 { padding-left: 46px; }
.pk-row.card { padding-left: 62px; }
.ck { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--sub); flex: none; position: relative; background: var(--card); opacity: .9; }
.ck.all { background: var(--brand); border-color: var(--brand); opacity: 1; }
.ck.all::after { content: ""; position: absolute; left: 5.5px; top: 1.5px; width: 5px; height: 10px; border: solid var(--brand-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.ck.part { border-color: var(--brand); opacity: 1; }
.ck.part::after { content: ""; position: absolute; left: 3.5px; top: 8px; width: 11px; height: 2.5px; background: var(--brand); border-radius: 2px; }
.pk-name { flex: 1; display: flex; align-items: center; gap: 8px; text-align: left; min-width: 0; padding: 4px 0; }
.pk-name .grow { display: block; }
.pk-name small { margin-left: 8px; }
.pk-bar { width: 4px; height: 20px; border-radius: 2px; flex: none; }
.arr { display: inline-block; transition: transform .15s; color: var(--sub); flex: none; width: 12px; }
.arr.o { transform: rotate(90deg); }
.pk-resbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; }
.pick-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.pick-bar > * { max-width: var(--w); width: 100%; margin: 0 auto; }
.pb-info b { font-size: 1.25rem; margin: 0 4px; }
.pb-info small { margin-left: 8px; }
.pb-opts { display: flex; gap: 8px; }
.opt { padding: 5px 13px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line); font-size: .82rem; font-weight: 600; color: var(--sub); }
.opt.on { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.pb-btns { display: flex; gap: 10px; }
.pb-btns .btn { flex: 1; }
.pb-btns .btn.ghost { flex: 0 0 92px; }

/* ===== 刑法重点分级 ===== */
.pr { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: .72rem; font-weight: 800; color: #fff; margin-right: 6px; vertical-align: 1px; flex: none; line-height: 1; }
.pr-A { background: #e0662f; } .pr-B { background: #2f6fdb; } .pr-C { background: #159a78; } .pr-D { background: #8a8f99; }
.pr-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 700; padding: 1px 10px 1px 3px; border-radius: 99px; background: color-mix(in srgb, var(--lc) 14%, transparent); color: var(--lc); margin-left: 6px; }
.pr-chip .pr { margin: 0; width: 18px; height: 18px; font-size: .68rem; }
.chip.tch { background: var(--note-bg); color: var(--note-ink); margin-left: 6px; }
.req { font-size: .84rem; background: var(--bg); border-radius: 9px; padding: 6px 11px; margin-top: 10px; line-height: 1.55; }
.req b, .goal em, .pn-r em { font-style: normal; font-weight: 700; color: var(--sub); margin-right: 8px; }
.goal { font-size: .86rem; background: var(--bg); border-radius: 9px; padding: 7px 12px; margin: 0 4px 14px; text-align: left; line-height: 1.55; }
details.pn { margin-top: 16px; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 12px; }
details.pn summary, .pn-box summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--sub); }
.pn-r { font-size: .88rem; margin-top: 7px; line-height: 1.6; }
.pn-r.skim { color: var(--sub); }
.pr-panel .pr-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pr-panel .pr-top .pr-chip { margin-left: 0; }
.prow { padding: 10px 0; }
.prow + .prow { border-top: 1px solid var(--line); }
.prow-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.key-link { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.lv { padding: 13px 16px; }
.lv-h { display: flex; align-items: center; gap: 4px; }
.lv-h .sub { margin-left: auto; }
.lv-req { font-size: .86rem; margin-top: 4px; }
.lv .link { font-size: .85rem; margin-top: 4px; }
.ord { margin-top: 10px; font-size: .9rem; line-height: 1.65; }
.chain { padding: 13px 16px; }
.ch-f { font-size: .9rem; margin-top: 4px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .88rem; margin-top: 8px; }
.pn-box { margin-top: 10px; }
.pn-box .sk { padding: 9px 0; font-size: .88rem; line-height: 1.6; }
.pn-box .sk + .sk { border-top: 1px solid var(--line); }
.kr-h { display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; padding: 11px 14px; }
.kr-h .grow { display: flex; flex-direction: column; margin-left: 4px; }
.kr-h small { margin: 1px 0 0; color: var(--sub); font-size: .76rem; font-weight: 500; }
.kd { padding: 0 16px 14px 44px; }
.kd-cards { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.kc { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .9rem; color: var(--brand); }

/* ===== 各科段位 ===== */
.rank-subj { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--sub); }
.rank-subj i, .rk-cell b i { width: 4px; height: 12px; border-radius: 2px; display: inline-block; }
.ranks { padding: 12px 8px 12px; }
.ranks-h { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 6px; }
.ranks-h a { color: var(--brand); font-size: .82rem; }
.ranks-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.rk-cell { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; padding: 4px 0 2px; border-radius: 10px; min-width: 0; }
.rk-cell .badge { margin-bottom: 2px; }
.rk-cell b { display: flex; align-items: center; gap: 4px; font-size: .8rem; }
.rk-cell b i { height: 10px; width: 3px; background: var(--sc, var(--brand)); }
.rk-n { font-size: .64rem; color: var(--ink); line-height: 1.25; font-weight: 600; }
.rk-p { font-size: .66rem; color: var(--sub); }
.sum-rank { display: flex; flex-direction: column; gap: 8px; }
.sum-r { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow); text-align: left; }
.sum-r .obar { margin: 4px 0 0; height: 8px; }
.sum-r em { font-style: normal; font-weight: 900; color: var(--g2); font-size: 1.05rem; }

/* ===== 收藏（书签）===== */
.fi { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; display: block; flex: none; }
.fi.on { fill: #e0662f; stroke: #e0662f; }
.fav-btn { flex: none; width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; color: var(--sub); }
.fav-btn.on { color: #e0662f; }
.fav-btn.pop .fi { animation: favPop .38s ease-out; }
@keyframes favPop { 0% { transform: scale(.55); } 55% { transform: scale(1.4); } 100% { transform: scale(1); } }
.sc-head { position: relative; padding-right: 58px; }
.fav-btn.corner { position: absolute; right: 8px; top: 8px; width: 46px; height: 46px; }
.fav-btn.corner .fi { width: 26px; height: 26px; }
.tb.fav.on { color: #e0662f; }
.tb i { display: block; }
.tb .fi { width: 24px; height: 24px; margin: 0 auto; }
.crow .fav-btn { margin-right: 2px; }
.fav-mark { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.fav-mark .fi { width: 15px; height: 15px; }
.btn .fi { width: 18px; height: 18px; margin-right: 2px; }
.fav-chip { display: inline-flex; align-items: center; gap: 4px; }
.fav-chip .fi { width: 16px; height: 16px; }
.mm-stage .Q.fav { box-shadow: 0 0 0 2.5px #e0662f; }
.mm-stage .Q.fav::after { content: ""; position: absolute; right: 6px; top: -3px; width: 10px; height: 15px; background: #e0662f; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }

/* ===== iPad / 大屏：内容栏加宽、字更大、导图占满高度 ===== */
@media (min-width: 700px) {
  :root { --w: 780px; }
  body { font-size: 17px; }
  .mm-vp { height: calc(100dvh - 260px); min-height: 520px; }
  .ranks-strip .badge { width: 60px; height: auto; }
  .rk-n { font-size: .74rem; } .rk-p { font-size: .76rem; }
  .sc-body { font-size: calc(1.08rem * var(--fs)); }
}
@media (min-width: 1000px) {
  :root { --w: 900px; }
  .mm-vp { height: calc(100dvh - 240px); }
}
/* 横屏 iPad：背诵卡片不要被底部操作条挡住 */
@media (orientation: landscape) and (max-height: 820px) {
  body.studying #app { padding-bottom: calc(130px + env(safe-area-inset-bottom)); }
}

.err { color: var(--g0); }
.btn[disabled] { opacity: .5; }
.btn.sm, .btn-row.wrap .btn { white-space: nowrap; }
