* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

h1 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

.controls label {
    color: #fff;
    font-size: 1rem;
}

.controls select {
    padding: 10px 15px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    outline: none;
}

.controls button,
#playAgain {
    padding: 10px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #e94560 0%, #ff6b6b 100%);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
}

.controls button:hover,
#playAgain:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.controls button:active,
#playAgain:active {
    transform: translateY(0);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
}

.stat {
    color: #fff;
    font-size: 1.2rem;
}

.stat .label {
    opacity: 0.8;
}

.stat span:last-child {
    font-weight: bold;
    color: #4fc3f7;
}

.board {
    display: grid;
    gap: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 15px;
    margin: 0 auto;
    width: fit-content;
}

.tile {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(145deg, #4a69bd, #3c55a5);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.tile:hover:not(.empty) {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.tile.empty {
    background: transparent;
    box-shadow: none;
    cursor: default;
}

.tile.movable {
    background: linear-gradient(145deg, #26de81, #20bf6b);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 15px rgba(38, 222, 129, 0.5);
    }
}

.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.win-message h2 {
    color: #2d3436;
    margin-bottom: 15px;
    font-size: 2rem;
}

.win-message p {
    color: #636e72;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.win-message button {
    margin-top: 15px;
}

.hidden {
    display: none !important;
}

/* Responsividade */
@media (max-width: 500px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .stats {
        gap: 20px;
    }

    .stat {
        font-size: 1rem;
    }

    .tile {
        font-size: 1.2rem;
    }
}
