/* ================================================================
   菜刀客在线工具页 · sudoku-solver.html 私有样式
   需在 /css/common.css 之后加载。
   ================================================================ */

.container {
    max-width: 1400px;
}

.main {
    grid-template-columns: 1fr 360px;
}

/* ---- 左侧：游戏设置 ---- */
.sudoku-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row .btn {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
    font-size: 13px;
}

/* ---- 右侧：棋盘 ---- */
.board-wrap {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.board {
    display: grid;
    width: 100%;
    max-width: 540px;
    border: 2px solid #667eea;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(102,126,234,0.12);
    user-select: none;
    touch-action: manipulation;
}

.cell {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #4338ca;
    cursor: pointer;
    transition: background 0.08s;
    line-height: 1;
    padding: 0;
    min-width: 0;
    min-height: 0;
}

.cell:nth-child(4n) { border-right: none; }
.board[data-n="6"] .cell:nth-child(6n) { border-right: none; }
.board[data-n="8"] .cell:nth-child(8n) { border-right: none; }
.board[data-n="9"] .cell:nth-child(9n) { border-right: none; }
.board[data-n="4"] .cell:nth-child(n+13) { border-bottom: none; }
.board[data-n="6"] .cell:nth-child(n+31) { border-bottom: none; }
.board[data-n="8"] .cell:nth-child(n+57) { border-bottom: none; }
.board[data-n="9"] .cell:nth-child(n+73) { border-bottom: none; }

.board[data-n="4"] .cell { font-size: 24px; }
.board[data-n="6"] .cell { font-size: 20px; }
.board[data-n="8"] .cell { font-size: 17px; }
.board[data-n="9"] .cell { font-size: 16px; }

.cell.bt {
    border-top: 2px solid #667eea;
}

.cell.bl {
    border-left: 2px solid #667eea;
}

.cell.given {
    background: #f3f4f6;
    color: #111827;
    font-weight: 700;
    cursor: default;
}

.cell.peer {
    background: #f5f7ff;
}

.cell.peer.given {
    background: #eef0f5;
}

.cell.same {
    background: #c7d2fe;
}

.cell.selected {
    background: #eef2ff;
    box-shadow: inset 0 0 0 2px #667eea;
    z-index: 2;
}

.cell.conflict,
.cell.wrong {
    color: #dc2626;
    background: #fef2f2;
}

.cell.conflict.given,
.cell.wrong.given {
    color: #b91c1c;
}

.cell.revealed {
    color: #667eea;
    font-weight: 600;
}

.cell.hinted {
    color: #059669;
}

.cell .note {
    position: absolute;
    inset: 2px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    align-content: center;
    gap: 0 2px;
    font-size: 9px;
    font-weight: 500;
    color: #9ca3af;
    letter-spacing: 0;
    word-break: break-all;
    text-align: center;
    line-height: 1.15;
}

.board[data-n="4"] .cell .note,
.board[data-n="6"] .cell .note {
    font-size: 10px;
}

/* ---- 虚拟数字键盘 ---- */
.num-pad {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 540px;
}

.num-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
    gap: 8px;
}

.num-row.pad-actions {
    grid-template-columns: 1fr 1fr;
}

.num-btn {
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.num-btn:hover {
    border-color: #667eea;
    background: #eef2ff;
    transform: translateY(-1px);
}

.num-btn.small {
    font-size: 13px;
    font-weight: 500;
}

.num-row.pad-actions .num-btn {
    background: #eef0f3;
    color: #4b5563;
}

.num-row.pad-actions .num-btn:hover {
    background: #e2e5ea;
    border-color: #9ca3af;
}

.num-row.pad-actions .num-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.btn.btn-blue {
    background: #e8f1fd;
    border-color: #b9d5f7;
    color: #2563eb;
}

.btn.btn-blue:hover {
    background: #d7e7fb;
    border-color: #8fbdf2;
}

.num-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: #ffffff;
}

.num-btn.done {
    opacity: 0.35;
    pointer-events: none;
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }

    .board {
        max-width: 100%;
    }
}
