@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    background: #0a0a0f;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0,255,255,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255,0,255,0.03) 0%, transparent 50%);
}

#game-container {
    position: relative;
    width: min(800px, 95vw);
    aspect-ratio: 4 / 3;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    border: 2px solid rgba(0,255,255,0.6);
    border-radius: 4px;
    box-shadow:
        0 0 20px rgba(0,255,255,0.2),
        0 0 60px rgba(0,255,255,0.1),
        inset 0 0 20px rgba(0,255,255,0.05);
}

/* --- Overlays --- */
.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(4px);
    gap: 14px;
    padding: 20px;
    z-index: 10;
}
.overlay.hidden { display: none; }

.overlay h1 {
    font-size: clamp(1.2rem, 4vw, 2.2rem);
    color: #0ff;
    text-shadow: 0 0 10px rgba(0,255,255,0.8), 0 0 30px rgba(0,255,255,0.4);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 4px;
}

.overlay p {
    font-size: clamp(0.5rem, 1.5vw, 0.7rem);
    color: #aaa;
    text-align: center;
    line-height: 1.8;
    max-width: 90%;
}

.overlay button {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.55rem, 1.6vw, 0.8rem);
    padding: 14px 28px;
    background: transparent;
    border: 2px solid #0ff;
    color: #0ff;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 2px;
    min-width: 200px;
}
.overlay button:hover {
    background: rgba(0,255,255,0.15);
    box-shadow: 0 0 15px rgba(0,255,255,0.3), inset 0 0 15px rgba(0,255,255,0.1);
    transform: scale(1.05);
}
.overlay button:active {
    transform: scale(0.98);
    background: rgba(0,255,255,0.25);
}

.btn-back {
    border-color: #555 !important;
    color: #555 !important;
    margin-top: 8px;
    min-width: 150px !important;
    font-size: clamp(0.45rem, 1.2vw, 0.6rem) !important;
}
.btn-back:hover {
    border-color: #999 !important;
    color: #999 !important;
    box-shadow: 0 0 10px rgba(153,153,153,0.2) !important;
}

/* Peer ID display */
#peer-id-display {
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: #0f0;
    background: rgba(0,255,0,0.08);
    border: 1px solid rgba(0,255,0,0.3);
    padding: 12px 20px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0,255,0,0.5);
    user-select: all;
    cursor: pointer;
    word-break: break-all;
    text-align: center;
    max-width: 90%;
}

#btn-copy-id {
    font-size: clamp(0.4rem, 1vw, 0.55rem) !important;
    min-width: 150px !important;
    border-color: #0f0 !important;
    color: #0f0 !important;
}
#btn-copy-id:hover {
    background: rgba(0,255,0,0.15) !important;
    box-shadow: 0 0 15px rgba(0,255,0,0.3) !important;
}

#join-id-input {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.55rem, 1.4vw, 0.75rem);
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(0,255,255,0.4);
    color: #fff;
    text-align: center;
    width: min(350px, 90%);
    outline: none;
    transition: border-color 0.2s;
}
#join-id-input:focus {
    border-color: #0ff;
    box-shadow: 0 0 15px rgba(0,255,255,0.2);
}
#join-id-input::placeholder { color: #444; }

#final-score {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #fff;
    margin: 8px 0 16px;
}

#host-status, #join-status {
    font-size: clamp(0.4rem, 1.1vw, 0.55rem);
    min-height: 1.5em;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.waiting { animation: pulse 1.5s ease-in-out infinite; }

@media (hover: none) and (pointer: coarse) {
    .overlay button { padding: 18px 32px; min-width: 240px; }
}
