/* ============================================
   BRAWL BATTLE ROYALE - GAME STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    overflow: hidden;
    color: white;
}

.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ============================================
   START SCREEN
   ============================================ */

#start-screen {
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 100%);
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
}

.game-title {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(45deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 50px rgba(255, 107, 107, 0.5);
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.subtitle {
    font-size: 1.5rem;
    color: #888;
    margin-top: 10px;
}

/* Character Selection */
.character-select {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1000px;
    padding: 20px;
}

.character-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    width: 200px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.character-card:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: #feca57;
    box-shadow: 0 20px 40px rgba(254, 202, 87, 0.3);
}

.character-card.selected {
    border-color: #ff6b6b;
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.3) 0%, rgba(255, 107, 107, 0.1) 100%);
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
}

.character-card h3 {
    font-size: 1.3rem;
    margin: 10px 0;
}

.character-card .stats {
    font-size: 0.8rem;
    color: #aaa;
    margin: 5px 0;
    font-family: monospace;
}

.character-card .ability {
    background: linear-gradient(90deg, #ff6b6b, #feca57);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
    margin-top: 10px;
}

/* Character Previews */
.character-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border-radius: 50%;
    position: relative;
}

.warrior-preview {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
}

.warrior-preview::after {
    content: '🗡️';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ninja-preview {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    box-shadow: 0 0 20px rgba(155, 89, 182, 0.5);
}

.ninja-preview::after {
    content: '🌟';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.robot-preview {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
}

.robot-preview::after {
    content: '🤖';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wizard-preview {
    background: linear-gradient(135deg, #1abc9c, #16a085);
    box-shadow: 0 0 20px rgba(26, 188, 156, 0.5);
}

.wizard-preview::after {
    content: '🔮';
    font-size: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Mode Buttons (Play AI / Play Online) */
.mode-buttons {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.mode-button {
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-button.ai-mode {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
}

.mode-button.online-mode {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.mode-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.mode-button:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.mode-hint {
    margin-top: 15px;
    color: #888;
    font-size: 0.9rem;
}

/* Start Button (legacy) */
.start-button {
    margin-top: 30px;
    padding: 20px 60px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.start-button:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5);
}

.start-button:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

/* ============================================
   LOBBY SCREEN
   ============================================ */

#lobby-screen {
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a14 100%);
}

.lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    width: 100%;
    padding: 20px;
}

.lobby-title {
    font-size: 3rem;
    background: linear-gradient(45deg, #3498db, #48dbfb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.lobby-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.player-count-box {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.player-count {
    font-size: 4rem;
    font-weight: bold;
    color: #2ecc71;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

.player-label {
    font-size: 1.2rem;
    color: #888;
}

.lobby-status {
    color: #feca57;
    font-size: 1.1rem;
}

.countdown {
    font-size: 2rem;
    color: #ff6b6b;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Player Slots */
.lobby-players {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.player-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    min-width: 120px;
    transition: all 0.3s ease;
}

.player-slot.filled {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.player-slot.you {
    border-color: #feca57;
    background: rgba(254, 202, 87, 0.15);
}

.slot-character {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 10px;
}

.slot-character.empty {
    background: rgba(255, 255, 255, 0.1);
    color: #555;
}

.slot-name {
    display: block;
    font-size: 0.9rem;
    color: #ddd;
    margin-bottom: 5px;
}

.slot-ready {
    color: #2ecc71;
    font-size: 0.8rem;
}

/* Lobby Actions */
.lobby-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.start-early-btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-early-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.start-early-btn:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.leave-btn {
    padding: 15px 30px;
    font-size: 1rem;
    border: 2px solid #e74c3c;
    border-radius: 10px;
    background: transparent;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.3s ease;
}

.leave-btn:hover {
    background: #e74c3c;
    color: white;
}

/* Lobby Chat */
.lobby-chat {
    width: 100%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
}

.chat-messages {
    height: 150px;
    overflow-y: auto;
    padding: 15px;
}

.chat-messages p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.system-msg {
    color: #888;
    font-style: italic;
}

.player-msg {
    color: #ddd;
}

.chat-input-container {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.9rem;
}

.chat-input-container input::placeholder {
    color: #666;
}

.chat-input-container button {
    padding: 12px 20px;
    border: none;
    background: #3498db;
    color: white;
    cursor: pointer;
    font-weight: bold;
}

/* ============================================
   GAME SCREEN
   ============================================ */

#game-screen {
    position: relative;
    padding: 0;
}

#game-canvas {
    display: block;
    background: #1a1a2e;
}

.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.portrait {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid #feca57;
}

.health-bar-container {
    width: 200px;
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.health-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    transition: width 0.3s ease;
    border-radius: 15px;
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
}

.ability-cooldown {
    background: rgba(255, 107, 107, 0.3);
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 2px solid #ff6b6b;
}

#ability-icon {
    font-size: 1.5rem;
}

.game-stats {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.game-stats span {
    font-weight: bold;
}

.controls-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #888;
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */

#gameover-screen {
    background: rgba(0, 0, 0, 0.9);
}

.gameover-content {
    text-align: center;
}

.gameover-content h1 {
    font-size: 5rem;
    margin-bottom: 30px;
}

.gameover-content h1.victory {
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gameover-content h1.defeat {
    color: #e74c3c;
}

.final-stats {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.final-stats p {
    margin: 10px 0;
}