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

body {
    font-family: 'Courier New', monospace;
    background-color: #000;
    color: #0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#container {
    max-width: 1200px;
    width: 100%;
}

/* Lobby Styles */
#lobby {
    background-color: #111;
    border: 3px solid #0f0;
    padding: 30px;
    text-align: center;
}

.title h1 {
    font-size: 48px;
    color: #0f0;
    text-shadow: 0 0 10px #0f0;
    margin-bottom: 10px;
    letter-spacing: 5px;
}

.title h2 {
    font-size: 24px;
    color: #0a0;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 12px;
    color: #080;
    margin-bottom: 30px;
}

.section {
    background-color: #0a0a0a;
    border: 2px solid #0a0;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

.section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #0f0;
}

.section h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #0c0;
}

/* Input Styles */
input[type="text"] {
    background-color: #000;
    border: 2px solid #0a0;
    color: #0f0;
    padding: 10px 15px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    width: 100%;
    max-width: 300px;
    margin-bottom: 15px;
    touch-action: manipulation; /* Enable touch, prevent zoom on double-tap */
    -webkit-appearance: none; /* Remove iOS default styling */
    position: relative;
    z-index: 10;
}

input[type="text"]:focus {
    outline: none;
    border-color: #0f0;
    box-shadow: 0 0 5px #0f0;
}

/* Button Styles */
.btn, button {
    background-color: #0a0;
    color: #000;
    border: 2px solid #0f0;
    padding: 12px 30px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    font-weight: bold;
    touch-action: manipulation; /* Enable touch, prevent zoom on double-tap */
    -webkit-appearance: none; /* Remove iOS default styling */
    -webkit-tap-highlight-color: rgba(0, 255, 0, 0.3); /* Add tap feedback */
    position: relative;
    z-index: 10;
}

.btn:hover, button:hover {
    background-color: #0f0;
    box-shadow: 0 0 10px #0f0;
}

.btn-small {
    background-color: #0a0;
    color: #000;
    border: 2px solid #0f0;
    padding: 8px 20px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    font-weight: bold;
    margin: 10px 0;
}

.btn-small:hover {
    background-color: #0f0;
    box-shadow: 0 0 10px #0f0;
}

#ready-btn.ready {
    background-color: #f90;
    border-color: #fa0;
    color: #000;
}

#ready-btn.ready:hover {
    background-color: #fa0;
    box-shadow: 0 0 10px #fa0;
}

/* Players List */
.players-container {
    margin: 20px 0;
}

#player-list {
    list-style: none;
    padding: 10px;
    background-color: #000;
    border: 1px solid #0a0;
    min-height: 100px;
}

#player-list li {
    padding: 8px;
    margin: 5px 0;
    border-left: 3px solid #0a0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}

.remove-bot-btn {
    background-color: #600;
    color: #f00;
    border: 1px solid #f00;
    padding: 2px 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1;
    min-width: 24px;
    height: 24px;
}

.remove-bot-btn:hover {
    background-color: #900;
    color: #ff0;
    border-color: #ff0;
}

/* Add Bot button and select styling */
.add-bot-btn {
    background-color: #030;
    color: #0f0;
    border: 1px solid #0a0;
    padding: 6px 12px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 3px;
}

.add-bot-select {
    background-color: #030;
    color: #0f0;
    border: 1px solid #0a0;
    padding: 6px 32px 6px 12px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin-right: 0;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%230f0" height="16" viewBox="0 0 20 20" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5.516 7.548a.625.625 0 0 1 .884-.032L10 11.01l3.6-3.494a.625.625 0 1 1 .852.916l-4.025 3.91a.625.625 0 0 1-.852 0l-4.025-3.91a.625.625 0 0 1-.032-.884z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px 16px;
}

.add-bot-btn:hover {
    background-color: #050;
    border-color: #0f0;
    box-shadow: 0 0 5px #0f0;
}

#start-info {
    margin: 15px 0;
    font-size: 14px;
    color: #0c0;
}

/* Instructions */
.instructions {
    background-color: #0a0a0a;
    border: 2px solid #080;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
}

.control-toggle {
    margin: 10px 0 15px 0;
}

#control-instructions {
    list-style: none;
    padding: 10px;
    background-color: #000;
    border: 1px solid #0a0;
    margin: 10px 0;
}

#control-instructions li {
    padding: 5px;
    text-align: left;
}

.instructions h4 {
    color: #0c0;
    margin-bottom: 10px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 5px 0;
    color: #0a0;
}

.instructions strong {
    color: #0f0;
}

/* Game Canvas */
#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    border: 3px solid #0f0;
    box-shadow: 0 0 20px #0f0;
    background-color: #000;
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

/* Game Over Screen */
#game-over {
    background-color: #111;
    border: 3px solid #f00;
    padding: 40px;
}

.game-over-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100vw;
    box-sizing: border-box;
}

.game-over-left {
    flex: 0 0 auto;
    text-align: center;
}

.game-over-right {
    flex: 0 0 auto;
}

#game-over h2 {
    font-size: 36px;
    color: #f00;
    text-shadow: 0 0 10px #f00;
    margin-bottom: 20px;
}

#game-over h3 {
    font-size: 24px;
    color: #0f0;
    margin-bottom: 30px;
}

.scoreboard {
    background-color: #000;
    border: 2px solid #0a0;
    padding: 20px;
    margin: 20px 0;
    width: 500px;
    max-width: 90vw;
    text-align: left;
    font-family: 'Courier New', monospace;
    box-sizing: border-box;
}

.scoreboard-header {
    display: grid;
    grid-template-columns: 30px 120px 50px 50px 50px 50px;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 2px solid #0a0;
    color: #fff;
    font-weight: bold;
    font-size: 12px;
}

.scoreboard-header, .scoreboard-row {
    display: grid;
    grid-template-columns: minmax(18px,2.5em) minmax(40px,1.5fr) minmax(24px,0.7fr) minmax(24px,0.7fr) minmax(24px,0.7fr) minmax(28px,0.8fr);
    gap: 6px;
    padding: 8px 2px;
    border-bottom: 1px solid #0a0;
    color: #fff;
    font-weight: normal;
    font-size: 12px;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.scoreboard-header {
    border-bottom: 2px solid #0a0;
    font-weight: bold;
    color: #fff;
}
.scoreboard-row {
    color: #0f0;
}
    @media (max-width: 600px) {
        .scoreboard-header, .scoreboard-row {
            font-size: 9px;
            gap: 2px;
            padding: 4px 1px;
            grid-template-columns: minmax(14px,1.5em) minmax(30px,1.2fr) minmax(16px,0.5fr) minmax(16px,0.5fr) minmax(16px,0.5fr) minmax(18px,0.6fr);
        }
        .scoreboard {
            overflow-x: auto;
            width: 100%;
            min-width: 0;
        }
    }
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#game-over-canvas {
    display: block;
    border: 2px solid #0a0;
    width: 500px;
    height: 375px;
    max-width: 90vw;
    max-height: 50vw;
    box-sizing: border-box;
}
/* Responsive Game Over/Scoreboard */
@media (max-width: 900px) {
    .game-over-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        padding: 0 5vw;
    }
    .scoreboard {
        width: 100%;
        max-width: 98vw;
        padding: 10px;
        font-size: 13px;
    }
    #game-over-canvas {
        width: 100%;
        height: auto;
        max-width: 98vw;
        max-height: 60vw;
    }
    #game-over h2 {
        font-size: 28px;
    }
    #game-over h3 {
        font-size: 18px;
    }
    .scoreboard-header, .scoreboard-row {
        font-size: 11px;
        gap: 6px;
        padding: 6px 2px;
    }
}

@media (max-width: 600px) {
    .game-over-container {
        padding: 0 2vw;
    }
    .scoreboard {
        font-size: 11px;
        padding: 6px;
    }
    #game-over h2 {
        font-size: 20px;
    }
    #game-over h3 {
        font-size: 14px;
    }
    #game-over-canvas {
        max-height: 40vw;
    }
    .scoreboard-header, .scoreboard-row {
        font-size: 9px;
        gap: 4px;
        padding: 4px 1px;
    }
}

/* Responsive */
@media (max-width: 850px) {
    #game-canvas {
        width: 100%;
        height: auto;
    }
}

@media (max-width: 600px) {
    .title h1 {
        font-size: 32px;
    }
    
    .title h2 {
        font-size: 18px;
    }
    
    #lobby {
        padding: 20px;
    }
}

/* Mobile - works in both portrait and landscape */
@media (max-width: 900px) {
    html, body {
        overflow: hidden;
        padding: 0;
        margin: 0;
        width: 100%;
        height: 100%;
        position: fixed;
        overscroll-behavior: none;
    }
    
    #game-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        touch-action: none;
    }
    
    #game-canvas {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        touch-action: none;
    }
    
    #lobby {
        padding: 10px;
        font-size: 12px;
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
        touch-action: auto; /* Explicitly enable touch on lobby */
    }
    
    #lobby h1 {
        font-size: 24px;
    }
    
    #lobby h2 {
        font-size: 16px;
    }
    
    #lobby h3, #lobby h4 {
        font-size: 14px;
    }
    
    .section {
        padding: 10px;
        margin: 15px 0;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .instructions {
        padding: 10px;
    }
}
/* Touch Controls */
.touch-controls {
    display: none;
    position: fixed;
    pointer-events: none;
    z-index: 1000;
}

.touch-controls.active {
    display: block;
}

.touch-shoot {
    position: fixed;
    background-color: rgba(255, 0, 0, 0.6);
    color: #fff;
    border: 3px solid #f00;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 0 0 5px #000;
}

.touch-shoot.active {
    background-color: rgba(255, 0, 0, 0.9);
    box-shadow: 0 0 20px #f00;
}

/* Portrait mode - button below screen */
@media (max-width: 900px) and (orientation: portrait) {
    .touch-shoot {
        bottom: 120px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Landscape mode - button on right side */
@media (max-width: 900px) and (orientation: landscape) {
    .touch-shoot {
        position: fixed;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10000;
    }
}

/* Also show in landscape for any mobile device */
@media (orientation: landscape) and (max-width: 900px) {
    .touch-controls {
        display: block !important;
    }
    
    .touch-controls.active .touch-shoot {
        display: flex !important;
    }
}