/* ============ 口算题生成 mental-arithmetic-generator.css ============ */

/* ---- 年级 / 页数 网格化单选项 ---- */
.radio-group.grade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.radio-group.grade-grid .radio-card {
    margin: 0;
    justify-content: center;
}

/* ---- 复选框行 ---- */
.chk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

/* ---- 题型多选（加/减/乘/除/小数/分数） ---- */
.radio-group.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.radio-group.type-grid .type-pill {
    flex: 1;
    margin: 0;
    justify-content: center;
    padding: 9px 8px;
    font-size: 13px;
    color: #cdd3dd;
    border-color: #e5e7eb;
}

.radio-group.type-grid .type-pill:has(input:checked) {
    border-color: #667eea;
    background: #eef2ff;
    color: #4338ca;
}

/* ---- 生成页数数字输入 ---- */
.num-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.num-row input[type="number"] {
    width: 110px;
    padding: 9px 10px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.num-row input[type="number"]:focus {
    border-color: #667eea;
}

.hint-inline {
    font-size: 12px;
    color: #9ca3af;
}

.chk-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.chk-label input {
    accent-color: #667eea;
    width: 15px;
    height: 15px;
}

/* ---- 按钮行 ---- */
.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calc-btn {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 16px;
}

/* ---- 打印纸预览 ---- */
.pages-area {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sheet-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
}

.sheet {
    width: 100%;
    max-width: 820px;
    aspect-ratio: 210 / 297;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #d9dce3;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    padding: 28px 30px 34px;
    page-break-after: always;
    overflow: hidden;
}

.sheet-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #111;
}

.sheet-legend {
    text-align: center;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
    margin-bottom: 18px;
}

/* ---- 题目网格（<40 两列，≥40 三列） ---- */
.sheet-grid {
    display: grid;
    flex: 1;
    align-content: stretch;
    grid-auto-rows: 1fr;
    row-gap: 4px;
    column-gap: 10px;
}

.sheet-grid.cols2 { grid-template-columns: repeat(2, 1fr); }
.sheet-grid.cols3 { grid-template-columns: repeat(3, 1fr); }

.sheet-cell {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    font-size: 16px;
    color: #111;
    white-space: nowrap;
    padding-left: 2px;
}

.sheet-cell.sheet-answer .sheet-op {
    font-weight: 700;
    color: #b45309;
}

.sheet-idx {
    color: #888;
    font-size: 12px;
    min-width: 24px;
    text-align: right;
}

.sheet-op {
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.sheet-blank {
    display: inline-block;
    width: 46px;
    border-bottom: 2px solid #333;
    height: 12px;
    margin-left: 2px;
}

@media (max-width: 600px) {
    .sheet {
        padding: 20px 14px 26px;
    }

    .sheet-grid.cols3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .sheet-cell {
        font-size: 14px;
    }

    .sheet-blank {
        width: 34px;
    }
}