:root { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: #000;
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #fff;
}

#gameCanvas {
    display: block;
    position: fixed;
    inset: 0;
}

/* ---- Overlays ---- */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 9, 22, 0.90);
    backdrop-filter: blur(6px);
    z-index: 10;
}
.overlay.hidden { display: none; }

/* ---- Lobby ---- */
.lobby-inner {
    text-align: center;
    width: min(860px, 92vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.lobby-inner h1 {
    font-size: clamp(2.4rem, 4.5vw, 4rem);
    font-weight: 900;
    letter-spacing: 2px;
    color: #00e5ff;
    text-shadow: 0 0 30px #00e5ffaa, 0 0 60px #00e5ff44;
}

#qr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#qr-img {
    width: clamp(150px, 16vw, 220px);
    height: auto;
    border-radius: 14px;
    border: 3px solid #00e5ff;
    box-shadow: 0 0 24px #00e5ff55;
}

#qr-url {
    font-size: clamp(0.7rem, 1.1vw, 0.95rem);
    color: #6ab8c8;
    word-break: break-all;
    max-width: 280px;
}

#player-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    min-height: 52px;
}

.player-card {
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid currentColor;
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    font-weight: 700;
    min-width: 110px;
    text-align: center;
    opacity: 0.55;
    transition: opacity 0.3s, box-shadow 0.3s;
}
.player-card.ready {
    opacity: 1;
    box-shadow: 0 0 18px currentColor;
}
.player-card .status-tag {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    margin-top: 3px;
    opacity: 0.8;
}

#lobby-hint {
    font-size: clamp(0.9rem, 1.5vw, 1.15rem);
    color: #7aaec0;
}

/* ---- Countdown ---- */
#countdown-num {
    font-size: clamp(9rem, 20vw, 17rem);
    font-weight: 900;
    color: #00e5ff;
    text-shadow: 0 0 60px #00e5ff, 0 0 120px #00e5ff66;
    animation: countPulse 0.85s ease-out both;
}
@keyframes countPulse {
    0%   { transform: scale(1.5); opacity: 0; }
    35%  { transform: scale(1);   opacity: 1; }
    85%  { transform: scale(0.95); opacity: 1; }
    100% { transform: scale(0.88); opacity: 0; }
}

/* ---- Game Over ---- */
#gameover-ov {
    flex-direction: column;
    gap: 22px;
}

#go-title {
    font-size: clamp(2rem, 4vw, 3.4rem);
    font-weight: 900;
    color: #ff4081;
    text-shadow: 0 0 24px #ff408199;
}

#final-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(500px, 88vw);
}

.score-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: clamp(1rem, 1.6vw, 1.2rem);
}
.score-row .place {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    min-width: 38px;
}
.score-row .sname {
    flex: 1;
    font-weight: 700;
}
.score-row .sval {
    color: #ffd740;
    font-weight: 700;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
}

#btn-again {
    padding: 14px 48px;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    font-weight: 700;
    background: rgba(0, 229, 255, 0.1);
    color: #00e5ff;
    border: 2px solid #00e5ff;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}
#btn-again:hover {
    background: rgba(0, 229, 255, 0.22);
    box-shadow: 0 0 24px #00e5ff55;
}
