/* Generale */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #050b1f;
    text-align: center;
    color: #ecf0f1;
    margin: 0;
    padding: 8px;
    box-sizing: border-box;
    overflow-x: hidden;
}

.schermata-login-iniziale[hidden] {
    display: none;
}

.schermata-login-iniziale {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 0;
    background: #080d25;
}

.login-iniziale-form {
    position: relative;
    width: min(420px, calc((100vh - 18px) * 768 / 1318), calc(100vw - 12px));
    aspect-ratio: 768 / 1318;
    z-index: 2;
    padding: 0;
    border: 2px solid rgba(113, 239, 255, 0.72);
    border-radius: 14px;
    background: #080d25 url("images/login.png") center / contain no-repeat;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    text-align: left;
    pointer-events: none;
}

@supports (height: 100svh) {
    .login-iniziale-form {
        width: min(420px, calc((100svh - 18px) * 768 / 1318), calc(100vw - 12px));
    }
}

.login-iniziale-form h1 {
    display: none;
}

.login-iniziale-form label:not(.ricordami-autenticazione) {
    display: none;
}

.login-iniziale-form input[type="email"],
.login-iniziale-form input[type="password"],
.login-iniziale-form input[type="text"] {
    position: absolute;
    left: 26%;
    width: 48%;
    height: 6.2%;
    padding: 0;
    border: 0;
    border-radius: 20px;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: clamp(0.68rem, 3vw, 0.85rem);
    line-height: normal;
    text-align: center;
    pointer-events: auto;
    caret-color: #fff;
}

#login-iniziale-email {
    top: 31.5%;
}

#login-iniziale-password {
    top: 39.5%;
}

.login-iniziale-form .campo-login-username {
    display: none;
}

.login-iniziale-form .btn-login-iniziale,
.login-iniziale-form .btn-cambia-login-iniziale,
.login-iniziale-form .btn-ospite-login-iniziale {
    position: absolute;
    left: 26%;
    width: 48%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    cursor: pointer;
    pointer-events: auto;
}

.btn-login-iniziale {
    top: 53%;
    height: 8.5%;
}

/* Posizioni in percentuale di images/login.png (768x1318): ogni area copre il disegno corrispondente
   senza toccare le icone sotto (Google, Facebook, ospite al 68,7%). */
.login-iniziale-form .btn-cambia-login-iniziale {
    top: 62.5%;
    left: 34.9%;
    width: 30.2%;
    height: 4%;
}

.btn-ospite-login-iniziale {
    top: 73%;
    height: 4%;
}

#login-iniziale-messaggio {
    position: absolute;
    left: 24%;
    top: 78%;
    width: 52%;
    margin: 0;
    color: #fff;
    font-size: 0.68rem;
    text-align: center;
    text-shadow: 0 1px 3px #000;
}

.btn-social-iniziale {
    position: absolute;
    top: 68%;
    width: 7%;
    height: 4.6%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    pointer-events: auto;
    cursor: pointer;
}

.btn-social-google {
    left: 38.2%;
}

.btn-social-facebook {
    left: 46.5%;
}

.btn-social-ospite {
    left: 54.9%;
}

.login-iniziale-form .ricordami-autenticazione {
    position: absolute;
    top: 45.5%;
    left: 27%;
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    color: transparent;
    font-size: 0;
    pointer-events: auto;
}

.login-iniziale-form .ricordami-autenticazione input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: #5edfff;
}

.btn-password-dimenticata {
    position: absolute;
    top: 46%;
    left: 56%;
    width: 20%;
    height: 3%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    pointer-events: auto;
    cursor: pointer;
}

*, *::before, *::after {
    box-sizing: inherit;
}

h1 {
    color: #ecf0f1;
    margin: 0 0 8px;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.menu-principale {
    margin: 0 auto 12px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.menu-principale button {
    background: linear-gradient(135deg, #2f89c6, #1f78c1);
    border: 1px solid rgba(214, 236, 255, 0.6);
    box-shadow: 0 4px 12px rgba(31, 120, 193, 0.35);
}

.menu-principale button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

#schermata-setup,
#schermata-deck {
    width: min(1100px, 96vw);
    margin: 0 auto;
}

#schermata-setup.setup-home-mode {
    width: min(420px, calc(100vw - 12px));
}

.schermata-secondaria {
    background: linear-gradient(160deg, rgba(31, 51, 74, 0.96), rgba(19, 33, 49, 0.95));
    border: 2px solid rgba(241, 196, 15, 0.7);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    padding: 16px;
    color: #ecf0f1;
}

.home-menu-cinematico {
    position: relative;
    min-height: calc(100vh - 18px);
    height: calc(100vh - 18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 14px 14px 20px;
    overflow: hidden;
    border-color: rgba(113, 239, 255, 0.7);
    background: #070f2a;
}

@supports (height: 100svh) {
    .home-menu-cinematico {
        min-height: calc(100svh - 18px);
        height: calc(100svh - 18px);
    }
}

.home-menu-cinematico::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("images/menu-home-bg.png") center center / cover no-repeat;
    z-index: 0;
    filter: saturate(1.05) brightness(0.92);
}

.home-menu-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at 50% 0%, rgba(129, 72, 248, 0.22) 0%, rgba(6, 10, 30, 0.06) 36%, rgba(6, 9, 24, 0.5) 100%);
    pointer-events: none;
}

.home-avatar-mini {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 6px 10px;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid rgba(131, 236, 255, 0.8);
    background: rgba(11, 29, 58, 0.72);
    box-shadow: 0 0 12px rgba(63, 203, 255, 0.45);
    color: #ecf0f1;
    cursor: pointer;
}

.home-avatar-mini:hover {
    filter: brightness(1.15);
    transform: scale(1.04);
}

.btn-autenticazione {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 7px 10px;
    border: 1px solid rgba(157, 244, 255, 0.85);
    border-radius: 9px;
    background: rgba(11, 35, 72, 0.82);
    color: #e9fbff;
    font-size: 0.68rem;
    font-weight: 900;
    box-shadow: 0 0 11px rgba(63, 203, 255, 0.4);
}

.btn-autenticazione:hover {
    filter: brightness(1.15);
}

.popup-autenticazione[hidden] {
    display: none;
}

.popup-autenticazione {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 7, 24, 0.86);
}

.popup-autenticazione.schermata-accesso-iniziale {
    background: #080d25 url("images/login.png") center / cover no-repeat;
}

.popup-autenticazione.schermata-accesso-iniziale .popup-info-chiudi {
    display: none;
}

.popup-autenticazione > .popup-info-overlay {
    background: rgba(2, 7, 24, 0.18);
    backdrop-filter: none;
}

.autenticazione-form {
    position: relative;
    z-index: 1;
    width: min(390px, 100%);
    padding: 24px 20px 18px;
    border: 2px solid rgba(151, 241, 255, 0.9);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(26, 57, 103, 0.55), rgba(27, 37, 91, 0.48));
    box-shadow: 0 0 28px rgba(54, 214, 255, 0.5), inset 0 0 24px rgba(206, 246, 255, 0.1);
    backdrop-filter: blur(2px);
    text-align: left;
}

.autenticazione-form h2 {
    margin: 0 0 10px;
    color: #ffe28c;
    font-size: 1.2rem;
    text-align: center;
}

.autenticazione-form label {
    display: block;
    margin: 10px 0 5px;
    color: #d9f7ff;
    font-size: 0.78rem;
    font-weight: 900;
}

.autenticazione-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #8feaff;
    border-radius: 8px;
    background: rgba(4, 18, 45, 0.8);
    color: #fff;
    font-size: 1rem;
}

.messaggio-autenticazione {
    min-height: 18px;
    margin: 0;
    color: #bcefff;
    font-size: 0.72rem;
    text-align: center;
}

.btn-cambia-autenticazione {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: transparent;
    color: #bcefff;
    font-size: 0.72rem;
    text-decoration: underline;
}

.ricordami-autenticazione {
    display: flex !important;
    align-items: center;
    gap: 7px;
    margin: 10px 0 0 !important;
    color: #d9f7ff;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
}

.ricordami-autenticazione input {
    width: 17px;
    height: 17px;
    accent-color: #49c9f1;
}

.btn-ospite-autenticazione {
    width: 100%;
    margin-top: 8px;
    padding: 9px;
    border: 1px solid rgba(157, 244, 255, 0.72);
    border-radius: 9px;
    background: rgba(9, 28, 65, 0.55);
    color: #d8f7ff;
    font-size: 0.72rem;
    font-weight: 900;
}

.pannello-setup.profilo-menu-cinematico {
    position: relative;
    width: min(420px, calc(100vw - 12px));
    min-height: calc(100vh - 18px);
    height: calc(100vh - 18px);
    margin: 0 auto;
    padding: 24px 18px 82px;
    overflow: hidden;
    border-color: rgba(113, 239, 255, 0.72);
    background-color: #080d25 !important;
    background-image: url("images/menu-home-bg.png") !important;
    background-position: center !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
}

.pannello-setup.profilo-menu-cinematico::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: url("images/menu-home-bg.png") center / cover no-repeat;
    filter: saturate(1.05) brightness(0.92);
}

.profilo-menu-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(4, 9, 25, 0.12), rgba(4, 9, 25, 0.38));
    pointer-events: none;
}

.profilo-intestazione,
.profilo-card-giocatore,
.profilo-statistiche,
.btn-profilo-modifica,
.btn-profilo-indietro {
    position: relative;
    z-index: 1;
}

.profilo-intestazione,
.profilo-card-giocatore,
.profilo-statistiche,
.btn-profilo-modifica {
    transform: none;
}

.profilo-intestazione {
    margin-top: 34px;
}

.profilo-intestazione {
    display: flex;
    flex-direction: column;
    line-height: 0.95;
    text-transform: uppercase;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.9);
}

.profilo-intestazione span {
    color: #d8f7ff;
    font-size: clamp(2rem, 10vw, 2.8rem);
    font-weight: 900;
}

.profilo-intestazione strong {
    color: #ffe49d;
    font-size: clamp(1.8rem, 8vw, 2.35rem);
}

.profilo-intestazione h2 {
    margin: 8px 0 0;
    color: #c8f5ff;
    font-size: clamp(1.25rem, 5.5vw, 1.7rem);
}

.profilo-card-giocatore {
    margin: 10px auto 8px;
    width: 124px;
    padding: 7px;
    border: 2px solid rgba(130, 238, 255, 0.85);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(54, 151, 211, 0.65), rgba(40, 43, 108, 0.8));
    box-shadow: 0 0 18px rgba(53, 220, 255, 0.55), inset 0 0 14px rgba(215, 252, 255, 0.2);
}

.profilo-avatar {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 7px;
    border: 3px solid #c8f8ff;
    border-radius: 50%;
    background: radial-gradient(circle, #3fc5ee, #273a91);
    font-size: 2.7rem;
}

.profilo-card-giocatore h3 {
    margin: 0;
    color: #fff;
    font-size: 0.92rem;
}

.profilo-livello {
    color: #ffe16e;
    font-size: 0.68rem;
    font-weight: 900;
}

.profilo-statistiche {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 8px 0;
}

.profilo-statistiche div {
    padding: 6px 3px;
    border: 1px solid rgba(134, 226, 255, 0.55);
    border-radius: 8px;
    background: rgba(8, 28, 65, 0.72);
}

.profilo-statistiche strong,
.profilo-statistiche span {
    display: block;
}

.profilo-statistiche strong {
    color: #fff;
    font-size: 1.15rem;
}

.profilo-statistiche span {
    color: #a8e8f7;
    font-size: 0.55rem;
    font-weight: 900;
}

.profilo-tabella {
    position: relative;
    z-index: 1;
    width: min(350px, 100%);
    margin: 6px auto 0;
    padding: 6px 10px;
    border: 1px solid rgba(135, 229, 255, 0.58);
    border-radius: 10px;
    background: rgba(7, 25, 61, 0.72);
    box-shadow: inset 0 0 13px rgba(94, 216, 255, 0.12);
    text-align: left;
}

.profilo-tabella h3 {
    margin: 0 0 5px;
    color: #aeefff;
    font-size: 0.72rem;
    text-align: center;
    text-shadow: 0 2px 4px #000;
}

.profilo-tabella div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    border-top: 1px solid rgba(174, 239, 255, 0.18);
    color: #d8f7ff;
    font-size: 0.65rem;
}

.profilo-tabella strong {
    color: #fff;
    text-align: right;
}

.profilo-progressi {
    margin-top: 6px;
}

.btn-profilo-modifica {
    width: min(290px, 100%);
    margin: 12px auto;
    padding: 12px;
    border: 2px solid rgba(155, 244, 255, 0.9);
    border-radius: 12px;
    background: linear-gradient(90deg, #298fce, #5448b8);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 900;
    box-shadow: 0 0 15px rgba(63, 215, 255, 0.55);
}

.btn-profilo-indietro {
    position: absolute;
    left: 20px;
    bottom: 18px;
    width: 60px;
    height: 60px;
    padding: 0 2px 5px 0;
    border: 3px solid rgba(157, 244, 255, 0.95);
    border-radius: 50%;
    background: radial-gradient(circle at 32% 25%, rgba(209, 249, 255, 0.7), rgba(53, 177, 221, 0.9) 45%, rgba(41, 86, 176, 0.94));
    color: #f2fcff;
    font-size: 2.2rem;
}

.popup-modifica-profilo[hidden] {
    display: none;
}

.popup-modifica-profilo {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 18px;
}

.profilo-form {
    position: relative;
    z-index: 1;
    width: min(330px, 100%);
    padding: 20px 16px 16px;
    border: 2px solid rgba(151, 241, 255, 0.9);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(21, 65, 105, 0.98), rgba(32, 35, 91, 0.98));
    box-shadow: 0 0 28px rgba(54, 214, 255, 0.6);
    text-align: left;
}

.profilo-form h2 {
    margin: 0 0 16px;
    color: #ffe28c;
    font-size: 1.15rem;
    text-align: center;
}

.profilo-form label,
.profilo-form-label {
    display: block;
    margin: 10px 0 5px;
    color: #d9f7ff;
    font-size: 0.78rem;
    font-weight: 900;
}

.profilo-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #8feaff;
    border-radius: 8px;
    background: rgba(4, 18, 45, 0.8);
    color: #fff;
    font-size: 1rem;
}

.scelta-avatar {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}

.scelta-avatar button {
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 2px solid rgba(140, 231, 255, 0.55);
    border-radius: 10px;
    background: rgba(7, 31, 75, 0.8);
    font-size: 1.55rem;
}

.scelta-avatar button.avatar-selezionato {
    border-color: #ffe05e;
    background: linear-gradient(145deg, #3ac8ec, #4352ba);
    box-shadow: 0 0 12px rgba(255, 224, 94, 0.65);
}

.btn-salva-profilo {
    width: 100%;
    margin-top: 17px;
    padding: 10px;
    border: 2px solid #9df4ff;
    border-radius: 9px;
    background: linear-gradient(90deg, #2aa9dd, #5750c5);
    color: #fff;
    font-weight: 900;
}

/* Eliminazione dell'account: in fondo a MODIFICA PROFILO, poco in vista ma sempre raggiungibile. */
.btn-elimina-account {
    display: block;
    margin: 14px auto 0;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #ff8a8a;
    font-size: 0.72rem;
    text-decoration: underline;
    cursor: pointer;
}

.btn-elimina-account[hidden] {
    display: none;
}

/* Ospite che salva i progressi con Google o Facebook (popup-autenticazione). */
.collega-social-ospite {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    color: #bcefff;
    font-size: 0.72rem;
}

.collega-social-ospite[hidden] {
    display: none;
}

.collega-social-ospite span {
    width: 100%;
    text-align: center;
}

.btn-collega-social {
    flex: 1;
    padding: 8px;
    border: 1px solid #9df4ff;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

/* Link alla privacy policy (privacy.html) in Modifica profilo e nella registrazione. */
.link-privacy {
    margin: 10px 0 0;
    color: #a9bfdc;
    font-size: 0.68rem;
    text-align: center;
}

.link-privacy a {
    color: #9df4ff;
}

.testo-elimina-account {
    margin: 4px 0 12px;
    color: #d8ecff;
    font-size: 0.8rem;
    line-height: 1.4;
}

.btn-salva-profilo.btn-conferma-elimina {
    border-color: #ff9a9a;
    background: linear-gradient(90deg, #d33a3a, #8f1f4f);
}

.btn-conferma-elimina:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.home-logo-gioco {
    z-index: 1;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 1px;
}

.home-logo-gioco span:first-child {
    font-size: clamp(2.1rem, 8vw, 2.7rem);
    color: #a4dcff;
    text-shadow: 0 0 10px rgba(131, 236, 255, 0.78), 0 0 24px rgba(131, 236, 255, 0.42);
}

.home-logo-gioco span:last-child {
    font-size: clamp(1.9rem, 7vw, 2.35rem);
    color: #ffe29a;
    text-shadow: 0 0 10px rgba(255, 205, 114, 0.8), 0 0 24px rgba(255, 205, 114, 0.4);
}

.home-bottoni-verticali {
    z-index: 1;
    width: min(308px, 66%);
    margin-top: 0;
    margin-bottom: 0;
    position: absolute;
    left: 50%;
    bottom: clamp(84px, 13.5vh, 132px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.btn-home-neon {
    position: relative;
    width: 100%;
    min-height: 59px;
    margin-top: 0;
    padding: 7px 14px;
    border-radius: 16px;
    border: 2px solid rgba(156, 241, 255, 0.88);
    background: linear-gradient(90deg, rgba(76, 168, 241, 0.72) 0%, rgba(88, 73, 178, 0.78) 100%);
    color: #ecf8ff;
    display: grid;
    grid-template-columns: 35px 1fr 40px;
    align-items: center;
    gap: 8px;
    font-size: clamp(0.98rem, 3.2vw, 1.18rem);
    font-family: "Arial Black", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 900;
    letter-spacing: 0.8px;
    text-shadow: 0 2px 0 rgba(5, 22, 46, 0.75), 0 0 8px rgba(132, 232, 255, 0.4);
    box-shadow: 0 0 14px rgba(73, 193, 255, 0.46), 0 0 24px rgba(162, 103, 255, 0.28), inset 0 0 15px rgba(210, 247, 255, 0.2);
}

.btn-home-neon::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 18px;
    border: 1px solid rgba(227, 251, 255, 0.42);
    pointer-events: none;
}

.btn-home-neon::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 6px;
    height: 46%;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(245, 252, 255, 0.34), rgba(245, 252, 255, 0));
    pointer-events: none;
}

.btn-home-neon .btn-home-icona,
.btn-home-neon .btn-home-icona-destra {
    font-size: 1.12rem;
    line-height: 1;
    text-shadow: 0 0 12px rgba(102, 225, 255, 0.55);
}

.btn-home-neon .btn-home-icona {
    justify-self: center;
}

.btn-home-neon .btn-home-testo {
    justify-self: center;
    white-space: nowrap;
    line-height: 1;
}

.btn-home-neon .btn-home-icona-destra {
    justify-self: center;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.86rem;
    border: 2px solid rgba(180, 243, 255, 0.85);
    background: radial-gradient(circle at 30% 25%, rgba(206, 248, 255, 0.45), rgba(129, 88, 236, 0.8));
}

.btn-home-neon:not(.btn-home-gioca):not(.btn-home-deck) {
    grid-template-columns: 35px 1fr;
}

.btn-home-gioca,
.btn-home-deck {
    border-color: rgba(255, 172, 243, 0.9);
    box-shadow: 0 0 18px rgba(209, 111, 255, 0.4), 0 0 26px rgba(101, 203, 255, 0.44), inset 0 0 16px rgba(236, 252, 255, 0.24);
}

.pannello-setup.play-menu-cinematico {
    position: relative;
    width: min(420px, calc(100vw - 12px));
    min-height: calc(100vh - 18px);
    height: calc(100vh - 18px);
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border-color: rgba(113, 239, 255, 0.7);
    background: #070f2a url("images/menu_gioca.png") center / cover no-repeat;
}

@supports (height: 100svh) {
    .pannello-setup.play-menu-cinematico {
        min-height: calc(100svh - 18px);
        height: calc(100svh - 18px);
    }
}

.play-menu-contenuto,
.play-menu-overlay {
    position: absolute;
    inset: 0;
}

.play-menu-overlay {
    background: linear-gradient(180deg, rgba(5, 10, 31, 0.42) 0%, rgba(5, 10, 31, 0.04) 36%, rgba(5, 10, 31, 0.62) 100%);
    pointer-events: none;
}

.play-logo-gioco,
.play-bottoni-menu {
    position: absolute;
    z-index: 1;
}

.play-logo-gioco {
    top: clamp(22px, 6vh, 54px);
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(131, 236, 255, 0.78), 0 0 24px rgba(131, 236, 255, 0.42);
}

.play-logo-gioco span:first-child { font-size: clamp(2rem, 9vw, 2.7rem); color: #a4dcff; }
.play-logo-gioco span:last-child { font-size: clamp(1.75rem, 7.8vw, 2.35rem); color: #ffe29a; }

.play-bottoni-menu {
    left: 50%;
    bottom: clamp(42px, 6vh, 82px);
    width: min(350px, 92%);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.play-bottoni-menu .btn-home-neon {
    min-height: 64px;
    margin: 0;
    padding: 7px 8px;
    border-radius: 12px;
    grid-template-columns: 26px 1fr 26px;
    font-size: clamp(0.72rem, 3.5vw, 0.94rem);
}

.play-bottoni-menu .btn-home-neon:not(.btn-home-gioca),
.play-bottoni-menu .btn-home-deck {
    grid-template-columns: 26px 1fr;
}

.btn-torna-menu-gioca {
    margin-top: 14px;
}

#selettore-modalita {
    position: absolute;
    inset: 0;
    padding: 16px;
    background: linear-gradient(180deg, rgba(5, 10, 31, 0.35) 0%, rgba(5, 10, 31, 0.1) 42%, rgba(5, 10, 31, 0.7) 100%);
}

#selettore-modalita .griglia-modalita {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(350px, calc(100% - 32px));
    transform: translateX(-50%);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 11px;
}

#selettore-modalita .btn-modalita {
    position: relative;
    min-height: 59px;
    margin: 0;
    padding: 7px 14px;
    grid-template-columns: 35px minmax(0, 1fr);
    text-align: initial;
}

#selettore-modalita .btn-modalita .btn-home-testo {
    max-width: 100%;
    white-space: normal;
    font-size: clamp(0.82rem, 3.4vw, 1rem);
    line-height: 1.08;
}

#selettore-modalita .modalita-classificata {
    background: linear-gradient(90deg, rgba(232, 168, 40, 0.88), rgba(176, 82, 196, 0.88));
}

#selettore-modalita .modalita-amico {
    background: linear-gradient(90deg, rgba(255, 150, 70, 0.84), rgba(214, 72, 160, 0.88));
}

#selettore-modalita .modalita-amichevole {
    background: linear-gradient(90deg, rgba(70, 183, 255, 0.84), rgba(180, 88, 248, 0.88));
}

#selettore-modalita .modalita-allenamento {
    background: linear-gradient(90deg, rgba(42, 172, 167, 0.84), rgba(65, 114, 221, 0.88));
}

#selettore-modalita .btn-modalita:disabled {
    opacity: 0.68;
    cursor: not-allowed;
}

#selettore-modalita .btn-torna-menu-gioca {
    position: absolute;
    z-index: 1;
    left: 24px;
    bottom: 24px;
    transform: none;
    margin: 0;
    width: 62px;
    height: 62px;
    padding: 0 2px 5px 0;
    border: 3px solid rgba(157, 244, 255, 0.95);
    border-radius: 50%;
    background: radial-gradient(circle at 32% 25%, rgba(209, 249, 255, 0.7), rgba(53, 177, 221, 0.9) 45%, rgba(41, 86, 176, 0.94));
    box-shadow: 0 0 16px rgba(61, 220, 255, 0.7), inset 0 0 14px rgba(223, 253, 255, 0.48);
    color: #f2fcff;
    font-size: 2.3rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 3px rgba(3, 20, 42, 0.85);
}

#selettore-modalita .btn-torna-menu-gioca:hover {
    filter: brightness(1.12);
    transform: scale(1.06);
}

#selettore-modalita .btn-torna-menu-gioca:active {
    transform: scale(0.96);
}

#selettore-modalita .btn-deck-modalita {
    position: absolute;
    z-index: 1;
    right: 24px;
    bottom: 24px;
    width: 78px;
    height: 62px;
    padding: 3px 4px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    border: 3px solid rgba(157, 244, 255, 0.95);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(88, 212, 255, 0.92), rgba(70, 78, 191, 0.94));
    box-shadow: 0 0 16px rgba(61, 220, 255, 0.7), inset 0 0 14px rgba(223, 253, 255, 0.48);
    color: #f2fcff;
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 2px 3px rgba(3, 20, 42, 0.85);
}

#selettore-modalita .btn-deck-modalita-icona {
    font-size: 1.7rem;
    line-height: 1;
}

#selettore-modalita .btn-deck-modalita:hover {
    filter: brightness(1.12);
    transform: scale(1.06);
}

body.modalita-selettore-attivo .menu-principale,
body.modalita-selettore-attivo #titolo-app {
    display: none;
}

.btn-home-gioca {
    background: linear-gradient(90deg, rgba(70, 183, 255, 0.84) 0%, rgba(180, 88, 248, 0.88) 100%);
}

.btn-home-deck {
    background: linear-gradient(90deg, rgba(73, 156, 238, 0.82) 0%, rgba(167, 73, 198, 0.84) 100%);
}

.btn-home-neon:hover {
    transform: translateY(-1px) scale(1.01);
}

.btn-home-neon:active {
    transform: translateY(0) scale(0.99);
}

.home-nota-prossima {
    display: none;
}

body.home-menu-attivo #titolo-app,
body.home-menu-attivo .menu-principale {
    display: none;
}

.contenitore-deck {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 120px;
    border: 2px dashed #e67e22;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.lista-carte-deck {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.schermata-deck-artistica {
    position: relative;
    width: min(420px, calc(100vw - 12px)) !important;
    min-height: calc(100vh - 18px);
    height: calc(100vh - 18px);
    margin: 0 auto;
    padding: 18px 12px 78px;
    overflow: hidden;
    border-color: rgba(113, 239, 255, 0.72);
    background-color: #080d25;
    background-image: url("images/menu-deck.png"), url("images/menu_gioca.png");
    background-position: center, center;
    background-size: cover, cover;
    background-repeat: no-repeat;
}

@supports (height: 100svh) {
    .schermata-deck-artistica {
        min-height: calc(100svh - 18px);
        height: calc(100svh - 18px);
    }
}

.deck-menu-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 9, 25, 0.2), rgba(4, 9, 25, 0.72));
    pointer-events: none;
}

.deck-intestazione,
.deck-layout,
.btn-deck-indietro {
    position: relative;
    z-index: 1;
}

.deck-intestazione {
    display: flex;
    align-items: center;
    flex-direction: column;
    line-height: 1;
    text-transform: uppercase;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.9), 0 0 14px rgba(106, 224, 255, 0.45);
}

.deck-intestazione strong {
    color: #c8f5ff;
    font-size: clamp(1rem, 4.5vw, 1.25rem);
    letter-spacing: 0.5px;
}

.deck-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: calc(100% - 52px);
    margin-top: 10px;
}

.deck-pannello-attivo,
.deck-pannello-collezione {
    min-width: 0;
    padding: 8px 7px;
    border: 1px solid rgba(137, 229, 255, 0.45);
    border-radius: 12px;
    background: rgba(8, 23, 52, 0.38);
    box-shadow: inset 0 0 18px rgba(92, 214, 255, 0.1);
}

.deck-pannello-attivo h2,
.deck-pannello-collezione h2 {
    margin: 0;
    color: #dffaff;
    font-size: 0.82rem;
    text-transform: uppercase;
    text-shadow: 0 2px 5px #000;
}

.deck-contatore {
    margin: 4px 0 8px;
    color: #b7e9f5;
    font-size: 0.75rem;
}

.deck-contatore span {
    color: #ffe076;
    font-weight: 900;
}

.schermata-deck-artistica .contenitore-deck,
.schermata-deck-artistica .lista-carte-deck {
    min-height: 0;
    height: calc(100% - 36px);
    margin: 0;
    padding: 5px 2px;
    align-content: start;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(116, 231, 255, 0.8) transparent;
}

.schermata-deck-artistica .contenitore-deck {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 7px;
    border: 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.schermata-deck-artistica .lista-carte-deck {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.deck-pannello-attivo {
    flex: 0 0 132px;
    min-height: 132px;
    background: linear-gradient(180deg, rgba(28, 71, 107, 0.72), rgba(8, 24, 55, 0.62));
}

.deck-pannello-collezione {
    flex: 1 1 auto;
    min-height: 0;
    background: rgba(8, 20, 48, 0.52);
}

.schermata-deck-artistica .contenitore-deck {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    height: 96px;
    gap: 6px;
    overflow: hidden;
    background-color: rgba(4, 15, 38, 0.36);
    background-image:
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0),
        linear-gradient(rgba(132, 226, 255, 0.5) 0 0);
    background-repeat: no-repeat;
    background-size: calc(25% - 5px) calc(50% - 3px);
    background-position: 0 0, 25% 0, 50% 0, 75% 0, 0 100%, 25% 100%, 50% 100%, 75% 100%;
}

.schermata-deck-artistica .slot-deck-vuoto {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(132, 226, 255, 0.58);
    border-radius: 8px;
    background: rgba(4, 15, 38, 0.58);
    color: rgba(198, 244, 255, 0.8);
    box-shadow: inset 0 0 10px rgba(44, 177, 235, 0.18);
}

.schermata-deck-artistica .slot-deck-vuoto span {
    font-size: 1.2rem;
    line-height: 1;
}

.schermata-deck-artistica .slot-deck-vuoto small {
    margin-top: 3px;
    font-size: 0.48rem;
    text-transform: uppercase;
}

.schermata-deck-artistica .contenitore-deck .carta {
    width: 100%;
    min-width: 0;
}

.schermata-deck-artistica .contenitore-deck .carta {
    position: relative;
    height: 42px;
    border-width: 1px;
    border-radius: 6px;
}

.schermata-deck-artistica .contenitore-deck .carta-footer {
    display: none;
}

.btn-rimuovi-carta {
    position: absolute;
    z-index: 4;
    top: 2px;
    right: 2px;
    width: 17px !important;
    min-width: 17px;
    height: 17px !important;
    min-height: 17px;
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    background: #bb425a;
    color: #fff;
    font-size: 0.8rem;
    line-height: 1;
}

body.schermata-deck-attiva .menu-principale,
body.schermata-deck-attiva #titolo-app {
    display: none;
}

.schermata-deck-artistica .carta {
    width: 100%;
    min-width: 0;
    height: 96px;
    aspect-ratio: auto;
    margin: 0;
    border-width: 2px;
    border-radius: 9px;
}

.schermata-deck-artistica .lista-carte-deck .carta {
    height: 96px;
}

.schermata-deck-artistica .lista-carte-deck .carta-immagine {
    z-index: 2;
}

.schermata-deck-artistica .lista-carte-deck .carta-bloccata {
    filter: grayscale(1) brightness(0.58);
    opacity: 0.72;
}

.schermata-deck-artistica .lista-carte-deck .carta-bloccata .btn-info-carta {
    filter: grayscale(1) brightness(1.35);
}

.badge-carta-bloccata {
    position: absolute;
    z-index: 4;
    left: 3px;
    right: 3px;
    bottom: 4px;
    padding: 3px 1px;
    border: 1px solid rgba(220, 241, 255, 0.7);
    border-radius: 4px;
    background: rgba(22, 35, 55, 0.9);
    color: #d8e1e8;
    font-size: 0.42rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 2px #000;
}

.schermata-deck-artistica .lista-carte-deck .carta-footer {
    display: none;
}

.btn-info-carta,
.btn-aggiungi-carta {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 2px solid rgba(226, 252, 255, 0.95);
    color: #fff;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 8px rgba(55, 210, 255, 0.7), 0 2px 4px rgba(0, 0, 0, 0.7);
}

.schermata-deck-artistica .lista-carte-deck .carta .btn-info-carta,
.schermata-deck-artistica .lista-carte-deck .carta .btn-aggiungi-carta {
    width: 23px !important;
    min-width: 23px;
    height: 23px;
    min-height: 23px;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50%;
}

.btn-info-carta {
    top: 4px;
    right: 4px;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #d9fbff, #319fdb 52%, #244791);
    font-family: Georgia, serif;
    font-size: 0.95rem;
    font-style: italic;
}

.btn-aggiungi-carta {
    right: 4px;
    bottom: 4px;
    width: 23px;
    height: 23px;
    border-radius: 7px !important;
    background: linear-gradient(145deg, #61e7ff, #2378c8);
    font-size: 1.15rem;
}

.btn-aggiungi-carta:disabled {
    background: linear-gradient(145deg, #8ba7b5, #465768);
    cursor: default;
}

.btn-info-carta:hover,
.btn-aggiungi-carta:not(:disabled):hover {
    filter: brightness(1.2);
    transform: scale(1.08);
}

.popup-info-carta[hidden] {
    display: none;
}

.popup-info-carta {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.popup-info-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 7, 24, 0.78);
    backdrop-filter: blur(4px);
}

.popup-info-pannello {
    position: relative;
    z-index: 1;
    width: min(330px, 100%);
    padding: 12px;
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    border: 2px solid rgba(151, 241, 255, 0.9);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(21, 65, 105, 0.98), rgba(32, 35, 91, 0.98));
    box-shadow: 0 0 28px rgba(54, 214, 255, 0.6), inset 0 0 18px rgba(186, 244, 255, 0.16);
}

.popup-immagine-carta {
    width: 92px;
    aspect-ratio: 17 / 27;
    object-fit: cover;
    border: 2px solid #a9f3ff;
    border-radius: 9px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.popup-info-contenuto h2 {
    margin: 5px 22px 12px 0;
    color: #ffe28c;
    font-size: 1.05rem;
    line-height: 1.1;
}

.popup-info-statistiche {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.popup-info-statistiche div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(184, 239, 255, 0.25);
    color: #d9f7ff;
    font-size: 0.75rem;
}

.popup-info-statistiche strong {
    color: #fff;
    text-align: right;
}

.popup-info-chiudi {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    background: rgba(18, 33, 69, 0.8);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
}

.schermata-deck-artistica .carta-footer {
    padding: 2px;
    gap: 2px;
}

.schermata-deck-artistica .carta-footer button {
    padding: 3px 4px;
    font-size: 0.52rem;
}

.btn-deck-indietro {
    position: absolute;
    right: 20px;
    bottom: 18px;
    width: 60px;
    height: 60px;
    padding: 0 2px 5px 0;
    border: 3px solid rgba(157, 244, 255, 0.95);
    border-radius: 50%;
    background: radial-gradient(circle at 32% 25%, rgba(209, 249, 255, 0.7), rgba(53, 177, 221, 0.9) 45%, rgba(41, 86, 176, 0.94));
    box-shadow: 0 0 16px rgba(61, 220, 255, 0.7), inset 0 0 14px rgba(223, 253, 255, 0.48);
    color: #f2fcff;
    font-size: 2.2rem;
    font-weight: 900;
}

.btn-deck-gioca {
    position: absolute;
    left: 20px;
    bottom: 18px;
    z-index: 2;
    width: 112px;
    height: 58px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 3px solid rgba(157, 244, 255, 0.95);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(70, 211, 255, 0.95), rgba(66, 74, 190, 0.96));
    box-shadow: 0 0 17px rgba(61, 220, 255, 0.72), inset 0 0 14px rgba(223, 253, 255, 0.45);
    color: #f2fcff;
    font-size: 0.82rem;
    text-shadow: 0 2px 3px rgba(3, 20, 42, 0.85);
}

.schermata-deck-artistica .btn-deck-gioca {
    left: auto !important;
    right: 20px !important;
    bottom: 18px !important;
}

.schermata-deck-artistica .btn-deck-indietro {
    left: 20px !important;
    right: auto !important;
    bottom: 18px !important;
}

.btn-deck-gioca span {
    font-size: 1.45rem;
}

.btn-deck-gioca:hover,
.btn-deck-indietro:hover {
    filter: brightness(1.12);
    transform: scale(1.05);
}

.pannello-setup {
    background: linear-gradient(160deg, rgba(31, 51, 74, 0.96), rgba(19, 33, 49, 0.95));
    border: 2px solid rgba(241, 196, 15, 0.7);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    padding: 16px;
    color: #ecf0f1;
}

.home-hero h2,
.play-hero h2 {
    margin: 0 0 6px;
    color: #f1c40f;
}

.home-hero p,
.play-hero p {
    margin: 0 0 12px;
    color: #d6e3ef;
}

.home-azioni-principali {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.home-grid-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 10px;
}

.home-box {
    text-align: left;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
}

.home-box h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: #ffd86b;
}

.home-box p {
    margin: 4px 0;
    font-size: 0.9rem;
}

.home-box label {
    display: block;
    margin: 8px 0 4px;
    font-size: 0.82rem;
}

.home-box input[type="range"] {
    width: 100%;
}

.home-box small {
    display: block;
    margin-top: 6px;
    color: #a9c3dc;
}

.griglia-modalita {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 10px;
}

.card-modalita {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.14);
    border: 2px solid rgba(52, 152, 219, 0.45);
}

.card-modalita .titolo {
    color: #f1c40f;
    font-size: 0.95rem;
}

.card-modalita .desc {
    color: #d7e4ee;
    font-size: 0.82rem;
}

.card-modalita .stato {
    color: #ffb0a6;
    font-size: 0.76rem;
    font-weight: bold;
}

.card-modalita:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: rgba(127, 140, 141, 0.24);
    border-color: rgba(189, 195, 199, 0.5);
}

/* Stile base delle carte */
.carta {
    position: relative;
    width: clamp(92px, 8vw, 170px);
    aspect-ratio: 17 / 27;
    height: auto;
    border-radius: 16px;
    border: 3px solid #f39c12;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: inline-flex;
    flex-direction: column;
    justify-content: flex-end; /* Sposta tutto il footer in basso */
    margin: 8px;
    transition: transform 0.2s ease;
    touch-action: none;
    user-select: none;
}

.carta * {
    touch-action: none;
    user-select: none;
    -webkit-user-drag: none;
}

.carta img {
    pointer-events: none;
}

.drag-in-corso {
    cursor: grabbing;
}

.drag-source {
    opacity: 0.45;
    transform: scale(0.96);
}

.drag-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.92;
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.55), 0 0 18px rgba(241, 196, 15, 0.85);
}

.drop-target-attivo {
    outline: 4px solid #f1c40f;
    outline-offset: 4px;
    filter: brightness(1.2);
}

.target-selezione {
    outline: 4px solid #f1c40f;
    outline-offset: 4px;
    box-shadow: 0 0 26px rgba(241, 196, 15, 0.95), 0 0 0 5px rgba(241, 196, 15, 0.25), 0 8px 16px rgba(0, 0, 0, 0.6);
    animation: bersaglio-selezionabile 1s ease-in-out infinite alternate;
}

#info-obiettivo.drop-target-attivo {
    transform: scale(1.02);
}

.attacco-in-corso {
    animation: scatto-attacco 0.28s ease-in-out;
}

.bersaglio-colpito {
    animation: colpo-bersaglio 0.28s ease-in-out;
}

.cambio-in-corso {
    animation: carta-cambio 0.28s ease-in-out;
}

.cambio-target {
    animation: target-cambio 0.28s ease-in-out;
}

.shake-error {
    animation: shake-error 0.32s ease-in-out;
    outline: 4px solid #e74c3c !important;
    outline-offset: 4px;
    filter: brightness(1.2);
}

@keyframes shake-error {
    0% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(7px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

@keyframes scatto-attacco {
    0% { transform: scale(1); }
    45% { transform: scale(1.12) translateY(-12px); filter: brightness(1.35); }
    100% { transform: scale(1); }
}

@keyframes bersaglio-selezionabile {
    from { filter: brightness(1.12); }
    to { filter: brightness(1.45); }
}

@keyframes colpo-bersaglio {
    0% { transform: translateX(0); filter: brightness(1); }
    25% { transform: translateX(-6px); filter: brightness(1.8); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes carta-cambio {
    0% { transform: scale(1); }
    50% { transform: scale(1.12) rotate(-3deg); filter: brightness(1.25); }
    100% { transform: scale(1); }
}

@keyframes target-cambio {
    0% { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6); }
    50% { box-shadow: 0 0 24px rgba(52, 152, 219, 0.95), 0 0 0 5px rgba(52, 152, 219, 0.45); }
    100% { box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6); }
}

.carta-immagine {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.carta-overlay {
    /*    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.9) 80%);
    z-index: 2;
    pointer-events: none;*/
    display: none; /* Rimuove completamente il livello nero */
}

/* Footer: HP -> Cerchi -> Bottone */
.carta-footer {
    position: relative;
    z-index: 3;
    padding: 8px;
   /* background: rgba(0, 0, 0, 0.85);*/
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.carta-hp {
    font-size: 0.75rem;
    color: #2ecc71;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.bonus-affinita {
    max-width: 95%;
    padding: 2px 5px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid currentColor;
    font-size: 0.58rem;
    font-weight: bold;
    line-height: 1.1;
    text-shadow: 1px 1px 2px #000;
}

.bonus-affinita.positivo {
    color: #2ecc71;
}

.bonus-affinita.negativo {
    color: #ff4d4d;
}

.badge-tipo-carta {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid currentColor;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
    text-shadow: 1px 1px 2px #000;
}

.badge-tipo-carta.offensivo {
    color: #ff6b6b;
}

.badge-tipo-carta.difensivo {
    color: #74b9ff;
}

.timer-formazione {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid #f1c40f;
    color: #f1c40f;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

#btn-abbandona-partita.btn-abbandona-partita {
    position: absolute !important;
    top: 10px;
    right: 12px;
    z-index: 20;
    margin: 0;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.btn-abbandona-partita:hover {
    background: #c0392b;
}

.log-azioni {
    position: absolute !important;
    right: 12px;
    bottom: 12px;
    z-index: 18;
    width: min(300px, 56vw);
    margin: 0;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.58);
    border: 1px solid rgba(241, 196, 15, 0.8);
    color: #ecf0f1;
    text-align: left;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.25);
}

.btn-toggle-log {
    width: 100%;
    margin: 0;
    padding: 4px 8px;
    background: transparent;
    color: #f1c40f;
    border: none;
    font-size: 0.82rem;
    cursor: pointer;
    text-align: center;
}

#lista-log-azioni {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 58px;
    overflow-y: auto;
    font-size: 0.72rem;
}

.log-azioni.compatto #lista-log-azioni {
    display: none;
}

.voce-log-azione {
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.07);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voce-log-azione.locale {
    border-left: 4px solid #2ecc71;
}

.voce-log-azione.avversario {
    border-left: 4px solid #e74c3c;
}

.schermata-fine-partita {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(4px);
}

.pannello-fine-partita {
    width: min(460px, 92vw);
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.96), rgba(20, 30, 40, 0.96));
    border: 2px solid #f1c40f;
    color: #ecf0f1;
    text-align: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 22px rgba(241, 196, 15, 0.35);
}

.pannello-fine-partita h2 {
    margin: 0 0 10px;
    color: #f1c40f;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.pannello-fine-partita p {
    margin: 0 0 18px;
    font-size: 1rem;
    line-height: 1.4;
}

.azioni-fine-partita {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.azioni-fine-partita button {
    min-width: 150px;
    padding: 10px 14px;
}

.panchina-nemica {
    position: absolute;
    top: 0;
    left: 8px;
    bottom: 0;
    z-index: 4;
    width: clamp(118px, 15vw, 220px);
    flex: 0 0 clamp(118px, 15vw, 220px) !important;
    margin: 0;
    padding: 8px;
    border-radius: 12px;
    background: rgba(231, 76, 60, 0.16) !important;
    border: none;
    overflow: hidden;
}

.panchina-nemica h4 {
    margin: 0 0 6px;
    color: #e74c3c;
    font-size: 0.82rem;
}

#lista-panchina-nemica {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: calc(100% - 24px);
    overflow-y: auto;
}

.carta-panchina-nemica {
    border: 2px dashed #e74c3c;
}

.panchina-nemica .carta {
    width: clamp(72px, 6vw, 105px);
}

.carta-stats-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 5px;
}

.badge-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #fff;
    color: white;
}

.badge-difesa {
    background: linear-gradient(135deg, #2980b9, #1c5980);
}

.badge-attacco {
    background: linear-gradient(135deg, #c0392b, #8e2a1e);
}

.badge-valore {
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-etichetta {
    font-size: 0.3rem;
    text-transform: uppercase;
}

.carta button {
    width: 100%;
    padding: 6px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    background: #27ae60;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.carta.morta {
    filter: grayscale(1);
    opacity: 0.6;
}
/* Barre della vita */
.barra-vita-container {
    width: 100%;
    background-color: #7f8c8d;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin: 8px 0;
}

.barra-vita-riempimento {
    height: 100%;
    width: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Pulsanti */
button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 5px;
}

nav {
    margin-bottom: 8px !important;
}

    button:disabled {
        background-color: #95a5a6;
        cursor: not-allowed;
    }

/* Layout delle aree di gioco */
#mie-carte-div, #nemici-div, #pool-carte-disponibili, #tua-formazione-scelta {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

#schermata-gioco {
    position: relative;
    width: min(100%, calc((100vh - 86px) * 16 / 9));
    min-height: 0;
    height: calc(100vh - 86px);
    max-height: calc(100vh - 86px);
    margin: 8px auto 0 !important;
    padding: 8px;
    border-radius: 8px;
    overflow: hidden;
    flex-direction: column;
    gap: 6px;
}

#info-obiettivo-giocatore {
    margin: 8px auto 0 !important;
    padding: 8px 12px !important;
    font-size: clamp(0.72rem, 1vw, 1.1rem) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

#schermata-gioco #info-campo {
    width: min(100%, 520px);
    margin: 0 auto 4px !important;
    padding: 6px !important;
    font-size: clamp(0.75rem, 1vw, 1.1rem) !important;
    background: rgba(44, 62, 80, 0.72) !important;
}

#area-avversaria {
    flex: 1 1 0;
    min-height: 0;
    margin-bottom: 0 !important;
    padding: 8px !important;
    background: transparent !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

#info-obiettivo {
    margin-bottom: 4px !important;
    padding: 8px 12px !important;
    font-size: clamp(0.72rem, 1vw, 1.1rem) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.obiettivo-grafica {
    position: relative;
    width: min(220px, 34vw);
    height: clamp(34px, 5vw, 58px);
}

.obiettivo-hp-container {
    position: relative;
    width: min(260px, 42vw);
    height: 18px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.65), 0 0 10px rgba(255,255,255,0.18);
}

.obiettivo-hp-riempimento {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.35s ease;
}

.obiettivo-hp-numero {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: clamp(0.65rem, 0.9vw, 0.9rem);
    font-weight: 900;
    line-height: 1;
    text-shadow: 1px 1px 2px #000;
}

.linea-meta-campo {
    flex: 0 0 auto;
    margin: 0 !important;
    font-size: clamp(0.55rem, 0.8vw, 0.8rem);
}

#area-giocatore {
    flex: 1.25 1 0;
    min-height: 0;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: center !important;
    position: relative;
}

#formazione-campo,
#panchina-div {
    min-width: 0 !important;
    padding: 8px !important;
    overflow: hidden;
    background: rgba(46, 204, 113, 0.14) !important;
}

#formazione-campo {
    flex: 0 1 min(100%, 760px) !important;
    width: min(100%, 760px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
}

#panchina-div {
    position: absolute;
    top: 0;
    right: 12px;
    bottom: 0;
    transform: none;
    z-index: 4;
    width: clamp(118px, 15vw, 220px);
    flex: 0 0 clamp(118px, 15vw, 220px) !important;
    background: rgba(52, 152, 219, 0.16) !important;
    border-radius: 12px;
    overflow: hidden !important;
}

#mie-carte-div,
#nemici-div {
    gap: clamp(4px, 0.7vw, 12px) !important;
    margin-top: 4px !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center !important;
    width: 100%;
}

#lista-panchina {
    max-height: calc(100% - 24px);
    overflow-y: auto;
    gap: 6px !important;
}

#schermata-gioco .carta {
    width: clamp(76px, 7vw, 130px);
    margin: 2px;
    border-width: 2px;
    border-radius: 10px;
}

#panchina-div .carta {
    width: clamp(72px, 6vw, 105px);
}

#schermata-gioco .carta-footer {
    padding: 4px;
    gap: 2px;
}

#schermata-gioco .badge-stat {
    width: clamp(20px, 2vw, 30px);
    height: clamp(20px, 2vw, 30px);
}

#schermata-gioco .carta-hp,
#schermata-gioco .carta button,
#schermata-gioco .bonus-affinita {
    font-size: clamp(0.45rem, 0.65vw, 0.7rem);
}

#schermata-gioco .carta button {
    padding: 3px;
}

#info-turno {
    flex: 0 0 auto;
    margin: 0 !important;
    font-size: clamp(0.65rem, 0.9vw, 1rem) !important;
    color: #ffec6e !important;
    text-shadow: 1px 1px 2px #145a24;
}

#schermata-formazione {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px;
}

.formazione-header {
    color: #f1c40f;
    text-shadow: 1px 1px 2px #000;
}

.formazione-header h3 {
    margin: 0 0 4px;
    font-size: clamp(1rem, 1.5vw, 1.4rem);
}

.formazione-header p {
    margin: 0;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
}

.popup-autenticazione.schermata-accesso-iniziale > .popup-info-overlay {
    background: rgba(2, 7, 24, 0.12) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Layout Deck mobile in stile arena */
.schermata-deck-artistica {
    padding: 10px 10px 78px;
}

.schermata-deck-artistica .deck-intestazione {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    line-height: 1;
}

.schermata-deck-artistica .deck-tab {
    min-height: 48px;
    margin: 0;
    border: 2px solid rgba(52, 212, 255, 0.5);
    border-radius: 15px 15px 8px 8px;
    background: rgba(11, 45, 99, 0.82);
    color: #d8f8ff;
    font-size: clamp(1rem, 5vw, 1.35rem);
    font-weight: 900;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px #000;
}

.schermata-deck-artistica .deck-tab-attivo {
    border-color: rgba(117, 239, 255, 0.95);
    background: linear-gradient(180deg, #36bfea, #186ab8);
    box-shadow: 0 0 15px rgba(42, 213, 255, 0.65), inset 0 0 12px rgba(222, 253, 255, 0.3);
}

.schermata-deck-artistica .deck-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 7px 0 8px;
    padding: 5px;
    border-top: 1px solid rgba(89, 222, 255, 0.45);
    border-bottom: 2px solid rgba(33, 128, 231, 0.85);
    background: rgba(3, 34, 86, 0.82);
}

.schermata-deck-artistica .deck-tool-menu,
.schermata-deck-artistica .deck-tool-scambia,
.schermata-deck-artistica .deck-numero {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 2px solid rgba(83, 200, 255, 0.75);
    color: #f4fdff;
    font-weight: 900;
    box-shadow: inset 0 0 8px rgba(141, 236, 255, 0.25), 0 2px 5px rgba(0, 0, 0, 0.35);
}

.schermata-deck-artistica .deck-tool-menu,
.schermata-deck-artistica .deck-tool-scambia {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: linear-gradient(145deg, #218cd2, #254b9d);
    font-size: 1.45rem;
}

.schermata-deck-artistica .deck-selettore-numero {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    flex: 1;
}

.schermata-deck-artistica .deck-numero {
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(145deg, #376fc9, #283d8c);
    font-size: 1.05rem;
}

.schermata-deck-artistica .deck-numero-attivo {
    border-color: #ffe56a;
    background: linear-gradient(145deg, #ffd85d, #ed981f);
    color: #173266;
    transform: translateY(3px);
}

.schermata-deck-artistica .deck-layout {
    height: calc(100% - 116px);
    margin-top: 0;
}

.schermata-deck-artistica .deck-pannello-attivo {
    flex: 0 0 128px;
    min-height: 128px;
}

.schermata-deck-artistica .lista-carte-deck {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.schermata-deck-artistica .lista-carte-deck .carta {
    height: 132px;
}

.slot-formazione {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 1vw, 14px);
    width: 100%;
    min-height: clamp(130px, 23vh, 230px);
    padding: 10px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.18);
}

.slot-carta-formazione {
    position: relative;
    width: clamp(82px, 8vw, 135px);
    aspect-ratio: 17 / 27;
    border: 3px dashed rgba(241, 196, 15, 0.78);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f1c40f;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    background: rgba(44, 62, 80, 0.38);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    touch-action: none;
    user-select: none;
}

.slot-carta-formazione.pieno {
    border-style: solid;
    border-color: #2ecc71;
    box-shadow: 0 0 18px rgba(46, 204, 113, 0.55);
}

.slot-carta-formazione.slot-hover {
    transform: scale(1.05);
    border-color: #f1c40f;
    box-shadow: 0 0 24px rgba(241, 196, 15, 0.9);
}

.mano-formazione {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(5px, 0.8vw, 10px);
    width: 100%;
    padding: 8px;
    overflow-x: auto;
}

.carta-formazione-mano {
    width: clamp(76px, 7vw, 120px) !important;
    flex: 0 0 auto;
    cursor: grab;
}

.carta-formazione-mano.formazione-selezionata {
    outline: 4px solid #f1c40f;
    outline-offset: 4px;
    filter: brightness(1.25);
}

#btn-conferma-formazione {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    border: 2px solid #d5f5e3;
    box-shadow: 0 0 14px rgba(46, 204, 113, 0.45);
}

.azioni-formazione {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

#btn-auto-formazione {
    background: linear-gradient(135deg, #3498db, #1f78c1);
    border: 2px solid #d6ecff;
    box-shadow: 0 0 12px rgba(52, 152, 219, 0.35);
}

#btn-auto-formazione:hover {
    background: linear-gradient(135deg, #2f89c6, #1a6dac);
}

#btn-conferma-formazione:disabled {
    background: #7f8c8d;
    border-color: #bdc3c7;
    box-shadow: none;
}

@media (max-width: 900px), (max-height: 650px) {
    .home-grid-info,
    .griglia-modalita {
        grid-template-columns: 1fr;
    }

    #schermata-gioco {
        width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    #area-giocatore {
        flex-wrap: wrap !important;
    }

    #formazione-campo {
        flex: 1 1 100% !important;
        width: 100%;
    }

    #panchina-div {
        position: static;
        width: 100%;
        flex: 1 1 100% !important;
    }

    #mie-carte-div,
    #nemici-div {
        flex-wrap: wrap !important;
    }

    .slot-formazione,
    .mano-formazione {
        flex-wrap: wrap;
    }
}

/* Indicatore campo */
#info-campo {
    max-width: 600px;
    margin: 20px auto;
}

/* ==========================================
   AGGIUNTA GRAFICA CAMPO DI GIOCO
   ========================================== */

/* ==========================================
   ARENE SPORTIVE DETTAGLIATE (VOLLEY, CALCIO, BASKET)
   ========================================== */

/* --- 1. PALLAVOLO: campo dall'alto con rete e tabelloni --- */
#schermata-gioco.campo-pallavolo {
    position: relative;
    background-color: #10281f;
    background-image:
        var(--ambientazione-arena, none),
        radial-gradient(ellipse at center, rgba(43, 118, 82, 0.7) 0 48%, transparent 72%),
        repeating-linear-gradient(135deg, rgba(255,255,255,0.035) 0 3px, transparent 3px 18px);
    background-size: 100% 100%, auto, auto;
    border: 3px solid #2ecc71;
    box-shadow: inset 0 0 45px rgba(46, 204, 113, 0.28), 0 0 18px rgba(16, 40, 31, 0.55);
}

    #schermata-gioco.campo-pallavolo::before,
    #schermata-gioco.campo-pallavolo::after {
        content: "";
        position: absolute;
        pointer-events: none;
        z-index: 0;
    }

    #schermata-gioco.campo-pallavolo::before {
        top: 12%;
        bottom: 12%;
        left: 23%;
        right: 23%;
        border: 4px solid rgba(255, 255, 255, 0.96);
        background:
            linear-gradient(0deg, transparent calc(50% - 2px), rgba(255,255,255,0.95) calc(50% - 2px), rgba(255,255,255,0.95) calc(50% + 2px), transparent calc(50% + 2px)),
            linear-gradient(0deg, transparent 0 30%, rgba(255,255,255,0.88) 30% calc(30% + 3px), transparent calc(30% + 3px) calc(70% - 3px), rgba(255,255,255,0.88) calc(70% - 3px) 70%, transparent 70% 100%),
            linear-gradient(90deg, rgba(255,255,255,0.16) 0 2px, transparent 2px 33%, rgba(255,255,255,0.16) 33% calc(33% + 2px), transparent calc(33% + 2px) 66%, rgba(255,255,255,0.16) 66% calc(66% + 2px), transparent calc(66% + 2px) 100%),
            linear-gradient(135deg, rgba(255, 120, 40, 0.92), rgba(238, 82, 28, 0.96));
        box-shadow: 0 0 0 46px rgba(38, 96, 68, 0.95), 0 10px 22px rgba(0, 0, 0, 0.35);
    }

    #schermata-gioco.campo-pallavolo::after {
        top: calc(50% - 12px);
        left: 18%;
        right: 18%;
        height: 24px;
        border-left: 8px solid rgba(235, 245, 251, 0.95);
        border-right: 8px solid rgba(235, 245, 251, 0.95);
        background:
            repeating-linear-gradient(90deg, rgba(255,255,255,0.85) 0 2px, transparent 2px 16px),
            repeating-linear-gradient(0deg, rgba(255,255,255,0.65) 0 1px, transparent 1px 6px),
            rgba(60, 60, 60, 0.22);
        box-shadow: 0 0 0 2px rgba(255,255,255,0.7), 0 6px 10px rgba(0,0,0,0.25);
    }

    #schermata-gioco.campo-pallavolo > * {
        position: relative;
        z-index: 1;
    }

    #schermata-gioco.campo-pallavolo #area-avversaria,
    #schermata-gioco.campo-pallavolo #formazione-campo {
        background: rgba(255, 112, 40, 0.12) !important;
    }

    #schermata-gioco.campo-pallavolo #area-avversaria {
        background: transparent !important;
    }

    #schermata-gioco.campo-pallavolo #panchina-div {
        background: rgba(46, 204, 113, 0.16) !important;
    }

    #schermata-gioco.campo-pallavolo .linea-meta-campo {
        height: 24px;
        margin: 0 !important;
        border: 0;
        background: transparent;
        font-size: 0;
        line-height: 0;
        position: relative;
    }

        #schermata-gioco.campo-pallavolo .linea-meta-campo::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(20, 20, 20, 0.72);
            color: #ffffff;
            padding: 2px 14px;
            font-size: 0.62rem;
            letter-spacing: 2px;
            border-radius: 999px;
            border: 1px solid rgba(255,255,255,0.75);
            display: none;
        }

    #schermata-gioco.campo-pallavolo #info-obiettivo,
    #schermata-gioco.campo-pallavolo #info-obiettivo-giocatore,
    #schermata-gioco.campo-pallavolo #info-turno {
        position: relative;
        overflow: visible;
        background:
            radial-gradient(circle at 12% 50%, #ff4d4d 0 4px, transparent 5px),
            radial-gradient(circle at 18% 50%, #f1c40f 0 4px, transparent 5px),
            radial-gradient(circle at 24% 50%, #2ecc71 0 4px, transparent 5px),
            linear-gradient(180deg, #30363a 0%, #15191c 28%, #050807 100%) !important;
        color: #ffdf6e !important;
        border: 4px solid #dfe6e9 !important;
        border-radius: 12px !important;
        box-shadow:
            0 0 0 3px rgba(44, 62, 80, 0.95),
            0 8px 18px rgba(0,0,0,0.45),
            inset 0 0 18px rgba(46, 204, 113, 0.18);
        font-family: 'Courier New', Courier, monospace;
        font-weight: bold;
        text-shadow: 1px 1px 2px #000;
        padding: 10px 18px !important;
    }

    #schermata-gioco.campo-pallavolo #info-obiettivo .obiettivo-grafica,
    #schermata-gioco.campo-pallavolo #info-obiettivo-giocatore .obiettivo-grafica {
        width: min(240px, 38vw);
        height: clamp(34px, 4.5vw, 52px);
        border: 4px solid #dfe6e9;
        border-radius: 10px;
        background:
            radial-gradient(circle at 14% 50%, #ff4d4d 0 4px, transparent 5px),
            radial-gradient(circle at 22% 50%, #f1c40f 0 4px, transparent 5px),
            radial-gradient(circle at 30% 50%, #2ecc71 0 4px, transparent 5px),
            linear-gradient(180deg, #30363a 0%, #15191c 38%, #050807 100%);
        box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.95), inset 0 0 18px rgba(46, 204, 113, 0.18);
    }

        #schermata-gioco.campo-pallavolo #info-obiettivo::after,
        #schermata-gioco.campo-pallavolo #info-turno::after {
            content: "";
            position: absolute;
            left: 50%;
            bottom: -12px;
            width: 58%;
            height: 8px;
            transform: translateX(-50%);
            border-radius: 0 0 8px 8px;
            background: linear-gradient(90deg, transparent, #dfe6e9 18%, #dfe6e9 82%, transparent);
            box-shadow: 0 5px 0 rgba(52, 73, 94, 0.9);
        }

        #schermata-gioco.campo-pallavolo #info-turno::after {
            top: -12px;
            bottom: auto;
            border-radius: 8px 8px 0 0;
            box-shadow: 0 -5px 0 rgba(52, 73, 94, 0.9);
        }

        #schermata-gioco.campo-pallavolo #info-obiettivo::before {
            content: "";
            display: none;
            font-size: 0.8rem;
            letter-spacing: 2px;
            color: #ffffff;
            margin-bottom: 4px;
            text-shadow: 0 0 6px #2ecc71;
        }

        #schermata-gioco.campo-pallavolo #info-turno::before {
            content: "";
            display: none;
            font-size: 0.72rem;
            letter-spacing: 2px;
            color: #ffffff;
            margin-bottom: 2px;
            text-shadow: 0 0 6px #2ecc71;
        }


/* --- 2. CALCIO: Stile Stadio e Linee di Porta --- */
#schermata-gioco.campo-calcio {
    background-color: #21a33a;
    background-image:
        var(--ambientazione-arena, none),
        linear-gradient(rgba(46, 204, 113, 0.12), rgba(46, 204, 113, 0.12)),
        url('images/campo_calcio.png'),
        repeating-linear-gradient(90deg, #188a30 0 12%, #24b541 12% 24%);
    background-size: 100% 100%, cover, cover, 100% 100%; /* Copre tutta l'area di gioco */
    background-position: center; /* Centra perfettamente l'immagine */
    background-repeat: no-repeat; /* Evita che l'immagine si quadri/ripeta */
    border: 3px solid #5cff8d;
    box-shadow: inset 0 0 40px rgba(92, 255, 141, 0.35), 0 0 18px rgba(46, 204, 113, 0.45);
}

    #schermata-gioco.campo-calcio .linea-meta-campo {
        border-top: 3px dashed #a3e4d7;
        background: transparent;
    }

    #schermata-gioco.campo-calcio #info-obiettivo,
    #schermata-gioco.campo-calcio #info-obiettivo-giocatore {
        background: rgba(14, 112, 38, 0.85);
        border: 3px solid #d5ffdf;
        border-radius: 12px;
        box-shadow: 0 0 20px rgba(213, 255, 223, 0.65);
        position: relative;
    }

    #schermata-gioco.campo-calcio #info-obiettivo .obiettivo-grafica,
    #schermata-gioco.campo-calcio #info-obiettivo-giocatore .obiettivo-grafica {
        border-left: 8px solid #ecf0f1;
        border-right: 8px solid #ecf0f1;
        border-top: 8px solid #ecf0f1;
        border-radius: 8px 8px 2px 2px;
        background:
            repeating-linear-gradient(90deg, rgba(255,255,255,0.45) 0 2px, transparent 2px 18px),
            repeating-linear-gradient(0deg, rgba(255,255,255,0.35) 0 2px, transparent 2px 14px),
            rgba(10, 80, 30, 0.45);
        box-shadow: 0 0 18px rgba(236, 240, 241, 0.65), inset 0 0 12px rgba(255,255,255,0.22);
    }

        /* Effetto traversa della porta sopra l'obiettivo */
        #schermata-gioco.campo-calcio #info-obiettivo::before {
            content: "";
            display: none;
            font-size: 0.8rem;
            letter-spacing: 2px;
            color: #a3e4d7;
            margin-bottom: 4px;
        }


/* --- 3. BASKET: Campo dall'alto stile parquet --- */
#schermata-gioco.campo-basket {
    position: relative;
    background-color: #a96528;
    background-image:
        var(--ambientazione-arena, none),
        radial-gradient(ellipse at center, rgba(255, 230, 150, 0.14) 0 38%, transparent 64%),
        repeating-linear-gradient(90deg, rgba(84, 45, 15, 0.12) 0 2px, transparent 2px 74px),
        repeating-linear-gradient(0deg, #a75f24 0 46px, #c77a33 46px 92px);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid #e0a84c;
    box-shadow: inset 0 0 45px rgba(70, 35, 10, 0.35), 0 0 18px rgba(198, 125, 62, 0.45);
}

    #schermata-gioco.campo-basket::before,
    #schermata-gioco.campo-basket::after {
        content: "";
        position: absolute;
        top: 16px;
        bottom: 16px;
        left: 19%;
        right: 19%;
        pointer-events: none;
        z-index: 0;
    }

    #schermata-gioco.campo-basket::before {
        border: 4px solid rgba(255, 255, 255, 0.96);
        border-radius: 4px;
        background:
            linear-gradient(0deg, transparent calc(50% - 2px), rgba(255, 255, 255, 0.96) calc(50% - 2px), rgba(255, 255, 255, 0.96) calc(50% + 2px), transparent calc(50% + 2px)),
            radial-gradient(circle at 50% 50%, transparent 0 9.5%, rgba(255, 255, 255, 0.96) 10% 10.8%, transparent 11.3%),
            linear-gradient(90deg, transparent 0 38%, rgba(255, 255, 255, 0.96) 38% calc(38% + 3px), transparent calc(38% + 3px) calc(62% - 3px), rgba(255, 255, 255, 0.96) calc(62% - 3px) 62%, transparent 62% 100%) center top / 100% 24% no-repeat,
            linear-gradient(90deg, transparent 0 38%, rgba(255, 255, 255, 0.96) 38% calc(38% + 3px), transparent calc(38% + 3px) calc(62% - 3px), rgba(255, 255, 255, 0.96) calc(62% - 3px) 62%, transparent 62% 100%) center bottom / 100% 24% no-repeat,
            linear-gradient(0deg, transparent 0 24%, rgba(255, 255, 255, 0.96) 24% calc(24% + 3px), transparent calc(24% + 3px) calc(76% - 3px), rgba(255, 255, 255, 0.96) calc(76% - 3px) 76%, transparent 76% 100%),
            repeating-linear-gradient(90deg, rgba(255, 231, 170, 0.16) 0 22px, rgba(180, 97, 34, 0.08) 22px 52px, rgba(226, 151, 72, 0.12) 52px 78px),
            repeating-linear-gradient(0deg, rgba(255, 224, 150, 0.16) 0 34px, rgba(175, 92, 32, 0.1) 34px 78px);
        box-shadow: 0 0 18px rgba(60, 28, 8, 0.35);
    }

    #schermata-gioco.campo-basket::after {
        background:
            radial-gradient(circle at 50% 20.5%, transparent 0 7.5%, rgba(255, 255, 255, 0.96) 8% 8.8%, transparent 9.3%),
            radial-gradient(circle at 50% 79.5%, transparent 0 7.5%, rgba(255, 255, 255, 0.96) 8% 8.8%, transparent 9.3%),
            radial-gradient(circle at 50% 8%, transparent 0 12px, #ff6a3d 13px 18px, transparent 19px),
            radial-gradient(circle at 50% 92%, transparent 0 12px, #ff6a3d 13px 18px, transparent 19px),
            linear-gradient(0deg, transparent 0 7%, rgba(255, 255, 255, 0.9) 7% 7.8%, transparent 7.8% 92.2%, rgba(255, 255, 255, 0.9) 92.2% 93%, transparent 93% 100%);
    }

    #schermata-gioco.campo-basket > * {
        position: relative;
        z-index: 1;
    }

    #schermata-gioco.campo-basket #area-avversaria,
    #schermata-gioco.campo-basket #formazione-campo {
        background: rgba(255, 236, 185, 0.12) !important;
    }

    #schermata-gioco.campo-basket #area-avversaria {
        background: transparent !important;
    }

    #schermata-gioco.campo-basket #panchina-div {
        background: rgba(52, 152, 219, 0.18) !important;
    }

    #schermata-gioco.campo-basket .linea-meta-campo {
        border-top: 3px solid rgba(255, 255, 255, 0.88);
        background: transparent;
        color: #ffffff;
        font-size: 0;
        line-height: 0;
        text-shadow: 0 1px 1px rgba(255,255,255,0.6);
    }

    #schermata-gioco.campo-basket #info-obiettivo,
    #schermata-gioco.campo-basket #info-obiettivo-giocatore {
        background: rgba(75, 38, 0, 0.86);
        border: 3px solid #fff4bd;
        border-radius: 12px;
        box-shadow: 0 0 20px rgba(255, 244, 189, 0.65);
        position: relative;
    }

    #schermata-gioco.campo-basket #info-obiettivo .obiettivo-grafica,
    #schermata-gioco.campo-basket #info-obiettivo-giocatore .obiettivo-grafica {
        width: min(190px, 32vw);
        height: clamp(40px, 5.5vw, 62px);
    }

        #schermata-gioco.campo-basket #info-obiettivo .obiettivo-grafica::before,
        #schermata-gioco.campo-basket #info-obiettivo-giocatore .obiettivo-grafica::before {
            content: "";
            position: absolute;
            left: 50%;
            top: 0;
            width: 76%;
            height: 62%;
            transform: translateX(-50%);
            border: 5px solid #f7f1d1;
            border-radius: 5px;
            background: linear-gradient(135deg, rgba(255,255,255,0.28), rgba(255,255,255,0.06));
            box-shadow: 0 0 16px rgba(255, 244, 189, 0.65);
        }

        #schermata-gioco.campo-basket #info-obiettivo .obiettivo-grafica::after,
        #schermata-gioco.campo-basket #info-obiettivo-giocatore .obiettivo-grafica::after {
            content: "";
            position: absolute;
            left: 50%;
            bottom: 2px;
            width: 54px;
            height: 18px;
            transform: translateX(-50%);
            border: 5px solid #ff6a3d;
            border-top: 0;
            border-radius: 0 0 999px 999px;
            box-shadow: 0 0 12px rgba(255, 106, 61, 0.8);
        }

        #schermata-gioco.campo-basket #info-obiettivo::before {
            content: "";
            display: none;
            font-size: 0.8rem;
            letter-spacing: 2px;
            color: #fff4bd;
            margin-bottom: 4px;
        }

/* Obiettivo pulito: niente pannello esterno, solo grafica e barra HP */
#schermata-gioco.campo-pallavolo #info-obiettivo,
#schermata-gioco.campo-pallavolo #info-obiettivo-giocatore,
#schermata-gioco.campo-pallavolo #info-turno,
#schermata-gioco.campo-calcio #info-obiettivo,
#schermata-gioco.campo-calcio #info-obiettivo-giocatore,
#schermata-gioco.campo-calcio #info-turno,
#schermata-gioco.campo-basket #info-obiettivo,
#schermata-gioco.campo-basket #info-obiettivo-giocatore,
#schermata-gioco.campo-basket #info-turno {
    position: relative;
    overflow: visible;
    background: transparent !important;
    color: #ffdf6e !important;
    border: 0 !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    padding: 10px 18px !important;
}

#schermata-gioco.campo-pallavolo #info-obiettivo::after,
#schermata-gioco.campo-pallavolo #info-turno::after,
#schermata-gioco.campo-calcio #info-obiettivo::after,
#schermata-gioco.campo-calcio #info-turno::after,
#schermata-gioco.campo-basket #info-obiettivo::after,
#schermata-gioco.campo-basket #info-turno::after {
    display: none;
}

#schermata-gioco #info-obiettivo-giocatore {
    position: relative !important;
    left: auto;
    bottom: auto;
    transform: none;
    margin: 4px auto 0 !important;
    padding: 4px 8px !important;
    gap: 3px;
    z-index: 1;
}

#schermata-gioco #info-obiettivo,
#schermata-gioco #info-obiettivo-giocatore {
    padding: 4px 8px !important;
    gap: 3px;
}

#schermata-gioco #info-obiettivo .obiettivo-grafica,
#schermata-gioco #info-obiettivo-giocatore .obiettivo-grafica {
    width: min(170px, 28vw) !important;
    height: clamp(24px, 3.2vw, 36px) !important;
}

#schermata-gioco #info-obiettivo .obiettivo-hp-container,
#schermata-gioco #info-obiettivo-giocatore .obiettivo-hp-container {
    width: min(230px, 34vw) !important;
    height: 14px;
}

#schermata-gioco #info-obiettivo .obiettivo-hp-numero,
#schermata-gioco #info-obiettivo-giocatore .obiettivo-hp-numero {
    font-size: clamp(0.58rem, 0.75vw, 0.76rem);
}

.codice-stanza-amico {
    margin: 12px 0 4px;
    padding: 10px;
    border: 2px dashed #ffe28c;
    border-radius: 10px;
    background: rgba(4, 18, 45, 0.8);
    color: #ffe28c;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.35em;
    text-align: center;
    user-select: all;
}

.codice-stanza-amico[hidden] {
    display: none;
}

#input-codice-stanza {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    text-align: center;
}

/* Ricerca della partita classificata */
.icona-ricerca-classificata {
    margin: 10px 0 4px;
    font-size: 3rem;
    text-align: center;
    animation: pulsazione-ricerca-classificata 1.4s ease-in-out infinite;
}

@keyframes pulsazione-ricerca-classificata {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.messaggio-classificata {
    min-height: 2.6em;
    white-space: pre-line;
    text-align: center;
}

.btn-passa-turno {
    margin-left: 8px;
}

/* Il badge è un <button>: annulla gli stili generici di .carta button */
button.badge-abilita,
#schermata-gioco .carta button.badge-abilita {
    width: auto;
    max-width: 95%;
    margin: 0;
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(40, 10, 70, 0.85);
    border: 1px solid #c79bff;
    color: #eadcff;
    font-size: 0.55rem;
    font-weight: bold;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px #000;
    cursor: pointer;
}

/* Niente menu "salva immagine" o selezione del testo durante la pressione lunga su mobile */
[data-info-carta],
[data-info-carta] * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Su touch e schermi stretti il badge mostra solo l'icona, più grande e facile da toccare */
@media (hover: none), (max-width: 768px) {
    .badge-abilita .nome-abilita {
        display: none;
    }

    button.badge-abilita,
    #schermata-gioco .carta button.badge-abilita {
        min-width: 26px;
        min-height: 22px;
        padding: 2px 6px;
        font-size: 0.8rem;
        line-height: 1;
    }
}

.carta-stordita {
    margin-left: 3px;
}

.carta.stordita .carta-immagine {
    filter: saturate(0.4) brightness(0.8);
}

.popup-descrizione-abilita {
    margin: 8px 0 0;
    color: #eadcff;
    font-size: 0.72rem;
    line-height: 1.3;
    white-space: pre-line;
}

.popup-descrizione-abilita:empty {
    display: none;
}

.formazione-header .suggerimento-scheda-carta {
    margin-top: 2px;
    font-size: 0.75em;
    opacity: 0.8;
}

/* ==========================================
   EFFETTI VISIVI DELLA PARTITA (js/effetti.js)
   ========================================== */
#livello-effetti {
    position: fixed;
    inset: 0;
    z-index: 9000;
    overflow: hidden;
    pointer-events: none;
}

.effetto-fluttuante {
    position: absolute;
    transform: translate(-50%, -50%);
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 4px #000, 0 0 8px rgba(0, 0, 0, 0.8);
    animation: effetto-sali 1.2s ease-out forwards;
}

.effetto-danno {
    color: #ff5252;
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
}

.effetto-cura {
    color: #5dff9a;
    font-size: clamp(1rem, 2vw, 1.4rem);
}

.effetto-ko {
    color: #fff;
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
}

.effetto-abilita,
.effetto-cambio {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid #c79bff;
    background: rgba(40, 10, 70, 0.92);
    color: #f3eaff;
    font-size: clamp(0.7rem, 1.3vw, 0.9rem);
}

.effetto-cambio {
    border-color: #7fd3ff;
    background: rgba(8, 40, 80, 0.92);
}

@keyframes effetto-sali {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30% { transform: translate(-50%, -60%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

.banner-partita {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    padding: 12px 28px;
    border: 2px solid #f1c40f;
    border-radius: 14px;
    background: rgba(5, 11, 31, 0.9);
    box-shadow: 0 0 24px rgba(241, 196, 15, 0.45);
    color: #ffe38a;
    font-size: clamp(1.1rem, 4vw, 1.9rem);
    font-weight: 900;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 6px #000;
    animation: banner-partita 1.1s ease forwards;
}

.banner-partita.avversario {
    border-color: #e74c3c;
    box-shadow: 0 0 24px rgba(231, 76, 60, 0.5);
    color: #ff9f94;
}

.banner-partita.campo {
    border-color: #7fd3ff;
    box-shadow: 0 0 24px rgba(127, 211, 255, 0.45);
    color: #d7f3ff;
}

@keyframes banner-partita {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
    25% { transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.carta.effetto-colpo {
    animation: effetto-colpo 0.35s ease;
}

@keyframes effetto-colpo {
    0%, 100% { transform: none; filter: none; }
    25% { transform: translateX(-3px); filter: brightness(1.8) saturate(0.4); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

/* Carta dell'avversario in movimento e bersaglio che sta puntando.
   "#schermata-gioco #livello-ghost" supera le regole "#schermata-gioco.campo-... > *" che rendono relativi i figli. */
#schermata-gioco #livello-ghost {
    position: fixed;
    inset: 0;
    z-index: 8500;
    pointer-events: none;
}

.ghost-avversario .bonus-affinita,
.ghost-avversario .carta-footer > button:not(.badge-abilita) {
    display: none !important;
}

.carta.ghost-avversario {
    position: fixed;
    z-index: 1;
    margin: 0;
    opacity: 0.92;
    transform: translate(-50%, -50%) rotate(-5deg) scale(1.05);
    box-shadow: 0 0 22px rgba(231, 76, 60, 0.85);
    pointer-events: none;
}

/* Online la posizione arriva a scatti (al massimo ~7 al secondo): la transizione rende il movimento fluido */
.carta.ghost-avversario:not(.ghost-animato) {
    transition: left 0.15s linear, top 0.15s linear;
}

.sorgente-avversario {
    outline: 3px dashed #e74c3c;
    outline-offset: 2px;
    opacity: 0.75;
}

.mira-avversario {
    outline: 3px solid #ff5252;
    outline-offset: 3px;
    box-shadow: 0 0 20px rgba(255, 82, 82, 0.9) !important;
}

@media (prefers-reduced-motion: reduce) {
    .effetto-fluttuante,
    .banner-partita {
        animation-duration: 1.4s;
        animation-name: effetto-dissolvenza;
    }

    .carta.effetto-colpo {
        animation: none;
    }

    @keyframes effetto-dissolvenza {
        0%, 80% { opacity: 1; }
        100% { opacity: 0; }
    }
}

/* In partita le carte hanno touch-action: none per il trascinamento; nel deck invece non si trascinano,
   quindi il dito posato su una carta deve poter far scorrere la collezione. Il mouse non è interessato. */
.schermata-deck-artistica .carta,
.schermata-deck-artistica .carta * {
    touch-action: pan-y;
}

.schermata-deck-artistica .lista-carte-deck {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Filtri della collezione (sport e fazione): la lista occupa lo spazio che resta sotto l'intestazione */
.schermata-deck-artistica .deck-pannello-collezione {
    display: flex;
    flex-direction: column;
}

.schermata-deck-artistica .deck-pannello-collezione .lista-carte-deck {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

.intestazione-collezione {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 4px;
}

#contatore-collezione {
    color: #b7e9f5;
    font-weight: normal;
}

.filtri-collezione {
    display: flex;
    align-items: center;
    gap: 3px;
}

.filtro-collezione {
    width: 30px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(137, 229, 255, 0.45);
    border-radius: 8px;
    background: rgba(8, 23, 52, 0.7);
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.75;
}

.filtro-collezione.filtro-attivo {
    border-color: #ffe56a;
    background: linear-gradient(145deg, rgba(255, 216, 93, 0.35), rgba(237, 152, 31, 0.35));
    box-shadow: 0 0 8px rgba(255, 229, 106, 0.55);
    opacity: 1;
}

.separatore-filtri {
    width: 1px;
    height: 20px;
    margin: 0 2px;
    background: rgba(137, 229, 255, 0.45);
}

/* Popup "Conferma la tua email": sopra anche la schermata di accesso iniziale (z-index 2000) */
.popup-modifica-profilo.popup-conferma-email {
    z-index: 2100;
    background: rgba(2, 7, 24, 0.6);
}

.icona-conferma-email {
    font-size: 2.4rem;
    text-align: center;
    line-height: 1;
}

.testo-conferma-email {
    margin: 10px 0 0;
    color: #d9f7ff;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

.popup-conferma-email .messaggio-autenticazione {
    margin-top: 8px;
}

.popup-conferma-email #btn-reinvia-conferma:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* CAPTCHA (js/captcha.js): sopra a tutto; nascosto con lo stile perché il widget deve restare nella pagina */
.popup-modifica-profilo.popup-captcha {
    z-index: 2200;
    background: rgba(2, 7, 24, 0.6);
}

.popup-captcha:not(.visibile) {
    visibility: hidden;
    pointer-events: none;
}

.contenitore-captcha {
    display: flex;
    justify-content: center;
    min-height: 65px;
    margin-top: 12px;
}

/* Statistiche del profilo (js/statistiche.js) */
.profilo-statistiche.profilo-statistiche-4 {
    grid-template-columns: repeat(4, 1fr);
}

.profilo-xp {
    height: 6px;
    margin: 4px 6px 2px;
    overflow: hidden;
    border: 1px solid rgba(255, 225, 110, 0.7);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
}

.profilo-xp-riempimento {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #ffe16e, #ff9f43);
    transition: width 0.4s ease;
}

.profilo-xp-testo {
    display: block;
    color: #d9f7ff;
    font-size: 0.55rem;
    font-weight: bold;
}

.xp-fine-partita {
    min-height: 1.2em;
    margin: -8px 0 16px;
    color: #ffe16e;
    font-weight: 900;
}

.xp-fine-partita:empty {
    display: none;
}

.xp-fine-partita.nuovo-livello {
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(255, 225, 110, 0.7);
}

.home-avatar-mini {
    max-width: 60vw;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.stato-salvataggio-deck {
    margin-left: 6px;
    font-size: 0.7rem;
    font-weight: bold;
}

.stato-salvataggio-deck.in-corso {
    color: #bcefff;
}

.stato-salvataggio-deck.ok {
    color: #5dff9a;
}

.stato-salvataggio-deck.errore {
    color: #ff8a80;
}

.collezione-vuota {
    grid-column: 1 / -1;
    margin: 16px 0;
    color: #b7e9f5;
    font-size: 0.8rem;
}

/* Le regole "#schermata-gioco.campo-basket > *" e "...campo-pallavolo > *" rendono relativo ogni figlio:
   il pannello di fine partita deve restare sopra tutto lo schermo. */
#schermata-gioco > .schermata-fine-partita {
    position: fixed;
    z-index: 10000;
}

/* ==========================================
   TELEFONO IN VERTICALE (fino a 600px di larghezza)
   Tutte le regole sono in questo blocco: sopra i 600px la versione PC resta invariata.
   Molti !important servono a superare stili inline dell'HTML e regole già marcate !important.
   ========================================== */
@media (max-width: 600px) {
    body.partita-attiva {
        padding: 0;
    }

    /* --- Schermata di gioco a tutto schermo, dall'alto in basso --- */
    #schermata-gioco {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom)) !important;
        border-radius: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        justify-content: space-between;
        gap: 4px !important;
    }

    #schermata-gioco #info-campo {
        width: auto !important;
        margin: 0 132px 0 0 !important;
        padding: 4px 8px !important;
        font-size: 0.72rem !important;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #btn-abbandona-partita.btn-abbandona-partita {
        top: 6px;
        right: 6px;
        padding: 5px 8px;
        font-size: 0.68rem;
    }

    /* --- Panchine: una fila orizzontale invece della colonna laterale --- */
    .panchina-nemica,
    #panchina-div {
        position: static !important;
        display: flex;
        align-items: center;
        gap: 6px;
        width: 100% !important;
        flex: 0 0 auto !important;
        padding: 4px 6px !important;
        overflow: visible !important;
    }

    .panchina-nemica {
        order: -1;
    }

    .panchina-nemica h4,
    #panchina-div h4 {
        flex: 0 0 52px;
        margin: 0 !important;
        font-size: 0.6rem !important;
        line-height: 1.15;
        text-align: left !important;
    }

    #lista-panchina-nemica,
    #lista-panchina {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        gap: 6px !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .panchina-nemica .carta,
    #panchina-div .carta {
        width: 54px !important;
        margin: 0 !important;
    }

    /* In panchina restano solo statistiche e abilità: il resto è nella scheda (pressione lunga) */
    #lista-panchina .carta-hp,
    #lista-panchina-nemica .carta-hp,
    #lista-panchina .carta-footer > div:last-child {
        display: none;
    }

    /* --- Aree di gioco --- */
    #area-avversaria,
    #area-giocatore {
        flex: 0 0 auto !important;
        padding: 0 !important;
        gap: 4px !important;
    }

    #area-avversaria {
        justify-content: flex-start !important;
    }

    #area-giocatore {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }

    #formazione-campo {
        flex: 0 0 auto !important;
        width: 100% !important;
        padding: 4px !important;
    }

    .linea-meta-campo {
        margin: 2px 0 !important;
    }

    /* --- Cinque carte per riga su tutta la larghezza --- */
    #mie-carte-div,
    #nemici-div {
        flex-wrap: nowrap !important;
        gap: 4px !important;
        margin-top: 0 !important;
    }

    #mie-carte-div .carta,
    #nemici-div .carta {
        width: calc((100vw - 36px) / 5) !important;
        max-width: 96px;
        margin: 0 !important;
        border-radius: 8px;
    }

    /* Tocco sulla carta = seleziona/attacca, quindi i pulsanti testuali non servono; l'affinità è nella scheda */
    #schermata-gioco .carta-footer > button:not(.badge-abilita),
    #schermata-gioco .carta .bonus-affinita {
        display: none !important;
    }

    #schermata-gioco .carta-footer {
        padding: 2px !important;
        gap: 1px !important;
    }

    #schermata-gioco .carta-stats-row {
        padding: 0 1px;
    }

    #schermata-gioco .badge-stat {
        width: 20px !important;
        height: 20px !important;
        border-width: 1px;
    }

    #schermata-gioco .badge-tipo-carta {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
    }

    #schermata-gioco .carta-hp {
        font-size: 0.5rem !important;
    }

    /* --- Obiettivi più compatti --- */
    #schermata-gioco #info-obiettivo,
    #schermata-gioco #info-obiettivo-giocatore {
        margin: 0 auto !important;
        padding: 2px 6px !important;
        gap: 2px !important;
    }

    #schermata-gioco #info-obiettivo .obiettivo-grafica,
    #schermata-gioco #info-obiettivo-giocatore .obiettivo-grafica {
        width: 80px !important;
        height: 20px !important;
    }

    #schermata-gioco #info-obiettivo .obiettivo-hp-container,
    #schermata-gioco #info-obiettivo-giocatore .obiettivo-hp-container {
        width: min(240px, 64vw) !important;
    }

    /* --- Barra del turno in fondo, con "Passa turno" grande per il pollice --- */
    #info-turno {
        padding: 4px !important;
        font-size: 0.62rem !important;
        line-height: 1.5;
    }

    #info-turno .btn-passa-turno {
        display: block;
        margin: 4px auto 0 !important;
        padding: 9px 22px;
        font-size: 0.85rem;
    }

    .log-azioni {
        position: static !important;
        order: 20;
        width: 100% !important;
        padding: 2px 6px;
    }

    /* --- Formazione: cinque slot su una riga, mano su due righe (niente scorrimento: il dito trascina le carte) --- */
    #schermata-formazione {
        justify-content: flex-start !important;
        gap: 6px !important;
        padding: 4px !important;
    }

    .formazione-header h3 {
        font-size: 1rem;
    }

    .formazione-header p {
        font-size: 0.68rem;
    }

    .timer-formazione {
        margin-top: 4px;
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    .slot-formazione {
        flex-wrap: nowrap !important;
        gap: 5px;
        min-height: 0;
        padding: 6px;
    }

    .slot-carta-formazione {
        width: calc((100vw - 60px) / 5);
        flex: 0 0 auto;
        border-width: 2px;
        border-radius: 10px;
        font-size: 0.6rem;
    }

    .slot-carta-formazione .carta-hp,
    .slot-carta-formazione .bonus-affinita {
        display: none;
    }

    .mano-formazione {
        flex-wrap: wrap !important;
        gap: 6px;
        padding: 4px;
        overflow: visible;
    }

    .carta-formazione-mano {
        width: calc((100vw - 58px) / 4) !important;
        max-width: 96px;
        margin: 0 !important;
    }

    .azioni-formazione button {
        margin-top: 0;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Telefoni bassi (per esempio 360x640): panchine più piccole e obiettivi solo con la barra HP */
@media (max-width: 600px) and (max-height: 720px) {
    .panchina-nemica .carta,
    #panchina-div .carta {
        width: 44px !important;
    }

    .panchina-nemica .badge-stat,
    #panchina-div .badge-stat {
        width: 16px !important;
        height: 16px !important;
    }

    .panchina-nemica .badge-tipo-carta,
    #panchina-div .badge-tipo-carta,
    .panchina-nemica .badge-etichetta,
    #panchina-div .badge-etichetta {
        display: none;
    }

    #schermata-gioco #info-obiettivo .obiettivo-grafica,
    #schermata-gioco #info-obiettivo-giocatore .obiettivo-grafica {
        display: none;
    }

    #info-turno {
        line-height: 1.3;
    }

    #info-turno .btn-passa-turno {
        margin-top: 2px !important;
        padding: 7px 20px;
    }
}