/**
 * FriendJong — Arcade Mahjong Solitaire CSS
 * Widescreen 16:9 Responsive Design, AdSense Immunization & Arcade Theme
 */

/* ==========================================================================
   1. CONTENITORE PRINCIPALE & TOPBAR
   ========================================================================== */
.yf-jong-app {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #f8fafc;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* Modalità Fullscreen Reale (Pulsante Ingrandisci) */
:fullscreen {
    background-color: #02100e !important;
}

/* Regola Universale basata sulla classe .is-fullscreen e pseudo-classi standard */
.yf-jong-app.is-fullscreen,
.yf-jong-app:fullscreen,
.yf-jong-app:-webkit-full-screen {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #02100e !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    overflow: hidden !important;
}

.yf-jong-app.is-fullscreen .yf-jong-topbar,
.yf-jong-app:fullscreen .yf-jong-topbar,
.yf-jong-app:-webkit-full-screen .yf-jong-topbar {
    border-radius: 0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    flex-shrink: 0 !important;
    padding: 12px 24px !important;
    gap: 16px !important;
    background: #061715 !important;
    border-bottom: 2px solid #0d9488 !important;
}

.yf-jong-app.is-fullscreen .yf-jong-player,
.yf-jong-app:fullscreen .yf-jong-player,
.yf-jong-app:-webkit-full-screen .yf-jong-player {
    font-size: 16px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-topbar-hud,
.yf-jong-app:fullscreen .yf-jong-topbar-hud,
.yf-jong-app:-webkit-full-screen .yf-jong-topbar-hud {
    gap: 12px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-hud-pill,
.yf-jong-app:fullscreen .yf-jong-hud-pill,
.yf-jong-app:-webkit-full-screen .yf-jong-hud-pill {
    padding: 6px 16px !important;
    border-radius: 24px !important;
    gap: 8px !important;
    border-width: 1.5px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-hud-label,
.yf-jong-app:fullscreen .yf-jong-hud-label,
.yf-jong-app:-webkit-full-screen .yf-jong-hud-label {
    font-size: 12px !important;
    letter-spacing: 0.8px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-hud-val,
.yf-jong-app:fullscreen .yf-jong-hud-val,
.yf-jong-app:-webkit-full-screen .yf-jong-hud-val {
    font-size: 19px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-hud-timer,
.yf-jong-app:fullscreen .yf-jong-hud-timer,
.yf-jong-app:-webkit-full-screen .yf-jong-hud-timer {
    padding: 6px 20px !important;
    border-width: 2px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-hud-timer .yf-jong-hud-icon,
.yf-jong-app:fullscreen .yf-jong-hud-timer .yf-jong-hud-icon,
.yf-jong-app:-webkit-full-screen .yf-jong-hud-timer .yf-jong-hud-icon {
    font-size: 20px !important;
}

.yf-jong-app.is-fullscreen #yf-jong-hud-timer, #yf-jong-hud-timer-val,
.yf-jong-app:fullscreen #yf-jong-hud-timer, #yf-jong-hud-timer-val,
.yf-jong-app:-webkit-full-screen #yf-jong-hud-timer, #yf-jong-hud-timer-val {
    font-size: 22px !important;
    letter-spacing: 1px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-topbar-controls .yf-racer-btn,
.yf-jong-app:fullscreen .yf-jong-topbar-controls .yf-racer-btn,
.yf-jong-app:-webkit-full-screen .yf-jong-topbar-controls .yf-racer-btn {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
    border-radius: 21px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-main-stage,
.yf-jong-app:fullscreen .yf-jong-main-stage,
.yf-jong-app:-webkit-full-screen .yf-jong-main-stage {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    overflow: hidden !important;
}

.yf-jong-app.is-fullscreen .yf-jong-viewport,
.yf-jong-app:fullscreen .yf-jong-viewport,
.yf-jong-app:-webkit-full-screen .yf-jong-viewport {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    touch-action: none !important;
}

.yf-jong-app.is-fullscreen #yf-jong-canvas,
.yf-jong-app:fullscreen #yf-jong-canvas,
.yf-jong-app:-webkit-full-screen #yf-jong-canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    margin: auto !important;
    display: block !important;
    touch-action: none !important;
}

.yf-jong-app.is-fullscreen .yf-jong-bottombar,
.yf-jong-app.is-fullscreen #yf-jong-floating-actions,
.yf-jong-app:fullscreen .yf-jong-bottombar,
.yf-jong-app:fullscreen #yf-jong-floating-actions,
.yf-jong-app:-webkit-full-screen .yf-jong-bottombar,
.yf-jong-app:-webkit-full-screen #yf-jong-floating-actions {
    flex-shrink: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    border-top: 2px solid #0d9488 !important;
    background: #061715 !important;
    padding: 14px 24px !important;
    gap: 24px !important;
    z-index: 100000 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.yf-jong-app.is-fullscreen .yf-jong-tool-btn,
.yf-jong-app:fullscreen .yf-jong-tool-btn,
.yf-jong-app:-webkit-full-screen .yf-jong-tool-btn {
    padding: 10px 28px !important;
    font-size: 15px !important;
    border-radius: 28px !important;
}

.yf-jong-app.is-fullscreen .yf-tool-icon,
.yf-jong-app:fullscreen .yf-tool-icon,
.yf-jong-app:-webkit-full-screen .yf-tool-icon {
    font-size: 18px !important;
}

.yf-jong-app.is-fullscreen .yf-jong-badge,
.yf-jong-app:fullscreen .yf-jong-badge,
.yf-jong-app:-webkit-full-screen .yf-jong-badge {
    font-size: 13px !important;
    padding: 2px 8px !important;
    min-width: 22px !important;
}

.yf-jong-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #091a18;
    border: 1px solid #134e4a;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 8px 14px;
    gap: 10px;
}

.yf-jong-player {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
}

.yf-jong-topbar-hud {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yf-jong-hud-pill {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid #0d9488;
    border-radius: 20px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.yf-jong-hud-label {
    font-size: 10px;
    font-weight: 800;
    color: #5eead4;
    letter-spacing: 0.5px;
}

.yf-jong-hud-val {
    font-size: 14px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(94, 234, 212, 0.6);
}

.yf-jong-hud-timer {
    border-color: #0284c7 !important;
}

.yf-jong-hud-timer .yf-jong-hud-label {
    color: #38bdf8 !important;
}

.yf-jong-hud-timer.urgent {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.25) !important;
    animation: yf-timer-pulse 0.6s infinite alternate ease-in-out !important;
}

.yf-jong-hud-timer.urgent .yf-jong-hud-val {
    color: #f87171 !important;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.8) !important;
}

@keyframes yf-timer-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.yf-jong-hud-fever {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(239, 68, 68, 0.45)) !important;
    border: 1px solid #f59e0b !important;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.6) !important;
    animation: yf-fever-pulse 0.75s infinite alternate ease-in-out;
}

@keyframes yf-fever-pulse {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
    100% { transform: scale(1.06); box-shadow: 0 0 18px rgba(245, 158, 11, 0.95); }
}

.yf-jong-hud-fever .yf-jong-hud-label {
    color: #fbbf24 !important;
    font-weight: 900 !important;
}

.yf-jong-hud-fever .yf-jong-hud-val {
    color: #fef08a !important;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.9) !important;
}

.yf-jong-topbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   2. STAGE DI GIOCO 16:9 E CANVAS
   ========================================================================== */
.yf-jong-main-stage {
    position: relative;
    width: 100%;
    background: #051412;
    border: 1px solid #134e4a;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

.yf-jong-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-width: 100%;
    overflow: hidden;
    background: radial-gradient(circle at center, #0f3d38 0%, #06211e 70%, #02100e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

#yf-jong-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    touch-action: none;
}

/* ==========================================================================
   3. BARRA COMANDI TATTICI INFERIORE DEDICATA (Suggerimento e Mischia)
   ========================================================================== */
.yf-jong-bottombar,
.yf-jong-floating-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: #091a18;
    border: 1px solid #134e4a;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 10px 16px;
    z-index: 30;
    position: relative;
    pointer-events: auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.yf-jong-tool-btn {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.9), rgba(15, 118, 110, 0.98));
    border: 1px solid #2dd4bf;
    border-radius: 24px;
    color: #ffffff;
    padding: 8px 18px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 10px rgba(45, 212, 191, 0.3);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.yf-jong-tool-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 16px rgba(45, 212, 191, 0.6);
}

.yf-jong-tool-btn:active {
    transform: translateY(1px);
}

.yf-jong-tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.yf-tool-icon {
    font-size: 14px;
}

.yf-tool-badge {
    background: #022c22;
    border: 1px solid #34d399;
    color: #34d399;
    border-radius: 12px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 900;
}

/* ==========================================================================
   4. ADSENSE SHIELD: Protezione da annunci iniettati nel canvas
   ========================================================================== */
.yf-jong-app ins.adsbygoogle,
.yf-jong-app .google-auto-placed,
.yf-jong-app div[id^="google_ads_iframe"],
.yf-jong-app iframe[id^="google_ads_iframe"],
.yf-jong-app iframe[src*="googlesyndication"],
.yf-jong-app iframe[src*="googleads"],
.yf-jong-app div[data-google-query-id],
.yf-jong-app .ad-placement,
.yf-jong-main-stage ins,
.yf-jong-viewport ins,
.yf-jong-viewport .google-auto-placed,
.yf-jong-viewport iframe {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    z-index: -9999 !important;
    overflow: hidden !important;
}

/* ==========================================================================
   5. OVERLAY (Start Screen & Game Over)
   ========================================================================== */
.yf-jong-overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(3, 15, 13, 0.92) !important;
    backdrop-filter: blur(8px) !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    padding: 16px !important;
    pointer-events: auto !important;
}

.yf-jong-overlay.hidden,
.yf-jong-overlay[style*="display: none"] {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.yf-jong-dialog {
    position: relative !important;
    z-index: 100000 !important;
    pointer-events: auto !important;
    background: #092622;
    border: 2px solid #2dd4bf;
    box-shadow: 0 0 35px rgba(45, 212, 191, 0.35);
    border-radius: 16px;
    padding: 24px 30px;
    max-width: 490px;
    width: 100%;
    text-align: center;
}

.yf-jong-logo {
    font-size: 32px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 0 16px rgba(45, 212, 191, 0.8);
    margin-bottom: 4px;
}

.yf-jong-action-btn {
    position: relative !important;
    z-index: 100001 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    background: linear-gradient(135deg, #2dd4bf, #059669) !important;
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    letter-spacing: 1px !important;
    border: none !important;
    padding: 14px 38px !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 18px rgba(45, 212, 191, 0.45) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.yf-jong-action-btn:hover {
    transform: translateY(-2px) scale(1.03) !important;
    box-shadow: 0 6px 24px rgba(45, 212, 191, 0.65) !important;
}

.yf-jong-action-btn:active {
    transform: translateY(1px) scale(0.98) !important;
}

/* ==========================================================================
   6. RESPONSIVE MOBILE
   ========================================================================== */
@media (max-width: 640px) {
    .yf-jong-topbar {
        padding: 6px 10px;
    }

    .yf-jong-topbar-hud {
        gap: 4px;
    }

    .yf-jong-hud-pill {
        padding: 2px 7px;
    }

    .yf-jong-hud-label {
        font-size: 9px;
    }

    .yf-jong-hud-val {
        font-size: 12px;
    }

    .yf-jong-floating-actions,
    .yf-jong-bottombar {
        gap: 8px;
        padding: 8px 12px;
    }

    .yf-jong-tool-btn {
        padding: 5px 10px;
        font-size: 10px;
    }

    .yf-jong-dialog {
        padding: 18px 20px;
    }

    .yf-jong-logo {
        font-size: 24px;
    }

    .yf-kick-instructions {
        font-size: 12px;
        padding: 10px 12px;
    }
}


/* Desktop Enhanced HUD Visibility */
@media (min-width: 800px) {
    .yf-jong-topbar {
        padding: 10px 18px;
    }
    .yf-jong-hud-pill {
        padding: 5px 14px;
        gap: 8px;
    }
    .yf-jong-hud-label {
        font-size: 12px;
    }
    .yf-jong-hud-val {
        font-size: 16px;
    }
    #yf-jong-hud-timer, #yf-jong-hud-timer-val {
        font-size: 19px;
        font-weight: 900;
        letter-spacing: 0.5px;
    }
    .yf-jong-tool-btn {
        padding: 10px 24px;
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .yf-jong-topbar {
        padding: 12px 22px;
    }
    .yf-jong-hud-pill {
        padding: 6px 16px;
        gap: 10px;
        border-radius: 20px;
    }
    .yf-jong-hud-label {
        font-size: 13px;
    }
    .yf-jong-hud-val {
        font-size: 18px;
    }
    #yf-jong-hud-timer, #yf-jong-hud-timer-val {
        font-size: 22px;
        font-weight: 900;
        letter-spacing: 1px;
    }
    .yf-jong-tool-btn {
        padding: 11px 28px;
        font-size: 14px;
        border-radius: 28px;
    }
}

:fullscreen .yf-jong-topbar,
:-webkit-full-screen .yf-jong-topbar {
    padding: 14px 26px;
}
:fullscreen .yf-jong-hud-pill,
:-webkit-full-screen .yf-jong-hud-pill {
    padding: 8px 18px;
    gap: 12px;
}
:fullscreen .yf-jong-hud-label,
:-webkit-full-screen .yf-jong-hud-label {
    font-size: 14px;
}
:fullscreen .yf-jong-hud-val,
:-webkit-full-screen .yf-jong-hud-val {
    font-size: 22px;
}
:fullscreen #yf-jong-hud-timer,
:fullscreen #yf-jong-hud-timer-val,
:-webkit-full-screen #yf-jong-hud-timer,
:-webkit-full-screen #yf-jong-hud-timer-val {
    font-size: 26px;
    font-weight: 900;
}
:fullscreen .yf-jong-tool-btn,
:-webkit-full-screen .yf-jong-tool-btn {
    padding: 12px 32px;
    font-size: 16px;
}

