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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
    height: 100vh;
}

/* Main Layout */
#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Splash Screen */
#splash-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.splash-container {
    text-align: center;
    animation: fadeIn 1s ease-in-out;
}


.splash-text h1 {
    font-size: 3em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.powered-text {
    font-size: 0.9em;
    color: #888;
    opacity: 0.7;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.windsurf-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.windsurf-img {
    height: 80px;
    width: auto;
    opacity: 0.8;
    filter: brightness(0.9);
    transition: all 0.3s ease;
}

.windsurf-img:hover {
    opacity: 1;
    filter: brightness(1);
    transform: scale(1.05);
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: #FFD700;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 40% { 
        transform: scale(1);
    }
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    z-index: 1;
}

.screen.active {
    display: block;
    z-index: 10;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Game Screen */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    height: 100vh;
    justify-content: center;
}

.player-info-panel {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 20px 40px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.5);
    text-align: center;
    min-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.player-info-text {
    font-size: 1.4em;
    font-weight: bold;
    color: white;
    line-height: 1.4;
}

.player-info-text div {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-ui {
    display: flex;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 20px;
    gap: 20px;
}

/* Main Layout */
.main-layout {
    display: flex;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    padding: 20px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
}

.lobby-screen {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 700px;
}

/* Session Selection Screen */
.session-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    flex: 1;
    text-align: center;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Objectives Panel */
.objectives-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    width: 300px;
    height: fit-content;
    max-height: 600px;
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.objectives-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.objective-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #FFD700;
}

.objective-icon {
    font-size: 1.2em;
    min-width: 24px;
}

.objective-text {
    font-size: 0.9em;
    line-height: 1.3;
    color: #E0E0E0;
}

/* High Scores Panel */
.highscores-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    width: 300px;
    height: fit-content;
    max-height: 600px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: linear-gradient(135deg, #ff6b6b, #ffd93d);
    padding: 20px;
    text-align: center;
    color: #333;
    border-radius: 20px 20px 0 0;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.4em;
}

.subtitle {
    font-size: 0.9em;
    margin-top: 5px;
    opacity: 0.8;
}

.panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 15px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    background: linear-gradient(135deg, #ff6b6b, #ffd93d);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #333;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #666;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.highscores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.highscore-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.highscore-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.highscore-rank {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 40px;
    color: #ffd93d;
}

.highscore-rank.gold { color: #ffd700; }
.highscore-rank.silver { color: #c0c0c0; }
.highscore-rank.bronze { color: #cd7f32; }

.highscore-info {
    flex-grow: 1;
    text-align: left;
    margin-left: 15px;
}

.highscore-name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.highscore-date {
    font-size: 0.8em;
    color: #ccc;
}

.highscore-stats {
    text-align: right;
}

.highscore-length {
    font-size: 1.3em;
    font-weight: bold;
    color: #4ecdc4;
}

.highscore-score {
    font-size: 0.9em;
    color: #ff6b6b;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #ccc;
    font-style: italic;
}

.no-scores {
    text-align: center;
    padding: 40px;
    color: #ccc;
    font-style: italic;
}

/* Music Controls */
.music-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.music-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #4ecdc4;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: #4ecdc4;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-btn:hover {
    background: #4ecdc4;
    color: #000;
    transform: scale(1.1);
}

.music-btn.playing {
    background: #4ecdc4;
    color: #000;
    animation: pulse 2s infinite;
}


@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.name-form {
    margin: 30px 0;
}

.name-form input {
    padding: 15px 20px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 300px;
    text-align: center;
}

.session-actions {
    margin: 40px 0;
}

.action-btn {
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
}

.create-btn {
    background: #4CAF50;
    color: white;
}

.create-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.divider {
    margin: 20px 0;
    font-size: 16px;
    color: #ccc;
}

.players-list {
    max-height: 400px;
    overflow-y: auto;
}

.sessions-list {
    margin-top: 20px;
}

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

.session-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.session-info-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.session-host {
    font-weight: bold;
    color: #FFD700;
}

.session-players {
    font-size: 14px;
    color: #ccc;
}

.session-status {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.session-status.lobby {
    background: #4CAF50;
    color: white;
}

.session-status.playing {
    background: #f44336;
    color: white;
}

.session-status.full {
    background: #FF9800;
    color: white;
}

/* Lobby Screen */
.lobby-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 600px;
    max-width: 800px;
    flex: 1;
}

.lobby-header {
    text-align: center;
    margin-bottom: 30px;
}

.lobby-header h2 {
    margin-bottom: 10px;
    font-size: 2.5em;
}

.session-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 16px;
}

.session-info span {
    color: #ccc;
}

.session-info strong {
    color: #FFD700;
}

.lobby-container h1 {
    text-align: center;
    font-size: 3em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.lobby-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.ready-btn, .start-btn, .leave-btn {
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 100px;
}

.ready-btn {
    background: #4CAF50;
    color: white;
}

.ready-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.ready-btn.ready {
    background: #f44336;
    animation: pulse 2s infinite;
}

.start-btn {
    background: #FFD700;
    color: #333;
    font-weight: bold;
}

.start-btn:hover {
    background: #FFC107;
    transform: translateY(-2px);
}

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

.leave-btn:hover {
    background: #555;
    transform: translateY(-2px);
}

.lobby-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.players-section, .chat-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 25px;
}

.players-section h3, .chat-section h3 {
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

#players-list {
    min-height: 200px;
    margin-bottom: 20px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid;
}

.player-item.ready {
    background: rgba(76, 175, 80, 0.2);
}

.ready-status {
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.ready-status.ready {
    background: #4CAF50;
}

.ready-status.not-ready {
    background: #f44336;
}


#chat-messages, #game-chat-messages {
    height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

#game-chat-messages {
    height: 400px;
    flex: 1;
    margin-bottom: 15px;
    max-height: none;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    word-wrap: break-word;
}

.chat-message .sender {
    font-weight: bold;
    color: #FFD700;
}

.chat-input {
    display: flex;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
}

.chat-input input:focus {
    outline: 2px solid #4FC3F7;
    background: rgba(255, 255, 255, 1);
}

.chat-input button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #2196F3;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: bold;
    min-width: 60px;
}

.chat-input button:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

/* Countdown Screen */
.countdown-container {
    text-align: center;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    max-width: 600px;
    min-width: 400px;
}

.player-snake-display {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.player-snake-display h2 {
    margin: 0 0 10px 0;
    font-size: 1.8em;
}

.player-snake-display p {
    margin: 0;
}

.countdown-container {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    padding: 40px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.countdown-container h1 {
    font-size: 3em;
    margin-bottom: 30px;
}

#countdown-timer {
    font-size: 8em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    margin: 20px 0;
}

#countdown-players {
    margin-top: 30px;
    font-size: 1.2em;
}

/* Game Screen */
.game-ui {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 250px 1fr 325px;
    gap: 20px;
    padding: 20px;
}

.game-info {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.score-board h3 {
    margin-bottom: 15px;
    text-align: center;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid;
}

.score-item.dead {
    background: rgba(255, 0, 0, 0.15);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.status-emoji {
    font-size: 12px;
    min-width: 16px;
}

.player-name {
    font-weight: bold;
    font-size: 0.95em;
}

.snake-color {
    font-weight: normal;
    opacity: 0.8;
}

.player-score {
    font-weight: bold;
    font-size: 1.1em;
    min-width: 30px;
    text-align: right;
}

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

.game-controls p {
    margin-bottom: 15px;
    font-size: 14px;
}

#toggle-chat {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    background: #2196F3;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 20px;
}

#game-canvas {
    border: 2px solid #fff;
    border-radius: 10px;
    background: #000;
}

.game-chat {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    height: 500px;
    min-height: 400px;
}


/* Game Over Screen */
#gameover-screen.active {
    display: block !important;
    background: red !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
}

.gameover-container {
    text-align: center;
    background: rgba(255, 0, 0, 0.8); /* Bright red for debugging */
    border-radius: 20px;
    padding: 60px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    max-width: 800px;
    width: 90%;
    margin: auto;
    border: 5px solid yellow; /* Bright border for debugging */
}

.gameover-container h1 {
    font-size: 3em;
    margin-bottom: 30px;
}

/* Victory Display */
.victory-display {
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.victory-banner {
    font-size: 4em;
    font-weight: bold;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6B6B, #4ECDC4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: victoryPulse 2s ease-in-out infinite;
}

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

.winner-info {
    margin: 20px 0;
}

.winner-name {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.winner-color {
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Fireworks Canvas */
.fireworks-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#final-scores {
    margin: 30px 0;
    font-size: 1.2em;
    position: relative;
    z-index: 2;
}

.final-score-item {
    padding: 10px 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.final-score-item.winner {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid #FFD700;
}

/* Mobile-specific elements */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
    
    /* Force hide desktop-only elements on mobile */
    .game-info,
    .score-board,
    #scores-list,
    .music-controls,
    .game-chat,
    #game-chat,
    #game-chat-messages,
    #game-chat-input,
    #game-send-btn {
        display: none !important;
    }
}

/* Responsive Design */
/* Mobile Responsiveness */
@media (max-width: 1200px) {
    .game-ui {
        grid-template-columns: 200px 1fr 250px;
    }
    
    .lobby-container {
        min-width: 600px;
        padding: 30px;
    }
    
    .main-layout {
        grid-template-columns: 1fr 600px 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    /* Mobile reset and base styles */
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
    }
    
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    /* Hide champions panel completely on mobile */
    .highscores-panel {
        display: none !important;
    }
    
    /* Splash screen mobile */
    .splash-text h1 {
        font-size: 2em;
    }
    
    /* Main layout - simple mobile stack */
    .main-layout {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 15px;
        height: auto;
        min-height: 100vh;
    }
    
    /* Objectives - simple vertical list */
    .objectives-panel {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 15px;
        padding: 20px;
        border: 2px solid rgba(255, 215, 0, 0.3);
        max-height: none; /* Remove any height restrictions */
        height: auto; /* Allow natural height for all content */
        min-height: fit-content; /* Ensure it fits content */
    }
    
    .objectives-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .objective-item {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 10px;
        border-left: 4px solid #FFD700;
        min-height: auto; /* Allow flexible height */
        word-wrap: break-word; /* Break long words if needed */
    }
    
    .objective-item .objective-text {
        line-height: 1.4; /* Better line spacing for readability */
        flex: 1; /* Take remaining space */
    }
    
    /* Session and lobby containers - full width */
    .session-container, .lobby-container {
        width: 100%;
        max-width: none;
        padding: 20px;
        box-sizing: border-box;
    }
    
    .session-container h1, .lobby-container h2 {
        font-size: 1.5em;
        text-align: center;
    }
    
    /* MOBILE GAME VIEW - CRITICAL FIX */
    .game-screen {
        padding: 0;
        margin: 0;
        width: 100%;
        height: 100vh;
        overflow: hidden;
        position: relative;
    }
    
    .game-ui {
        display: block !important;
        height: 100vh;
        width: 100%;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
    
    /* Hide everything except game area on mobile */
    .game-screen .game-info,
    .game-screen .score-board,
    .game-screen #scores-list {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .game-screen .game-chat,
    .game-screen #game-chat,
    .game-screen #game-chat-messages,
    .game-screen #game-chat-input,
    .game-screen #game-send-btn {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
    
    /* Game area takes full screen with proper centering */
    .game-area {
        width: 100% !important;
        height: 100vh !important;
        display: flex;
        justify-content: center;
        align-items: center;
        background: #000;
        padding: 5px; /* Small padding to ensure walls are visible */
        padding-top: 45px; /* Space for player info */
        margin: 0;
        box-sizing: border-box;
        overflow: hidden; /* Prevent any scrollbars */
    }
    
    #game-canvas {
        width: calc(100% - 10px) !important; /* Full width minus padding */
        max-height: calc(100vh - 50px); /* Space for player info */
        height: auto;
        display: block;
        border: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border to see edges */
    }
    
    /* Player info header - minimal */
    .player-info-panel {
        position: fixed;
        top: 5px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid rgba(255, 215, 0, 0.5);
        padding: 10px 20px;
        border-radius: 20px;
        font-size: 16px;
        z-index: 100;
        color: white;
        font-weight: bold;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
        min-width: 200px;
        text-align: center;
    }
    
    /* Lobby mobile */
    .lobby-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .lobby-container {
        min-width: 90vw;
        max-width: 100%;
        padding: 15px;
    }
    
    /* Lobby chat mobile improvements */
    .lobby-screen .chat-input {
        flex-direction: column;
        gap: 5px;
    }
    
    .lobby-screen .chat-input input {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .lobby-screen .chat-input button {
        width: 100%;
        padding: 12px;
    }
    
    /* Button improvements for mobile */
    .action-btn, .ready-btn, .start-btn, .leave-btn {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px; /* iOS touch target size */
    }
    
    /* Player info mobile */
    .player-info-panel {
        padding: 10px;
    }
    
    /* Form inputs mobile */
    #player-name {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    /* Music controls hidden on mobile - see main mobile breakpoint */
    
    /* Countdown mobile */
    .countdown-container h1 {
        font-size: 1.8em;
    }
    
    #countdown-timer {
        font-size: 4em;
    }
    
    /* Game over mobile */
    .gameover-container h1 {
        font-size: 1.8em;
    }
    
    .victory-banner {
        font-size: 2.5em;
    }
    
    .winner-name {
        font-size: 1.8em;
    }
    
    .winner-color {
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .splash-text h1 {
        font-size: 1.5em;
    }
    
    .main-layout {
        padding: 5px;
        gap: 10px;
    }
    
    .objectives-panel {
        max-height: none; /* Remove height restriction on mobile */
        height: auto; /* Allow natural height */
    }
    
    .highscores-panel {
        max-height: 150px; /* Keep restriction only on highscores */
    }
    
    .game-chat {
        max-height: 150px;
    }
    
    #game-chat-messages {
        max-height: 100px;
    }
    
    .session-container, .lobby-container {
        padding: 10px;
    }
    
    #countdown-timer {
        font-size: 3em;
    }
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ready-btn.ready {
    animation: pulse 2s infinite;
}

#countdown-timer {
    animation: pulse 1s infinite;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
