/* Sudoku Theme - Mobile-First Rebuild */

:root {
    --primary: #4CAF50;
    --secondary: #26A69A;
    --tertiary: #66BB6A;
    --accent: #FFC107;
}

/* Background gradient */
body {
    background: linear-gradient(135deg, #E8F5E9 0%, #B2DFDB 100%);
}

/* Decorative background circles */
body::before {
    background: var(--primary);
}

body::after {
    background: var(--secondary);
}

/* Card styling */
.card {
    border-color: var(--primary);
}

.card::before {
    content: '🧩';
}

/* Buttons */
.btn-start {
    background: linear-gradient(135deg, var(--primary), var(--tertiary));
}

.btn-back {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-back:hover {
    background: var(--primary);
    color: white;
}

/* Slider */
input[type="range"]::-webkit-slider-thumb {
    border-color: var(--primary);
}

input[type="range"]::-moz-range-thumb {
    border-color: var(--primary);
}

/* Milestone celebration */
.milestone-celebration {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    z-index: 99999 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

/* Preview section - CENTERED */
.preview {
    text-align: center;
}

.preview-header {
    border-bottom-color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

/* Hide check button - auto-check instead */
.btn-check {
    display: none;
}

.preview-title {
    color: var(--primary);
    margin: 0;
}

/* === SUDOKU GRID - MOBILE FIRST === */
.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    width: 130px;
    max-width: 100%;
    margin: 0.5rem auto;
    background: var(--primary);
    padding: 1px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.sudoku-cell {
    aspect-ratio: 1;
    width: 100%;
    background: white;
    border: 1px solid #C0C0C0;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    text-align: center;
    cursor: text;
    transition: all 0.2s ease;
    color: var(--text-dark);
    padding: 0;
    outline: none;
    caret-color: var(--primary);
    box-sizing: border-box;
}

/* Add darker borders between 2x2 boxes */
/* Vertical divider after column 2 (cells 2, 6, 10, 14) */
.sudoku-cell:nth-child(2),
.sudoku-cell:nth-child(6),
.sudoku-cell:nth-child(10),
.sudoku-cell:nth-child(14) {
    border-right: 3px solid var(--primary);
}

/* Horizontal divider after row 2 (cells 5, 6, 7, 8) */
.sudoku-cell:nth-child(5),
.sudoku-cell:nth-child(6),
.sudoku-cell:nth-child(7),
.sudoku-cell:nth-child(8) {
    border-bottom: 3px solid var(--primary);
}

.sudoku-cell:hover:not(.prefilled):not(.correct):not(.incorrect):not([readonly]) {
    background: #E8F5E9;
    transform: scale(1.05);
}

.sudoku-cell:focus {
    border-color: var(--primary);
    border-width: 2px;
    background: #FFF9C4;
    box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.3);
}

.sudoku-cell.selected {
    border-color: var(--primary);
    border-width: 2px;
    background: #FFFDE7;
}

/* Prefilled cells */
.sudoku-cell.prefilled,
.sudoku-cell[readonly] {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: var(--primary);
    cursor: default;
    font-weight: 800;
}

.sudoku-cell.prefilled:hover,
.sudoku-cell[readonly]:hover {
    transform: none;
}

/* Correct/Incorrect states */
.sudoku-cell.correct {
    background: linear-gradient(135deg, #C8E6C9, #A5D6A7);
    color: var(--primary);
    animation: bounceIn 0.5s ease-out;
}

.sudoku-cell.incorrect {
    background: linear-gradient(135deg, #FFCDD2, #EF9A9A);
    color: #C62828;
    animation: shake 0.5s ease-out;
}

.sudoku-cell.hint {
    background: linear-gradient(135deg, #FFF9C4, #FFF59D);
    animation: pulse 1s ease-in-out;
}

/* Control buttons */
.sudoku-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.btn-check,
.btn-hint,
.btn-new {
    flex: 1;
    min-width: 60px;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-check {
    background: linear-gradient(135deg, var(--primary), var(--tertiary));
}

.btn-hint {
    background: linear-gradient(135deg, var(--accent), #FFD54F);
    color: var(--text-dark);
}

.btn-new {
    background: linear-gradient(135deg, var(--secondary), #4DB6AC);
}

.btn-check:hover,
.btn-hint:hover,
.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-check:active,
.btn-hint:active,
.btn-new:active {
    transform: translateY(0);
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* === RESPONSIVE - SCALE UP FOR LARGER SCREENS === */

/* Small phones (≥360px) */
@media (min-width: 360px) {
    .sudoku-grid {
        width: 140px;
    }

    .sudoku-cell {
        font-size: 1rem;
    }
}

/* Large phones (≥480px) */
@media (min-width: 480px) {
    .sudoku-grid {
        width: 170px;
    }

    .sudoku-cell {
        font-size: 1.15rem;
    }

    .btn-check,
    .btn-hint,
    .btn-new {
        font-size: 0.8rem;
        padding: 0.65rem 0.9rem;
    }
}

/* Tablets (≥768px) */
@media (min-width: 768px) {
    .sudoku-grid {
        width: 200px;
        margin: 1rem auto;
    }

    .sudoku-cell {
        font-size: 1.3rem;
    }

    .btn-check,
    .btn-hint,
    .btn-new {
        font-size: 0.85rem;
        padding: 0.7rem 1.1rem;
    }
}

/* Desktop (≥1024px) */
@media (min-width: 1024px) {
    .sudoku-grid {
        width: 220px;
    }

    .sudoku-cell {
        font-size: 1.4rem;
    }

    .btn-check,
    .btn-hint,
    .btn-new {
        font-size: 0.9rem;
        padding: 0.75rem 1.3rem;
        min-width: 90px;
    }
}

/* Mobile-specific optimizations */
@media (max-width: 767px) {
    .preview {
        padding: 0.5rem !important;
    }

    .preview-header {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .preview-title {
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .card {
        padding: 0.75rem !important;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .slider-value {
        font-size: 0.75rem;
    }

    .slider-labels span {
        font-size: 0.65rem;
    }
}
