/* Classifica, barra di navigazione mobile e pannello admin.
   Fa parte degli stili del gioco: fragments/game-styles.html li include
   in ordine dopo game.css. */

/* Classifica: medaglie del podio e riga del giocatore. */
.rank-medal {
    margin-right: 0.3rem;
    font-size: 1.05rem;
}

.rank-medal-1 {
    color: #e2b93b;
}

.rank-medal-2 {
    color: #c9ced6;
}

.rank-medal-3 {
    color: #cd8a4f;
}

.leaderboard-me td {
    font-weight: 600;
}

.leaderboard-flash td {
    animation: leaderboardFlash 1.6s ease;
}

@keyframes leaderboardFlash {
    0%, 40% {
        background-color: rgba(194, 164, 109, 0.45);
    }

    100% {
        background-color: transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    .leaderboard-flash td {
        animation: none;
    }
}

/* Barra di navigazione mobile, fissa in basso sopra l'area sicura del
   telefono: tutte le sezioni, scorrevoli in orizzontale con lo snap. */
.mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    padding: .3rem 0 calc(.3rem + env(safe-area-inset-bottom));
    background: rgba(8, 9, 12, 0.92);
    border-top: 1px solid var(--border-soft);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.mobile-tabbar-scroll {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: .25rem;
    scrollbar-width: none;
    padding: 0 .25rem;
}

.mobile-tabbar-scroll::-webkit-scrollbar {
    display: none;
}

/* Sfumature ai bordi: dicono che ci sono altre schede da quel lato. */
.mobile-tabbar::before,
.mobile-tabbar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 1;
}

.mobile-tabbar::before {
    left: 0;
    background: linear-gradient(to right, rgba(8, 9, 12, 0.95), transparent);
}

.mobile-tabbar::after {
    right: 0;
    background: linear-gradient(to left, rgba(8, 9, 12, 0.95), transparent);
}

.mobile-tabbar[data-more-start]::before,
.mobile-tabbar[data-more-end]::after {
    opacity: 1;
}

.mobile-tab {
    position: relative;
    flex: 0 0 72px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    padding: .3rem .15rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-soft);
    font-size: .64rem;
    letter-spacing: .02em;
    text-decoration: none;
    min-width: 0;
}

.mobile-tab span:not(.mobile-tab-badge) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-tab .bi {
    font-size: 1.2rem;
    line-height: 1;
}

.mobile-tab.active {
    color: var(--aged-gold);
}

.mobile-tab.active::before {
    content: "";
    position: absolute;
    /* Dentro la barra scorrevole: sopra la scheda verrebbe tagliato. */
    top: 0;
    left: 28%;
    right: 28%;
    height: 2px;
    border-radius: 2px;
    background: var(--aged-gold);
}

.mobile-tab:focus-visible {
    outline: 2px solid var(--aged-gold);
    outline-offset: -2px;
}

.mobile-tab-badge {
    position: absolute;
    top: .05rem;
    left: calc(50% + .35rem);
    margin: 0;
    min-width: 1.1rem;
    height: 1.1rem;
    font-size: .6rem;
}

@media (max-width: 991.98px) {
    /* Spazio per la barra in basso, che altrimenti coprirebbe il fondo pagina. */
    .main-content {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }

    .game-version-badge {
        display: none;
    }
}

/* Pannello admin: stesso tema del gioco, larghezza contenuta. */
.admin-shell {
    max-width: 900px;
}

.admin-shell .btn .bi,
[data-leaderboard-find-me] .bi {
    margin-right: 0.35rem;
}

/* "Tira per aggiornare" su telefono (static/js/pull-refresh.js). Il body
   contiene lo scorrimento oltre i bordi: niente doppio refresh del browser. */
@media (pointer: coarse) {
    body {
        overscroll-behavior-y: contain;
    }
}

.pull-refresh-indicator {
    position: fixed;
    top: calc(-2.75rem + env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 2100;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .85rem;
    border-radius: 999px;
    border: 1px solid rgba(194, 164, 109, .55);
    background: rgba(14, 15, 19, .96);
    color: #f1eadc;
    font-size: .85rem;
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .45);
    opacity: 0;
    transform: translate(-50%, 0);
    pointer-events: none;
    transition: opacity .15s ease;
}

.pull-refresh-indicator.is-visible {
    opacity: 1;
}

.pull-refresh-indicator .bi {
    transition: transform .2s ease;
}

.pull-refresh-indicator.is-ready .bi {
    transform: rotate(180deg);
    color: #f2c94c;
}

.pull-refresh-indicator.is-loading .bi {
    animation: pull-refresh-spin .8s linear infinite;
}

@keyframes pull-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}
