.main {
    grid-template-columns: 400px minmax(0, 1fr);
}

.main .extra-panel {
    grid-column: 1 / -1;
    margin-top: 0;
}

/* ---- 方格大小选择 ---- */
.size-options {
    flex-wrap: wrap;
}

.size-options .radio-card {
    flex: 1 1 auto;
    min-width: 66px;
    justify-content: center;
    padding: 9px 6px;
    font-weight: 600;
}

.size-options .radio-card input {
    position: absolute;
    opacity: 0;
}

/* ---- 顺序模式 ---- */
.mode-options {
    flex-wrap: wrap;
}

.mode-options .radio-card {
    flex: 1 1 auto;
    min-width: 110px;
    justify-content: center;
}

.mode-options .radio-card input {
    position: absolute;
    opacity: 0;
}

/* ---- 游戏面板 ---- */
.game-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 12px;
    font-size: 13px;
    color: #6b7280;
}

.game-top b {
    font-variant-numeric: tabular-nums;
    color: #374151;
}

.timer {
    font-size: 20px;
    font-weight: 700;
    color: #4338ca;
    font-variant-numeric: tabular-nums;
}

.timer.on {
    color: #667eea;
}

.next-chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.err-chip {
    color: #ef4444;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.board-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.schulte-grid {
    display: grid;
    grid-template-columns: repeat(var(--n), 1fr);
    gap: 6px;
}

.cell {
    aspect-ratio: 1;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-size: clamp(18px, calc((min(520px, 92vw) - (var(--n) - 1) * 6px) / var(--n) / 1.6), 72px);
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #334155;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s, transform 0.08s, box-shadow 0.15s;
}

.cell:hover {
    border-color: #667eea;
    color: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.18);
}

.cell.done {
    background: linear-gradient(180deg, #eef2ff 0%, #e6ecff 100%);
    border-color: #c7d2fe;
    color: #6366f1;
    opacity: 0.7;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.cell.flash {
    animation: cellflash 0.28s ease;
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

@keyframes cellflash {
    0%   { transform: scale(1); }
    30%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}

/* ---- 覆盖层 ---- */
.board-mask {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 5;
    text-align: center;
    padding: 20px;
}

.board-mask .big {
    font-size: 42px;
}

.board-mask .txt {
    font-size: 15px;
    color: #374151;
}

.board-mask .sub {
    font-size: 12px;
    color: #9ca3af;
}

.board-mask.hidden {
    display: none;
}

/* ---- 成绩统计 ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.stat {
    background: #f9fafb;
    border: 1px solid #eef0f4;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.stat b {
    display: block;
    font-size: 18px;
    color: #4338ca;
    font-variant-numeric: tabular-nums;
}

.stat span {
    font-size: 12px;
    color: #6b7280;
}

/* ---- 历史记录 ---- */
.record-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 6px;
}

.record-title .link-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
}

.record-title .link-btn:hover {
    color: #ef4444;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #f3f4f6;
    font-size: 13px;
    color: #4b5563;
    font-variant-numeric: tabular-nums;
}

.record-item .rec-time {
    font-weight: 600;
    color: #374151;
}

.record-item .rec-date {
    font-size: 12px;
    color: #9ca3af;
}

.record-item.best .rec-time {
    color: #4338ca;
}

@media (max-width: 600px) {
    .schulte-grid {
        gap: 4px;
    }
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
}