/**
 * FriendBobble — Foglio di Stile Arcade Slime Edition
 * Stile Widescreen 16:9, HUD integrato e controlli mobile
 */

.yf-bobble-app {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #f8fafc;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

/* ==============================================================
   1. Barra Superiore Info Giocatore & Controlli Esterni
   ============================================================== */
.yf-bobble-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
}

.yf-bobble-player .yf-player-badge {
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.yf-bobble-player .yf-guest-badge {
    color: #94a3b8;
}

.yf-bobble-player .yf-guest-badge a {
    color: #38bdf8;
    text-decoration: underline;
    margin-left: 4px;
}

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

/* ==============================================================
   2. Main Stage Panoramico 16:9
   ============================================================== */
.yf-bobble-main-stage {
    position: relative;
    width: 100%;
    background: #060913;
    border: 2px solid #22c55e;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(34, 197, 94, 0.25);
    overflow: hidden;
    touch-action: none;
}

.yf-bobble-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 80vh;
    overflow: hidden;
    background: #030712;
}

.yf-bobble-viewport canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #050814;
    cursor: crosshair;
}

/* ==============================================================
   3. In-Game HUD Integrato
   ============================================================== */
.yf-bobble-ingame-hud {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.yf-bobble-ingame-hud .yf-hud-left,
.yf-bobble-ingame-hud .yf-hud-right {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.yf-bobble-app .yf-hud-badge {
    background: rgba(10, 15, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 8px;
    padding: 3px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.yf-bobble-app .yf-hud-label {
    font-size: 9px;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.yf-bobble-app .yf-hud-value {
    font-size: 14px;
    font-weight: 900;
    color: #ffffff;
    font-family: monospace, monospace;
}

.yf-bobble-app .yf-val-score {
    color: #facc15;
    text-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.yf-bobble-app .yf-val-level {
    color: #38bdf8;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.yf-bobble-app .yf-val-combo {
    color: #f43f5e;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.5);
}

.yf-bobble-app .yf-val-slimes {
    color: #4ade80;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.yf-bobble-app .yf-hud-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.yf-bobble-app .yf-icon-btn,
.yf-bobble-app .yf-hud-actions .yf-icon-btn {
    background: rgba(10, 15, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #cbd5e1;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.yf-bobble-app .yf-icon-btn:hover,
.yf-bobble-app .yf-hud-actions .yf-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: #22c55e;
    transform: scale(1.08);
}

/* ==============================================================
   4. Overlay Start / Pause / Game Over
   ============================================================== */
.yf-bobble-overlay {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 20px;
}

.yf-bobble-overlay.yf-show {
    opacity: 1;
    pointer-events: auto;
}

.yf-bobble-overlay-content {
    max-width: 440px;
    animation: yfPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes yfPopIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.yf-bobble-logo-badge {
    font-size: 38px;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 12px rgba(34, 197, 94, 0.6));
    animation: yfPulseBadge 1.8s infinite ease-in-out;
}

@keyframes yfPulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.yf-bobble-overlay-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #22c55e;
    text-shadow: 0 0 16px rgba(34, 197, 94, 0.6);
    margin: 0 0 8px 0;
    text-transform: uppercase;
}

.yf-bobble-overlay-subtitle {
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.yf-bobble-key-hints {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    font-size: 11px;
    color: #facc15;
    font-weight: 700;
}

.yf-bobble-app .yf-racer-btn-start {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
    transition: all 0.15s ease;
    text-transform: uppercase;
}

.yf-bobble-app .yf-racer-btn-start:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.6);
    filter: brightness(1.1);
}

.yf-bobble-app .yf-racer-btn-start:active {
    transform: translateY(1px) scale(0.98);
}

/* ==============================================================
   5. Comandi Touch Flottanti per Mobile
   ============================================================== */
.yf-bobble-touch-controls {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: none;
    justify-content: space-between;
    pointer-events: none;
    z-index: 15;
}

@media (pointer: coarse), (max-width: 768px) {
    .yf-bobble-touch-controls {
        display: flex;
    }
}

.yf-bobble-touch-controls .yf-touch-zone {
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
}

.yf-bobble-touch-controls .yf-touch-action-btn {
    height: 44px;
    min-width: 44px;
    padding: 0 12px;
    border-radius: 22px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 900;
    font-size: 12px;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: transform 0.08s ease, filter 0.08s ease;
}

.yf-bobble-touch-controls .yf-touch-action-btn:active,
.yf-bobble-touch-controls .yf-touch-action-btn.active {
    transform: scale(0.92);
    filter: brightness(1.25);
}

.yf-btn-rot {
    background: rgba(30, 41, 59, 0.85);
    border-color: #64748b !important;
}

.yf-btn-swap {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.8), rgba(2, 132, 199, 0.9));
    border-color: #38bdf8 !important;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45);
}

.yf-btn-fire {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.85), rgba(22, 163, 74, 0.95));
    border-color: #4ade80 !important;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.45);
}

.yf-bobble-touch-controls .yf-btn-icon {
    font-size: 16px;
}

/* ==============================================================
   6. Fullscreen Mode
   ============================================================== */
.yf-bobble-viewport:fullscreen,
.yf-bobble-viewport:-webkit-full-screen,
.yf-bobble-viewport.yf-is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000 !important;
}

.yf-bobble-viewport:fullscreen canvas,
.yf-bobble-viewport:-webkit-full-screen canvas,
.yf-bobble-viewport.yf-is-fullscreen canvas {
    width: auto !important;
    height: 100% !important;
    aspect-ratio: 16 / 9;
    max-width: 100vw;
}

.yf-bobble-app:fullscreen .yf-bobble-topbar,
.yf-bobble-app.yf-is-fullscreen .yf-bobble-topbar {
    display: none !important;
}
