/* ═══════════════════════════════════════════════════════════
   SalaGiochi — Core: modale nickname + badge giocatore
   Caricato automaticamente da sg-core.js
   ═══════════════════════════════════════════════════════════ */

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

/* ── Overlay nickname ─────────────────────────────────────── */
.sg-nick-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(ellipse at center, rgba(20, 6, 45, 0.92), rgba(4, 1, 12, 0.97));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    animation: sg-fade-in 0.25s ease;
}

@keyframes sg-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sg-nick-box {
    width: min(420px, 100%);
    padding: 30px 26px 24px;
    border-radius: 18px;
    text-align: center;
    background: linear-gradient(150deg, rgba(30, 12, 60, 0.96), rgba(12, 4, 28, 0.96));
    border: 1px solid rgba(123, 44, 191, 0.55);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 70px rgba(123, 44, 191, 0.22);
    animation: sg-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sg-pop {
    from { transform: translateY(14px) scale(0.94); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.sg-nick-icon {
    font-size: 2.6rem;
    line-height: 1;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 14px rgba(192, 132, 252, 0.6));
}

.sg-nick-box h2 {
    margin: 0 0 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.82rem;
    line-height: 1.6;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 0 16px rgba(192, 132, 252, 0.55);
}

.sg-nick-box p {
    margin: 0 0 18px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #b9a7d6;
}

#sgNickInput,
#sgPassInput {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    border-radius: 10px;
    border: 1px solid rgba(123, 44, 191, 0.6);
    background: rgba(0, 0, 0, 0.45);
    color: #ffd700;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#sgNickInput:disabled {
    opacity: 0.55;
    color: #b9a7d6;
}

#sgPassInput {
    margin-top: 10px;
    color: #fff;
    /* La password si scrive com'è: nessuna maiuscola forzata dallo stile */
    text-transform: none;
    letter-spacing: 3px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 1rem;
}

.sg-vedi {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 9px;
    font-size: 0.76rem;
    color: #b9a7d6;
    cursor: pointer;
    user-select: none;
}

.sg-vedi input {
    accent-color: #c084fc;
    cursor: pointer;
}

#sgNickInput:focus,
#sgPassInput:focus {
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.18), 0 0 24px rgba(192, 132, 252, 0.25);
}

#sgNickInput::placeholder {
    color: #4b3b6b;
    letter-spacing: 2px;
}

.sg-nick-err {
    min-height: 18px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #ff5c7a;
}

.sg-nick-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.sg-nick-btn {
    flex: 1;
    padding: 13px 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    letter-spacing: 1px;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.sg-nick-ok {
    color: #14032b;
    background: linear-gradient(135deg, #ffd700, #ff9f1c);
    box-shadow: 0 6px 20px rgba(255, 190, 40, 0.3);
}

.sg-nick-ok:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.sg-nick-cancel {
    color: #cbb8e8;
    background: rgba(123, 44, 191, 0.22);
    border: 1px solid rgba(123, 44, 191, 0.45);
}

.sg-nick-cancel:hover {
    background: rgba(123, 44, 191, 0.35);
}

/* ── Badge giocatore (banner di navigazione e hub) ────────── */
.sg-player {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.35);
    background: rgba(255, 215, 0, 0.08);
    color: #ffd700;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    letter-spacing: 1px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, box-shadow 0.2s;
}

.sg-player:hover {
    background: rgba(255, 215, 0, 0.18);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.22);
}

.sg-player .sg-player-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00e676;
    box-shadow: 0 0 8px #00e676;
}

.sg-player.sg-offline .sg-player-dot {
    background: #ff5c7a;
    box-shadow: 0 0 8px #ff5c7a;
}

@media (max-width: 640px) {
    .sg-player {
        font-size: 0.5rem;
        padding: 4px 7px;
    }

    .sg-nick-box h2 {
        font-size: 0.7rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   TELEFONO
   Sul touch il browser interpreta da solo: una strisciata la
   legge come scorrimento, due tocchi vicini come ingrandimento.
   Qui gli si toglie quel diritto sulle superfici di gioco, e
   glielo si lascia su tutto il resto della pagina.
   ═══════════════════════════════════════════════════════════ */

html, body {
    /* niente rimbalzo di fine pagina ne' trascina-per-ricaricare */
    overscroll-behavior: none;
}

/* Il campo da gioco: il tocco lo gestisce il gioco, non il browser */
canvas,
[data-sg-gioco] {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* I comandi restano toccabili, ma senza l'attesa dei 300 ms
   con cui il browser aspetta di capire se e' un doppio tocco */
button,
.btn,
a,
[role="button"],
.sg-player,
.sg-nick-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Bersagli grandi abbastanza da centrarli col pollice */
@media (pointer: coarse) {
    button,
    .btn,
    .sg-nick-btn {
        min-height: 44px;
    }
}
