/* Sudoku Game Styles */

.sudoku-board {
    width: min(80vw, 70vh, 450px);
    height: min(80vw, 70vh, 450px);
    background: #fff;
    border: 3px solid #333;
    border-radius: 8px;
    margin: 0 auto 20px auto;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    max-width: 450px;
    max-height: 450px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.sudoku-cell {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    min-height: 30px;
}

.sudoku-cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.sudoku-cell.given {
    background: #e9ecef;
    color: #000;
    font-weight: bold;
}

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

.sudoku-cell.selected {
    background: #e3f2fd;
}

/* Mobile Number Input for Sudoku */
.mobile-number-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid #667eea;
    padding: 15px;
    display: none;
    z-index: 1000;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
}

.number-input-title {
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.number-btn {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.number-btn:active {
    transform: scale(0.95);
}

.number-btn.clear {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.number-btn.close {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
    grid-column: span 2;
}

/* Desktop optimizations */
@media (min-width: 768px) {
    .sudoku-board {
        width: 500px;
        height: 500px;
        border: 4px solid #333;
        border-radius: 12px;
        gap: 2px;
    }
    
    .sudoku-cell {
        font-size: 1.4em;
        min-height: 50px;
        border: 1px solid #dee2e6;
    }
    
    .sudoku-cell:nth-child(3n) {
        border-right: 3px solid #333;
    }
    
    .sudoku-cell:nth-child(n+19):nth-child(-n+27),
    .sudoku-cell:nth-child(n+46):nth-child(-n+54) {
        border-bottom: 3px solid #333;
    }
    
    /* Hide mobile number input on desktop */
    .mobile-number-input {
        display: none !important;
    }
}

/* Tablet/iPad Responsive */
@media (min-width: 601px) and (max-width: 1024px) {
    .sudoku-board {
        width: min(65vw, 60vh, 500px);
        height: min(65vw, 60vh, 500px);
        border-width: 4px;
        border-radius: 12px;
        margin-bottom: 25px;
        box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    }

    .sudoku-cell {
        font-size: 1.4em;
        min-height: 50px;
        border-width: 1.5px;
        transition: all 0.2s ease;
    }

    .sudoku-cell:hover {
        background: #f0f8ff;
        transform: scale(1.05);
    }

    .sudoku-cell.selected {
        background: #e3f2fd;
        box-shadow: inset 0 0 10px rgba(33, 150, 243, 0.3);
    }

    .sudoku-cell.error {
        background: #ffebee;
        animation: shake 0.5s ease-in-out;
    }

    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        25% { transform: translateX(-5px); }
        75% { transform: translateX(5px); }
    }

    .number-input {
        gap: 15px;
        margin: 20px 0;
    }

    .number-btn {
        width: 50px;
        height: 50px;
        font-size: 1.3em;
        border-radius: 25px;
        transition: all 0.3s ease;
    }

    .number-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    }

    .game-info {
        padding: 25px;
        border-radius: 20px;
    }

    .control-section {
        margin: 25px 0;
    }

    .primary-controls {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn {
        padding: 15px 25px;
        font-size: 1.1em;
        min-width: 140px;
        border-radius: 25px;
    }

    .status-info {
        gap: 25px;
        margin: 20px 0;
    }

    .timer, .moves-counter {
        font-size: 1.1em;
        padding: 12px 20px;
        border-radius: 20px;
    }
}

/* Large Desktop/Monitor Responsive */
@media (min-width: 1025px) {
    .sudoku-board {
        width: min(50vw, 65vh, 600px);
        height: min(50vw, 65vh, 600px);
        border-width: 5px;
        border-radius: 15px;
        margin-bottom: 30px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.2);
        background: linear-gradient(135deg, #ffffff, #f8f9fa);
    }

    .sudoku-cell {
        font-size: 1.6em;
        min-height: 60px;
        border-width: 2px;
        transition: all 0.3s ease;
        cursor: pointer;
    }

    .sudoku-cell:hover {
        background: #f0f8ff;
        transform: scale(1.08);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .sudoku-cell:active {
        transform: scale(1.05);
    }

    .sudoku-cell.selected {
        background: #e3f2fd;
        box-shadow: inset 0 0 15px rgba(33, 150, 243, 0.4);
        transform: scale(1.05);
    }

    .sudoku-cell.given {
        background: linear-gradient(135deg, #e9ecef, #f8f9fa);
        font-weight: 900;
    }

    .sudoku-cell.error {
        background: linear-gradient(135deg, #ffebee, #ffcdd2);
        animation: errorPulse 0.6s ease-in-out;
    }

    @keyframes errorPulse {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.1); background: #ff5252; color: white; }
    }

    .number-input {
        gap: 20px;
        margin: 30px 0;
        justify-content: center;
    }

    .number-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
        border-radius: 30px;
        transition: all 0.3s ease;
        box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    }

    .number-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    }

    .number-btn:active {
        transform: translateY(-1px);
    }

    .number-btn.selected {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
    }

    .game-info {
        padding: 40px;
        border-radius: 25px;
        max-width: 800px;
        margin: 0 auto;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    }

    .game-header {
        margin-bottom: 30px;
    }

    .game-title-section h1 {
        font-size: 2.5em;
        margin-bottom: 10px;
    }

    .game-subtitle {
        font-size: 1.3em;
    }

    .control-section {
        margin: 30px 0;
    }

    .primary-controls {
        gap: 25px;
        margin: 25px 0;
    }

    .btn {
        padding: 18px 35px;
        font-size: 1.2em;
        min-width: 160px;
        border-radius: 30px;
        transition: all 0.3s ease;
        box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    }

    .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    }

    .status-info {
        gap: 30px;
        margin: 25px 0;
    }

    .timer, .moves-counter {
        font-size: 1.2em;
        padding: 15px 25px;
        border-radius: 25px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .difficulty-selector {
        gap: 20px;
        margin: 20px 0;
    }

    .difficulty-btn {
        padding: 15px 30px;
        font-size: 1.2em;
        min-width: 120px;
        border-radius: 30px;
        transition: all 0.3s ease;
    }

    .difficulty-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
}