* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100dvh; overflow: hidden; }
body {
    font-family: "STKaiti", "KaiTi", "Noto Serif SC", serif;
    display: flex; justify-content: center; height: 100dvh; overflow: hidden; color: #3d3226;
    background:
      radial-gradient(ellipse at 50% 120%, rgba(143,43,33,.07), transparent 55%),
      linear-gradient(180deg, #f2ead8 0%, #eae0c8 100%);
}
#app { width: 100%; max-width: 520px; position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#seal { display: none; }

h1, h2, h3 { font-family: "STKaiti", "KaiTi", serif; letter-spacing: 3px; color: #8f2b21; font-weight: 400; text-align: center; }
h1 { font-size: 28px; margin-top: 10px; margin-bottom: 20px; }
h2 { font-size: 23px; margin-bottom: 15px; }
h3 { font-size: 18px; margin-top: 10px; }

.level-subtitle { font-size: 13px; color: #9c8b70; letter-spacing: 1px; text-align: center; margin-bottom: 15px; margin-top: -10px; }

.btn {
    width: 100%; min-height: 52px; margin-top: 10px; border: none; border-radius: 10px;
    font-family: inherit; font-size: 16px; font-weight: 700; color: #3d3226;
    background: linear-gradient(#ffffff, #fdf8ec);
    box-shadow: 0 3px 0 rgba(120,90,50,.22), inset 0 0 0 1.5px rgba(120,90,50,.22);
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(120,90,50,.22) !important; }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.alt { background: linear-gradient(#fdeec4, #f7dfa0); color: #8f2b21; box-shadow: inset 0 0 0 1.5px rgba(178,58,46,.45), 0 3px 0 rgba(120,90,50,.2); }
.btn.ghost { background: rgba(255,253,247,.92); color: #3d3226; box-shadow: inset 0 0 0 1.5px rgba(120,90,50,.25), 0 3px 0 rgba(120,90,50,.18); }

.card {
    margin-top: 8px; padding: 18px 16px; border-radius: 12px; position: relative;
    background: linear-gradient(#fffdf7, #f7f1e2); box-shadow: 0 3px 0 rgba(120,90,50,.18), inset 0 0 0 1px rgba(120,90,50,.16);
}
.card.selected { background: linear-gradient(#fdeec4, #f7dfa0); box-shadow: 0 3px 0 rgba(178,58,46,.32), inset 0 0 0 1.6px rgba(178,58,46,.4); color: #8f2b21; }
.card.error { background: #fbeeea; box-shadow: inset 0 0 0 1.5px #c2574a, 0 3px 0 rgba(178,58,46,.32); }

.hud { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #6b5a3e; font-weight: 600; gap: 8px; }
.hud b { color: #b23a2e; font-size: 18px; }
.hud.light-hud { opacity: 0.8; font-weight: normal; }
.txt-back { background:none; border:none; font-family:inherit; font-size:15px; color:#8f2b21; font-weight:700; padding:12px 10px; min-height:44px; cursor:pointer; }
.txt-back:active { opacity:.55; }

/* 刷题模式进度条 */
.bar { display: flex; gap: 4px; margin: 8px 0 14px; }
.bar i { flex: 1; height: 7px; border-radius: 4px; background: rgba(120,90,50,.16); }
.bar i.ok { background: linear-gradient(#8fbf6a, #6d9b48); }
.bar i.no { background: linear-gradient(#e08d80, #c2574a); }
.bar i.now { background: #fdeec4; box-shadow: inset 0 0 0 1.5px #b23a2e; }

.tip {
    margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.55; min-height: 42px;
    background: #fbeeea; border-left: 5px solid #a8331f; color: #8f2b21;
}

.section { margin-bottom: 20px; }
.board { display: none; flex-direction: column; height: 100%; overflow: hidden; padding: 14px 14px 22px; }
.board.active { display: flex; }
#view-home { padding: 0; }
.board-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#view-home .board-scroll, .scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 8px; }

/* 页眉：像册子封面题签 */
.cover { padding: 18px 20px 10px; display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid rgba(143,43,33,.28); flex: none; }
.cover .lt .t1 { font-size: 26px; font-weight: bold; color: #8f2b21; letter-spacing: 4px; line-height: 1.1; }
.cover .lt .t2 { font-size: 11px; color: #9c8b70; margin-top: 6px; letter-spacing: 3px; }
.cover .rt { text-align: right; font-size: 11px; color: #5d5039; line-height: 1.8; }
.cover .rt b { font-size: 17px; color: #b23a2e; letter-spacing: 1px; font-weight: bold; }

.grp { font-size: 12px; color: #9c8b70; letter-spacing: 3px; margin: 6px 4px 8px; display: flex; align-items: center; gap: 8px; }
.grp::after { content: ""; flex: 1; border-top: 1px dashed rgba(120,90,50,.3); }

/* 签条行：竖排签头 + 横排信息，整行可点 */
.tab { display: flex; align-items: stretch; background: rgba(255,253,247,.9); border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(120,90,50,.18), 0 3px 0 rgba(120,90,50,.14); margin-bottom: 9px; min-height: 56px; overflow: hidden; cursor: pointer; transition: transform .07s; }
.tab:active { transform: translateY(2px); }
.tab .head { flex: none; width: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(120,90,50,.07); border-right: 1px dashed rgba(120,90,50,.25); }
.tab .head .no { writing-mode: vertical-rl; font-size: 15px; font-weight: bold; color: #5d5039; letter-spacing: 2px; }
.tab .body { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; }
.tab .name { font-size: 16px; font-weight: bold; color: #3d3226; letter-spacing: 1px; }
.tab .sub { font-size: 11px; color: #9c8b70; margin-top: 4px; }
.tab .pctl { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.tab .pctl .bar { display: block; gap: 0; margin: 0; flex: 1; max-width: 140px; height: 5px; border-radius: 3px; background: rgba(120,90,50,.14); overflow: hidden; }
.tab .pctl .bar i { display: block; flex: none; height: 100%; background: #8f2b21; border-radius: 3px; }
.tab .pctl span { font-size: 10px; color: #9c8b70; }
.tab .ring { flex: none; width: 52px; display: flex; align-items: center; justify-content: center; }
.ring circle { fill: none; stroke-width: 4; }
.ring .bgc { stroke: rgba(120,90,50,.15); }
.ring .fgc { stroke: #8f2b21; stroke-linecap: round; }
.ring text { font-size: 9px; fill: #8f2b21; font-family: inherit; }

.tab.kou { background: linear-gradient(90deg, rgba(255,253,247,.95), rgba(178,58,46,.08)); }
.tab.kou .head { background: rgba(143,43,33,.9); }
.tab.kou .head .no { color: #fffdf7; }

/* 页脚 */
.foot { flex: none; padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; margin-top: 0; min-height: 48px; font-size: 15px; letter-spacing: 2px; }
.titlerow { display: flex; align-items: center; gap: 10px; }
#acct-slot { display: flex; align-items: center; }
#acct-slot .acct-chip { min-height: 44px; padding: 6px 12px; font-size: 13px; letter-spacing: 1px; color: #5d5039; background: transparent; border: none; box-shadow: none; border-radius: 8px; }
#acct-slot .acct-chip:not(.anon)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #6d9b48; display: inline-block; margin-right: 7px; vertical-align: 1px; }
#acct-slot .acct-chip:active { background: rgba(120,90,50,.08); }
#acct-slot .acct-chip.anon { color: rgba(143,43,33,.85); }

.pline { height: 6px; border-radius: 3px; background: rgba(120,90,50,.12); overflow: hidden; margin-top: 8px; }
.pline i { display: block; height: 100%; background: #8f2b21; border-radius: 3px; width: 0%; transition: width .2s; }
.gtoast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #3d3226; color: #f6efe1; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 99; max-width: 80vw; }

.stat-card { background: #fffdf7; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: inset 0 0 0 1px rgba(120,90,50,.16); }
.stat-card-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; font-weight: bold; }
.stat-bar-bg { width: 100%; background: rgba(120,90,50,.1); height: 8px; border-radius: 4px; overflow: hidden; position: relative; margin-top: 5px; }
.stat-bar-fg { height: 100%; background: #6d9b48; }
.stat-bar-fg.error-bar { background: #b23a2e; }

.modal {
    width: 100%; max-width: 380px; margin: 0 auto; padding: 20px 16px; border-radius: 12px; text-align: center;
    background: radial-gradient(circle at 20% 8%, #fffdf7, transparent 60%), linear-gradient(#fdfaf1, #f6efdd);
    box-shadow: 0 4px 0 rgba(120,90,50,.28), inset 0 0 0 2px rgba(178,58,46,.32);
    display: flex; flex-direction: column; gap: 10px;
}
.back { margin-top: 20px; }

#question-text { font-family: "STKaiti", "KaiTi", serif; font-size: 22px; line-height: 1.4; margin-bottom: 15px; }
#options-area div { min-height: 44px; display: flex; align-items: center; padding: 10px 14px; font-size: 16px; margin-bottom: 10px; border-radius: 8px; border: 1px solid rgba(120,90,50,.2); background: #fffdf7; cursor: pointer; transition: 0.2s; }
#options-area div:active { background: #f4ecda; }
#options-area div[data-state="selected"] { border-color: #8f2b21; background: #fdeec4; font-weight: bold; color: #8f2b21; }
#options-area div[data-state="correct"] { border-color: #4c7a2f; background: #eef7e6; color: #3f6b2a; }
#options-area div[data-state="wrong"] { border-color: #c2574a; background: #fbeeea; color: #a83c2e; }
span[data-role="tag"] { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #fdeec4; color: #8f2b21; margin-right: 8px; }
.tag-outline { display: inline-block; padding: 1px 4px; border: 1px solid var(--cinnabar, #8f2b21); border-radius: 2px; font-size: 11px; line-height: 1.2; font-family: "STKaiti", "KaiTi", serif; color: var(--cinnabar, #8f2b21); background: transparent; vertical-align: middle; }
.muted { font-size: 11px; color: #9c8b70; }

.star-on { color: #e0a72b; }
.burst { font-size: 30px; margin: 10px 0; color: #e0a72b; letter-spacing: 5px; }

@media (max-width: 340px) {
    .cover { padding: 12px 14px 8px; }
    .cover .lt .t1 { font-size: 22px; letter-spacing: 2px; }
    .cover .lt .t2 { font-size: 10px; letter-spacing: 1px; margin-top: 4px; }
    .cover .rt { font-size: 10px; line-height: 1.6; }
    .cover .rt b { font-size: 15px; }
    #view-home .board-scroll, .scroll { padding: 10px 12px 6px; }
    .tab .head { width: 44px; }
    .tab .head .no { font-size: 14px; }
    .tab .body { padding: 8px 10px; }
    .tab .name { font-size: 15px; }
    .tab .ring { width: 44px; }
    .foot { padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
    .btnrow .btn { min-height: 44px; font-size: 14px; }
    #question-text { font-size: 20px; }
    #options-area div { font-size: 15px; padding: 8px 12px; }
}
