/* practice.css */

.practice-container {
    width: min(98%, 1400px);
    margin: 30px auto 50px;
}

.practice-header-card,
.practice-workspace-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.practice-header-card h1 {
    color: #0047ab;
    text-align: center;
    margin: 0 0 12px;
}

.practice-header-card p {
    text-align: center;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.practice-workspace-card {
    display: grid;
    grid-template-columns: 240px minmax(360px, 1fr) 270px;
    gap: 24px;
    align-items: start;
}

.practice-left-panel,
.practice-right-panel {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    background: #f8fafc;
}

.practice-left-panel h2,
.practice-right-panel h2 {
    margin: 0 0 16px;
    color: #0f172a;
    font-size: 20px;
}

.practice-center-panel {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.control-field label {
    font-weight: bold;
    color: #334155;
}

.control-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    background: #ffffff;
}

.left-new-puzzle-btn {
    width: 100%;
    margin-top: 2px;
}

.practice-info-box {
    margin-top: 18px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    line-height: 1.6;
}

.practice-status {
    min-height: 20px;
    margin-top: 14px;
    color: #1d4ed8;
    font-weight: bold;
    line-height: 1.45;
}

.practice-status.error {
    color: #b91c1c;
}

.practice-status.success {
    color: #15803d;
}

.practice-timer-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
    padding: 13px 14px;
    border-radius: 12px;
    background: #0f172a;
    color: #ffffff;
}

.practice-timer-box span {
    font-weight: 600;
}

.practice-timer-box strong {
    font-size: 24px;
    letter-spacing: 1px;
}

.practice-timer-box.stopped {
    background: #166534;
}

.practice-board {
    display: grid;
    margin: 0 auto;
    width: min(54vw, 560px);
    height: min(54vw, 560px);
    border: 3px solid #0f172a;
    background: #0f172a;
    box-sizing: border-box;
    overflow: hidden;
}

.practice-board.board-4 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    width: min(48vw, 400px);
    height: min(48vw, 400px);
}

.practice-board.board-6 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    width: min(52vw, 500px);
    height: min(52vw, 500px);
}

.practice-board.board-9 {
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
}

.practice-cell {
    position: relative;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 2.8vw, 34px);
    font-weight: 500;
    color: #0047ab;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    overflow: hidden;
}

.practice-cell.given {
    background: #e2e8f0;
    color: #0f172a;
    cursor: default;
    font-weight: 500;
}

/* Selected cell highlight must stay INSIDE the original cell size. */
.practice-cell.selected {
    background: #dbeafe;
    outline: none;
    box-shadow: inset 0 0 0 3px #2563eb;
    z-index: 2;
}

.practice-cell.wrong {
    background: #fee2e2;
}

.practice-cell.correct {
    background: #dcfce7;
}

.practice-cell.solution {
    background: #fef3c7;
}

.practice-cell.border-right {
    border-right: 3px solid #0f172a;
}

.practice-cell.border-bottom {
    border-bottom: 3px solid #0f172a;
}

.pencil-notes {
    position: absolute;
    inset: 3px;
    display: grid;
    gap: 1px;
    font-size: 10px;
    color: #64748b;
    line-height: 1;
}

.board-4 .pencil-notes {
    grid-template-columns: repeat(2, 1fr);
}

.board-6 .pencil-notes,
.board-9 .pencil-notes {
    grid-template-columns: repeat(3, 1fr);
}

.pencil-note {
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-pad {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.number-pad.number-pad-4 {
    grid-template-columns: repeat(2, minmax(46px, 1fr));
}

.number-pad.number-pad-6,
.number-pad.number-pad-9 {
    grid-template-columns: repeat(3, minmax(46px, 1fr));
}

.number-pad button,
.practice-btn {
    border: none;
    border-radius: 9px;
    padding: 11px 15px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.number-pad button {
    min-height: 44px;
    background: #e0f2fe;
    color: #075985;
}

.number-pad button:hover {
    background: #bae6fd;
}

.practice-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.practice-btn.primary {
    background: #2563eb;
    color: #ffffff;
}

.practice-btn.secondary {
    background: #0f766e;
    color: #ffffff;
}

.practice-btn.secondary.active {
    background: #14b8a6;
}

.number-pad.pencil-on button,
.practice-btn.secondary.active + .number-pad button {
    background: #e5e7eb;
    color: #374151;
}

.practice-btn.warning {
    background: #f59e0b;
    color: #ffffff;
}

.practice-btn.danger {
    background: #dc2626;
    color: #ffffff;
}

.answer-message {
    margin-top: 16px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    line-height: 1.45;
}

.answer-message.correct {
    color: #15803d;
}

.answer-message.incorrect {
    color: #b91c1c;
}

@media (max-width: 1180px) {
    .practice-workspace-card {
        grid-template-columns: 220px minmax(320px, 1fr) 250px;
        gap: 18px;
    }

    .practice-board,
    .practice-board.board-9 {
        width: min(50vw, 500px);
        height: min(50vw, 500px);
    }
}

@media (max-width: 980px) {
    .practice-container {
        width: min(96%, 760px);
    }

    .practice-workspace-card {
        grid-template-columns: 1fr;
    }

    .practice-board,
    .practice-board.board-9 {
        width: min(92vw, 540px);
        height: min(92vw, 540px);
    }

    .practice-board.board-6 {
        width: min(90vw, 480px);
        height: min(90vw, 480px);
    }

    .practice-board.board-4 {
        width: min(84vw, 380px);
        height: min(84vw, 380px);
    }
}

@media (max-width: 700px) {
    .practice-header-card,
    .practice-workspace-card {
        border-radius: 0;
        padding: 18px 12px;
    }

    .practice-container {
        width: 100%;
        margin: 0 0 30px;
    }

    .practice-left-panel,
    .practice-right-panel {
        padding: 14px;
    }

    .practice-board,
    .practice-board.board-9 {
        width: min(94vw, 420px);
        height: min(94vw, 420px);
    }
}
