/* ============================================================
   LAYOUT.CSS — Stage scaling 16:9 / 9:16, grid, spacing
   ============================================================
   Il #stage è il "canvas" dell'app. Mantiene sempre il suo
   aspect ratio e scala per occupare il massimo spazio
   disponibile senza overflow. Tutto usa unità relative a
   --stage-w / --stage-h (via CSS custom props aggiornate da JS).
   ============================================================ */

:root {
    /* Valori default landscape — aggiornati da kiosk.js */
    --stage-w: 1920px;
    --stage-h: 1080px;
    --stage-scale: 1;

    /* Spacing scale (relativo al layout) */
    --space-xxs: calc(var(--stage-h) * 0.005);
    --space-xs: calc(var(--stage-h) * 0.010);
    --space-sm: calc(var(--stage-h) * 0.020);
    --space-md: calc(var(--stage-h) * 0.035);
    --space-lg: calc(var(--stage-h) * 0.055);
    --space-xl: calc(var(--stage-h) * 0.080);

    /* Font scale */
    --font-size-xs: calc(var(--stage-h) * 0.018);
    --font-size-sm: calc(var(--stage-h) * 0.024);
    --font-size-md: calc(var(--stage-h) * 0.032);
    --font-size-lg: calc(var(--stage-h) * 0.048);
    --font-size-xl: calc(var(--stage-h) * 0.065);
    --font-size-xxl: calc(var(--stage-h) * 0.100);
    --font-size-hero: calc(var(--stage-h) * 0.160); /* codice locker */

    /* Touch target minimo */
    --touch-min: calc(var(--stage-h) * 0.080);
}

/* ── Stage wrapper ─────────────────────────────────────── */
#stage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(var(--stage-scale));
    transform-origin: center center;
    overflow: hidden;
    background-color: var(--color-bg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* Dimensioni logiche fisse — il scaling avviene tramite transform */
    width: var(--stage-w);
    height: var(--stage-h);

    /* will-change: transform dice al compositor di rasterizzare il
       layer dello stage alla risoluzione POST-transform (es. su un
       totem 4K con stage-scale=2 → raster a 3840×2160 invece che
       1920×1080 e poi upscale bitmap). Senza questo hint le immagini
       interne ai layer 3D di StPageFlip risultano sgranate dopo
       l'upscale del bitmap. */
    will-change: transform;
}


/* ── Landscape (tavolo 16:9) — default ─────────────────── */
body.landscape {
    --stage-w: 1920px;
    --stage-h: 1080px;
}

/* ── Portrait (totem 9:16) ─────────────────────────────── */
body.portrait {
    --stage-w: 1080px;
    --stage-h: 1920px;
}

/* ── App root: occupa tutto lo stage ───────────────────── */
#app-root {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ── Pagine: transizione fade tra route ────────────────── */
.page {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
}

/* ── Layout home landscape: header + 2 big tile ────────── */
.home-landscape {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    height: 100%;
    padding: var(--space-lg);
    gap: var(--space-lg);
    background: var(--color-bg);
}

.home-landscape .home-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
}

/* ── Layout home portrait: stack verticale ─────────────── */
.home-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    height: 100%;
    padding: var(--space-xl) var(--space-lg);
    background: linear-gradient(160deg, var(--color-primary) 0%, #001540 60%, #002060 100%);
}

.home-portrait .home-title {
    color: #fff;
    font-size: var(--font-size-xl);
}

.home-portrait .home-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--font-size-sm);
    margin-top: var(--space-sm);
}

.home-portrait .home-event-badge {
    color: rgba(255, 255, 255, 0.4);
}

/* ── Card generica ─────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Grid 3 colonne per hub consultazione ─────────────── */
.hub-grid {
    display: grid;
    gap: var(--space-md);
    height: 100%;
    padding: var(--space-md);
}

body.landscape .hub-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
}

body.portrait .hub-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, 1fr);
}

/* ── Sub-hub grid per le sezioni interne ───────────────── */
.sub-hub-grid {
    display: grid;
    gap: var(--space-sm);
    padding: var(--space-md);
    flex: 1;
    overflow: hidden;
}

body.landscape .sub-hub-grid {
    grid-template-columns: repeat(auto-fit, minmax(calc(var(--stage-w) * 0.18), 1fr));
}

body.portrait .sub-hub-grid {
    grid-template-columns: 1fr;
}

/* ── Content viewer (PDF / video) ──────────────────────── */
.content-viewer {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

.content-viewer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Bottone fullscreen assoluto sopra il viewer */
.btn-fullscreen {
    position: absolute;
    bottom: var(--space-sm);
    right: var(--space-sm);
    width: var(--touch-min);
    height: var(--touch-min);
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.btn-fullscreen img {
    width: 60%;
}

/* ── Navbar interna (back + home) ──────────────────────── */
.inner-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    flex-shrink: 0;
}

.inner-nav .nav-title {
    font-size: var(--font-size-md);
    color: #fff;
    font-weight: 600;
    flex: 1;
}

.btn-nav {
    width: var(--touch-min);
    height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.btn-nav img {
    width: 55%;
}

/* ── Home big tiles (solo landscape) ──────────────────── */
.home-big-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    border-radius: var(--radius-lg);
    color: #fff;
    text-align: center;
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-big-tile:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-md);
}

.home-big-tile .big-tile-icon {
    width: calc(var(--stage-h) * 0.14);
    height: calc(var(--stage-h) * 0.14);
}

.home-big-tile .big-tile-label {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-black);
    line-height: 1;
}

.home-big-tile .big-tile-sub {
    font-size: var(--font-size-sm);
    opacity: 0.8;
    max-width: 80%;
    line-height: 1.4;
}

.tile-consulta {
    background: var(--color-primary);
}

.tile-gioca {
    background: var(--color-accent);
}

/* Home logos */
.home-logos {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.home-logo-main {
    width: min(70%, 340px);
}

.home-sub-logos {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.home-sub-logos img {
    height: calc(var(--stage-h) * 0.04);
}

.home-title {
    font-size: var(--font-size-xl);
    color: var(--color-primary);
    text-align: center;
}

.home-subtitle {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    text-align: center;
    margin-top: var(--space-sm);
    line-height: 1.5;
}

.home-welcome {
    text-align: center;
}

.home-cta-single {
    width: min(80%, 400px);
}

.home-event-badge {
    font-size: var(--font-size-xs);
    color: var(--color-text-light);
    text-align: center;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.page-inner {
    width: 100%;
    height: 100%;
}

/* ============================================================
   LANDSCAPE YELLOW THEME — Pagine gioco 1920×1080
   ============================================================ */

/* Sfondo giallo per tutte le pagine landscape del flusso gioco */
body.landscape .ls-page {
    background-color: #ffd800;
    position: relative;
    overflow: hidden;
}

/* SVG decorazioni (dots, archi, arco blu) */
.ls-decor-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
}

/* Logo Poste fisso in basso a sinistra */
.ls-logo {
    position: absolute;
    bottom: calc(var(--stage-h) * 0.038);
    left: calc(var(--stage-w) * 0.024);
    height: calc(var(--stage-h) * 0.025);
    width: auto;
    z-index: 5;
}

/* ── Wrapper per il contenuto centrato (cerchio + bottone) ── */
.ls-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -51%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--stage-h) * 0.05);
    z-index: 2;
}

/* ── Cerchio principale blu ── */
.ls-main-circle {
    width: calc(var(--stage-h) * 0.58);
    height: calc(var(--stage-h) * 0.58);
    border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%, #2171c7 0%, #0d47a1 42%, #00205b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    text-align: center;
    padding: var(--space-xl);
    box-shadow: 0 24px 64px rgba(0, 32, 91, 0.45);
    position: relative;
}

.ls-main-circle.big {
    width: calc(var(--stage-h) * 0.80);
    height: calc(var(--stage-h) * 0.80);
}


/* Anello decorativo 1 */
.ls-main-circle::before {
    content: '';
    position: absolute;
    inset: calc(var(--stage-h) * -0.022);
    border-radius: 50%;
    border: calc(var(--stage-h) * 0.009) solid #ffd800;
    clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 50% 0%,
    100% 0%, 100% 100%, 50% 100%, 0% 100%);
    /* Arco giallo parziale (effetto gap in alto-sinistra) */
    border-top-color: transparent;
    border-left-color: transparent;
    transform: rotate(-30deg);
}

/* Anello outline esterno */
.ls-main-circle::after {
    content: '';
    position: absolute;
    inset: calc(var(--stage-h) * -0.045);
    border-radius: 50%;
    border: 1.5px solid rgba(0, 32, 91, 0.18);
    pointer-events: none;
}

.ls-circle-icon {
    width: calc(var(--stage-h) * 0.12);
    height: calc(var(--stage-h) * 0.12);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.ls-main-circle.big > .ls-circle-icon.mano {
    width: calc(var(--stage-h) * 0.16);
    height: calc(var(--stage-h) * 0.16);
    position: absolute;
    top: calc(var(--stage-h) * 0.08);
    left: 50%;
    transform: translateX(-50%);
}


.ls-circle-title {
    font-size: calc(var(--stage-h) * 0.035);
    font-weight: var(--font-weight-bold);
    color: #ffd700;
    line-height: 1.15;
    position: relative;
    z-index: 1;
}

.ls-circle-title.come-giocare {
    font-size: calc(var(--stage-h) * 0.055);

}

.ls-circle-title-info {
    font-size: calc(var(--stage-h) * 0.025);
    font-weight: var(--font-weight-regular);
}


.ls-circle-subtitle {
    font-size: calc(var(--stage-w) * 0.020);
    font-weight: var(--font-weight-semibold);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.35;
    max-width: 85%;
}

.ls-circle-subtitle strong {
    color: #ffd700;
}

/* ── Bottoni pill landscape ── */
.ls-btn {
    padding: calc(var(--stage-h) * 0.022) calc(var(--stage-w) * 0.025);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.05em;
    cursor: pointer;
    white-space: nowrap;
    min-width: calc(var(--stage-w) * 0.15);
    text-align: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 8px 24px rgba(0, 32, 91, 0.25);
    border: none;
}

.ls-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px rgba(0, 32, 91, 0.2);
}

.ls-btn-blue {
    background: url("/assets/svg/ui/bg-pulsante-blu.svg") center/100% 100% no-repeat;
    color: #ffd700;
    box-shadow: none;
}

.ls-btn-white {
    background: #ffffff;
    color: #00205b;
}


.ls-btn-white.nickname {
    border-radius: calc(var(--stage-w) * 0.020);
    color: #0047ba;
    padding: calc(var(--stage-h) * 0.005) calc(var(--stage-w) * 0.025);
    font-size: calc(var(--stage-w) * 0.020);
}

.ls-main-circle.big > .ls-btn-white.nickname {
    position: absolute;
    bottom: calc(var(--stage-h) * 0.08);
    left: 50%;
    transform: translateX(-50%);
}

.ls-main-circle.big > .ls-btn-white.nickname:active {
    transform: translateX(-50%) scale(0.96);
}

.ls-btn-yellow {
    background: url("/assets/svg/ui/bg-pulsante-giallo.svg") center/100% 100% no-repeat;
    color: #0047ba;
    box-shadow: none;
}

.ls-lb-btn-wrap .ls-btn-yellow {
    background: url("/assets/svg/ui/bg-pulsante-giallo-grande.svg") center/100% 100% no-repeat;
}

/* ── HOME LANDSCAPE — 3 cerchi ── */
.ls-home {
    width: 100%;
    height: 100%;
    background: transparent;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: calc(var(--stage-w) * 0.025);
    padding: 0 calc(var(--stage-w) * 0.02);
}

/* Cerchio: layout, dimensioni e interazione */
.ls-home-circle {
    flex-shrink: 0;
    width: calc(var(--stage-h) * 0.50);
    height: calc(var(--stage-h) * 0.50);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-lg);
    gap: var(--space-sm);
    cursor: pointer;
    transition: transform 0.14s ease;
    background: none;
    border: none;
}

.ls-home-circle:active {
    transform: scale(0.97);
}

/* Cerchio centrale hub più grande */
.ls-home-circle.ls-hub {
    width: calc(var(--stage-h) * 0.60);
    height: calc(var(--stage-h) * 0.60);
    cursor: default;
}

/* SVG del cerchio: sfondo visuale assoluto */
.ls-circle-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
}

/* Quando il cerchio è disegnato dall'SVG (.ls-circle-bg),
   disattiva il cerchio CSS: gradient, ombra e anelli decorativi */
.ls-main-circle:has(> .ls-circle-bg),
.ls-result-circle:has(> .ls-circle-bg) {
    background: none;
    box-shadow: none;
}

.ls-main-circle:has(> .ls-circle-bg)::before,
.ls-main-circle:has(> .ls-circle-bg)::after,
.ls-result-circle:has(> .ls-circle-bg)::before,
.ls-result-circle:has(> .ls-circle-bg)::after {
    display: none;
}

/* Tutti i figli (tranne l'SVG bg) devono stare sopra l'SVG absolute */
.ls-main-circle > *:not(.ls-circle-bg),
.ls-result-circle > *:not(.ls-circle-bg) {
    position: relative;
    z-index: 1;
}

/* Icona e label sopra il cerchio SVG */
.ls-home-circle-icon {
    width: calc(var(--stage-h) * 0.115);
    height: calc(var(--stage-h) * 0.115);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.ls-home-circle-label {
    font-size: calc(var(--stage-h) * 0.028);
    font-weight: var(--font-weight-bold);
    color: #ffd700;
    line-height: 1.1;
    letter-spacing: 0.02em;
    max-width: 55%;
    position: relative;
    z-index: 1;
}

.ls-home-circle-label-info {
    font-size: calc(var(--stage-h) * 0.019);
    font-weight: var(--font-weight-regular);

}

/* Hub Poste — contenuto sovrapposto al SVG */
.ls-hub-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    margin-top: var(--space-lg);
}

.ls-hub-logo {
    height: calc(var(--stage-h) * 0.04);
}

.ls-hub-tagline {
    font-size: var(--font-size-sm);
    color: #0047bb;
    margin-bottom: var(--space-sm);
}

.ls-hub-featured {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xxs);
    margin-bottom: var(--space-sm);
}

.ls-hub-featured-icon {
    width: calc(var(--stage-h) * 0.085);
}

.ls-hub-featured-label {
    font-size: calc(var(--stage-h) * 0.010);
    color: #0047bb;
    letter-spacing: 0.03em;
}

.ls-hub-icons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.ls-hub-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xxs);
}

.ls-hub-icon-item img {
    width: calc(var(--stage-h) * 0.052);
}

.ls-hub-icon-item span {
    font-size: calc(var(--stage-h) * 0.010);
    color: #0047bb;
    white-space: nowrap;
}

/* ── COME GIOCARE — form nickname dentro cerchio ── */
.ls-nick-input {
    width: 90%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-primary);
    color: #fff;
    background: transparent;
    border: 3px solid #fff;
    border-radius: var(--radius-full);
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s;
}


.ls-nick-input::placeholder {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
}

.ls-nick-hint {
    font-size: var(--font-size-xs);
    min-height: 1.4em;
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.2s;
}

.ls-nick-hint--warn {
    color: #ffd700;
    font-weight: 600;
}

.ls-nick-hint--error {
    color: #ff7070;
    font-weight: 600;
}

/* ── GAME PLAY — sidebar + arena ── */
.ls-game-page {
    width: 100%;
    height: 100%;
    background-color: #ffd800;
    display: flex;
    align-items: stretch;
    gap: calc(var(--stage-w) * 0.018);
    padding: calc(var(--stage-h) * 0.042) calc(var(--stage-w) * 0.022);
    overflow: hidden;
    position: relative;
}

.ls-game-sidebar {
    flex-shrink: 0;
    width: calc(var(--stage-w) * 0.175);
    display: flex;
    flex-direction: column;
    gap: calc(var(--stage-h) * 0.028);
    position: relative;
    z-index: 2;
    padding-top: calc(var(--stage-h) * 0.1);
}

.ls-sidebar-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.ls-sidebar-icon {
    width: calc(var(--stage-h) * 0.055);
    height: calc(var(--stage-h) * 0.055);
    flex-shrink: 0;
}

.ls-sidebar-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: calc(var(--stage-h) * 0.005) calc(var(--stage-h) * 0.015);
    background: #0047ba;
    border-radius: calc(var(--stage-h) * 0.075);
    text-align: center;
}

.ls-sidebar-pill-icon {
    width: calc(var(--stage-h) * 0.042);
    height: calc(var(--stage-h) * 0.042);
    flex-shrink: 0;
}

.ls-sidebar-pill-text {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: #ffd700;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-sidebar-pill-text.ls-timer-danger {
    color: #ff6b6b;
    animation: timer-blink 0.6s ease-in-out infinite;
}

.ls-game-arena {
    flex: 1;
    background: url("/assets/svg/ui/bg-game-arena.webp") center/100% 100% no-repeat;
    position: relative;
    overflow: hidden;
}

.ls-game-arena canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Sidebar dots decoration (small circles) */
.ls-sidebar-dots {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    opacity: 0.25;
}

/* ── RESULT PAGE ── */
.ls-result-circle {
    width: calc(var(--stage-h) * 0.60);
    height: calc(var(--stage-h) * 0.60);
    border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%, #2171c7 0%, #0d47a1 42%, #00205b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-align: center;
    padding: var(--space-xl);
    box-shadow: 0 24px 64px rgba(0, 32, 91, 0.45);
    position: relative;
}

.ls-result-circle.big {
    width: calc(var(--stage-h) * 0.80);
    height: calc(var(--stage-h) * 0.80);
}

.ls-result-circle.big .ls-circle-title {
    font-size: calc(var(--stage-h) * 0.045);
    font-weight: 600;
    color: #ffd700;
    line-height: 1.1;
}

.ls-result-circle.big .ls-circle-subtitle {
    font-size: calc(var(--stage-h) * 0.045);
    font-weight: 600;
    color: #ffd700;
    line-height: 1.1;
}

.ls-result-circle.big .ls-btn.ls-btn-yellow {
    margin-top: calc(var(--stage-h) * 0.025);
}

.ls-result-circle::before {
    content: '';
    position: absolute;
    inset: calc(var(--stage-h) * -0.022);
    border-radius: 50%;
    border: calc(var(--stage-h) * 0.009) solid #ffd800;
    border-top-color: transparent;
    border-left-color: transparent;
    transform: rotate(-30deg);
}

.ls-result-circle::after {
    content: '';
    position: absolute;
    inset: calc(var(--stage-h) * -0.045);
    border-radius: 50%;
    border: 1.5px solid rgba(0, 32, 91, 0.18);
}

.ls-result-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: #ffd700;
    line-height: 1.1;
}

.ls-result-label {
    margin-top: calc(var(--stage-h) * 0.045);
    font-size: calc(var(--stage-h) * 0.035);
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
}

.ls-result-score {
    font-size: var(--font-size-xxl);
    font-weight: 600;
    color: #ffd700;
    line-height: 1;
    letter-spacing: -0.02em;
}

.ls-result-unit {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.85);
    font-weight: var(--font-weight-bold);
    margin-top: calc(var(--space-xs) * -1);
}

.ls-result-countdown {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.40);
    margin-top: var(--space-sm);
}

/* ── LEADERBOARD PANEL ── */
.ls-leaderboard-wrap {
    position: absolute;
    top: 50%;
    left: 58%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: calc(var(--stage-w) - var(--stage-w) * 0.022 * 2 - var(--stage-w) * 0.018 - var(--stage-w) * 0.175);
    height: calc(var(--stage-h) - var(--stage-h) * 0.042 * 2);
}

.ls-leaderboard-panel {
    width: 100%;
    height: 100%;
    background: url("/assets/svg/ui/bg-game-arena.webp") center/100% 100% no-repeat;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: calc(var(--stage-h) * 0.005) calc(var(--stage-w) * 0.005);
    box-sizing: border-box;
}

.ls-lb-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: calc(var(--stage-h) * 0.025);
    padding-bottom: calc(var(--stage-h) * 0.018);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.ls-lb-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: #ffd700;
    letter-spacing: 0.04em;
}

.ls-lb-trophy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.ls-lb-trophy img {
    width: calc(var(--stage-h) * 0.12);
    height: calc(var(--stage-h) * 0.12);
    display: block;
}

.ls-lb-list {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ls-lb-row {
    display: flex;
    align-items: center;
    padding: calc(var(--stage-h) * 0.002) var(--space-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.ls-lb-row:last-child {
    border-bottom: none;
}

.ls-lb-rank {
    width: calc(var(--stage-h) * 0.05);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    flex-shrink: 0;
}

.ls-lb-row:first-child .ls-lb-rank {
    color: #ffd700;
    font-size: var(--font-size-sm);
}

.ls-lb-row:nth-child(2) .ls-lb-rank {
    color: #c0c0c0;
}

.ls-lb-row:nth-child(3) .ls-lb-rank {
    color: #cd7f32;
}

.ls-lb-nick {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: #ffffff;
    padding: 0 var(--space-md);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-lb-score {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-black);
    color: #ffd700;
    text-align: right;
    flex-shrink: 0;
    min-width: calc(var(--stage-w) * 0.07);
}

.ls-lb-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.40);
    font-size: var(--font-size-sm);
    padding: var(--space-lg) 0;
}

.ls-lb-btn-wrap {
    margin-top: 0;
    padding-top: calc(var(--stage-h) * 0.025);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

/* ── TORNA INDIETRO — bottone circolare blu Poste ─────── */
.btn-torna-indietro {
    position: absolute;
    right: calc(var(--stage-w) * 0.025);
    bottom: calc(var(--stage-h) * 0.04);
    width: calc(var(--stage-h) * 0.07);
    height: calc(var(--stage-h) * 0.07);
    border-radius: 50%;
    background: #0047ba;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.14s ease;
    z-index: 5;
    padding: 0;
}

.btn-torna-indietro:active {
    transform: scale(0.94);
}

.btn-torna-indietro-icon {
    display: block;
    width: calc(var(--stage-h) * 0.030);
    height: calc(var(--stage-h) * 0.030);
    background: #ffd800;
    -webkit-mask: url("/assets/svg/ui/arrow-back.svg") center/contain no-repeat;
            mask: url("/assets/svg/ui/arrow-back.svg") center/contain no-repeat;
}

/* ── HOME — bottone circolare gemello, affiancato al back ─ */
.btn-home {
    position: absolute;
    /* sinistra del back: gap = larghezza bottone + margine */
    right: calc(var(--stage-w) * 0.025 + var(--stage-h) * 0.085);
    bottom: calc(var(--stage-h) * 0.04);
    width: calc(var(--stage-h) * 0.07);
    height: calc(var(--stage-h) * 0.07);
    border-radius: 50%;
    background: #0047ba;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.14s ease;
    z-index: 5;
    padding: 0;
}

.btn-home:active {
    transform: scale(0.94);
}

.btn-home-icon {
    display: block;
    width: calc(var(--stage-h) * 0.032);
    height: calc(var(--stage-h) * 0.032);
    background: #ffd800;
    -webkit-mask: url("/assets/svg/ui/home.svg") center/contain no-repeat;
            mask: url("/assets/svg/ui/home.svg") center/contain no-repeat;
}

/* ── PRIMA PAGINA PDF — gemello di home/back, solo nei viewer PDF ── */
.btn-first-page {
    position: absolute;
    /* sinistra di home: gap = larghezza bottone + margine */
    right: calc(var(--stage-w) * 0.025 + var(--stage-h) * 0.085 * 2);
    bottom: calc(var(--stage-h) * 0.04);
    width: calc(var(--stage-h) * 0.07);
    height: calc(var(--stage-h) * 0.07);
    border-radius: 50%;
    background: #0047ba;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.14s ease;
    z-index: 5;
    padding: 0;
}

.btn-first-page:active {
    transform: scale(0.94);
}

.btn-first-page-icon {
    display: block;
    width: calc(var(--stage-h) * 0.030);
    height: calc(var(--stage-h) * 0.030);
    background: #ffd800;
    -webkit-mask: url("/assets/svg/ui/arrow-first.svg") center/contain no-repeat;
            mask: url("/assets/svg/ui/arrow-first.svg") center/contain no-repeat;
}

/* Portrait (totem 1080×1920): pulsanti più compatti relativi alla
   larghezza, posizionati con margini coerenti col formato verticale.
   In landscape stage-h è la dimensione minore (1080) e funziona da base;
   in portrait usiamo stage-w (1080) per ottenere lo stesso visual size. */
body.portrait .btn-torna-indietro {
    width: calc(var(--stage-w) * 0.05);
    height: calc(var(--stage-w) * 0.05);
    right: calc(var(--stage-w) * 0.045);
    bottom: calc(var(--stage-h) * 0.30);
}

body.portrait .btn-home {
    width: calc(var(--stage-w) * 0.05);
    height: calc(var(--stage-w) * 0.05);
    right: calc(var(--stage-w) * 0.045 + var(--stage-w) * 0.08);
    bottom: calc(var(--stage-h) * 0.30);
}

body.portrait .btn-torna-indietro-icon {
    width: calc(var(--stage-w) * 0.025);
    height: calc(var(--stage-w) * 0.045);
}

body.portrait .btn-home-icon {
    width: calc(var(--stage-w) * 0.028);
    height: calc(var(--stage-w) * 0.048);
}

body.portrait .btn-first-page {
    width: calc(var(--stage-w) * 0.05);
    height: calc(var(--stage-w) * 0.05);
    right: calc(var(--stage-w) * 0.045 + var(--stage-w) * 0.08 * 2);
    bottom: calc(var(--stage-h) * 0.30);
}

body.portrait .btn-first-page-icon {
    width: calc(var(--stage-w) * 0.028);
    height: calc(var(--stage-w) * 0.048);
}

/* ── Highlight riga corrente ── */
.ls-lb-row.ls-lb-row--current {
    background: rgba(255, 215, 0, 0.08);
    border-radius: var(--radius-sm);
}

.ls-lb-row--current .ls-lb-nick {
    color: #ffd700;
    font-weight: var(--font-weight-black);
}

.ls-lb-row--outside {
    margin-top: calc(var(--stage-h) * 0.012);
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

/* ── VINCITORE — ricevuta premio ─────────────────────── */
.ls-vincitore-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(var(--stage-w) * 0.70);
    height: calc(var(--stage-h) * 0.72);
    background: url("/assets/svg/ui/bg-vincitore.webp") center/100% 100% no-repeat;
    z-index: 2;
}

.ls-vincitore-nick {
    position: absolute;
    top: 29%;
    left: 13.8%;
    width: 75%;
    font-size: calc(var(--stage-h) * 0.075);
    font-weight: var(--font-weight-black);
    text-transform: uppercase;
    color: #000000;
    letter-spacing: 0.02em;
    line-height: 1;
    z-index: 3;
}

.ls-vincitore-codice {
    position: absolute;
    top: 73%;
    left: 38.9%;
    width: 40%;
    font-size: calc(var(--stage-h) * 0.090);
    font-weight: var(--font-weight-black);
    color: #000000;
    letter-spacing: 0.04em;
    line-height: 1;
    z-index: 3;
}

/* Data corrente sulla ricevuta vincitore. Si sovrappone al "DATA 01/04/2026"
   hardcoded nello sfondo bg-vincitore.webp (background bianco coprente). */
.ls-vincitore-data {
    position: absolute;
    bottom: 4.7%;
    left: 7%;
    padding: 0.25em 0.6em;
    background: #ffffff;
    color: #000000;
    font-size: calc(var(--stage-h) * 0.024);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.02em;
    line-height: 1;
    z-index: 3;
}

/* Wrapper viewer (PDF) — iframe legacy, qui solo per fallback. */
.pdf-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.pdf-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Schermata gioco ───────────────────────────────────── */
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--color-primary);
    flex-shrink: 0;
}

.game-score,
.game-timer {
    font-size: var(--font-size-lg);
    color: #fff;
    font-weight: 700;
}

#game-canvas {
    flex: 1;
    display: block;
    width: 100%;
}

/* Wrapper per posizionare i popup score sopra il canvas */
.game-canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.game-canvas-wrap #game-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Timer lampeggiante sotto 10s */
@keyframes timer-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

#timer-display.danger {
    animation: timer-blink 0.6s ease-in-out infinite;
    color: #ff6b6b !important;
}

/* ── Schermata risultato / codice locker ───────────────── */
.result-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-lg);
    padding: var(--space-xl);
    background: var(--color-primary);
    color: #fff;
    text-align: center;
}

.result-score-label {
    font-size: var(--font-size-md);
    opacity: 0.8;
}

.result-score-value {
    font-size: var(--font-size-xxl);
    font-weight: 700;
}

.result-divider {
    width: 60%;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.result-code-label {
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.7;
}

.result-code {
    font-size: var(--font-size-hero);
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--color-yellow);
    line-height: 1;
}

.result-message {
    font-size: var(--font-size-md);
    max-width: 70%;
    opacity: 0.85;
    line-height: 1.4;
}

.result-countdown {
    font-size: var(--font-size-xs);
    opacity: 0.5;
}

/* ============================================================
   PORTRAIT CONSULTAZIONE YELLOW THEME — Totem 1080×1920
   ============================================================ */

body.portrait .pt-page {
    background: #ffd800;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pt-decor-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
}

body.portrait .pt-logo {
    position: absolute;
    bottom: calc(var(--stage-h) * 0.022);
    left: calc(var(--stage-w) * 0.040);
    height: calc(var(--stage-h) * 0.030);
    width: auto;
    z-index: 5;
}

/* ── Nav bar portrait ── */
.pt-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: calc(var(--stage-h) * 0.022) calc(var(--stage-w) * 0.045);
    background: #00205b;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.pt-nav-title {
    flex: 1;
    font-size: calc(var(--stage-w) * 0.046);
    font-weight: var(--font-weight-bold);
    color: #ffd700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pt-nav-btn {
    width: calc(var(--stage-w) * 0.098);
    height: calc(var(--stage-w) * 0.098);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    cursor: pointer;
    border: none;
}

.pt-nav-btn img {
    width: 55%;
}

/* ── HUB consultazione portrait ── */
.pt-hub {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: calc(var(--stage-h) * 0.050) calc(var(--stage-w) * 0.055) calc(var(--stage-h) * 0.095);
    position: relative;
    z-index: 2;
}

.pt-hub-circle {
    width: calc(var(--stage-w) * 0.64);
    height: calc(var(--stage-w) * 0.64);
    border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%, #2171c7 0%, #0d47a1 42%, #00205b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 24px 64px rgba(0, 32, 91, 0.45);
    position: relative;
    flex-shrink: 0;
}

.pt-hub-circle::before {
    content: '';
    position: absolute;
    inset: calc(var(--stage-w) * -0.018);
    border-radius: 50%;
    border: calc(var(--stage-w) * 0.008) solid #ffd800;
    border-top-color: transparent;
    border-left-color: transparent;
    transform: rotate(-30deg);
    pointer-events: none;
}

.pt-hub-circle::after {
    content: '';
    position: absolute;
    inset: calc(var(--stage-w) * -0.038);
    border-radius: 50%;
    border: 1.5px solid rgba(0, 32, 91, 0.18);
    pointer-events: none;
}

.pt-hub-logo {
    height: calc(var(--stage-w) * 0.18);
    filter: brightness(0) invert(1);
}

.pt-hub-tagline {
    font-size: calc(var(--stage-w) * 0.038);
    color: rgba(255, 255, 255, 0.80);
    margin-top: calc(var(--stage-w) * 0.018);
    text-align: center;
}

/* 3 cerchi area (2 top + 1 bottom center) */
.pt-area-circles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--stage-w) * 0.042);
    width: 100%;
    justify-items: center;
}

.pt-area-circle:nth-child(3) {
    grid-column: 1 / -1;
}

.pt-area-circle {
    width: calc(var(--stage-w) * 0.40);
    height: calc(var(--stage-w) * 0.40);
    border-radius: 50%;
    background: radial-gradient(ellipse at 38% 32%, #2171c7 0%, #0d47a1 42%, #00205b 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(var(--stage-w) * 0.04);
    gap: calc(var(--stage-w) * 0.020);
    box-shadow: 0 16px 48px rgba(0, 32, 91, 0.40);
    cursor: pointer;
    transition: transform 0.14s ease;
    position: relative;
    border: none;
}

.pt-area-circle:active {
    transform: scale(0.96);
}

.pt-area-circle::before {
    content: '';
    position: absolute;
    inset: calc(var(--stage-w) * -0.015);
    border-radius: 50%;
    border: calc(var(--stage-w) * 0.007) solid #ffd800;
    border-top-color: transparent;
    border-left-color: transparent;
    transform: rotate(-30deg);
    pointer-events: none;
}

.pt-area-circle-icon {
    width: calc(var(--stage-w) * 0.088);
    height: calc(var(--stage-w) * 0.088);
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.pt-area-circle-label {
    font-size: calc(var(--stage-w) * 0.042);
    font-weight: var(--font-weight-black);
    color: #ffd700;
    line-height: 1.15;
}

/* ── Pagamenti sub-hub (3 pill) ── */
.pt-sub-hub {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(var(--stage-h) * 0.038) calc(var(--stage-w) * 0.055) calc(var(--stage-h) * 0.095);
    gap: calc(var(--stage-h) * 0.036);
    position: relative;
    z-index: 2;
}

.pt-sub-circle {
    width: 88%;
    height: calc(var(--stage-w) * 0.26);
    border-radius: var(--radius-full);
    background: radial-gradient(ellipse at 35% 30%, #2171c7 0%, #0d47a1 45%, #00205b 100%);
    display: flex;
    align-items: center;
    gap: calc(var(--stage-w) * 0.045);
    padding: 0 calc(var(--stage-w) * 0.065);
    box-shadow: 0 14px 40px rgba(0, 32, 91, 0.38);
    cursor: pointer;
    transition: transform 0.14s ease;
    border: none;
    text-align: left;
    flex-shrink: 0;
}

.pt-sub-circle:active {
    transform: scale(0.97);
}

.pt-sub-circle-icon {
    width: calc(var(--stage-w) * 0.100);
    height: calc(var(--stage-w) * 0.100);
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.pt-sub-circle-label {
    font-size: calc(var(--stage-w) * 0.046);
    font-weight: var(--font-weight-black);
    color: #ffd700;
    line-height: 1.2;
}

/* ── Content list (sezioni) ── */
.pt-content-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: calc(var(--stage-h) * 0.026);
    padding: calc(var(--stage-h) * 0.035) calc(var(--stage-w) * 0.055) calc(var(--stage-h) * 0.095);
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

.pt-content-item {
    display: flex;
    align-items: center;
    gap: calc(var(--stage-w) * 0.045);
    padding: calc(var(--stage-h) * 0.028) calc(var(--stage-w) * 0.055);
    background: #00205b;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: transform 0.12s ease;
    box-shadow: 0 10px 32px rgba(0, 32, 91, 0.30);
    border: none;
    text-align: left;
    flex-shrink: 0;
}

.pt-content-item:active {
    transform: scale(0.97);
}

.pt-content-item-icon {
    width: calc(var(--stage-w) * 0.082);
    height: calc(var(--stage-w) * 0.082);
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.pt-content-item-text {
    flex: 1;
    font-size: calc(var(--stage-w) * 0.044);
    font-weight: var(--font-weight-bold);
    color: #ffffff;
    line-height: 1.25;
}

.pt-content-item-badge {
    font-size: calc(var(--stage-w) * 0.028);
    font-weight: var(--font-weight-bold);
    color: #ffd700;
    background: rgba(255, 215, 0, 0.12);
    padding: 0.22em 0.55em;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── PDB logo header (spedizioni) ── */
.pt-pdb-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--stage-h) * 0.028) 0 calc(var(--stage-h) * 0.010);
    flex-shrink: 0;
    z-index: 2;
    position: relative;
}

.pt-pdb-logo {
    height: calc(var(--stage-w) * 0.090);
    width: auto;
}

/* ── Placeholder ── */
.pt-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    color: rgba(0, 32, 91, 0.50);
    font-size: calc(var(--stage-w) * 0.042);
    text-align: center;
    padding: var(--space-xl) 0;
    flex: 1;
}

.pt-placeholder img {
    width: calc(var(--stage-w) * 0.12);
    opacity: 0.40;
}

/* ── Logo Poste cliccabile (apre overlay www.poste.it) ───── */
.poste-link[data-poste-link] {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.14s ease;
}

.poste-link[data-poste-link]:active {
    transform: scale(0.96);
}

/* ── Overlay iframe www.poste.it ──────────────────────── */
#poste-iframe-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0047bb;
    display: flex;
    flex-direction: column;
}

#poste-iframe-overlay.hidden {
    display: none;
}

#poste-iframe-overlay #poste-iframe {
    flex: 1 1 auto;
    width: 100%;
    border: 0;
    background: #fff;
}

.poste-iframe-bar {
    flex: 0 0 auto;
    height: calc(var(--stage-h) * 0.08);
    min-height: 56px;
    background: #0047bb;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
}

.poste-iframe-close {
    background: #FFD800;
    color: #0047bb;
    width: calc(var(--stage-h) * 0.3);
    margin: 10px auto;
    font-weight: var(--font-weight-black, 800);
    font-size: calc(var(--stage-h) * 0.012);
    border: 0;
    border-radius: 999px;
    padding: calc(var(--stage-h) * 0.014) calc(var(--stage-h) * 0.045);
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: transform 0.14s ease;
}

body.portrait .poste-iframe-bar {
    height: calc(var(--stage-h) * 0.045);
}

body.portrait .poste-iframe-close {
    width: calc(var(--stage-h) * 0.18);
    font-size: calc(var(--stage-h) * 0.008);
    padding: calc(var(--stage-h) * 0.0084) calc(var(--stage-h) * 0.045);
}

.poste-iframe-close:active {
    transform: scale(0.96);
}
