:root {
    --primary: #4A90E2;
    --primary-dark: #2E86C1;
    --success: #2ECC71;
    --danger: #E74C3C;
    --warning: #f39c12;
    --purple: #8e44ad;
    --bg: #F4F7F6;
    --card: #ffffff;
    --text: #1e293b;
    --text-2: #64748b;
    --text-3: #94a3b8;
    --line: #e2e8f0;
    --soft: #f8fafc;
    --soft-2: #f1f5f9;
    --keyboard: #e2e8f0;
    --key: #ffffff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 16px;
    --font-size-base: 16px;
    --paper: #FFFDF6;
    --ink: #16243B;
    --rule: rgba(22, 36, 59, 0.10);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card: #1e293b;
        --text: #e2e8f0;
        --text-2: #94a3b8;
        --text-3: #64748b;
        --line: #334155;
        --soft: #16213a;
        --soft-2: #1e293b;
        --keyboard: #0f172a;
        --key: #334155;
        --shadow: 0 4px 20px rgba(0,0,0,0.4);
        --paper: #1e293b;
        --ink: #f1f5f9;
        --rule: rgba(148, 163, 184, 0.18);
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
*, *::before, *::after { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: var(--font-size-base);
    background: var(--bg);
    color: var(--text);
    -webkit-user-select: none;
    user-select: none;
}

input, textarea { user-select: text; -webkit-user-select: text; }

body {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
    padding-top: env(safe-area-inset-top);
}

.hidden { display: none !important; }
.muted { color: var(--text-2); font-size: 13px; }
.small { font-size: 12px; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 通用按钮 ---------- */
.btn {
    min-height: 44px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn-sm { min-height: 38px; padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger { background: var(--danger); }
.btn-secondary { background: #6c757d; }
.btn-purple { background: var(--purple); }
.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn-arrow { background: var(--soft); color: var(--primary); min-width: 40px; min-height: 40px; padding: 0; font-size: 22px; border-radius: 10px; border: 1px solid var(--line); }
.audio-btn { background: #e0f2fe; color: #0284c7; border: 1px solid #bae6fd; min-height: 40px; font-size: 14px; }
.chip {
    min-height: 40px; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--line);
    background: var(--soft); color: var(--text-2); font-size: 14px; font-weight: 700;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 应用框架 ---------- */
.app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 14px;
    padding-top: calc(7px + env(safe-area-inset-top));
    flex-shrink: 0;
}
.topbar-title { font-size: 19px; font-weight: 800; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-chip { font-size: 13px; color: var(--primary); font-weight: 700; background: #e0f2fe; padding: 4px 10px; border-radius: 14px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 进度卡 */
.progress-card {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    border: 1px solid #bae6fd;
    border-radius: 14px;
    padding: 8px 12px;
    margin: 0 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
@media (prefers-color-scheme: dark) {
    .progress-card { background: linear-gradient(135deg, #102a43 0%, #1e293b 100%); border-color: #334155; }
}
.progress-stats { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: #0369a1; font-weight: 600; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) {
    .progress-stats { color: #7dd3fc; }
}
.progress-stats b { font-size: 13px; }
.progress-bar-bg { height: 7px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.4s ease; }
.daily-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.daily-stats { font-size: 12px; color: #0369a1; font-weight: 700; line-height: 1.3; }
@media (prefers-color-scheme: dark) {
    .daily-stats { color: #7dd3fc; }
}
.sync-status { font-size: 11px; color: var(--text-3); }
.sync-status.ok { color: var(--success); }
.sync-status.err { color: var(--danger); }

/* ---------- 面板 ---------- */
#panels { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel {
    display: none;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 14px 14px;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
}
.panel.active { display: flex; }
.mode-panel { overflow: hidden; }
.mode-panel > * { flex-shrink: 0; }
.mode-panel .mode-card { flex: 1 1 auto; min-height: 0; }
/* 练习/复习题目区不自动撑开时，用 margin-top:auto 把键盘压到卡片底部 */
.mode-panel .kb-area { margin-top: auto; }

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
}
.filter-bar label { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.filter-select {
    padding: 5px 8px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: var(--card);
    color: var(--text);
    font-weight: 700;
    min-height: 32px;
    max-width: 180px;
}

.mode-switch { display: flex; gap: 8px; }

/* 模式卡片 */
.mode-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.card-top {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 14px 16px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.learn-head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--rule);
}
.learn-word-row { text-align: center; }
.learn-speak-btn { width: 100%; min-height: 42px; white-space: nowrap; }
.learn-top .phonetic-text { text-align: center; }
.learn-top .meanings-text { text-align: center; }
.learn-top .meaning-line { display: flex; align-items: center; justify-content: center; gap: 6px; }
.big-word {
    font-size: clamp(42px, 11vw, 56px);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: 1px;
    line-height: 1.15;
    overflow-wrap: break-word;
}
.tag { font-size: 12px; color: #fff; padding: 2px 8px; border-radius: 12px; font-weight: 700; margin-left: 4px; }
.textbook-tag { background: #2980b9; }
.group-tag { background: #8e44ad; }
.phonetic-text { font-size: 18px; color: var(--text-2); }
.phonetic-value { font-size: 18px; color: var(--text-2); }
.phoneme-line {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.8;
}
.phoneme-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    min-height: 26px;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--soft-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.phoneme-chip:active { transform: scale(0.92); }
.phoneme-chip.playing {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.fb-word .phoneme-chip { font-size: 14px; min-width: 22px; min-height: 22px; padding: 1px 5px; }
.letter-map {
    display: inline-block;
    padding: 1px 4px;
    margin: 0 1px;
    border-radius: 6px;
    color: #16243b;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}
.letter-map:active { transform: scale(0.96); }
.big-word .letter-map { padding: 1px 5px; border-radius: 8px; }
.info-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 2px;
    margin-bottom: 2px;
}
.meanings-text { font-size: 17px; line-height: 1.7; color: var(--text); }
.meaning-line { padding: 2px 0; }
.pos-tag {
    font-size: 12px; color: #0284c7; background: #e0f2fe;
    padding: 2px 6px; border-radius: 4px; margin-right: 6px; font-weight: 700;
}

.details-toggle {
    background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 700;
    text-align: left; padding: 4px 0; min-height: 32px;
}
.details-collapsed { display: none; }
.details-expanded { display: flex; flex-direction: column; gap: 8px; }

.detail-item {
    font-size: 15px; padding: 8px 10px; border-radius: 8px; line-height: 1.6;
    display: flex; align-items: flex-start; gap: 8px; border-left: 3px solid transparent;
}
.detail-content { flex: 1; }
.badge-tag { font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; color: #fff; flex-shrink: 0; }
.badge-note { background: #f39c12; }
.badge-example { background: #3498db; }
.badge-diff { background: #9b59b6; }
.badge-variant { background: #16a085; }
.badge-collocation { background: #2ecc71; }
.badge-antonym { background: #e74c3c; }
.detail-item.note { background: #fef9e7; color: #7d6608; border-left-color: #f39c12; }
.detail-item.example { background: #ebf5fb; color: #1b4f72; border-left-color: #3498db; }
.detail-item.diff { background: #f4ecf7; color: #512e5f; border-left-color: #9b59b6; }
.detail-item.variant { background: #e8f8f5; color: #117864; border-left-color: #16a085; }
.detail-item.collocation { background: #eafaf1; color: #145a32; border-left-color: #2ecc71; }
.detail-item.antonym { background: #fadbd8; color: #78281f; border-left-color: #e74c3c; }
@media (prefers-color-scheme: dark) {
    .detail-item.note, .detail-item.example, .detail-item.diff,
    .detail-item.variant, .detail-item.collocation, .detail-item.antonym {
        color: var(--text); background: var(--soft-2);
    }
}

.learn-progress {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-2); font-size: 13px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 6px 10px;
    flex-shrink: 0;
}
.learn-progress-left {
    display: flex; align-items: center; gap: 6px;
    min-width: 0; overflow: hidden;
}
.learn-progress-left .tag { margin-left: 0; flex-shrink: 0; }
#learn-progress-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrow-group { display: flex; gap: 8px; }

.chinese-text { font-size: clamp(24px, 6.5vw, 34px); font-weight: 800; color: var(--text); line-height: 1.3; }
.pos-subtext { font-size: 14px; color: var(--text-2); }
.hint-text { font-size: 12px; color: var(--text-2); }
/* 练习 / 复习问题区：紧凑单行条，把空间让给反馈区 */
.practice-qbar, .ebb-qbar {
    flex: 0 0 auto;
    min-height: 0;
    justify-content: center;
    text-align: center;
    align-items: center;
    padding: 10px 12px;
    gap: 3px;
}

/* ---------- 字母格子 ---------- */
.letter-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    padding: 4px 0 3px;
    min-height: 40px;
    align-items: flex-end;
}
.slot {
    width: 30px;
    min-height: 36px;
    border-bottom: 3px solid #cbd5e1;
    border-radius: 6px 6px 0 0;
    background: var(--soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    padding-bottom: 2px;
    transition: border-color 0.15s ease;
}
.slot.space { width: 20px; border-bottom: none; background: transparent; }
.slot.filled { border-color: var(--primary); color: var(--primary); }
.slot.correct { border-color: var(--success); color: var(--success); background: #f0fdf4; }
.slot.wrong { border-color: var(--danger); color: var(--danger); background: #fff5f5; }
.slot .typed-wrong { font-size: 10px; color: var(--danger); text-decoration: line-through; line-height: 1; }
@media (prefers-color-scheme: dark) {
    .slot.correct { background: #0f2e1b; }
    .slot.wrong { background: #301412; }
}

/* ---------- 虚拟键盘 ---------- */
.kb-area { flex-shrink: 0; }
.virtual-keyboard {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: var(--keyboard);
    padding: 5px;
    border-radius: 12px;
}
.kb-row { display: flex; gap: 3px; }
.kb-key {
    flex: 1;
    min-height: 42px;
    background: var(--key);
    border: none;
    border-radius: 7px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    box-shadow: 0 2px 0 var(--line);
}
.kb-key:active { background: #cbd5e1; transform: translateY(2px); box-shadow: none; }
.kb-key.action { background: var(--soft-2); font-size: 12px; flex: 1.5; color: var(--text-2); }
.kb-key.space-key { flex: 2; font-size: 12px; }
.kb-key.enter-key { flex: 1.6; background: var(--primary); color: #fff; font-size: 12px; }
.kb-key.caps-active { background: #0284c7 !important; color: #fff !important; }

/* ---------- 反馈 ---------- */
.feedback-box {
    display: none;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.feedback-box.error { background: #fff5f5; color: var(--danger); border: 2px solid #feb2b2; }
.feedback-box.success { background: #f0fdf4; color: #15803d; border: 2px solid #86efac; }
@media (prefers-color-scheme: dark) {
    .feedback-box.error { background: #301412; border-color: #7f1d1d; }
    .feedback-box.success { background: #0f2e1b; border-color: #14532d; }
}
.feedback-box .fb-word { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: 1px; line-height: 1.25; overflow-wrap: break-word; }
.feedback-box .fb-word small { font-size: 15px; color: var(--text-2); font-weight: 600; }
.feedback-box .fb-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }
.fb-requeue { font-size: 12px; color: var(--text-2); margin-top: 6px; }
.fb-wrong-input { font-size: 15px; color: var(--danger); margin-top: 6px; font-weight: 600; }
.fb-wrong-input s { color: var(--danger); opacity: 0.85; }
.detail-box-container { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; text-align: left; }

/* 学习 / 练习 / 复习结果页：全屏展示 */
.fb-overlay.feedback-box {
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    z-index: 85;
    width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    text-align: left;
    padding: calc(24px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
    overflow: hidden;
    background: var(--paper);
}
.fb-overlay .fb-result { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.fb-overlay .fb-title {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
}
.fb-overlay.feedback-box.success .fb-title { background: #eafaf1; color: #145a32; }
.fb-overlay.feedback-box.error .fb-title { background: #fadbd8; color: #78281f; }
.fb-overlay .fb-word {
    font-size: clamp(40px, 12vw, 62px);
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--ink);
    line-height: 1.15;
    overflow-wrap: break-word;
}
.fb-overlay .fb-word small { font-size: 18px; color: var(--text-2); font-weight: 600; }
.fb-overlay .fb-meanings { font-size: 16px; line-height: 1.7; color: var(--text); margin: 8px 0; }
.fb-overlay .fb-audio { margin: 10px 0; }
.fb-overlay .fb-requeue { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.fb-overlay .fb-actions {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.fb-overlay .fb-actions .btn { flex: 1; min-height: 50px; font-size: 16px; }
@media (prefers-color-scheme: dark) {
    .fb-overlay.feedback-box.success .fb-title { background: #0f2e1b; color: #4ade80; }
    .fb-overlay.feedback-box.error .fb-title { background: #301412; color: #f87171; }
}

/* ---------- 练习范围栏 ---------- */
.range-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    min-height: 48px;
    text-align: left;
}
.range-arrow { color: var(--text-3); }
.limit-bar { display: flex; align-items: center; }
.limit-bar label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }

/* ---------- 底部弹层 ---------- */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 90; display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: var(--card); border-radius: 18px 18px 0 0;
    max-height: 75dvh; overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 30px rgba(0,0,0,0.2);
    max-width: 700px; margin: 0 auto; width: 100%;
}
.sheet h3 { margin-bottom: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sheet-head h3 { margin-bottom: 0; }
.sheet-close {
    background: var(--soft-2);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 15px;
    color: var(--text-2);
    flex-shrink: 0;
}
.sheet-tb-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.sheet-tb-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; background: var(--soft-2); font-weight: 700; font-size: 14px; color: var(--text);
}
.sheet-tb-head .tb-count { font-size: 12px; color: var(--text-3); font-weight: 600; }
.sheet-tb-head button { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 700; min-height: 32px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; }
.range-chip {
    min-height: 38px; padding: 7px 12px; border-radius: 18px; border: 1px solid var(--line);
    background: var(--soft); font-size: 13px; font-weight: 600; color: var(--text-2);
}
.range-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.sheet-actions { display: flex; gap: 8px; margin-top: 10px; }
.sheet-actions .btn { flex: 1; }
.sheet-footer-note { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ---------- 艾宾浩斯 ---------- */
.ebb-overview {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.ebb-overview h3 { font-size: 18px; }
.ebb-due { font-size: 17px; font-weight: 800; color: var(--purple); }

/* ---------- 面板头部 ---------- */
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h3 { font-size: 18px; }

/* ---------- 卡片列表 ---------- */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-item {
    background: var(--card); border-radius: 12px; padding: 12px;
    display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.acc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.acc-actions .btn { flex: 1; min-height: 38px; }
.acc-item .ci-title { font-weight: 800; }
.acc-tbs-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-top: 4px; }
.acc-tb-checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tb-check {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--soft-2); color: var(--text-2);
    font-size: 12px; font-weight: 600;
    padding: 4px 9px; border-radius: 12px;
    border: 1px solid var(--line);
    cursor: pointer;
}
.tb-check.on { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.tb-check input { width: 15px; height: 15px; margin: 0; }
.card-item .ci-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ci-word { font-size: 20px; font-weight: 800; color: var(--text); }
.ci-trans { font-size: 14px; color: var(--text-2); }
.ci-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 12px; flex-wrap: wrap; }
.ci-wrong { font-size: 13px; color: var(--danger); }

/* ---------- 勋章 ---------- */
.me-section {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.me-section h3 { font-size: 17px; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.badge-card {
    background: var(--soft); border: 2px solid var(--line); border-radius: 12px;
    padding: 10px; display: flex; align-items: center; gap: 10px;
    opacity: 0.45; transition: all 0.3s ease;
}
.badge-card.unlocked { opacity: 1; background: linear-gradient(135deg, #fef9e7, #fffbeb); border-color: #f39c12; box-shadow: 0 4px 12px rgba(243,156,18,0.15); }
@media (prefers-color-scheme: dark) {
    .badge-card.unlocked { background: linear-gradient(135deg, #3b2f10, #2b2410); }
}
.badge-icon { font-size: 30px; width: 46px; height: 46px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.badge-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.badge-name { font-size: 14px; font-weight: 800; color: var(--text); }
.badge-desc { font-size: 12px; color: var(--text-2); }
.badge-progress { font-size: 11px; color: #0284c7; font-weight: 700; }

/* ---------- 金币兑换 ---------- */
.balance-card {
    background: linear-gradient(135deg, #fef9e7, #fffbeb);
    border: 1px solid #fde68a; border-radius: 12px;
    padding: 12px 14px; font-size: 16px; font-weight: 700; color: #92400e;
}
@media (prefers-color-scheme: dark) {
    .balance-card { background: linear-gradient(135deg, #3b2f10, #2b2410); border-color: #713f12; color: #fbbf24; }
}
.redemption-form { display: flex; flex-direction: column; gap: 8px; }
.redemption-form input, .summary-form input, .modal-content input, .auth-card input, .title-row input {
    width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
    border: 1px solid #cbd5e1; background: var(--card); color: var(--text); font-size: 15px;
}
.modal-content select { width: 100%; min-height: 44px; }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.remember-row input { width: 18px; height: 18px; min-height: 0; }
.title-row { display: flex; align-items: center; gap: 10px; }
.title-label { font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.rd-row { display: flex; gap: 8px; }
.rd-row > * { flex: 1; }
.rd-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd-item .rd-info { flex: 1; }
.rd-item .rd-name { font-weight: 700; font-size: 15px; }
.rd-item .rd-note { font-size: 12px; color: var(--text-3); }
.rd-item .rd-cost { color: #d97706; font-weight: 800; font-size: 15px; white-space: nowrap; }
.rd-item .rd-del { background: none; border: none; color: var(--text-3); font-size: 16px; min-height: 36px; min-width: 36px; }

/* ---------- 今日总结 ---------- */
.summary-stats {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.summary-stat {
    background: var(--soft); border: 1px solid var(--line); border-radius: 10px;
    padding: 10px; text-align: center;
}
.summary-stat .ss-num { font-size: 20px; font-weight: 800; color: var(--primary); }
.summary-stat .ss-label { font-size: 12px; color: var(--text-2); }
.summary-form { display: flex; flex-direction: column; gap: 8px; }
.summary-form label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }

/* ---------- 家长配置 ---------- */
.excel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.excel-actions .btn { font-size: 13px; }
.settings-row { display: flex; align-items: center; }
.switch-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.switch-label input { width: 22px; height: 22px; }
.vocab-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.vocab-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.vocab-item:last-child { border-bottom: none; }
.vocab-item .vw { font-weight: 800; color: var(--text); }
.vocab-item .vm { color: var(--text-2); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vocab-item .vt { font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ---------- 底部 Tab ---------- */
.tabbar {
    display: flex;
    flex-shrink: 0;
    background: var(--card);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.tab-btn {
    flex: 1;
    min-height: 52px;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 20px;
    color: var(--text-3);
}
.tab-btn span { font-size: 11px; font-weight: 700; }
.tab-btn.active { color: var(--primary); }
.tab-btn.active span { color: var(--primary); }
.tab-badge {
    position: absolute;
    margin: -8px 0 0 34px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ---------- 登录 ---------- */
.auth-screen {
    position: fixed; inset: 0; z-index: 100;
    background:
        radial-gradient(110% 75% at 15% 8%, rgba(74, 144, 226, 0.16), transparent 55%),
        radial-gradient(95% 65% at 90% 95%, rgba(46, 134, 193, 0.12), transparent 52%),
        linear-gradient(150deg, #dbeafe 0%, #bfdbfe 30%, #e0f2fe 62%, #f4f7f6 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
@media (prefers-color-scheme: dark) {
    .auth-screen {
        background:
            radial-gradient(110% 75% at 15% 8%, rgba(59, 130, 246, 0.20), transparent 55%),
            radial-gradient(95% 65% at 90% 95%, rgba(14, 116, 144, 0.16), transparent 52%),
            linear-gradient(150deg, #0f172a 0%, #172554 35%, #1e293b 100%);
    }
}
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
    padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 12px;
}
.auth-title {
    text-align: center;
    font-size: clamp(32px, 10vw, 42px);
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.15;
    margin: 6px 0 10px;
}
.auth-title span { color: var(--primary); }
.auth-title::after {
    content: '';
    display: block;
    width: 52px;
    height: 3px;
    border-radius: 2px;
    background: var(--primary);
    margin: 10px auto 0;
}
.auth-card input { min-height: 48px; }
.auth-msg { font-size: 13px; color: var(--danger); min-height: 18px; text-align: center; }

/* ---------- 弹窗 ---------- */
.modal {
    position: fixed; inset: 0; z-index: 120;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--card); border-radius: 16px; padding: 20px;
    width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px;
    max-height: 88dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; }

/* 勋章弹窗 */
#badge-modal {
    display: none; position: fixed; inset: 0; z-index: 110;
    background: rgba(0,0,0,0.6);
    align-items: center; justify-content: center;
    animation: fadeIn 0.3s ease;
}
.badge-modal-content {
    background: #fff; border-radius: 20px; padding: 24px;
    width: 90%; max-width: 360px; text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.badge-modal-title { font-size: 15px; color: #f39c12; font-weight: 800; letter-spacing: 1px; }
.badge-modal-icon { font-size: 60px; }
.badge-modal-name { font-size: 22px; font-weight: 800; color: #1e293b; }
.badge-modal-desc { font-size: 13px; color: #64748b; }
#fireworks-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 105; display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounceIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes slideOutLeft { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(-40px); opacity: 0; } }
@keyframes slideInRight { 0% { transform: translateX(40px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { 0% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(40px); opacity: 0; } }
@keyframes slideInLeft { 0% { transform: translateX(-40px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
.slide-out { animation: slideOutLeft 0.22s ease forwards; }
.slide-in { animation: slideInRight 0.22s ease forwards; }
.slide-out-right { animation: slideOutRight 0.22s ease forwards; }
.slide-in-left { animation: slideInLeft 0.22s ease forwards; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 520px) {
    .progress-stats { font-size: 12px; }
    .progress-stats b { font-size: 13px; }
    .big-word { font-size: clamp(36px, 10vw, 44px); }
    .slot { width: 30px; min-height: 34px; font-size: 18px; }
    .kb-key { min-height: 36px; font-size: 16px; }
    #learn-feedback .fb-word { font-size: clamp(34px, 11vw, 46px); }
    #learn-feedback .fb-word small { font-size: 15px; }
    #learn-feedback .fb-title { font-size: 18px; }
    .badges-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .filter-bar label { font-size: 13px; }
    .filter-select { max-width: 140px; }
}

@media (min-width: 768px) {
    .app { box-shadow: 0 0 30px rgba(0,0,0,0.06); }
    .big-word { font-size: clamp(50px, 8vw, 64px); }
    .slot { width: 42px; min-height: 48px; font-size: 24px; }
    .kb-key { min-height: 48px; font-size: 19px; }
    #learn-feedback .fb-word { font-size: clamp(50px, 9vw, 66px); }
    #learn-feedback .fb-word small { font-size: 20px; }
    .chinese-text { font-size: 34px; }
}

/* 桌面端：页面自然滚动，不再挤压卡片 */
@media (min-width: 1024px) and (pointer: fine) {
    body { overflow: auto; }
    .app { height: auto; min-height: 100dvh; }
    #panels { display: block; }
    .panel { height: auto; overflow: visible; }
    .mode-panel { overflow: visible; }
    .mode-panel .mode-card { flex: none; }
    .card-top { overflow: visible; flex: none; min-height: 120px; }
    .tabbar {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 0;
        width: 100%;
        max-width: 1100px;
        z-index: 50;
    }
    .kb-key { min-height: 42px; font-size: 17px; }
    .slot { width: 38px; min-height: 42px; font-size: 21px; }
    /* 键盘固定悬浮在底部导航上方（导航约 52px + 安全区），滚动单词信息时不消失 */
    .mode-panel .kb-area {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(52px + env(safe-area-inset-bottom));
        width: 100%;
        max-width: 1100px;
        z-index: 40;
        background: var(--keyboard);
        padding: 6px 14px 8px;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 14px rgba(0,0,0,0.08);
        max-height: 46dvh;
        overflow-y: auto;
    }
    /* 内容区底部预留“键盘 + 导航”的高度，防止被悬浮键盘遮挡 */
    .mode-panel { padding-bottom: 300px; }
    .mode-panel .mode-card { padding-bottom: 0; }
}

/* 低高度屏幕（小窗口 / 放大页面）：进一步压缩键盘与卡片间距 */
@media (max-height: 760px) {
    .slot { min-height: 32px; font-size: 16px; }
    .kb-key { min-height: 34px; font-size: 15px; }
    .virtual-keyboard { gap: 2px; padding: 4px; }
    .letter-slots { min-height: 34px; }
}

/* 桌面端低高度：内容区底部预留按压缩后的键盘高度收紧 */
@media (min-width: 1024px) and (pointer: fine) and (max-height: 760px) {
    .mode-panel { padding-bottom: 240px; }
}

/* ---------- 跨端交互适配 ---------- */
/* 触屏设备（手机/平板/鸿蒙）：保证按钮可点击区域足够大（键盘按键除外） */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .range-bar { min-height: 48px; }
    .filter-select { min-height: 44px; }
    .range-chip { min-height: 40px; }
    .sheet-close { width: 40px; height: 40px; }
    .tab-btn { min-height: 52px; }
}
/* 精细指针（PC 鼠标）：悬停反馈，不参与任何核心逻辑 */
@media (hover: hover) and (pointer: fine) {
    .btn:not(:disabled):hover { filter: brightness(0.94); }
    .range-chip:hover { border-color: var(--primary); color: var(--primary); }
    .tb-check:hover { border-color: var(--primary); }
}
/* 折叠屏 / 近方形大屏（展开态）：教材筛选单行、卡片内容更宽松 */
@media (min-aspect-ratio: 1/1) and (max-width: 1024px) {
    .filter-bar { flex-wrap: nowrap; }
    .filter-select { max-width: 220px; }
    .progress-stats { flex-wrap: wrap; }
    .learn-head { max-width: 72%; align-self: center; width: 100%; }
}

/* ==================== 音素字母联动与放大动画 ==================== */

/* 单词字母模块可点击样式 */
.letter-map {
    display: inline-block;
    padding: 2px 4px;
    margin: 0 1px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.letter-map:active,
.letter-map.active-pop {
    transform: scale(1.18);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

/* 音标气泡的基础与点击放大动画 */
.phoneme-chip {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

/* 当点击字母时，对应音标被触发放大的 Keyframe 动画 */
.phoneme-chip.phoneme-highlight {
    animation: phonemePop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    z-index: 10;
}

@keyframes phonemePop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.45) translateY(-3px);
        box-shadow: 0 6px 16px rgba(74, 144, 226, 0.35);
        filter: brightness(1.1);
    }
    100% {
        transform: scale(1);
        box-shadow: none;
    }
}

/* ==================== 词库同步等待弹窗 ==================== */
.speak-tip {
    position: fixed; left: 50%; bottom: 18%;
    transform: translateX(-50%);
    z-index: 400;
    background: rgba(15, 23, 42, 0.85); color: #fff;
    padding: 10px 18px; border-radius: 12px;
    font-size: 14px; line-height: 1.5;
    text-align: center; max-width: 82vw;
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
    opacity: 0; transition: opacity .25s ease;
}
.speak-tip.show { opacity: 1; }

.sync-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* 覆盖全局 .hidden 的 display:none!important，让淡出动画生效 */
.sync-modal-overlay.hidden {
    display: flex !important;
    opacity: 0;
    pointer-events: none;
}

.sync-modal-card {
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    text-align: center;
    max-width: 320px;
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sync-modal-card h3 {
    margin: 16px 0 8px 0;
    font-size: 1.1rem;
    color: #2c3e50;
}

.sync-modal-card p {
    margin: 0 0 16px 0;
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* 加载 Spinner 环形动画 */
.sync-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 进度条样式 */
.sync-progress-bar {
    width: 100%;
    height: 8px;
    background: #eef2f5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.sync-progress-inner {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #67b26f);
    transition: width 0.2s ease;
}

.sync-progress-text {
    font-size: 0.75rem;
    color: #95a5a6;
}

/* ==================== 今日明细二级弹窗 ==================== */
.modal-lg {
    max-width: 600px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.modal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.daily-modal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--soft);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
    gap: 10px;
    flex-wrap: wrap;
}

.daily-detail-container {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 4px;
}

.daily-section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}

.daily-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.daily-word-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.daily-tag {
    background: var(--soft-2);
    color: var(--text-2);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.daily-word-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.daily-practice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--soft);
    border-radius: 8px;
    font-size: 0.85rem;
    gap: 8px;
    flex-wrap: wrap;
}

.daily-practice-word {
    font-weight: 600;
    color: var(--text);
}

.daily-practice-stats {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-correct { color: #16a34a; }
.stat-wrong { color: #dc2626; }

/* ==================== 模式状态栏：掌握度 / Combo ==================== */
.mode-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    font-size: 12px;
    flex-shrink: 0;
}
.mastery-box { margin-left: auto; display: inline-flex; align-items: center; }
.mastery-stars { display: inline-flex; gap: 2px; line-height: 1; }
.mstar { color: #cbd5e1; font-size: 16px; }
.mstar.on { color: #f59e0b; text-shadow: 0 0 6px rgba(245, 158, 11, 0.55); }
.mastered-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: #e6f7ec; color: #16a34a; border: 1px solid #b7e6c8;
    padding: 2px 8px; border-radius: 12px; font-weight: 800; font-size: 12px;
    box-shadow: 0 0 10px rgba(22, 163, 74, 0.25);
}
.mastered-celebrate {
    margin-top: 10px; text-align: center;
    background: #e6f7ec; color: #16a34a; border: 1px solid #b7e6c8;
    padding: 8px 12px; border-radius: 10px; font-weight: 800;
    animation: comboPop .4s ease;
}
.combo-box {
    display: inline-flex; align-items: center; gap: 4px;
    background: #fff1e6; color: #ea580c; border: 1px solid #ffd3a5;
    padding: 2px 8px; border-radius: 12px; font-weight: 800; font-size: 12px;
}
.combo-box.pop { animation: comboPop .3s ease; }
@keyframes comboPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Combo 屏中提示 */
.combo-toast {
    position: fixed; left: 50%; top: 42%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: rgba(15, 23, 42, 0.82); color: #fff;
    padding: 14px 26px; border-radius: 16px;
    font-size: 22px; font-weight: 900; letter-spacing: 1px;
    pointer-events: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.combo-toast.show { animation: comboToast .9s ease forwards; }
@keyframes comboToast {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* ==================== 答错字母级对比 ==================== */
.letter-diff {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 10px 0 4px; justify-content: center;
}
.diff-cell {
    min-width: 24px; min-height: 30px; padding: 2px 4px;
    border-radius: 6px; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800; color: var(--text);
}
.diff-correct { background: #e6f7ec; color: #16a34a; border-color: #b7e6c8; }
.diff-wrong { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.diff-miss { background: var(--soft-2); color: var(--text-3); border-style: dashed; }
.diff-extra { background: #fee2e2; color: #dc2626; border-color: #fecaca; }
.diff-space { min-width: 14px; border: none; background: transparent; }

/* ==================== 勋章陈列室（游戏化：品质/翻转/分类） ==================== */
.badge-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.badge-tab {
    background: var(--soft-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 700;
    min-height: 36px;
}
.badge-tab.on {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.badge-tab small { opacity: 0.8; font-weight: 600; margin-left: 2px; }

.badge-card {
    perspective: 800px;
    height: 178px;
    cursor: pointer;
    border: none;
    background: transparent;
    box-shadow: none;
    opacity: 1;
    padding: 0;
}
.badge-card.unlocked {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.badge-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}
.badge-card.flipped .badge-inner { transform: rotateY(180deg); }
.badge-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    text-align: center;
    border: 2px solid var(--line);
    background: var(--card);
}
.badge-back {
    transform: rotateY(180deg);
    background: var(--soft);
}
.badge-back-icon { font-size: 34px; }
.badge-back-title { font-size: 14px; font-weight: 800; color: var(--text); }
.badge-back-msg { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.badge-back-time { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 品质边框与光晕 */
.badge-card.quality-common .badge-face { border-color: #94a3b8; }
.badge-card.quality-rare .badge-face { border-color: #3b82f6; }
.badge-card.quality-epic .badge-face { border-color: #8b5cf6; }
.badge-card.quality-legendary .badge-face { border-color: #f59e0b; }
.badge-card.quality-mythic .badge-face { border-color: #ec4899; }
.badge-card.quality-common.unlocked .badge-front { box-shadow: 0 4px 14px rgba(148, 163, 184, 0.35); }
.badge-card.quality-rare.unlocked .badge-front { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.45); }
.badge-card.quality-epic.unlocked .badge-front { box-shadow: 0 4px 18px rgba(139, 92, 246, 0.5); }
.badge-card.quality-legendary.unlocked .badge-front { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.55); }
.badge-card.quality-mythic.unlocked .badge-front { box-shadow: 0 0 24px rgba(236, 72, 153, 0.6); }

/* 未解锁：灰度 + 锁 */
.badge-card.locked .badge-front {
    filter: grayscale(100%);
    opacity: 0.55;
}

/* ==================== 账户管理弹窗重构样式 ==================== */
.acc-top-tools {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.acc-top-tools .search-box {
    flex: 1;
}

.acc-top-tools input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    font-size: 0.9rem;
}

.acc-card-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
}

.acc-card {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.acc-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}

.acc-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.acc-user-name {
    font-weight: 700;
    color: var(--text);
    font-size: 1rem;
}

.acc-user-tag {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--soft-2);
    color: var(--text-2);
}

.acc-user-tag.admin {
    background: #fef3c7;
    color: #d97706;
}

.acc-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.acc-expand-icon {
    font-size: 0.85rem;
    color: var(--text-3);
    transition: transform 0.2s ease;
    display: inline-block;
}

.acc-card.expanded .acc-expand-icon {
    transform: rotate(180deg);
}

.acc-auth-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.acc-tb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.acc-tb-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    gap: 6px;
}

.acc-tb-item.active {
    border-color: var(--primary);
    background: #f0f7ff;
}

.acc-tb-left {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    min-width: 0;
}

.acc-exp-input {
    font-size: 0.72rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 4px;
    background: var(--card);
    color: var(--text);
    max-width: 118px;
}

.acc-exp-input:disabled {
    opacity: 0.45;
}

/* ==================== 双音标（美式/英式） ==================== */
.ph-variant-row {
    display: inline-flex; align-items: center; gap: 2px;
    margin: 1px 2px 1px 0; padding: 2px 6px;
    border-radius: 10px; cursor: pointer;
    border: 1px solid transparent;
    opacity: .55; transition: opacity .2s ease, background .2s ease;
}
.ph-variant-row.active {
    opacity: 1; background: rgba(255, 255, 255, .65);
    border-color: rgba(22, 36, 59, .14);
}
.ph-variant-label {
    font-size: 14px; font-weight: 700; line-height: 1.15; color: #fff;
    background: rgba(22, 36, 59, .55);
    border-radius: 8px; padding: 4px 7px 2px; margin-right: 5px;
    white-space: nowrap;
    display: inline-flex; flex-direction: column; align-items: center;
}
.ph-variant-label .ph-flag { font-size: 18px; line-height: 1.15; }
.ph-variant-row.active .ph-variant-label { background: #16243b; }
