@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(165deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

canvas,
.tile,
.memory-card,
.mine-cell,
.sudoku-cell,
.btn,
.dir-btn,
.number-btn {
    -webkit-tap-highlight-color: transparent;
}

canvas,
.btn,
.dir-btn,
.number-btn {
    touch-action: manipulation;
}

input,
textarea,
select {
    font-size: 16px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .game-container {
        width: 100% !important;
        margin: 10px auto !important;
        padding: 14px !important;
        border-radius: 12px !important;
    }

    .header,
    .controls,
    .score-panel,
    .info-panel {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }

    .btn,
    .dir-btn,
    .number-btn {
        min-height: 42px;
        font-size: 14px !important;
    }

    canvas {
        max-width: 100% !important;
        height: auto !important;
    }

    .board {
        grid-template-columns: repeat(8, min(10vw, 44px)) !important;
        gap: 4px !important;
        padding: 10px !important;
    }

    .board .tile {
        width: min(10vw, 44px) !important;
        height: min(10vw, 44px) !important;
        font-size: min(7vw, 24px) !important;
        border-radius: 8px !important;
    }

    .memory-board {
        grid-template-columns: repeat(4, min(20vw, 75px)) !important;
        gap: 8px !important;
    }

    .memory-board .memory-card {
        width: min(20vw, 75px) !important;
        height: min(20vw, 75px) !important;
        font-size: min(11vw, 36px) !important;
    }

    .sudoku-board {
        grid-template-columns: repeat(9, min(10vw, 40px)) !important;
        padding: 2px !important;
    }

    .sudoku-board .sudoku-cell {
        width: min(10vw, 40px) !important;
        height: min(10vw, 40px) !important;
        font-size: min(5.5vw, 18px) !important;
    }

    .mine-board .mine-cell {
        width: min(8vw, 30px) !important;
        height: min(8vw, 30px) !important;
        font-size: min(4vw, 14px) !important;
    }

    .tile:hover,
    .memory-card:hover {
        transform: none !important;
    }
}
