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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    overflow: hidden;
}

#game-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    border: 4px solid #ff6b35;
    border-radius: 8px;
    box-shadow: 
        0 0 30px rgba(255, 107, 53, 0.5),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated;
}

#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.menu-content, .modal {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ff6b35;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(255, 107, 53, 0.3);
}

.modal h1, .modal h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px currentColor;
}

.game-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 15px 25px;
    margin: 10px 5px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(180deg, #ff6b35 0%, #cc5528 100%);
    color: #fff;
    transition: all 0.2s;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    box-shadow: 0 4px 0 #993d1a, 0 0 20px rgba(255, 107, 53, 0.3);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #993d1a, 0 0 30px rgba(255, 107, 53, 0.5);
}

.game-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #993d1a;
}

.game-btn.host {
    font-size: 14px;
    padding: 20px 30px;
    animation: pulse 2s infinite;
}

.game-btn.secondary {
    background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
    box-shadow: 0 4px 0 #1a202c;
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 0 #993d1a, 0 0 20px rgba(255, 107, 53, 0.3); }
    50% { box-shadow: 0 4px 0 #993d1a, 0 0 40px rgba(255, 107, 53, 0.6); }
}

.join-section {
    margin: 20px 0;
    padding: 20px;
    border-top: 1px solid #ff6b35;
    border-bottom: 1px solid #ff6b35;
}

.join-section input {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    padding: 12px;
    width: 150px;
    text-align: center;
    background: #0f0f23;
    border: 2px solid #00d9ff;
    border-radius: 8px;
    color: #00d9ff;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.join-section input::placeholder {
    color: #4a5568;
}

.local-section {
    margin-top: 20px;
}

.local-section p {
    color: #888;
    margin-bottom: 10px;
    font-size: 12px;
}

.controls-info {
    margin-top: 20px;
    font-size: 10px;
    color: #666;
    line-height: 1.8;
}

.qr-container {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    display: inline-block;
    margin: 15px 0;
}

.qr-container img {
    display: block;
}

.room-code {
    font-family: 'Press Start 2P', monospace;
    font-size: 18px;
    color: #00d9ff;
    margin: 10px 0;
}

.room-code span {
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
}

.share-text {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 15px;
}

.player-count {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #44ff44;
    margin: 15px 0;
}

.winner-sprite {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 20px auto;
    animation: bounce 0.5s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.stats {
    text-align: left;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.stat-row {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    padding: 5px 0;
}

#mobile-controls {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    z-index: 50;
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 5px;
    pointer-events: auto;
}

.dpad-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 107, 53, 0.8);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #993d1a;
}

.dpad-btn[data-dir="up"] { grid-column: 2; grid-row: 1; }
.dpad-btn[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad-btn[data-dir="right"] { grid-column: 3; grid-row: 2; }
.dpad-btn[data-dir="down"] { grid-column: 2; grid-row: 3; }

.dpad-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #993d1a;
}

#bomb-btn {
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
    font-size: 40px;
    cursor: pointer;
    box-shadow: 0 5px 0 #990000, 0 0 30px rgba(255, 68, 68, 0.5);
    pointer-events: auto;
    align-self: center;
}

#bomb-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #990000;
}

#audio-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
    z-index: 200;
}

#audio-controls button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

#audio-controls button:hover {
    background: rgba(0, 0, 0, 0.8);
}

footer {
    position: fixed;
    bottom: 10px;
    text-align: center;
    font-size: 12px;
    color: #666;
    z-index: 10;
}

footer a {
    color: #ff6b35;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .modal, .menu-content {
        padding: 20px;
    }
    
    .modal h1, .modal h2 {
        font-size: 16px;
    }
    
    .game-btn {
        font-size: 10px;
        padding: 12px 18px;
    }
    
    .game-btn.host {
        font-size: 12px;
        padding: 15px 25px;
    }
    
    #mobile-controls {
        bottom: 60px;
    }
    
    .qr-container img {
        width: 150px;
        height: 150px;
    }
}

@media (min-width: 601px) {
    #mobile-controls {
        display: none !important;
    }
}