/* 스도쿠 */

.sudoku-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 16px 80px;
    padding-bottom: calc(50px + 20px);
    font-family: 'Pretendard', sans-serif;
    min-height: 100vh;
}

.sudoku-header {
    text-align: center;
    margin-bottom: 24px;
}

.sudoku-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.sudoku-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.sudoku-timer {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
    text-align: center;
}
.sudoku-timer span {
    font-variant-numeric: tabular-nums;
}

.sudoku-howto {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.sudoku-howto-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.sudoku-howto-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #444;
}

.sudoku-howto-list li {
    margin-bottom: 6px;
}

.sudoku-howto-list li:last-child {
    margin-bottom: 0;
}

.sudoku-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.sudoku-difficulty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.difficulty-buttons {
    display: flex;
    gap: 6px;
}

.difficulty-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.difficulty-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.difficulty-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

.sudoku-new-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.sudoku-new-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f6dad 100%);
}

.sudoku-board-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    width: min(90vw, 360px);
    aspect-ratio: 1;
    max-width: 360px;
    background: #888;
    border: 2px solid #666;
    border-radius: 6px;
    overflow: hidden;
    gap: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.sudoku-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 4vw, 22px);
    font-weight: 700;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    cursor: default;
    user-select: none;
}

/* 3×3 구역 구분선 (얇게) */
.sudoku-cell:nth-child(9n + 3),
.sudoku-cell:nth-child(9n + 6),
.sudoku-cell:nth-child(9n) {
    border-right-width: 2px;
    border-right-color: #888;
}
.sudoku-cell:nth-child(9n + 1),
.sudoku-cell:nth-child(9n + 4),
.sudoku-cell:nth-child(9n + 7) {
    border-left-width: 2px;
    border-left-color: #888;
}
.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54),
.sudoku-cell:nth-child(n + 73):nth-child(-n + 81) {
    border-bottom-width: 2px;
    border-bottom-color: #888;
}
.sudoku-cell:nth-child(n + 1):nth-child(-n + 9),
.sudoku-cell:nth-child(n + 28):nth-child(-n + 36),
.sudoku-cell:nth-child(n + 55):nth-child(-n + 63) {
    border-top-width: 2px;
    border-top-color: #888;
}

.sudoku-cell--given {
    background: #f5f5f5;
    color: #1a1a1a;
}

.sudoku-cell:not(.sudoku-cell--given) {
    cursor: pointer;
}

.sudoku-cell:not(.sudoku-cell--given):hover {
    background: #e8f4fc;
}

.sudoku-cell--selected {
    background: #b8daff !important;
    outline: 2px solid #3498db;
    outline-offset: -2px;
    z-index: 1;
}

.sudoku-cell--error {
    background: #ffebee !important;
    color: #c62828;
}

/* 선택한 칸과 같은 숫자 강조 */
.sudoku-cell--same {
    background: #fff9c4 !important;
}
.sudoku-cell--same.sudoku-cell--selected {
    background: #b8daff !important;
}
.sudoku-cell--same.sudoku-cell--given {
    background: #fff59d !important;
}

.sudoku-numpad-wrap {
    margin-bottom: 20px;
    padding: 12px 0;
}

.sudoku-numpad-hint {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    margin: 0 0 10px 0;
}

.sudoku-numpad-wrap.active .sudoku-numpad-hint {
    color: #2c3e50;
    font-weight: 600;
}

.sudoku-numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 240px;
    margin: 0 auto;
}

.sudoku-numpad-btn {
    min-height: 48px;
    padding: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
    color: #333;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.08s;
    -webkit-tap-highlight-color: transparent;
}

.sudoku-numpad-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.sudoku-numpad-btn:active {
    transform: scale(0.96);
}

.sudoku-numpad-wrap.active .sudoku-numpad-btn {
    background: #e8f4fc;
    border-color: #3498db;
}

.sudoku-numpad-wrap.active .sudoku-numpad-btn:hover {
    background: #b8daff;
}

.sudoku-numpad-clear {
    grid-column: span 3;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
}

.sudoku-numpad-wrap.active .sudoku-numpad-clear {
    color: #c62828;
    border-color: #ef9a9a;
}

.sudoku-numpad-wrap.active .sudoku-numpad-clear:hover {
    background: #ffcdd2;
}

.sudoku-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.sudoku-check-btn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.sudoku-check-btn:hover {
    background: linear-gradient(135deg, #1e8449 0%, #186a3b 100%);
}

.sudoku-message {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    min-height: 1.5em;
    color: #333;
}

.sudoku-message:empty {
    visibility: hidden;
}

.sudoku-record {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.sudoku-record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.sudoku-record-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.sudoku-record-clear-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.sudoku-record-clear-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.sudoku-record-empty {
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 12px 0;
}

.sudoku-record-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sudoku-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 0.9rem;
}

.sudoku-record-item .record-level {
    font-weight: 700;
    color: #2c3e50;
    min-width: 48px;
}

.sudoku-record-item .record-time {
    font-weight: 600;
    color: #27ae60;
}

.sudoku-record-item .record-date {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
}

@media (max-width: 420px) {
    .sudoku-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .sudoku-difficulty {
        justify-content: center;
    }
    .difficulty-btn {
        flex: 1;
    }
}
