* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #1a7a6e;
  --primary-dark: #12584f;
  --primary-light: #e6f2ef;
  --gold: #c8953f;
  --bg: #f4f2ed;
  --card: #ffffff;
  --text: #26332c;
  --text2: #7c8a80;
  --border: #ecebe5;
  --correct: #2e9e6b;
  --wrong: #d9534f;
  --shadow: 0 6px 22px rgba(26,122,110,.08);
  --page: #d9dde0;
  --soft: #f7f9f8;
  --note: #fffaf0;
  --note-border: #f0d99a;
}
/* 背景预设（浅色下可选，深色时自动失效） */
html[data-bg="green"]:not([data-theme="dark"]) { --bg: #e3efdd; --page: #cfdfc7; }
html[data-bg="blue"]:not([data-theme="dark"]) { --bg: #e0ecf7; --page: #cbdcee; }
html[data-bg="warm"]:not([data-theme="dark"]) { --bg: #f8eed6; --page: #e9d9ba; }
html[data-bg="gray"]:not([data-theme="dark"]) { --bg: #eaedef; --page: #d5dbde; }
/* 跟随系统深色 */
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --primary: #3cc0ac;
    --primary-dark: #2a9c8c;
    --primary-light: #1b3733;
    --gold: #e0b163;
    --bg: #121614;
    --card: #1b2220;
    --text: #e8eeea;
    --text2: #94a39b;
    --border: #2b342f;
    --correct: #45c98a;
    --wrong: #ec6f6a;
    --shadow: 0 6px 22px rgba(0,0,0,.45);
    --page: #0b0e0d;
    --soft: #202926;
    --note: #2a2620;
    --note-border: #5a4a2a;
  }
}
/* 手动深色 */
html[data-theme="dark"] {
  --primary: #3cc0ac;
  --primary-dark: #2a9c8c;
  --primary-light: #1b3733;
  --gold: #e0b163;
  --bg: #121614;
  --card: #1b2220;
  --text: #e8eeea;
  --text2: #94a39b;
  --border: #2b342f;
  --correct: #45c98a;
  --wrong: #ec6f6a;
  --shadow: 0 6px 22px rgba(0,0,0,.45);
  --page: #0b0e0d;
  --soft: #202926;
  --note: #2a2620;
  --note-border: #5a4a2a;
}
/* 手动浅色（覆盖系统深色） */
html[data-theme="light"] {
  --primary: #1a7a6e; --primary-dark: #12584f; --primary-light: #e6f2ef;
  --gold: #c8953f; --bg: #f4f2ed; --card: #ffffff; --text: #26332c;
  --text2: #7c8a80; --border: #ecebe5; --correct: #2e9e6b; --wrong: #d9534f;
  --shadow: 0 6px 22px rgba(26,122,110,.08); --page: #d9dde0;
  --soft: #f7f9f8; --note: #fffaf0; --note-border: #f0d99a;
}
/* 深色下的细节覆盖 */
html[data-theme="dark"] .hero { box-shadow: 0 8px 30px rgba(0,0,0,.5); }
html[data-theme="dark"] .analysis { color: #e6e2d6; }
html[data-theme="dark"] .resume-card { background: linear-gradient(135deg,#33291a,#2a2216); border-color: #5a4a2a; }
html[data-theme="dark"] .chip { background: var(--card); }
html[data-theme="dark"] .chapter .info .bar { background: #2b342f; }
html[data-theme="dark"] .quick .item .ic { filter: brightness(.82) saturate(.85); }
html[data-theme="dark"] input, html[data-theme="dark"] textarea { color: var(--text); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .analysis { color: #e6e2d6; }
  html:not([data-theme="light"]) .resume-card { background: linear-gradient(135deg,#33291a,#2a2216); border-color: #5a4a2a; }
  html:not([data-theme="light"]) .chip { background: var(--card); }
  html:not([data-theme="light"]) .chapter .info .bar { background: #2b342f; }
  html:not([data-theme="light"]) .quick .item .ic { filter: brightness(.82) saturate(.85); }
  html:not([data-theme="light"]) input, html:not([data-theme="light"]) textarea { color: var(--text); }
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page);
  display: flex; justify-content: center; align-items: center;
  color: var(--text);
}
#phone {
  width: 100%; max-width: 430px; height: 100vh; max-height: 932px;
  background-color: var(--bg); background-size: cover; background-position: center; background-repeat: no-repeat;
  position: relative; display: flex; flex-direction: column;
  box-shadow: 0 0 50px rgba(0,0,0,.15); overflow: hidden;
}
/* 顶部导航 */
.navbar {
  height: 88px; flex: none; padding: 38px 16px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; display: flex; align-items: center; gap: 12px; position: relative; z-index: 10;
}
.navbar .back { font-size: 22px; width: 28px; cursor: pointer; }
.navbar .title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; margin-right: 28px; }
.navbar.plain { background: var(--card); color: var(--text); border-bottom: 1px solid var(--border); }
/* 内容区 */
.page { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 70px; }
.page.no-tab { padding-bottom: 20px; }
.page::-webkit-scrollbar { display: none; }
/* 底部导航 */
.tabbar {
  height: 62px; flex: none; background: var(--card); border-top: 1px solid var(--border);
  display: flex; position: absolute; bottom: 0; left: 0; right: 0; z-index: 20;
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text2); font-size: 11px; cursor: pointer; }
.tabbar .tab .ic { font-size: 21px; line-height: 1; }
.tabbar .tab.active { color: var(--primary); font-weight: 600; }
/* 首页头部 */
.hero {
  margin: 16px; padding: 22px 20px; border-radius: 18px; color: #fff;
  background: linear-gradient(135deg, #1a7a6e 0%, #0f5a50 100%); position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; }
.hero::before { content: ''; position: absolute; right: 10px; bottom: -50px; width: 120px; height: 120px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.hero .tag { display: inline-block; font-size: 11px; padding: 3px 10px; background: rgba(255,255,255,.18); border-radius: 20px; margin-bottom: 12px; }
.hero h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.hero p { font-size: 12.5px; opacity: .85; line-height: 1.7; }
.hero .meta { display: flex; gap: 18px; margin-top: 16px; font-size: 12px; opacity: .9; }
/* 统计卡 */
.stats { display: flex; gap: 10px; margin: 0 16px 16px; }
.stat { flex: 1; background: var(--card); border-radius: 14px; padding: 16px 8px; text-align: center; box-shadow: var(--shadow); }
.stat .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 11px; color: var(--text2); margin-top: 4px; }
/* 区块标题 */
.section-title { font-size: 15px; font-weight: 700; margin: 18px 16px 12px; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 3px rgba(255,255,255,.7); }
.section-title::before { content: ''; width: 4px; height: 16px; background: var(--primary); border-radius: 2px; }
.section-title .more { margin-left: auto; font-size: 12px; color: var(--text2); font-weight: 400; }
/* 功能入口 */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 16px; }
.quick .item { background: var(--card); border-radius: 14px; padding: 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); cursor: pointer; }
.quick .item .ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.quick .item .t { font-size: 13.5px; font-weight: 600; }
.quick .item .s { font-size: 11px; color: var(--text2); margin-top: 3px; }
/* 章节列表 */
.chapters { margin: 0 16px; }
/* 章节分组标题 */
.chap-group { display: flex; align-items: center; gap: 6px; padding: 14px 4px 8px; flex-wrap: wrap; }
.chap-group:first-child { padding-top: 4px; }
.chap-group .cg-ic { font-size: 15px; }
.chap-group .cg-name { font-size: 13.5px; font-weight: 700; color: var(--primary); letter-spacing: .3px; }
.chap-group .cg-tip { font-size: 11px; color: #a9b2b0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chap-group .cg-cnt { font-size: 11px; color: #b6bfbd; flex: none; }
.chapter { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); cursor: pointer; }
.chapter .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none; }
.chapter .info { flex: 1; min-width: 0; }
.chapter .info .name { font-size: 14px; font-weight: 600; }
.chapter .info .desc { font-size: 11.5px; color: var(--text2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter .info .bar { height: 4px; background: #eee; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.chapter .info .bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.chapter .cnt { font-size: 11px; color: var(--text2); text-align: right; flex: none; }
.chapter .cnt b { color: var(--primary); font-size: 13px; }
/* 答题页 */
.quiz-head { padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.quiz-head .prog { flex: 1; height: 6px; background: #e6e6e0; border-radius: 4px; overflow: hidden; }
.quiz-head .prog i { display: block; height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.quiz-head .num { font-size: 13px; font-weight: 600; color: var(--primary); }
.quiz-head .timer { font-size: 13px; color: var(--gold); font-weight: 600; }
.qcard { background: var(--card); border-radius: 16px; margin: 0 16px; padding: 20px; box-shadow: var(--shadow); }
.qtype { display: inline-block; font-size: 11px; padding: 3px 10px; background: var(--primary-light); color: var(--primary); border-radius: 6px; margin-bottom: 14px; font-weight: 600; }
.group-stem { background: var(--soft); border-left: 3px solid var(--primary); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; line-height: 1.7; color: var(--text2); }
.group-stem .gs-label { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 6px; letter-spacing: .5px; }
.qstem { font-size: 15.5px; line-height: 1.75; font-weight: 500; margin-bottom: 20px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1.5px solid var(--border); border-radius: 12px; font-size: 14px; line-height: 1.6; cursor: pointer; transition: all .2s; }
.opt .key { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #ccd3cd; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text2); flex: none; }
.opt.selected { border-color: var(--primary); background: var(--primary-light); }
.opt.selected .key { background: var(--primary); color: #fff; border-color: var(--primary); }
.opt.correct { border-color: var(--correct); background: #eaf7f0; }
.opt.correct .key { background: var(--correct); color: #fff; border-color: var(--correct); }
.opt.wrong { border-color: var(--wrong); background: #fdecec; }
.opt.wrong .key { background: var(--wrong); color: #fff; border-color: var(--wrong); }
.analysis { margin: 16px; padding: 16px; background: var(--note); border-left: 4px solid var(--gold); border-radius: 8px; font-size: 13px; line-height: 1.8; }
.analysis .h { font-weight: 700; color: var(--gold); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.analysis .ans { color: var(--correct); font-weight: 700; }
.qnav { display: flex; gap: 10px; margin: 16px; }
.qnav button { flex: 1; padding: 14px; border: none; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--card); color: var(--primary); border: 1.5px solid var(--primary) !important; }
.btn-gold { background: var(--gold); color: #fff; }
/* 滑动翻页提示与动画 */
.swipe-tip { text-align: center; font-size: 11px; color: #999; margin: -6px 0 6px; letter-spacing: 1px; }
.disclaimer-tip { text-align: center; font-size: 10.5px; color: #b5862f; margin: 0 16px 18px; line-height: 1.6; background: rgba(255,255,255,.78); border-radius: 10px; padding: 6px 10px; }
html[data-theme="dark"] .disclaimer-tip { background: rgba(0,0,0,.4); color: #d9a75a; }
html[data-theme="dark"] .swipe-tip { color: #7e8b84; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
.qcard.slide-from-right { animation: slideInRight .22s ease-out; }
.qcard.slide-from-left { animation: slideInLeft .22s ease-out; }
/* 列表通用 */
.list-card { background: var(--card); border-radius: 14px; margin: 12px 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.empty { text-align: center; color: var(--text2); padding: 70px 20px; font-size: 14px; }
.empty .ic { font-size: 56px; display: block; margin-bottom: 16px; opacity: .4; }
/* 结果页 */
.result-hero { text-align: center; padding: 36px 20px 24px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; border-radius: 0 0 28px 28px; }
.result-hero .score { font-size: 52px; font-weight: 800; }
.result-hero .lbl { font-size: 13px; opacity: .85; margin-top: 4px; }
.result-hero .cmt { margin-top: 14px; font-size: 14px; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 20px 16px; }
.result-grid .g { background: var(--card); border-radius: 12px; padding: 14px 8px; text-align: center; box-shadow: var(--shadow); }
.result-grid .g .n { font-size: 20px; font-weight: 700; }
.result-grid .g .l { font-size: 11px; color: var(--text2); margin-top: 2px; }
/* 我的 */
.me-head { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); padding: 40px 20px 50px; color: #fff; display: flex; align-items: center; gap: 14px; }
.me-head .avatar { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 28px; border: 2px solid rgba(255,255,255,.4); }
.me-head .nm { font-size: 18px; font-weight: 700; }
.me-head .role { font-size: 12px; opacity: .85; margin-top: 5px; }
.me-stats { display: flex; background: var(--card); margin: -24px 16px 0; border-radius: 14px; padding: 18px 0; box-shadow: var(--shadow); position: relative; }
.me-stats .s { flex: 1; text-align: center; }
.me-stats .s .n { font-size: 20px; font-weight: 700; color: var(--primary); }
.me-stats .s .l { font-size: 11px; color: var(--text2); margin-top: 3px; }
.me-menu { margin: 16px; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.me-menu .row { padding: 15px 16px; display: flex; align-items: center; gap: 12px; font-size: 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.me-menu .row:last-child { border-bottom: none; }
.me-menu .row .ic { font-size: 18px; }
.me-menu .row .arrow { margin-left: auto; color: var(--text2); }
/* 类型标签色 */
.t-A1,.t-A2 { background: var(--primary-light); color: var(--primary); }
.t-X { background: #fff3e0; color: #c8953f; }
.t-Judge { background: #f0eafa; color: #7c5cbf; }
/* 提示 */
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 13px; z-index: 100; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }
/* 筛选 chips */
.chips { display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 18px; font-size: 12px; background: var(--card); border: 1px solid var(--border); cursor: pointer; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* 答题卡 */
.card-grid { display: grid; grid-template-columns: repeat(6,1fr); gap: 10px; margin: 16px; }
.card-grid .c { aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: var(--card); border: 1.5px solid var(--border); cursor: pointer; }
.card-grid .c.done { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.card-grid .c.cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.card-grid .c.mark { border-color: var(--gold); }
/* 接着上次做题卡片 */
.resume-card { display: flex; align-items: center; gap: 12px; margin: 16px 16px 4px; padding: 14px 16px; background: linear-gradient(135deg,#fff8e8,#fff3da); border: 1.5px solid #f0d99a; border-radius: 14px; cursor: pointer; }
.resume-card .resume-ic { width: 42px; height: 42px; border-radius: 12px; background: #f5dfa0; display: flex; align-items: center; justify-content: center; font-size: 21px; flex: none; }
.resume-card .resume-info { flex: 1; min-width: 0; }
.resume-card .resume-info .t { font-size: 14px; font-weight: 700; color: #8a6a1f; }
.resume-card .resume-info .s { font-size: 11.5px; color: #a8893a; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume-card .resume-btn { font-size: 12px; color: #fff; background: var(--gold); padding: 6px 12px; border-radius: 14px; flex: none; }
/* 自建题库 */
.custom-item { display: flex; align-items: flex-start; gap: 10px; }
.custom-form label { display: block; font-size: 13px; color: var(--text2); margin: 14px 0 7px; }
.custom-form input[type=text], .custom-form textarea { width: 100%; padding: 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; background: var(--card); font-family: inherit; }
.custom-form textarea { min-height: 76px; resize: vertical; line-height: 1.6; }
.opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.opt-row .ok { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; flex: none; background: var(--card); }
.opt-row .ok.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.opt-row input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 14px; min-width: 0; }
.opt-row .del { color: var(--wrong); font-size: 18px; cursor: pointer; padding: 0 4px; flex: none; }
.btn-add { width: 100%; padding: 11px; border: 1.5px dashed var(--primary); color: var(--primary); background: var(--primary-light); border-radius: 10px; font-size: 13px; cursor: pointer; margin-top: 4px; }
/* 外观与背景设置 */
.bg-grid { display: flex; gap: 10px; padding: 0 16px; flex-wrap: wrap; }
.bg-swatch { width: 64px; text-align: center; cursor: pointer; }
.bg-swatch .sw { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto; border: 2px solid var(--border); box-shadow: var(--shadow); }
.bg-swatch .sw.img { background-size: cover; background-position: center; }
.bg-swatch.on .sw { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.bg-swatch .sw-t { font-size: 11.5px; color: var(--text2); margin-top: 6px; }
.bg-swatch.on .sw-t { color: var(--primary); font-weight: 600; }
.bg-tip { padding: 6px 18px 2px; font-size: 11.5px; line-height: 1.6; color: var(--text2); }
.bg-tip, .bg-swatch .sw-t { text-shadow: 0 1px 3px rgba(255,255,255,.95), 0 0 1px rgba(255,255,255,.9); }
html[data-theme="dark"] .bg-tip, html[data-theme="dark"] .bg-swatch .sw-t { text-shadow: 0 1px 3px rgba(0,0,0,.9); }
.bg-btns { display: flex; gap: 10px; padding: 0 16px; margin: 4px 0 12px; }
.bg-btns .btn-primary, .bg-btns .btn-ghost { flex: 1; padding: 12px; border-radius: 12px; font-size: 14px; cursor: pointer; border: none; }
.bg-btns .btn-ghost { background: var(--card); color: var(--text2); border: 1.5px solid var(--border); }
.bg-preview { margin: 0 16px 8px; height: 130px; border-radius: 14px; background-size: cover; background-position: center; border: 1px solid var(--border); }
html[data-theme="dark"] .section-title { text-shadow: 0 1px 3px rgba(0,0,0,.8); }
