/* 口袋语法 · 样式。手机优先，单栏；电脑上居中一栏。日间 / 夜间两套颜色。 */
:root {
  --bg: #F4F1EA; --surface: #FFFDF8; --surface-2: #EAE5D9;
  --ink: #1B2430; --ink-2: #4A5563; --ink-3: #7C8694; --line: #D9D2C3;
  --accent: #1F3A5F; --accent-ink: #FFFFFF; --accent-soft: #DCE5F0;
  --ok: #1E7A4E; --ok-soft: #DDF0E5; --bad: #B23A2E; --bad-soft: #F7E1DD;
  --gold: #9A6B12; --gold-soft: #F6ECD3;
  --shadow: 0 1px 2px rgba(27, 36, 48, .06), 0 8px 24px rgba(27, 36, 48, .07);
  --font-ui: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-zh: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-en: "Times New Roman", "Georgia", "Noto Serif", serif;
  --fs: 16px; --nav-h: 58px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #10151C; --surface: #18202A; --surface-2: #212B37;
  --ink: #E8ECF1; --ink-2: #B4BDC9; --ink-3: #8490A0; --line: #2C3846;
  --accent: #8DB4E6; --accent-ink: #0C1622; --accent-soft: #1E3046;
  --ok: #5CC592; --ok-soft: #17332A; --bad: #EE8073; --bad-soft: #3A1F1C;
  --gold: #E0B45A; --gold-soft: #33290F;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.6; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }
#app { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 16px) 16px calc(var(--nav-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) + 28px); min-height: 100vh; }
.empty { text-align: center; color: var(--ink-3); padding: 80px 0; }

/* 底部导航 */
#nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))); padding-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; z-index: 10; }
#nav.hide { display: none; }
#nav button { flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; border: 0; background: none; padding: 0; font-family: inherit; color: var(--ink-3); font-size: 11px; }
#nav button svg { width: 22px; height: 22px; margin-bottom: 2px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#nav button.on { color: var(--accent); font-weight: 600; }

/* 首页 */
.brand { display: flex; align-items: baseline; margin: 6px 0 2px; }
.brand h1 { font-family: var(--font-zh); font-size: 26px; margin: 0 10px 0 0; letter-spacing: 1px; }
.brand span { color: var(--ink-3); font-size: 13px; }
.hero { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 18px 18px 16px; margin: 14px 0 22px; box-shadow: var(--shadow); }
.hero .k { font-size: 12px; opacity: .8; }
.hero .t { font-family: var(--font-zh); font-size: 20px; font-weight: 700; margin: 2px 0 2px; }
.hero .s { font-size: 13px; opacity: .88; }
.hero .row { display: flex; align-items: center; margin-top: 14px; }
.hero .bar { flex: 1; margin-right: 14px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .25); overflow: hidden; }
:root[data-theme="dark"] .hero .bar { background: rgba(0, 0, 0, .22); }
.hero .bar i { display: block; height: 100%; background: currentColor; border-radius: 3px; }
.hero .num { font-size: 12px; opacity: .9; white-space: nowrap; }
.hero button { margin-top: 14px; width: 100%; border: 0; border-radius: 10px; padding: 11px; background: var(--accent-ink); color: var(--accent); font-weight: 700; font-size: 15px; }

.part { margin: 26px 0 10px; }
.part h2 { font-family: var(--font-zh); font-size: 18px; margin: 0; }
.part h2 small { font-family: var(--font-ui); font-weight: 400; font-size: 13px; color: var(--ink-3); margin-left: 8px; }
.part p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.lessons { display: grid; grid-gap: 8px; }
.lesson { display: flex; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.lesson:active { background: var(--surface-2); }
.lesson .no { flex: none; margin-right: 12px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-en); font-size: 16px; background: var(--surface-2); color: var(--ink-2); }
.lesson.done .no { background: var(--ok-soft); color: var(--ok); }
.lesson .tt { flex: 1; min-width: 0; }
.lesson .tt b { display: block; font-size: 15px; }
.lesson .tt span { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson .st { flex: none; font-size: 12px; color: var(--ink-3); }
.lesson.done .st { color: var(--ok); font-weight: 600; }
.lesson .st.lock { color: var(--gold); }

/* 课程页 */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; margin: -16px -16px 8px; padding: var(--bar-top, calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 8px)) calc(8px + var(--cap-r, 0px)) 8px calc(8px + var(--cap-l, 0px)); background: var(--bg); border-bottom: 1px solid transparent; }
.top.shadow { border-bottom-color: var(--line); }
.top button { border: 0; background: none; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; }
.top .mid { flex: 1; text-align: center; font-size: 13px; color: var(--ink-3); }
.lh { margin: 6px 0 18px; }
.lh .k { font-size: 12.5px; color: var(--ink-3); letter-spacing: .5px; }
.lh h1 { font-family: var(--font-zh); font-size: 27px; line-height: 1.25; margin: 4px 0 2px; }
.lh .s { color: var(--ink-2); font-size: 15px; }
.read { font-size: var(--fs); }
.hook { background: var(--accent-soft); border-radius: 14px; padding: 16px; margin: 0 0 12px; }
.hook .k, .why .k, .take .k { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--accent); margin-bottom: 4px; }
.hook p { margin: 0; font-family: var(--font-zh); font-size: 1.08em; line-height: 1.7; font-weight: 600; }
.why { border-left: 3px solid var(--gold); padding: 2px 0 2px 14px; margin: 16px 2px 22px; color: var(--ink-2); }
.why .k { color: var(--gold); }
.why p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 12px; box-shadow: var(--shadow); }
.card h3 { font-family: var(--font-zh); font-size: 1.1em; margin: 0 0 8px; display: flex; align-items: baseline; }
.card h3 i { font-style: normal; font-family: var(--font-en); color: var(--ink-3); font-size: .9em; }
.card p { margin: 8px 0; line-height: 1.75; }
.ex { margin: 8px 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.ex .en { font-family: var(--font-en); font-size: 1.1em; line-height: 1.45; }
.ex .zh { color: var(--ink-2); font-size: .88em; margin-top: 2px; }
.ex.bad { background: var(--bad-soft); cursor: default; }
.ex.bad .en { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.ex.bad .en::before { content: "✗ "; text-decoration: none; display: inline-block; }
.ex.bad .zh { color: var(--ink); }
.rule { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); font-weight: 600; line-height: 1.7; }
.sec { font-family: var(--font-zh); font-size: 1.15em; margin: 28px 2px 10px; }
.mis { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 10px; }
.mis .en { font-family: var(--font-en); font-size: 1.08em; }
.mis .b { color: var(--bad); } .mis .g { color: var(--ok); margin-top: 4px; }
.mis .w { color: var(--ink-2); font-size: .9em; margin-top: 6px; }

/* 练习 */
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 12px; }
.q .qn { font-size: 12px; color: var(--ink-3); }
.q .qt { font-family: var(--font-en), var(--font-zh); font-size: 1.1em; margin: 4px 0 12px; line-height: 1.5; }
.q .opts { display: grid; grid-gap: 8px; }
.q .opts button { text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font-family: var(--font-en), var(--font-ui); font-size: 1.02em; line-height: 1.4; }
.q .opts button[disabled] { cursor: default; opacity: .75; }
.q .opts button.right { border-color: var(--ok); background: var(--ok-soft); opacity: 1; font-weight: 600; }
.q .opts button.wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.q .exp { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .93em; line-height: 1.7; }
.q .exp b { color: var(--ok); } .q .exp b.no { color: var(--bad); }
.take { background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 18px 16px; margin: 22px 0 14px; }
.take .k { color: inherit; opacity: .8; }
.take p { margin: 0; font-family: var(--font-zh); font-size: 1.08em; line-height: 1.7; font-weight: 600; }
.result { text-align: center; color: var(--ink-2); margin: 6px 0 14px; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 13px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; text-align: center; text-decoration: none; }
.btn.ghost { background: none; border: 1.5px solid var(--line); color: var(--ink); font-weight: 500; }
.btn + .btn { margin-top: 10px; }

/* 一页纸 / 错题 / 我的 */
.pt { font-family: var(--font-zh); font-size: 24px; margin: 6px 0 4px; }
.pd { color: var(--ink-2); font-size: 13.5px; margin: 0 0 16px; }
.mapi { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.mapi .h { display: flex; align-items: baseline; }
.mapi .h i { font-style: normal; font-family: var(--font-en); color: var(--ink-3); }
.mapi .h b { font-size: 15px; }
.mapi p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 8px; margin: 12px 0 20px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stats b { display: block; font-family: var(--font-en); font-size: 24px; line-height: 1.1; }
.stats span { font-size: 12px; color: var(--ink-3); }
.set { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.set .r { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.set .r:first-child { border-top: 0; }
.set .r small { color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 5px 12px; font-size: 13px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.note { color: var(--ink-3); font-size: 12.5px; line-height: 1.7; margin: 16px 2px; }
.vip { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 14px; padding: 18px 16px; margin: 12px 0; }
.vip h3 { margin: 0 0 4px; font-family: var(--font-zh); font-size: 18px; }
.vip .price { font-family: var(--font-en); font-size: 28px; color: var(--gold); margin: 6px 0; }
.vip p { margin: 4px 0; color: var(--ink-2); font-size: 14px; }
@media (min-width: 760px) { #app { padding-top: 28px; } .lh h1 { font-size: 32px; } }

/* 间距不用 flex gap（旧内核不支持），改用子项 margin */
.card h3 i, .mapi .h i { margin-right: 8px; }
.lesson .st { margin-left: 12px; }
.set .r > :first-child { margin-right: 12px; }

/* 小红书：关注 / 分享 */
.social { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.social .k { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.social .btn[disabled] { opacity: .6; }

/* 小红书：没有顶栏的页面，内容从平台按钮下面开始；有顶栏的页面，顶栏和平台按钮同一行、左右让开 */
#app { padding-top: var(--app-top, calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 16px)); }
#app.has-top { padding-top: 16px; }   /* 顶栏自己会让出安全区 */
.xhs .brand { display: block; }
.xhs .brand span { display: block; margin-top: 2px; }
@media (min-width: 760px) { #app { padding-top: var(--app-top, 28px); } #app.has-top { padding-top: 16px; } }

/* 时间轴小图 */
.tl { display: block; width: 100%; max-width: 340px; height: auto; margin: 2px 0 10px; }
.tl .ax { stroke: var(--ink-3); stroke-width: 1.2; }
.tl .axh { fill: var(--ink-3); }
.tl .br { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.tl .dash { stroke: var(--bad); stroke-width: 1.6; stroke-dasharray: 4 3; }
.tl .hot { fill: var(--bad); }
.tl .nw { stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; fill: none; }
.tl text { font-family: var(--font-ui); font-size: 11px; fill: var(--ink-2); }
.tl .vb { font-family: var(--font-en); font-size: 13px; fill: var(--ink); font-weight: 700; }
.tl .nwt { fill: var(--ink-3); font-size: 10px; }

/* ---------- 账号、开通（网站版） ---------- */
.inp { display: block; width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 10px; background: var(--card, transparent); color: var(--ink); font-size: 16px; }
.inp:focus { outline: none; border-color: var(--accent); }
.acc, .claim { margin: 12px 0; }
.accseg { display: flex; margin: 0 0 12px; }
.accseg button { flex: 1; padding: 9px 0; font-size: 14px; }
.coderow { display: flex; }
.coderow .inp { flex: 1; min-width: 0; margin-right: 10px; }
.coderow .btn { width: auto; white-space: nowrap; padding: 0 14px; margin: 0 0 10px; font-size: 14px; }
.btn[disabled] { opacity: .55; }
.accmsg { margin: 12px 0 0; color: var(--gold); font-size: 14px; }
.claim h3 { margin: 18px 0 6px; font-family: var(--font-zh); font-size: 17px; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.vip .price s { font-size: 15px; color: var(--ink-3); margin-left: 10px; }
.empty .btn { margin-top: 16px; }
