* {
    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 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
}

.screen {
    display: none;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Join Screen */
#join-screen {
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.join-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.join-container h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 25px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ddd;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
}

.form-group input[type="text"]::placeholder {
    color: #888;
}

.team-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.team-btn {
    padding: 12px;
    border: 3px solid transparent;
    border-radius: 10px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.team-btn:hover {
    transform: scale(1.05);
}

.team-btn.selected {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.primary-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: #4a4a6a;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(74, 74, 106, 0.5);
    background: #5a5a7a;
}

/* Game Screen */
#game-screen {
    padding: 10px 0;
    width: 100%;
}

.game-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

#game-canvas {
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 50%, #98D8C8 100%);
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 100vw;
    display: block;
    box-sizing: border-box;
    cursor: crosshair;
}

.controls-panel {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    padding: 15px 20px;
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group.team-change {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    font-size: 0.95rem;
}

.control-group select {
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.control-group select option {
    background: #1a1a2e;
    color: #fff;
}

/* Power bar for charging shots */
.power-bar-container {
    position: fixed;
    width: 60px;
    height: 8px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #fff;
    z-index: 100;
    pointer-events: none;
}

.power-bar-container.hidden {
    display: none;
}

.power-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.05s linear;
    border-radius: 3px;
}

.power-bar-fill.max-power {
    animation: pulse-red 0.2s infinite;
}

@keyframes pulse-red {
    0%, 100% { background: #e74c3c; }
    50% { background: #ff6666; }
}

.ready-btn.is-ready {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.teams-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0;
    padding: 15px 20px;
    margin-top: 0;
}

#teams-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.team-component {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 15px;
    border-radius: 10px;
    border-left: 4px solid;
}

.team-score-badge {
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 80px;
    text-align: center;
}

.team-members {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
}

.player-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-card.ready {
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.player-card.dead {
    opacity: 0.5;
}

.player-card .name {
    font-weight: bold;
    font-size: 0.9rem;
}

.player-card .score {
    color: #f1c40f;
    font-size: 0.85rem;
}

.player-card .status {
    font-size: 0.8rem;
    color: #aaa;
}

.player-card .lives {
    font-size: 0.75rem;
}

/* Results Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

#results-content {
    margin: 20px 0;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}

.next-round-text {
    color: #aaa;
    margin-top: 20px;
    font-style: italic;
}

/* Sound Toggle */
.sound-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
}

.sound-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.sound-btn.muted {
    color: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
    .controls-panel {
        flex-wrap: wrap;
    }
    
    .control-group {
        min-width: 150px;
    }
    
    .ready-btn {
        width: 100%;
    }
}

/* Animations */
@keyframes explosion {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes hit {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}
