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

body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    padding: 20px;
    color: white;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    text-shadow: 3px 3px 0px #ff6b00;
    color: #ffd700;
}

h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #ffd700;
}

h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #ffd700;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Lobby */
.lobby-content {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: #ffd700;
}

.input-group input {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #ffd700;
    border-radius: 10px;
    color: white;
    text-align: center;
}

.input-group input:focus {
    outline: none;
    border-color: #ff6b00;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.5);
}

/* Selector de emoji */
.emoji-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.emoji-option {
    width: 50px;
    height: 50px;
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-option:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.1);
}

.emoji-option.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.button-group {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 0.8rem;
    font-family: inherit;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
    color: black;
    font-weight: bold;
}

.btn-danger {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: white;
}

.available-rooms {
    margin-top: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#roomsList {
    max-height: 300px;
    overflow-y: auto;
}

.room-item {
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateX(5px);
}

.room-code {
    font-size: 1.2rem;
    color: #ffd700;
    font-weight: bold;
}

.room-players {
    font-size: 0.8rem;
    color: #fff;
}

/* Waiting Room */
.waiting-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

#currentRoomCode {
    color: #ff6b00;
    font-size: 2rem;
    display: block;
    margin: 10px 0;
}

.muted {
    color: #94a3b8;
    font-size: 0.7rem;
    margin-bottom: 30px;
}

.players-list {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin: 30px 0;
}

#playersList {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.player-item {
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border-left: 5px solid;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.8rem;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Game Screen */
.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
}

.info-item {
    text-align: center;
}

.info-label {
    color: #ffd700;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.2rem;
    color: white;
}

/* Grid del juego */
#gameGrid {
    display: block;
    border: 4px solid #ffd700;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    background: #1a1a1a;
    margin: 20px auto;
    width: fit-content;
}

#gameGrid table {
    border-collapse: collapse;
    background: #2d5016;
}

#gameGrid td {
    width: 50px;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    font-size: 0;
    line-height: 0;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0;
    box-sizing: border-box;
}

#gameGrid td.wall {
    background: #4a4a4a;
}

#gameGrid td.box {
    background: #8b4513;
}

#gameGrid td.empty {
    background: #5a8a2f;
}

#gameGrid td .player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    line-height: 1;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

#gameGrid td .bomb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
    z-index: 5;
    animation: bombPulse 0.5s infinite;
}

#gameGrid td .powerup {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    line-height: 1;
    z-index: 5;
    animation: powerupFloat 1s ease-in-out infinite;
}

#gameGrid td.explosion {
    position: relative;
    animation: explosionAnimation 0.5s ease-out;
}

#gameGrid td.explosion::before {
    content: '💥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 45px;
    z-index: 20;
    animation: explosionScale 0.5s ease-out;
}

#gameGrid td.explosion::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 200, 0, 0.8) 0%, rgba(255, 107, 0, 0.6) 50%, transparent 100%);
    animation: explosionGlow 0.5s ease-out;
    z-index: 15;
}

@keyframes bombPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes powerupFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes explosionAnimation {
    0% {
        background: #fff;
        box-shadow: 0 0 0 0 rgba(255, 200, 0, 1);
    }
    50% {
        background: #ff8c00;
        box-shadow: 0 0 20px 10px rgba(255, 107, 0, 0.8);
    }
    100% {
        background: #ff6b00;
        box-shadow: 0 0 0 0 rgba(255, 107, 0, 0);
    }
}

@keyframes explosionScale {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

@keyframes explosionGlow {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

.controls {
    margin-top: 20px;
    text-align: center;
}

.instructions {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    font-size: 0.6rem;
    line-height: 1.8;
}

.instructions h3 {
    margin-bottom: 10px;
    font-size: 0.8rem;
}

.instructions p {
    margin: 5px 0;
}

/* Game Over */
.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 40px 60px;
    border-radius: 20px;
    border: 4px solid #ff6b00;
    text-align: center;
    display: none;
    z-index: 1000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.game-over.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.game-over h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #ffd700;
}

.game-over.victory h2 {
    color: #00ff00;
}

.game-over.defeat h2 {
    color: #ff0000;
}

.game-over p {
    margin: 10px 0;
    font-size: 0.9rem;
}

/* Controles móviles */
.mobile-controls {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin: 20px auto;
    max-width: 600px;
    padding: 0 20px;
}

.dpad {
    position: relative;
    width: 150px;
    height: 150px;
}

.dpad-btn {
    position: absolute;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #ff6b00;
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.dpad-btn:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #ff6b00 0%, #ff8c00 100%);
}

.dpad-up {
    top: 0;
    left: 50px;
}

.dpad-down {
    bottom: 0;
    left: 50px;
}

.dpad-left {
    top: 50px;
    left: 0;
}

.dpad-right {
    top: 50px;
    right: 0;
}

.bomb-btn {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #ff0000 0%, #ff6b00 100%);
    border: 4px solid #ffd700;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.bomb-btn:active {
    transform: scale(0.9);
    box-shadow: 0 0 20px rgba(255, 107, 0, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 1rem;
    }

    .game-info {
        font-size: 0.6rem;
    }

    .info-value {
        font-size: 0.9rem;
    }
    
    .emoji-selector {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .emoji-option {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }

    #gameGrid td {
        width: 35px;
        height: 35px;
        font-size: 25px;
        line-height: 35px;
    }
    
    #gameGrid td .player {
        font-size: 28px;
    }
    
    #gameGrid td .bomb, #gameGrid td .powerup {
        font-size: 22px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.7rem;
    }

    .button-group {
        flex-direction: column;
    }

    .instructions {
        font-size: 0.5rem;
    }
    
    .mobile-controls {
        display: flex;
    }

    .game-over {
        padding: 30px 40px;
    }

    .game-over h2 {
        font-size: 1.5rem;
    }
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff6b00;
}
