* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

.container {
    padding: 10px;
    width: 100%;
    max-width: 1200px;
}

.game-wrapper {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    position: relative;
    flex-wrap: wrap;
    justify-content: center;
}

#gameCanvas {
    background: #0f0f23;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid #2d3561;
    width: 100%;
    height: auto;
    max-width: 800px;
}

.game-info {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-board {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #2d3561;
}

.score-item .label {
    font-size: 14px;
    color: #888;
    display: block;
    margin-bottom: 8px;
}

.score-item .value {
    font-size: 48px;
    font-weight: bold;
    color: #e74c3c;
}

.ready-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #2d3561;
    text-align: center;
}

.ready-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-bottom: 8px;
}

.ready-btn:hover {
    background: #27ae60;
    transform: scale(1.02);
}

.ready-btn.disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

.ready-status {
    font-size: 12px;
    padding: 5px;
    border-radius: 6px;
    text-align: center;
}

.ready-status.ready {
    background: #2ecc71;
    color: white;
}

.ready-status.not-ready {
    background: #7f8c8d;
    color: white;
}

.players-list {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #2d3561;
}

.players-list h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 16px;
}

#playersContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.player-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.player-name {
    flex: 1;
    color: #ddd;
    font-size: 14px;
}

.player-score {
    color: #f39c12;
    font-weight: bold;
}

.player-ready {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}

.player-ready.ready {
    background: #2ecc71;
    color: white;
}

.player-ready.not-ready {
    background: #7f8c8d;
    color: white;
}

.player-dead {
    color: #e74c3c;
    font-size: 11px;
}

/* Mobile Controls */
.mobile-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 20px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    align-items: center;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.control-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(30, 40, 60, 0.9);
    border: 2px solid #e74c3c;
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    transform: scale(0.95);
    background: #e74c3c;
}

.control-btn.up-btn {
    background: rgba(231, 76, 60, 0.8);
}

/* Hide mobile controls on desktop */
@media (min-width: 769px) {
    .mobile-controls {
        display: none !important;
    }
}

/* Responsive for mobile */
@media (max-width: 768px) {
    body {
        padding: 5px;
        align-items: flex-start;
    }

    .container {
        padding: 5px;
    }

    .game-wrapper {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        gap: 10px;
    }

    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 100%;
    }

    .mobile-controls {
        width: 100%;
        max-width: 280px;
        padding: 10px 16px;
        gap: 6px;
        margin: 0 auto;
    }

    .control-row {
        gap: 10px;
    }

    .control-btn {
        width: 62px;
        height: 62px;
        font-size: 28px;
    }

    .game-info {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .score-board, .players-list {
        flex: 1;
        min-width: 140px;
    }

    .score-item .value {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 24px;
    }

    .mobile-controls {
        max-width: 240px;
        padding: 8px 12px;
    }

    .control-row {
        gap: 8px;
    }

    .join-panel {
        padding: 25px 20px;
    }

    .join-panel h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .score-board, .players-list {
        min-width: 120px;
    }
}

.ui-overlay {
    position: fixed;
    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: 1000;
    backdrop-filter: blur(5px);
}

.join-panel {
    background: linear-gradient(135deg, #1e2a3a 0%, #0f1724 100%);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #2d3561;
}

.join-panel h1 {
    color: #e74c3c;
    margin-bottom: 30px;
    font-size: 28px;
}

.join-panel input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    border: none;
    border-radius: 8px;
    background: #2d3561;
    color: white;
    font-size: 16px;
}

.join-panel input::placeholder {
    color: #888;
}

.join-panel button {
    width: 100%;
    padding: 12px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.join-panel button:hover {
    transform: scale(1.02);
    background: #c0392b;
}

.tips {
    margin-top: 20px;
    text-align: left;
    color: #888;
    font-size: 12px;
}

.tips p {
    margin: 5px 0;
}

.game-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
    z-index: 100;
}

.game-tips {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 100;
}

@media (max-width: 768px) {
    .game-status {
        position: fixed;
        top: 35%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 18px;
        padding: 15px 30px;
        white-space: normal;
        text-align: center;
        max-width: 80%;
        width: auto;
    }

    .game-tips {
        position: fixed;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        white-space: normal;
        text-align: center;
        width: 90%;
    }
}
