/* 工具标题行 */
.tool-title-row {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.tool-title-row h1 { margin: 0; font-size: 1.5rem; color: #0d2b3e; }
.tool-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-badge {
    padding: 6px 14px; border-radius: 40px;
    font-size: 0.82rem; font-weight: 600;
}
.badge-login { background: #e8f5e9; color: #2e7d32; }
.badge-stat  { background: #fff3e0; color: #e65100; }

/* 卡状态条 */
.card-status-bar {
    display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.card-item {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px; border-radius: 20px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    font-weight: 600; color: #e65100;
    font-size: 0.9rem;
}
.card-balance { font-weight: 700; color: #d35400; font-size: 1.05rem; }

/* 配置面板 */
.config-panel {
    background: rgba(225,245,254,0.6);
    padding: 1.8rem 2rem;
    border-radius: 40px;
    border: 2px solid rgba(66,165,245,0.15);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 6px 0 #42a5f5;
}
.config-row { display: flex; flex-wrap: wrap; gap: 1.5rem 2rem; align-items: flex-end; }
.form-group { flex: 1 1 180px; min-width: 140px; }
.form-group label { display: block; font-weight: 700; color: #0d2b3e; margin-bottom: 6px; }
.rules-tip {
    margin-top: 16px; padding: 12px 16px;
    background: #fff8e1; border-radius: 12px;
    color: #7d6608; font-size: 0.9rem;
    line-height: 1.6;
}

/* 答题区 */
.progress-bar {
    width: 100%; height: 12px; background: rgba(66,165,245,0.15);
    border-radius: 40px; overflow: hidden; margin-bottom: 12px;
}
.progress-bar-inner {
    height: 100%; background: linear-gradient(90deg, #42a5f5, #1e88e5);
    transition: width 0.3s; width: 0;
}
.question-meta {
    display: flex; justify-content: space-between;
    margin-bottom: 20px; color: #1e88e5; font-weight: 600;
}

.nums-row {
    display: flex; justify-content: center; gap: 16px;
    margin: 30px 0; flex-wrap: wrap;
}
.num-tile {
    width: 80px; height: 100px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.6rem; font-weight: 700; color: #0d2b3e;
    background: linear-gradient(135deg, #fff, #f0f7ff);
    border: 3px solid #42a5f5; border-radius: 16px;
    cursor: pointer; user-select: none;
    box-shadow: 0 6px 0 #1e88e5;
    transition: all 0.15s;
}
.num-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #1e88e5; }
.num-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 #1e88e5; }
.num-tile.used {
    opacity: 0.35; cursor: not-allowed;
    box-shadow: none; background: #eee;
    transform: none;
}

.expr-display {
    min-height: 56px; padding: 14px 20px;
    background: #f8fbff; border-radius: 14px;
    font-size: 1.5rem; font-weight: 600; color: #0d47a1;
    text-align: center; word-break: break-all;
    border: 2px dashed #bbdefb; margin-bottom: 20px;
}
.expr-placeholder { color: #a0b0c0; font-size: 1rem; font-weight: 400; }

.ops-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 20px;
}
.op-btn {
    padding: 14px 0; font-size: 1.5rem; font-weight: 700;
    background: #e3f2fd; border: 2px solid #90caf9;
    border-radius: 12px; color: #0d47a1;
    cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.op-btn:hover { background: #bbdefb; }
.op-btn:active { transform: scale(0.96); }
.op-btn-back, .op-btn-clear {
    font-size: 1.1rem; background: #fff3e0;
    border-color: #ffcc80; color: #e65100;
}

.action-row {
    display: flex; gap: 10px; flex-wrap: wrap;
    justify-content: center; align-items: center;
}
.action-row #btnSubmitOne {
    flex: 0 0 auto;
    min-width: 310px;
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: 0 6px 0 #1565c0;
}

.feedback {
    margin-top: 20px; min-height: 30px;
    font-size: 1.1rem; font-weight: 600; text-align: center;
}
.feedback.ok { color: #2e7d32; }
.feedback.err { color: #c62828; }

/* 解析弹窗 */
.analysis-content {
    padding: 14px 18px;
}
.analysis-item {
    padding: 14px 18px; background: #f8fbff;
    border-radius: 12px; margin-bottom: 12px;
    border-left: 4px solid #42a5f5;
}
.analysis-item-title { font-weight: 700; color: #0d47a1; margin-bottom: 8px; }
.analysis-step {
    padding: 6px 0; font-size: 1rem;
    color: #263238; font-family: 'Consolas', monospace;
}
.analysis-final {
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed #bbdefb;
    font-size: 1.15rem; font-weight: 700; color: #1e88e5;
}

/* 结果区 */
.result-area { text-align: center; padding: 30px 20px; }
.result-emoji { font-size: 5rem; margin-bottom: 16px; }
.result-title { font-size: 1.8rem; font-weight: 700; color: #0d2b3e; margin-bottom: 12px; }
.result-desc { font-size: 1rem; color: #1e88e5; line-height: 1.8; }

/* 复习欢迎页 */
.review-welcome { text-align: center; padding: 60px 20px; }
.review-emoji { font-size: 4rem; margin-bottom: 16px; }
.review-title { font-size: 1.6rem; font-weight: 700; color: #0d2b3e; margin-bottom: 10px; }
.review-desc { font-size: 1rem; color: #1e88e5; margin-bottom: 24px; }

/* 弹窗 */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 9999;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff; border-radius: 20px; padding: 24px;
    max-width: 480px; width: 92%; max-height: 80vh; overflow-y: auto;
}
.modal-title {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 1.15rem; font-weight: 700; color: #0d2b3e; margin-bottom: 16px;
}
.pack-option {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border: 2px solid #e0e7ef;
    border-radius: 14px; margin-bottom: 10px;
    cursor: pointer; transition: all 0.15s;
}
.pack-option:hover { border-color: #42a5f5; background: #f8fbff; }
.pack-left { display: flex; flex-direction: column; gap: 4px; }
.pack-count { font-size: 1.15rem; font-weight: 700; color: #0d47a1; }
.pack-bonus { font-size: 0.85rem; color: #e65100; font-weight: 600; }
.pack-price { font-size: 1.1rem; font-weight: 700; color: #d35400; }

/* 徽章墙 */
.badge-wall {
    margin-top: 30px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    border: 2px solid #e2ecf6;
}
.badge-wall-title {
    font-size: 1.2rem;
    color: #1a73c7;
    margin-bottom: 18px;
    text-align: center;
}
.badge-subject-title {
    font-size: 1rem;
    font-weight: 700;
    color: #52627a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.badge-score {
    color: #e67e22;
    font-size: 1.1rem;
}
.badge-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.badge-item {
    text-align: center;
    padding: 12px 6px;
    border-radius: 16px;
    background: #f7fafd;
    border: 2px solid #eef4fb;
    transition: all 0.3s;
}
.badge-item .badge-icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 6px;
    filter: grayscale(100%);
    opacity: 0.35;
    transition: all 0.3s;
}
.badge-item .badge-name {
    font-size: 0.78rem;
    color: #7a8ba0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge-item .badge-threshold {
    font-size: 0.7rem;
    color: #b3c1d1;
    margin-top: 4px;
}
.badge-item.unlocked {
    background: linear-gradient(135deg, #fff8e1, #ffe9b0);
    border-color: #f5c142;
    box-shadow: 0 4px 12px rgba(245, 193, 66, 0.25);
}
.badge-item.unlocked .badge-icon {
    filter: none;
    opacity: 1;
    transform: scale(1.1);
}
.badge-item.unlocked .badge-name { color: #8a5a00; }
.badge-item.unlocked .badge-threshold { color: #d35400; }

/* ============================================================
   解锁弹窗
   ============================================================ */
.unlock-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(13, 43, 62, 0.55);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.unlock-modal-box {
    background: #fff;
    border-radius: 24px;
    padding: 32px 28px 24px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: popIn 0.3s ease;
}
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.unlock-emoji {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 12px;
}
.unlock-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0d2b3e;
    margin-bottom: 10px;
}
.unlock-desc {
    font-size: 1rem;
    color: #52627a;
    margin-bottom: 16px;
}
.unlock-desc b {
    color: #d35400;
    font-size: 1.15rem;
}
.unlock-balance {
    padding: 10px 16px;
    background: linear-gradient(135deg, #fff8e1, #ffe9b0);
    border-radius: 40px;
    color: #8a5a00;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 18px;
}
.unlock-balance b {
    color: #d35400;
    font-size: 1.1rem;
}
.unlock-benefits {
    text-align: left;
    background: linear-gradient(135deg, #e3f2fd, #f1f8ff);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 22px;
}
.unlock-benefits .ub-item {
    font-size: 0.9rem;
    color: #1976d2;
    font-weight: 600;
    padding: 4px 0;
}
.unlock-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.unlock-btn {
    display: block;
    padding: 13px 0;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}
.unlock-btn-primary {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    color: #fff;
    box-shadow: 0 6px 16px rgba(66, 165, 245, 0.35);
}
.unlock-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(66, 165, 245, 0.45);
    color: #fff;
}
.unlock-btn-default {
    background: #f5f7fa;
    color: #7a8ba0;
    border: 2px solid #e0e7ef;
}
.unlock-btn-default:hover {
    background: #eef3f9;
    color: #52627a;
}
.unlock-tip {
    margin-top: 16px;
    font-size: 0.82rem;
    color: #a0b0c0;
    line-height: 1.5;
}
/* ============================================================
   关卡 Tab
   ============================================================ */
.level-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.level-tab {
    padding: 16px 12px;
    border: 2px solid #e2ecf6;
    border-radius: 16px;
    background: #fff;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

.level-tab:hover {
    border-color: #90caf9;
    transform: translateY(-2px);
}

.level-tab.active {
    border-color: #42a5f5;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    box-shadow: 0 6px 16px rgba(66, 165, 245, 0.25);
}

.level-tab.unlocked {
    border-color: #a5d6a7;
}

.level-tab.unlocked.active {
    border-color: #42a5f5;
}

.level-tab:not(.unlocked) {
    background: #f7fafd;
    opacity: 0.9;
}

.level-tab .level-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0d2b3e;
    margin-bottom: 4px;
}

.level-tab .level-desc {
    font-size: 0.78rem;
    color: #7a8ba0;
    line-height: 1.4;
    margin-bottom: 4px;
    min-height: 1.1em;
}

.level-tab .level-price {
    font-size: 0.8rem;
    color: #e65100;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    background: #fff3e0;
    border-radius: 40px;
    display: inline-block;
}

/* 移动端：3 列 → 1 列 */
@media (max-width: 576px) {
    .level-tabs {
        grid-template-columns: 1fr;
    }
    .level-tab {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 12px 14px;
        gap: 10px;
    }
    .level-tab .level-name {
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    .level-tab .level-desc {
        flex: 1;
        margin-bottom: 0;
        min-height: auto;
    }
    .level-tab .level-price {
        margin-top: 0;
        flex: 0 0 auto;
    }

    .num-tile { width: 60px; height: 76px; font-size: 2rem; }
    .ops-row { grid-template-columns: repeat(4, 1fr); }
    .op-btn { padding: 12px 0; font-size: 1.2rem; }
    .expr-display { font-size: 1.2rem; }
    .action-row #btnSubmitOne { height: 55px; }
    .badge-list { grid-template-columns: repeat(3, 1fr); }
}