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

body {
    font-family: 'Courier New', monospace;
    background: #000000;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Menu Screens */
.menu-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #000;
    position: relative;
    overflow: hidden;
}

.menu-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../img/zhorin.png') center / cover no-repeat;
    pointer-events: none;
    z-index: 0;
}

.menu-screen > * {
    position: relative;
    z-index: 1;
}

.logo {
    display: none;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 15%;
    margin-right: 5%;

.menu-btn {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 60px;
    min-width: 300px;
    background: linear-gradient(180deg, #8b6914 0%, #6b4f0f 100%);
    border: 3px solid #000;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 2px 2px 0 #000;
}

.menu-btn:hover {
    background: linear-gradient(180deg, #a67c00 0%, #8b6914 100%);
    transform: scale(1.05);
}

.menu-btn:active {
    transform: scale(0.95);
}

/* Game Screen */
.game-screen {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-bottom: 2px solid #8b6914;
}

.team-hud {
    text-align: center;
}

.team-hud h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.team1 h3 {
    color: #ff6b6b;
}

.team2 h3 {
    color: #6b9fff;
}

.squad-portraits {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.portrait {
    width: 60px;
    height: 80px;
    border: 2px solid #000;
    background: rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portrait.active {
    border-color: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}

.portrait.dead {
    filter: grayscale(100%);
    opacity: 0.5;
}

.portrait-name {
    font-size: 10px;
    color: #fff;
    margin-top: 5px;
}

.portrait-hp {
    position: absolute;
    bottom: 5px;
    width: 80%;
    height: 8px;
    background: #333;
    border: 1px solid #000;
}

.portrait-hp-bar {
    height: 100%;
    background: #4caf50;
}

.score-board {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 32px;
    font-weight: bold;
}

.score {
    min-width: 50px;
    text-align: center;
}

#score1 {
    color: #ff6b6b;
}

#score2 {
    color: #6b9fff;
}

.timer {
    color: #ffd700;
    font-size: 28px;
}

#gameCanvas {
    flex: 1;
    min-height: 0;          /* allow flex to shrink so HUD isn't pushed off */
    width: 100%;
    height: 100%;
    display: block;
    background: #2a5a8a;     /* sea color (visible outside the island) */
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none; /* prevent browser gestures interfering with joystick */
}

.hud-bottom {
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-top: 2px solid #8b6914;
}

.controls-info {
    text-align: center;
    color: #fff;
    font-size: 14px;
}

/* Result Screen */
.result {
    text-align: center;
    margin-bottom: 50px;
}

.result h1 {
    font-size: 48px;
    color: #ffd700;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
}

.final-score {
    font-size: 36px;
    color: #fff;
}

.hidden {
    display: none !important;
}

/* Override menu-screen flex when hidden */
.menu-screen.hidden {
    display: none !important;
}

/* Round info bar (in HUD) */
.round-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 4px 20px;
    background: rgba(0, 0, 0, 0.5);
}

.round-wins {
    font-size: 22px;
    font-weight: bold;
}

#roundWins1 { color: #ff6b6b; }
#roundWins2 { color: #6b9fff; }

.round-label {
    font-size: 14px;
    color: #ffd700;
    letter-spacing: 2px;
}

/* Round banner overlay — big retro text in the center of the canvas */
.round-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 80px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 4px 4px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
    letter-spacing: 8px;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease;
}

.round-banner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    animation: bannerPulse 0.6s ease-in-out;
}

@keyframes bannerPulse {
    0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    50%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
