/* ========================================
   芸隐轩-语法社 用户端 - 软木板心情板主题
   ======================================== */

/* ---- 设计令牌 ---- */
:root {
    --bg-primary: #c9986a;
    --bg-dark: #a87b4f;
    --bg-light: #d4b084;
    --card-bg: #faf8f3;
    --card-bg-2: #fffdf7;
    --card-shadow: 3px 4px 14px rgba(0,0,0,0.18);
    --card-shadow-lg: 5px 7px 22px rgba(0,0,0,0.22);
    --card-shadow-sm: 2px 3px 8px rgba(0,0,0,0.12);
    --ink-primary: #2d2d2d;
    --ink-light: #4a4a4a;
    --note-bg: #fef3a8;
    --note-text: #4a4a4a;
    --pin-red: #e74c3c;
    --pin-green: #2ecc71;
    --pin-blue: #3498db;
    --pin-yellow: #f1c40f;
    --tape: rgba(254,243,168,0.78);
    --success: #27ae60;
    --error: #c0392b;
    --skip: #f39c12;
    --font-hand: 'Caveat', 'Kalam', cursive;
    --font-body: 'Kalam', 'Caveat', -apple-system, BlinkMacSystemFont, cursive;
}

/* ---- 全局 reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%;
    font-family: var(--font-body);
    color: var(--ink-primary);
    background-color: var(--bg-primary);
    /* 软木板纹理：SVG 噪点 + 多层软木孔隙 + 细微纤维，营造真实软木质感 */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.07'/%3E%3C/svg%3E"),
        radial-gradient(circle at 15% 25%, rgba(255,255,255,0.10) 0, rgba(255,255,255,0) 3px),
        radial-gradient(circle at 75% 65%, rgba(0,0,0,0.08) 0, rgba(0,0,0,0) 3px),
        radial-gradient(circle at 45% 85%, rgba(139,90,43,0.16) 0, rgba(139,90,43,0) 4px),
        radial-gradient(circle at 85% 15%, rgba(255,255,255,0.07) 0, rgba(255,255,255,0) 2.5px),
        radial-gradient(circle at 10% 75%, rgba(0,0,0,0.07) 0, rgba(0,0,0,0) 2.5px),
        radial-gradient(circle at 60% 10%, rgba(101,67,33,0.10) 0, rgba(101,67,33,0) 4px),
        radial-gradient(circle at 30% 55%, rgba(255,255,255,0.06) 0, rgba(255,255,255,0) 2px),
        repeating-linear-gradient(90deg, rgba(101,67,33,0.03) 0px, rgba(101,67,33,0.03) 1px, transparent 1px, transparent 6px),
        repeating-linear-gradient(0deg, rgba(101,67,33,0.03) 0px, rgba(101,67,33,0.03) 1px, transparent 1px, transparent 8px),
        linear-gradient(135deg, rgba(0,0,0,0.04) 0%, rgba(255,255,255,0.04) 50%, rgba(0,0,0,0.04) 100%);
    background-size: 200px 200px, 110px 110px, 90px 90px, 140px 140px, 100px 100px, 80px 80px, 130px 130px, 70px 70px, 12px 12px, 14px 14px, 100% 100%;
    -webkit-font-smoothing: antialiased;
}

/* ---- 通用组件 ---- */

/* 白纸卡：带图钉与轻微旋转 */
.paper-card {
    position: relative;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 18px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.paper-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.55), rgba(0,0,0,0.15));
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
    z-index: 2;
}
.paper-card.pin-red::before { background-color: var(--pin-red); }
.paper-card.pin-green::before { background-color: var(--pin-green); }
.paper-card.pin-blue::before { background-color: var(--pin-blue); }
.paper-card.pin-yellow::before { background-color: var(--pin-yellow); }

/* 便利贴：黄色便签，带胶带 */
.sticky-note {
    position: relative;
    background: var(--note-bg);
    color: var(--note-text);
    border-radius: 4px 12px 4px 12px;
    padding: 16px;
    box-shadow: 2px 3px 10px rgba(0,0,0,0.14);
    font-family: var(--font-hand);
    transition: transform 0.15s, box-shadow 0.15s;
}
.sticky-note::before {
    /* 胶带 */
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    width: 52px;
    height: 18px;
    background: var(--tape);
    border-left: 1px dashed rgba(0,0,0,0.08);
    border-right: 1px dashed rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    z-index: 2;
}

/* 胶带装饰 */
.tape {
    position: relative;
}
.tape::after {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 52px;
    height: 18px;
    background: var(--tape);
    border-left: 1px dashed rgba(0,0,0,0.08);
    border-right: 1px dashed rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    z-index: 2;
}

/* 轻微旋转 */
.tilt-left { transform: rotate(-1.5deg); }
.tilt-right { transform: rotate(1.5deg); }
.tilt-left-sm { transform: rotate(-0.8deg); }
.tilt-right-sm { transform: rotate(0.8deg); }

/* 手绘按钮：通用 sketch button */
.btn-sketch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 22px;
    border: 2px solid var(--ink-primary);
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    background: var(--card-bg);
    color: var(--ink-primary);
    font-family: var(--font-hand);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.btn-sketch:active { transform: translateY(2px) scale(0.98); box-shadow: 1px 1px 0 rgba(0,0,0,0.12); }
.btn-sketch.primary { background: var(--note-bg); border-color: #e8d56a; }
.btn-sketch.success { background: #d4edda; border-color: var(--success); color: #1e5631; }

/* 便利贴按钮 */
.btn-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 22px;
    border: none;
    border-radius: 4px 12px 4px 12px;
    background: var(--note-bg);
    color: var(--note-text);
    font-family: var(--font-hand);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, box-shadow 0.12s;
    position: relative;
}
.btn-note:active { transform: translateY(2px) rotate(0deg) scale(0.98); box-shadow: 1px 1px 0 rgba(0,0,0,0.12); }
.btn-note.tilt-left { transform: rotate(-1.5deg); }
.btn-note.tilt-right { transform: rotate(1.5deg); }

/* 手绘输入框 */
.input-sketch {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--ink-primary);
    border-radius: 8px;
    font-size: 17px;
    font-family: var(--font-body);
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-sketch:focus { outline: none; border-color: var(--pin-blue); box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 0 0 3px rgba(52,152,219,0.12); }

/* 软木进度条 */
.cork-progress {
    width: 100%;
    height: 14px;
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.25);
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.12);
}
.cork-progress .progress-fill {
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(
        45deg,
        var(--success),
        var(--success) 8px,
        #2ecc71 8px,
        #2ecc71 16px
    );
    border-radius: 6px;
    transition: width 0.35s ease;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}

/* ---- 页面容器 ---- */
.page-board {
    min-height: 100vh;
    max-width: 460px;
    margin: 0 auto;
    padding: 0 14px 32px;
}

/* ---- 通用头部（便签条风格） ---- */
.board-header {
    position: relative;
    padding: 18px 16px;
    display: flex;
    align-items: center;
    margin: 0 -14px 18px;
}
.board-header h1 {
    flex: 1;
    text-align: center;
    font-family: var(--font-hand);
    font-size: 26px;
    font-weight: 700;
    color: var(--card-bg);
    text-shadow: 1px 2px 3px rgba(0,0,0,0.25);
}
.board-back {
    background: var(--card-bg);
    border: 2px solid var(--ink-primary);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 20px;
    color: var(--ink-primary);
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-hand);
    font-weight: 700;
    transition: transform 0.12s, background 0.15s;
}
.board-back:active { transform: scale(0.9); }

/* ---- Cover Page ---- */
.cover-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
}
.cover-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    text-align: center;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}
.logo {
    position: relative;
    margin-bottom: 20px;
}
.logo::after {
    /* 胶带效果，与 encouragement 一致 */
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 46px;
    height: 16px;
    background: var(--tape);
    border-left: 1px dashed rgba(0,0,0,0.08);
    border-right: 1px dashed rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    z-index: 2;
}
.logo-icon {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: block;
    margin: 0 auto;
    box-shadow: var(--card-shadow-lg);
    border: 4px solid var(--card-bg);
    background: var(--card-bg);
    object-fit: contain;
    padding: 8px;
    z-index: 1;
}
.title {
    font-family: var(--font-hand);
    font-size: 34px;
    font-weight: 700;
    color: var(--card-bg);
    text-shadow: 2px 3px 5px rgba(0,0,0,0.3);
    margin-bottom: 6px;
    transform: rotate(-1deg);
    letter-spacing: 0.5px;
}
.subtitle {
    font-family: var(--font-body);
    font-size: 16px;
    color: rgba(255,255,255,0.95);
    margin-bottom: 28px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}
.tip {
    margin-top: 18px;
    font-size: 15px;
    color: rgba(255,255,255,0.95);
    font-family: var(--font-hand);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}
.disclaimer {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    font-family: var(--font-body);
}

/* ---- Site Footer (ICP / 投诉公示) ---- */
.site-footer {
    text-align: center;
    padding: 18px 14px 24px;
    font-size: 12px;
    color: rgba(255,255,255,0.88);
    line-height: 1.8;
    font-family: var(--font-body);
}
.site-footer a {
    color: rgba(255,255,255,0.95);
    text-decoration: underline;
}
.site-footer a:hover { color: #fff; }

/* 首页与个人中心：把 footer 放在页面底部，不额外增加滚动条 */
.cover-page .site-footer { margin-top: auto; width: 100%; }
.profile-page { display: flex; flex-direction: column; }
.profile-page .site-footer { margin-top: auto; }

/* Home Menu */
.home-menu { display: flex; flex-direction: column; gap: 14px; }
.home-menu-row { display: flex; gap: 14px; }
.home-menu-card {
    flex: 1;
    border: none;
    padding: 24px 10px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-family: var(--font-hand);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}
.home-menu-card::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15));
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
    z-index: 2;
}
.home-menu-card:active { transform: scale(0.96) rotate(0deg) !important; }
.home-menu-card.home-menu-primary::before { background-color: var(--pin-red); }
.home-menu-card.home-menu-secondary::before { background-color: var(--pin-blue); }
.home-menu-card.home-menu-primary {
    background: var(--note-bg);
    color: var(--note-text);
    border-radius: 4px 14px 4px 14px;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
}
.home-menu-card.home-menu-primary:nth-child(odd) { transform: rotate(-1.5deg); }
.home-menu-card.home-menu-primary:nth-child(even) { transform: rotate(1.5deg); }
.home-menu-card.home-menu-secondary {
    background: var(--card-bg);
    color: var(--ink-primary);
    border-radius: 10px;
    box-shadow: var(--card-shadow-sm);
}
.home-menu-card.home-menu-secondary:nth-child(odd) { transform: rotate(1deg); }
.home-menu-card.home-menu-secondary:nth-child(even) { transform: rotate(-1deg); }
.home-menu-icon { font-size: 32px; filter: grayscale(0.2); }
.home-menu-title { font-size: 20px; font-weight: 700; }
.home-menu-desc { font-size: 14px; opacity: 0.9; font-family: var(--font-body); }

/* ---- Quiz Page ---- */
.quiz-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.quiz-header {
    padding: 12px 16px;
    flex-shrink: 0;
}
/* progress-bar 在练习页复用软木进度条样式 */
.progress-bar {
    width: 100%;
    height: 14px;
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.25);
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.12);
}
.progress-fill {
    height: 100%;
    width: 0;
    background: repeating-linear-gradient(
        45deg,
        var(--success),
        var(--success) 8px,
        #2ecc71 8px,
        #2ecc71 16px
    );
    border-radius: 6px;
    transition: width 0.35s ease;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}
.quiz-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}
#questionNum {
    background: var(--card-bg);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: var(--font-hand);
    font-size: 16px;
    font-weight: 700;
    box-shadow: var(--card-shadow-sm);
    border: 2px solid var(--ink-primary);
}
.btn-home, .btn-tts {
    width: 44px;
    height: 44px;
    border: 2px solid var(--ink-primary);
    border-radius: 50%;
    background: var(--card-bg);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, background 0.15s;
    font-family: var(--font-hand);
    font-weight: 700;
}
.btn-home:active, .btn-tts:active { transform: scale(0.9); }
.btn-tts.speaking {
    background: var(--note-bg);
    animation: pulse 1.2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(241,196,15,0.45); }
    70% { box-shadow: 0 0 0 10px rgba(241,196,15,0); }
    100% { box-shadow: 0 0 0 0 rgba(241,196,15,0); }
}
.quiz-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}
.question-text {
    position: relative;
    background: var(--card-bg);
    padding: 30px 22px 24px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.85;
    color: var(--ink-primary);
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    font-family: var(--font-body);
    border: 1px solid rgba(0,0,0,0.05);
}
.question-text::before {
    /* 红色图钉 */
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-red);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.options-list { display: flex; flex-direction: column; gap: 12px; }
.option-item {
    position: relative;
    background: var(--card-bg);
    padding: 17px 18px 17px 48px;
    border-radius: 6px 14px 6px 14px;
    font-size: 18px;
    font-weight: 600;
    color: var(--ink-light);
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: var(--card-shadow-sm);
    font-family: var(--font-body);
    transition: transform 0.12s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    transform: rotate(0.3deg);
}
.option-item:nth-child(even) { transform: rotate(-0.3deg); }
.option-item::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--ink-primary);
    border-radius: 50%;
    background: #fff;
}
.option-item:active { transform: scale(0.97) rotate(0deg); }
.option-item.selected {
    border-color: var(--pin-blue);
    background: #eef6fc;
    color: #1a5276;
    font-weight: 700;
}
.option-item.selected::before {
    background: var(--pin-blue);
    box-shadow: inset 0 0 0 3px #fff;
}
.quiz-footer {
    padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.btn-nav {
    flex: 1;
    padding: 14px 10px;
    border: 2px solid var(--ink-primary);
    border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
    background: var(--card-bg);
    color: var(--ink-primary);
    font-family: var(--font-hand);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, background 0.15s, box-shadow 0.12s;
}
.btn-nav:active { transform: translateY(2px) scale(0.97); box-shadow: 1px 1px 0 rgba(0,0,0,0.12); }
.btn-nav:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; background: #e8e4dc; }
.btn-skip {
    position: relative;
    padding: 14px 18px;
    border: 2px solid var(--ink-primary);
    border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
    background: var(--card-bg);
    color: var(--ink-primary);
    font-family: var(--font-hand);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, background 0.15s, box-shadow 0.12s;
}
.btn-skip:active { transform: translateY(2px) scale(0.97); box-shadow: 1px 1px 0 rgba(0,0,0,0.12); }
.btn-skip.selected { background: #eef6fc; border-color: var(--pin-blue); color: #1a5276; }
.btn-submit { background: var(--note-bg) !important; border-color: #e8d56a !important; color: var(--note-text) !important; }
.btn-finish { background: #d4edda !important; border-color: var(--success) !important; color: #1e5631 !important; }

.skip-bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) scale(0.85);
    background: var(--card-bg);
    color: var(--ink-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font-hand);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 20;
    box-shadow: var(--card-shadow-sm);
    border: 2px solid var(--ink-primary);
}
.skip-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
.skip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--ink-primary);
}

/* ---- Result Page ---- */
.result-page { min-height: 100vh; padding-bottom: 40px; }
.result-header {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 24px 16px 0px;
}
.encouragement {
    position: relative;
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--note-bg);
    color: var(--note-text);
    padding: 14px 20px;
    border-radius: 4px 14px 4px 14px;
    font-family: var(--font-hand);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transform: rotate(-1.5deg);
}
.encouragement::before { content: '✨ '; }
.encouragement::after {
    /* 胶带 */
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    width: 48px;
    height: 16px;
    background: var(--tape);
    border-left: 1px dashed rgba(0,0,0,0.08);
    border-right: 1px dashed rgba(0,0,0,0.08);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.score-circle {
    position: relative;
    flex: 1;
    height: 100px;
    background: var(--card-bg);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.04);
}
.score-circle::before {
    /* 与页面纸卡统一的图钉 */
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-yellow);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.score-text { font-size: 28px; font-weight: 700; color: var(--ink-primary); font-family: var(--font-hand); }
.score-label { margin-top: 2px; font-size: 13px; color: var(--ink-light); font-family: var(--font-body); }
.result-tags, .result-stats {
    background: var(--card-bg);
    margin: 16px 0;
    border-radius: 10px;
    padding: 22px 18px 18px;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.result-tags::before, .result-stats::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-blue);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.result-tags h3, .result-stats h3 {
    font-family: var(--font-hand);
    font-size: 22px;
    margin-bottom: 16px;
    color: var(--ink-primary);
    padding-left: 22px;
}

/* Stacked tag bar */
.tag-stacked-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.tag-stacked-label {
    width: 86px;
    font-size: 14px;
    color: var(--ink-light);
    flex-shrink: 0;
    font-family: var(--font-hand);
    font-weight: 700;
}
.tag-stacked-wrap { flex: 1; }
.tag-stacked-bar {
    width: 100%;
    height: 16px;
    background: rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
    display: flex;
}
.tag-stacked-fill {
    height: 100%;
    transition: width 0.4s ease;
}
.tag-stacked-fill.correct { background: var(--success); }
.tag-stacked-fill.wrong { background: var(--error); }
.tag-stacked-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--ink-light);
    font-family: var(--font-hand);
}
.tag-stacked-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tag-stacked-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.tag-stacked-legend i.correct { background: var(--success); }
.tag-stacked-legend i.wrong { background: var(--error); }
.tag-num {
    font-size: 13px;
    color: var(--ink-light);
    white-space: nowrap;
    font-family: var(--font-hand);
    min-width: 64px;
    text-align: right;
}
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card {
    text-align: center;
    padding: 16px 6px;
    background: var(--note-bg);
    border-radius: 4px 12px 4px 12px;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.1);
    transform: rotate(-1deg);
}
.stat-card:nth-child(even) { transform: rotate(1deg); background: var(--card-bg-2); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--ink-primary); margin-bottom: 4px; font-family: var(--font-hand); }
.stat-label { font-size: 13px; color: var(--ink-light); }
.result-actions { padding: 0; margin-top: 8px; }
.result-actions-row { display: flex; gap: 12px; }
.result-actions-row .btn-start,
.result-actions-row .btn-review { flex: 1; }
.btn-review, .btn-start {
    padding: 15px;
    border: 2px solid var(--ink-primary);
    border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
    background: var(--card-bg);
    color: var(--ink-primary);
    font-family: var(--font-hand);
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s, box-shadow 0.12s;
}
.btn-review { background: var(--note-bg); border-color: #e8d56a; }
.btn-start { background: #d4edda; border-color: var(--success); color: #1e5631; }
.btn-review:active, .btn-start:active { transform: translateY(2px) scale(0.98); box-shadow: 1px 1px 0 rgba(0,0,0,0.12); }

/* ---- Review Mode ---- */
.option-item.correct { border-color: var(--success); background: #e8f6ef; color: #1e5631; }
.option-item.correct::before { background: var(--success); box-shadow: inset 0 0 0 3px #fff; }
.option-item.wrong { border-color: var(--error); background: #fdecea; color: #7b241c; }
.option-item.wrong::before { background: var(--error); box-shadow: inset 0 0 0 3px #fff; }
.review-panel {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 22px 18px 18px;
    margin-top: 14px;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.review-panel::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-green);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.review-status { font-size: 17px; font-weight: 700; margin-bottom: 10px; font-family: var(--font-hand); }
.review-status.correct { color: var(--success); }
.review-status.wrong { color: var(--error); }
.review-status.skipped { color: var(--skip); }
.review-answer { font-size: 16px; color: var(--ink-primary); margin-bottom: 10px; }
.review-explanation {
    font-size: 15px;
    color: var(--ink-light);
    line-height: 1.65;
    background: var(--note-bg);
    padding: 14px;
    border-radius: 4px 12px 4px 12px;
    font-family: var(--font-body);
    box-shadow: 1px 2px 0 rgba(0,0,0,0.06);
}

/* ---- Mini Program Tip & Auth Overlay ---- */
.mp-tip-overlay,
.mp-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    background-image: inherit;
    padding: 20px;
    text-align: center;
    color: var(--card-bg);
}
.mp-tip-content,
.mp-auth-content {
    max-width: 360px;
    width: 100%;
}
.mp-tip-icon,
.mp-auth-icon { font-size: 64px; margin-bottom: 20px; }
.mp-tip-overlay h2,
.mp-auth-overlay h2 { font-family: var(--font-hand); font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.mp-tip-overlay p,
.mp-auth-overlay p { font-size: 16px; line-height: 1.6; opacity: 0.92; margin-bottom: 32px; }
.mp-btn {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--card-bg);
    border-radius: 255px 14px 225px 14px / 14px 225px 14px 255px;
    background: var(--card-bg);
    color: var(--ink-primary);
    font-family: var(--font-hand);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 3px 4px 0 rgba(0,0,0,0.12);
}
.mp-btn:active { transform: scale(0.98); }

/* ---- Leaderboard Page ---- */
.leaderboard-page { min-height: 100vh; padding-bottom: 24px; }
.lb-tabs, .lb-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.lb-tab, .lb-subtab {
    flex: 1;
    text-align: center;
    padding: 12px 6px;
    font-size: 15px;
    color: var(--card-bg);
    cursor: pointer;
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
    font-family: var(--font-hand);
    font-weight: 700;
    transition: background 0.15s, transform 0.12s;
    border: 2px dashed rgba(255,255,255,0.25);
}
.lb-tab:active, .lb-subtab:active { transform: scale(0.96); }
.lb-tab.active, .lb-subtab.active {
    background: var(--note-bg);
    color: var(--note-text);
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transform: rotate(-1deg);
    border-style: solid;
    border-color: #e8d56a;
}
.lb-list { padding: 12px 0; }
.lb-empty { text-align: center; color: rgba(255,255,255,0.85); padding: 40px; font-family: var(--font-hand); font-size: 18px; }
.lb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow-sm);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.lb-item::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-red);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.lb-rank {
    width: 34px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink-light);
    font-family: var(--font-hand);
    padding-left: 18px;
}
.lb-rank-top { color: var(--ink-primary); font-size: 22px; }
.lb-item:nth-child(1)::before { background-color: #f1c40f; } /* 金 */
.lb-item:nth-child(2)::before { background-color: #bdc3c7; } /* 银 */
.lb-item:nth-child(3)::before { background-color: #cd7f32; } /* 铜 */
.lb-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    background: #e8e4dc;
    border: 2px solid var(--ink-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--ink-primary);
    flex-shrink: 0;
    font-family: var(--font-hand);
}
.lb-info { flex: 1; }
.lb-name { font-size: 16px; font-weight: 700; color: var(--ink-primary); margin-bottom: 3px; font-family: var(--font-hand); }
.lb-meta { font-size: 13px; color: var(--ink-light); }

/* ---- Profile Page ---- */
.profile-page { min-height: 100vh; padding-bottom: 24px; }
.profile-card {
    background: var(--card-bg);
    margin: 16px 0;
    border-radius: 10px;
    padding: 24px 22px 22px;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.profile-card::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-blue);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.profile-avatar-wrap { text-align: center; margin-bottom: 16px; }
.profile-avatar {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    object-fit: cover;
    background: #e8e4dc;
    border: 3px solid var(--ink-primary);
    box-shadow: var(--card-shadow);
}
.profile-form { display: flex; flex-direction: column; gap: 12px; }
.profile-label { font-size: 16px; color: var(--ink-light); font-family: var(--font-hand); font-weight: 700; }
.profile-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--ink-primary);
    border-radius: 8px;
    font-size: 17px;
    font-family: var(--font-body);
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.profile-input:focus { outline: none; border-color: var(--pin-blue); box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 0 0 3px rgba(52,152,219,0.12); }
.profile-save {
    margin-top: 6px;
    padding: 14px;
    border: 2px solid var(--ink-primary);
    border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
    background: var(--note-bg);
    color: var(--note-text);
    font-family: var(--font-hand);
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 3px 0 rgba(0,0,0,0.12);
    transition: transform 0.12s;
}
.profile-save:active { transform: translateY(2px) scale(0.98); }
.profile-menu {
    background: var(--card-bg);
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.profile-menu::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-green);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
    z-index: 2;
}
.profile-menu-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 2px dashed rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.12s;
}
.profile-menu-item:last-child { border-bottom: none; }
.profile-menu-item:active { background: rgba(0,0,0,0.04); }
.profile-menu-icon { font-size: 22px; margin-right: 12px; }
.profile-menu-text { flex: 1; font-size: 17px; color: var(--ink-primary); font-family: var(--font-hand); font-weight: 700; }
.profile-menu-arrow { font-size: 22px; color: var(--ink-light); font-family: var(--font-body); }
.profile-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.profile-switch input { opacity: 0; width: 0; height: 0; }
.profile-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #d7ccc8;
    border-radius: 28px;
    transition: .4s;
    border: 2px solid var(--ink-primary);
}
.profile-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background-color: var(--card-bg);
    border-radius: 50%;
    transition: .4s;
    border: 1px solid var(--ink-primary);
}
.profile-switch input:checked + .profile-slider { background-color: var(--note-bg); }
.profile-switch input:checked + .profile-slider:before { transform: translateX(20px); }

/* ---- Report Page ---- */
.report-page { min-height: 100vh; padding-bottom: 24px; }
.report-section {
    background: var(--card-bg);
    margin: 16px 0;
    border-radius: 10px;
    padding: 22px 18px 18px;
    box-shadow: var(--card-shadow);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.report-section::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-yellow);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.report-section h2 {
    font-family: var(--font-hand);
    font-size: 22px;
    margin-bottom: 14px;
    color: var(--ink-primary);
    padding-left: 22px;
}
.chart-wrap { position: relative; height: 260px; }

/* ---- History Page ---- */
.history-page { min-height: 100vh; padding-bottom: 24px; }
.history-list { padding: 12px 0; }
.history-empty { text-align: center; color: rgba(255,255,255,0.85); padding: 40px; font-family: var(--font-hand); font-size: 18px; }
.history-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 14px 16px 14px 38px;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow-sm);
    position: relative;
    border: 1px solid rgba(0,0,0,0.04);
}
.history-item::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), rgba(0,0,0,0.15)) var(--pin-blue);
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25), 1px 2px 3px rgba(0,0,0,0.18);
}
.history-item:nth-child(even) { transform: rotate(0.5deg); }
.history-item:nth-child(odd) { transform: rotate(-0.5deg); }
.history-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.history-date { font-size: 15px; color: var(--ink-primary); font-family: var(--font-hand); font-weight: 700; }
.history-mode {
    font-size: 12px;
    color: var(--note-text);
    background: var(--note-bg);
    padding: 3px 10px;
    border-radius: 10px;
    font-family: var(--font-hand);
    font-weight: 700;
    box-shadow: 1px 2px 0 rgba(0,0,0,0.06);
}
.history-bottom { display: flex; gap: 14px; font-size: 14px; color: var(--ink-light); }
.history-score { font-weight: 700; color: var(--ink-primary); font-family: var(--font-hand); font-size: 16px; }
.history-accuracy, .history-duration { font-family: var(--font-body); }

/* ---- 旧类名兼容（避免未覆盖到的地方裸奔） ---- */
.features, .feature { display: none; }
