/* Playable Ad Styling - Spin the Wheel Studio */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: #0f172a;
    color: #ffffff;
}

.playable-app {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(180deg, #fdfbfb 0%, #ebedee 100%);
}

.bg-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
    transition: background 0.4s ease;
}

/* Header Branding */
.app-header {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 24px 16px 8px 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.header-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 90%;
}

.header-logo {
    max-height: 90px;
    max-width: 320px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.header-title {
    font-size: 28px;
    font-weight: 900;
    color: #e91e63;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    opacity: 0.9;
}

/* Wheel Viewport Area */
.wheel-viewport {
    position: relative;
    z-index: 5;
    flex: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* Wheel Assembly */
.wheel-wrapper {
    position: relative;
    width: min(84vw, 380px);
    height: min(84vw, 380px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 12px 36px rgba(0,0,0,0.25), 0 0 0 6px rgba(255,255,255,0.4);
    cursor: pointer;
    touch-action: manipulation;
}

/* Top Pointer */
.wheel-pointer {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 54px;
    height: 62px;
    pointer-events: none;
    transform-origin: 50% 15%;
    transition: transform 0.05s ease-out;
}

.wheel-pointer.pointer-bounce {
    animation: pointerWiggle 0.15s ease-in-out;
}

@keyframes pointerWiggle {
    0% { transform: translateX(-50%) rotate(0deg); }
    30% { transform: translateX(-50%) rotate(-18deg); }
    70% { transform: translateX(-50%) rotate(12deg); }
    100% { transform: translateX(-50%) rotate(0deg); }
}

.wheel-pointer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
}

/* Wheel Hub */
.wheel-hub {
    position: absolute;
    z-index: 15;
    width: min(22vw, 95px);
    height: min(22vw, 95px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wheel-hub:active {
    transform: scale(0.92);
}

.hub-cap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ff80ab, #d81b60);
    border: 4px solid #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.2);
}

.hub-cap span {
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 1px;
}

.hub-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Footer CTA */
.app-footer {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 8px 16px min(5vh, 24px) 16px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cta-wrapper {
    width: 100%;
    max-width: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-play-img {
    max-width: min(75vw, 200px);
    max-height: clamp(42px, 8vh, 58px);
    width: auto;
    height: auto;
    object-fit: contain;
    cursor: pointer;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-play-img:hover {
    transform: scale(1.06);
}

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

.cta-pulse {
    animation: ctaPulseAnim 1.6s infinite ease-in-out alternate;
}

@keyframes ctaPulseAnim {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Guiding Hand Pointer Overlay */
.guide-hand {
    position: absolute;
    z-index: 30;
    top: 54%;
    left: 55%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    cursor: pointer;
    animation: tapHand 1.5s infinite ease-in-out;
}

.guide-hand-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
    -webkit-user-drag: none;
    user-drag: none;
}

@keyframes tapHand {
    0% { transform: translate(-30%, -30%) scale(1.1); }
    50% { transform: translate(-50%, -50%) scale(0.9); }
    100% { transform: translate(-30%, -30%) scale(1.1); }
}

/* Particle Canvas */
.particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

/* Full Screen Win / Lose End Screen Overlay */
.end-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    background: radial-gradient(circle at 50% 40%, rgba(15, 23, 42, 0.95) 0%, rgba(2, 6, 23, 0.98) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
    opacity: 1;
    transition: opacity 0.4s ease;
    cursor: pointer;
}

.end-screen-content {
    width: 100%;
    height: 100%;
    max-width: 440px;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    padding: 20px 10px;
    animation: fullScreenPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fullScreenPop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.end-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.end-logo {
    max-height: 60px;
    max-width: 240px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.end-game-title {
    font-size: 32px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 1px;
}

.end-game-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #cbd5e1;
}

.end-badge-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

.end-badge-img {
    max-width: min(85vw, 320px);
    max-height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(0,0,0,0.5));
    animation: badgePulse 2s ease-in-out infinite alternate;
}

@keyframes badgePulse {
    0% { transform: scale(1) translateY(0); }
    100% { transform: scale(1.05) translateY(-6px); }
}

.end-result-text h3 {
    font-size: 28px;
    font-weight: 900;
    color: #ff4081;
    letter-spacing: 0.5px;
}

.end-result-text p {
    font-size: 17px;
    font-weight: 700;
    color: #f1f5f9;
    margin-top: 6px;
}

.end-cta-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* ============================================================
   LANDSCAPE MODE - Side-by-side layout: [Header] | [Wheel] | [CTA]
   ============================================================ */
@media (orientation: landscape) and (max-height: 520px) {
    /* Switch to horizontal row layout */
    .playable-app {
        flex-direction: row;
        justify-content: center;
        align-items: stretch;
    }

    /* Left panel: header text */
    .app-header {
        flex: 0 0 auto;
        width: auto;
        min-width: 120px;
        max-width: 180px;
        padding: 8px 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .header-branding {
        gap: 4px;
        max-width: 100%;
    }

    .header-logo {
        max-height: 32px;
        max-width: 120px;
    }

    .header-title {
        font-size: clamp(12px, 3.2vh, 16px);
        line-height: 1.2;
    }

    .header-subtitle {
        font-size: clamp(9px, 2vh, 11px);
    }

    /* Wheel takes center flex */
    .wheel-viewport {
        flex: 1 1 auto;
        width: auto;
        padding: 6px;
        min-width: 0;
    }

    .wheel-wrapper {
        width: min(80vh, 300px);
        height: min(80vh, 300px);
    }

    .wheel-hub {
        width: min(20vh, 68px);
        height: min(20vh, 68px);
    }

    .wheel-pointer {
        top: -16px;
        width: min(11vh, 38px);
        height: min(13vh, 44px);
    }

    /* Right panel: CTA footer */
    .app-footer {
        flex: 0 0 auto;
        width: auto;
        min-width: 110px;
        max-width: 160px;
        padding: 8px 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .cta-wrapper {
        max-width: 140px;
    }

    .btn-play-img {
        max-width: 130px;
        max-height: clamp(30px, 10vh, 48px);
    }

    /* End Screen in Landscape — side by side */
    .end-screen {
        padding: 8px 12px;
    }

    .end-screen-content {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: 100vh;
        max-width: 100vw;
        justify-content: space-evenly;
        align-items: center;
        padding: 6px 8px;
        gap: 8px;
    }

    .end-branding {
        flex: 0 0 auto;
        gap: 4px;
    }

    .end-game-title {
        font-size: clamp(16px, 4.5vh, 22px);
    }

    .end-game-subtitle {
        font-size: clamp(10px, 2.5vh, 13px);
    }

    .end-badge-container {
        flex: 0 0 auto;
        margin: 0;
    }

    .end-badge-img {
        max-height: clamp(60px, 20vh, 100px);
        max-width: min(40vw, 180px);
    }

    .end-result-text {
        flex: 0 0 auto;
    }

    .end-result-text h3 {
        font-size: clamp(15px, 4vh, 20px);
    }

    .end-result-text p {
        font-size: clamp(11px, 2.8vh, 14px);
        margin-top: 2px;
    }

    .end-cta-container {
        flex: 0 0 auto;
        margin-top: 0;
    }

    .end-cta-container .btn-play-img {
        max-height: clamp(30px, 8vh, 44px);
    }
}

