/* Dogfight - BBC Micro style retro game */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
    /* Pastel colors */
    --sky-blue: #5588CC;
    --cloud-grey: #AAAAAA;
    --sun-yellow: #DDCC44;
    --plane-red: #DD4444;
    --plane-white: #EEEEEE;
    --dark: #222222;
    --retro-font: 'Press Start 2P', monospace;
}

* {
    box-sizing: border-box;
}

/* Main container - 340x256 scaled up 3x = 1020x768 */
#game-container {
    width: 1020px;
    height: 768px;
    background: var(--dark);
    font-family: monospace;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hidden { display: none !important; }

/* ========== LOBBY ========== */
#lobby {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sky-blue);
    position: relative;
}

#lobby-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#lobby-panel {
    width: 400px;
    padding: 32px;
    background: var(--dark);
    border: 4px solid var(--plane-white);
    position: relative;
    z-index: 10;
}

#lobby h2 {
    color: var(--plane-white);
    text-align: center;
    margin: 0 0 24px 0;
    font-family: var(--retro-font);
    font-size: 24px;
    letter-spacing: 2px;
    text-shadow: 3px 3px 0 var(--plane-red);
}

#room-link {
    font-family: var(--retro-font);
    font-size: 8px;
    color: var(--sun-yellow);
    margin-bottom: 24px;
    text-align: center;
    padding: 12px;
    background: var(--sky-blue);
    border: 2px solid var(--plane-white);
}

#room-link a {
    color: var(--plane-white);
    text-decoration: none;
}

#room-link button {
    font-family: var(--retro-font);
    font-size: 8px;
    padding: 6px 10px;
    margin-left: 12px;
    background: var(--sun-yellow);
    color: var(--dark);
    border: none;
    cursor: pointer;
}

#room-link button:hover {
    background: var(--plane-white);
}

#name-form {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

#name-input {
    padding: 10px;
    font-size: 10px;
    width: 180px;
    font-family: var(--retro-font);
    background: var(--sky-blue);
    border: 2px solid var(--plane-white);
    color: var(--plane-white);
    outline: none;
    text-transform: uppercase;
}

#name-input::placeholder {
    color: var(--sun-yellow);
}

#join-btn, #start-btn {
    padding: 10px 16px;
    font-size: 10px;
    font-family: var(--retro-font);
    background: var(--plane-red);
    color: var(--plane-white);
    border: none;
    cursor: pointer;
}

#join-btn:hover, #start-btn:hover {
    background: var(--plane-white);
    color: var(--dark);
}

#start-btn {
    background: var(--sun-yellow);
    color: var(--dark);
    margin-top: 16px;
    width: 100%;
}

#start-btn:disabled {
    background: #444;
    cursor: not-allowed;
}

#waiting-room h3 {
    color: var(--sun-yellow);
    font-family: var(--retro-font);
    font-size: 10px;
    margin: 0 0 12px 0;
}

#player-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
}

#player-list li {
    padding: 8px 12px;
    margin: 6px 0;
    background: var(--sky-blue);
    border: 2px solid var(--plane-white);
    color: var(--plane-white);
    font-family: var(--retro-font);
    font-size: 10px;
}

#player-list li.player1 {
    border-color: var(--plane-red);
    color: var(--plane-red);
}

#player-list li.player1::before {
    content: "P1: ";
}

#player-list li.player2 {
    border-color: var(--plane-white);
}

#player-list li.player2::before {
    content: "P2: ";
}

#player-list li.host::after {
    content: " [HOST]";
    color: var(--sun-yellow);
}

#status {
    color: var(--sun-yellow);
    text-align: center;
    font-family: var(--retro-font);
    font-size: 8px;
}

/* ========== GAME AREA ========== */
#game-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
}

#game-canvas {
    /* Canvas is 340x256, scaled up 3x */
    width: 1020px;
    height: 768px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ========== FULLSCREEN BUTTON ========== */
#fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--plane-white);
    color: var(--plane-white);
    font-size: 18px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#fullscreen-btn:hover {
    background: var(--plane-white);
    color: var(--dark);
}

/* ========== FULLSCREEN MODE ========== */
#game-container:fullscreen,
#game-container.pseudo-fullscreen {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-container:fullscreen #game-canvas,
#game-container.pseudo-fullscreen #game-canvas {
    width: auto;
    height: 100%;
    max-width: 100%;
    aspect-ratio: 340 / 256;
}

/* Pseudo-fullscreen for iOS */
#game-container.pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
    margin: 0 !important;
}

/* ========== RESPONSIVE SCALING ========== */
@media screen and (max-width: 1020px), screen and (max-height: 768px) {
    #game-container {
        width: 100vw;
        height: calc(100vw * 256 / 340);
        max-height: 100vh;
        max-width: calc(100vh * 340 / 256);
    }

    #game-canvas {
        width: 100%;
        height: 100%;
    }

    #lobby-panel {
        width: 90%;
        max-width: 400px;
    }
}
