﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 650px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    color: #845ef7;
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.stat {
    background: linear-gradient(135deg, #845ef7 0%, #5f3dc4 100%);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat .label {
    margin-right: 5px;
    opacity: 0.9;
}

.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: #e9ecef;
    border: 2px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    color: #495057;
}

.difficulty-btn:hover {
    background: #dee2e6;
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #845ef7 0%, #5f3dc4 100%);
    color: white;
    border-color: #5f3dc4;
}

.game-area {
    position: relative;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    min-height: 500px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    width: fit-content;
    margin: 0 auto 20px;
    border: 3px solid #495057;
    background: #495057;
}

.cell {
    width: 50px;
    height: 50px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 3px solid #495057;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #495057;
}

.cell.given {
    background: #e9ecef;
    color: #495057;
    cursor: default;
    font-weight: 900;
}

.cell.selected {
    background: #d0bfff;
}

.cell.error {
    background: #ffe0e0;
    color: #c92a2a;
    animation: shake 0.3s;
}

.cell.correct {
    color: #2f9e44;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.num-btn,
.clear-btn {
    background: linear-gradient(135deg, #845ef7 0%, #5f3dc4 100%);
    border: none;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
    color: white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.num-btn:hover,
.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.clear-btn {
    grid-column: span 2;
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 15px;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 30px;
}

.overlay-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #845ef7;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 15px;
    opacity: 0.9;
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.controls p {
    margin: 8px 0;
    font-size: 1em;
}

.btn {
    background: linear-gradient(135deg, #845ef7 0%, #5f3dc4 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(132, 94, 247, 0.4);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(132, 94, 247, 0.6);
}

.btn:active {
    transform: translateY(0);
}

.footer {
    text-align: center;
    margin-top: 20px;
}

.btn-home {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1em;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.btn-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

@media (max-width: 600px) {
    .game-container {
        padding: 15px;
    }

    .header h1 {
        font-size: 2em;
    }

    .cell {
        width: 35px;
        height: 35px;
        font-size: 1.2em;
    }

    .num-btn,
    .clear-btn {
        padding: 12px;
        font-size: 1em;
    }
}

/* ========================================
   RESPONSIVE ADDITIONS
   ======================================== */

/* ========================================
   Universal Responsive Game Styles
   Add this to all game style.css files
   ======================================== */

/* Canvas Auto-Resize */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    /* Maintains square aspect ratio */
}

#game-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    border-radius: 15px;
    touch-action: none;
    /* Prevents scrolling while playing */
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .canvas-container {
        max-width: 100%;
        padding: 0 !important;
    }

    .game-title {
        font-size: 1.8rem !important;
        text-align: center;
    }

    .score-display {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        justify-content: center;
    }

    .score-item {
        padding: 0.7rem 1.5rem !important;
        font-size: 0.9rem;
    }

    .score-value {
        font-size: 1.5rem !important;
    }

    /* Make social buttons stack vertically on mobile */
    .social-section {
        margin-top: 1rem;
    }

    .social-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .social-btn {
        width: 100% !important;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px !important;
    }

    .game-container {
        padding: 1rem 0.5rem !important;
        gap: 1rem;
    }

    .game-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.8rem !important;
    }

    .score-display {
        gap: 0.4rem !important;
        margin-bottom: 1rem !important;
        flex-direction: column;
        align-items: stretch;
    }

    .score-item {
        padding: 0.6rem 1rem !important;
        flex: 1;
        min-width: auto;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .score-label {
        font-size: 0.75rem !important;
    }

    .score-value {
        font-size: 1.3rem !important;
    }

    .canvas-container {
        padding: 0 !important;
        border-radius: 12px !important;
        margin: 0 auto;
    }

    .instructions {
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
        text-align: center;
    }

    .overlay {
        padding: 1.5rem !important;
    }

    .overlay h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    .overlay p {
        font-size: 0.9rem !important;
        margin: 0.5rem 0 !important;
    }

    .game-btn {
        padding: 0.8rem 2rem !important;
        font-size: 1rem !important;
        width: 100%;
        max-width: 200px;
    }

    /* Mobile hint for touch controls */
    .canvas-container::after {
        content: "ðŸ’¡ Swipe to move";
        display: block;
        text-align: center;
        font-size: 0.75rem;
        color: rgba(255, 255, 255, 0.5);
        margin-top: 0.5rem;
        font-style: italic;
    }
}

/* Touch Controls Enhancement */
@media (hover: none) and (pointer: coarse) {

    /* Touch device detected */
    .game-btn {
        min-height: 44px;
        min-width: 120px;
    }

    button,
    .social-btn {
        min-height: 44px;
        padding: 0.7rem 1.2rem;
    }
}

/* Landscape Mode for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 5px;
    }

    .game-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto 1fr auto;
        gap: 0.5rem;
        max-width: 100%;
    }

    .game-title {
        grid-column: 1 / -1;
        font-size: 1.3rem !important;
        margin-bottom: 0.5rem !important;
    }

    .score-display {
        grid-column: 1 / -1;
        margin-bottom: 0.5rem !important;
    }

    .canvas-container {
        grid-column: 1;
        grid-row: 3;
        max-width: 400px;
        justify-self: center;
    }

    .instructions {
        grid-column: 1 / -1;
        grid-row: 4;
        margin-top: 0.5rem;
    }

    .social-section {
        grid-column: 2;
        grid-row: 3;
        align-self: start;
    }
}