/**
 * CapitanLemon Widescreen 16:9 Arcade Responsive Stylesheet
 * Version 1.0.0
 */

/* ==============================================================
   1. Contenitore Principale & Layout Widescreen
   ============================================================== */
.yf-lemon-app {
    max-width: 820px;
    width: 100%;
    margin: 12px auto;
    background: #090d1a;
    border: 2px solid #facc15;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 20px rgba(250, 204, 21, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #f1f5f9;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: all 0.2s ease;
}

.yf-lemon-app * {
    box-sizing: border-box;
}

/* ============================================================== */
/* BARRA SUPERIORE INFO GIOCATORE & CONTROLLI ESTERNI             */
/* ============================================================== */
.yf-lemon-app .yf-racer-topbar,
.yf-lemon-app .yf-lemon-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.yf-lemon-app .yf-racer-player,
.yf-lemon-app .yf-lemon-player {
    font-size: 13px;
    font-weight: 700;
}

.yf-lemon-app .yf-player-badge {
    color: #facc15;
}

.yf-lemon-app .yf-guest-badge {
    color: #94a3b8;
    font-size: 12px;
}

.yf-lemon-app .yf-guest-badge a {
    color: #facc15;
    text-decoration: underline;
}

.yf-lemon-app .yf-racer-topbar-controls,
.yf-lemon-app .yf-lemon-topbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yf-lemon-app .yf-racer-topbar .yf-icon-btn,
.yf-lemon-app .yf-lemon-topbar .yf-icon-btn {
    background: #141b2d;
    border: 1px solid #2a3854;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.yf-lemon-app .yf-racer-topbar .yf-icon-btn:hover,
.yf-lemon-app .yf-lemon-topbar .yf-icon-btn:hover {
    background: rgba(250, 204, 21, 0.25);
    border-color: #facc15;
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

/* ============================================================== */
/* STAGE PRINCIPALE & VIEWPORT 16:9                               */
/* ============================================================== */
.yf-lemon-app .yf-lemon-main-stage,
.yf-lemon-app .yf-racer-main-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border: 2px solid #1e293b;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(0, 0, 0, 0.95);
    width: 100%;
}

.yf-lemon-app .yf-lemon-viewport,
.yf-lemon-app .yf-racer-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.yf-lemon-app #yf-lemon-canvas {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    touch-action: none;
    user-select: none;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============================================================== */
/* IN-GAME HUD INTEGRATO SULLO SCHERMO DI GIOCO                   */
/* Sempre visibile sia in visualizzazione normale sia a fullscreen*/
/* ============================================================== */
.yf-lemon-app .yf-lemon-ingame-hud,
.yf-lemon-app .yf-racer-ingame-hud {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    z-index: 15;
    pointer-events: none;
}

.yf-lemon-app .yf-lemon-ingame-hud *,
.yf-lemon-app .yf-racer-ingame-hud * {
    pointer-events: auto;
}

.yf-lemon-app .yf-hud-left,
.yf-lemon-app .yf-hud-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Badge HUD Stile Arcade */
.yf-lemon-app .yf-hud-badge {
    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);
    border-radius: 6px;
    padding: 3px 7px;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

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

.yf-lemon-app .yf-hud-value {
    font-size: 13px;
    font-weight: 900;
    font-family: "Courier New", Courier, monospace, sans-serif;
    line-height: 1;
}

.yf-lemon-app .yf-val-score { color: #facc15; }
.yf-lemon-app .yf-val-dist { color: #38bdf8; }
.yf-lemon-app .yf-val-level { color: #a855f7; }
.yf-lemon-app .yf-val-lives { color: #ef4444; font-size: 12px; letter-spacing: 1px; }

/* Pulsanti HUD Azione (Audio, Pausa, Fullscreen) */
.yf-lemon-app .yf-hud-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.yf-lemon-app .yf-icon-btn,
.yf-lemon-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-lemon-app .yf-icon-btn:hover,
.yf-lemon-app .yf-hud-actions .yf-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: #facc15;
    transform: scale(1.08);
}

/* ==============================================================
   3. Overlay Start / Pause / Game Over
   ============================================================== */
.yf-lemon-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-lemon-overlay.yf-show {
    opacity: 1;
    pointer-events: auto;
}

.yf-lemon-logo-badge {
    font-size: 48px;
    margin-bottom: 6px;
    filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.6));
}

.yf-lemon-key-hints {
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.7);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==============================================================
   4. Comandi Touch Flottanti per Mobile & Tablet
   ============================================================== */
.yf-lemon-touch-controls {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 15;
}

.yf-lemon-touch-controls .yf-touch-zone {
    pointer-events: auto;
    display: flex;
    gap: 8px;
}

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

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

.yf-btn-jump {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.75), rgba(16, 185, 129, 0.85));
    border-color: #4ade80;
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.45);
}

.yf-btn-down {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.75), rgba(2, 132, 199, 0.85));
    border-color: #38bdf8;
    box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.yf-btn-action {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.75), rgba(220, 38, 38, 0.85));
    border-color: #f87171;
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.45);
}

.yf-touch-action-btn .yf-btn-icon {
    font-size: 20px;
}

/* ==============================================================
   5. Modalità Schermo Intero & Responsive Landscape
   ============================================================== */
.yf-lemon-viewport:fullscreen,
.yf-lemon-viewport:-webkit-full-screen,
.yf-lemon-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-lemon-viewport:fullscreen canvas,
.yf-lemon-viewport:-webkit-full-screen canvas,
.yf-lemon-viewport.yf-is-fullscreen canvas {
    width: auto !important;
    height: 100% !important;
    aspect-ratio: 16 / 9;
    max-width: 100vw;
}

/* Posizionamento comandi nelle bande nere laterali in Fullscreen / Landscape */
@media (min-aspect-ratio: 16/9) {
    .yf-lemon-viewport:fullscreen .yf-lemon-touch-controls,
    .yf-lemon-viewport:-webkit-full-screen .yf-lemon-touch-controls,
    .yf-lemon-viewport.yf-is-fullscreen .yf-lemon-touch-controls {
        position: fixed;
        bottom: 24px;
        left: 20px;
        right: 20px;
    }

    .yf-lemon-viewport:fullscreen .yf-touch-action-btn,
    .yf-lemon-viewport:-webkit-full-screen .yf-touch-action-btn,
    .yf-lemon-viewport.yf-is-fullscreen .yf-touch-action-btn {
        height: 64px;
        padding: 0 22px;
        border-radius: 32px;
        font-size: 15px;
    }
}

/* Ingrandimento statistiche e pulsanti HUD in Schermo Intero */
.yf-lemon-viewport:fullscreen .yf-hud-badge,
.yf-lemon-viewport:-webkit-full-screen .yf-hud-badge,
.yf-lemon-viewport.yf-is-fullscreen .yf-hud-badge {
    padding: 6px 14px !important;
    border-radius: 10px !important;
}

.yf-lemon-viewport:fullscreen .yf-hud-label,
.yf-lemon-viewport:-webkit-full-screen .yf-hud-label,
.yf-lemon-viewport.yf-is-fullscreen .yf-hud-label {
    font-size: 11px !important;
}

.yf-lemon-viewport:fullscreen .yf-hud-value,
.yf-lemon-viewport:-webkit-full-screen .yf-hud-value,
.yf-lemon-viewport.yf-is-fullscreen .yf-hud-value {
    font-size: 18px !important;
}

.yf-lemon-viewport:fullscreen .yf-icon-btn,
.yf-lemon-viewport:-webkit-full-screen .yf-icon-btn,
.yf-lemon-viewport.yf-is-fullscreen .yf-icon-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
}

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