/* ========================================
   simidiots.com - Carnival Night Theme
   Palette: Neon-Candy on Deep Purple Night
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.65;
    color: #FFF5E6;
    background: radial-gradient(ellipse at 50% 0%, #2D1B4E 0%, #120826 70%);
    background-color: #120826;
}

/* --- Typography --- */
h2, .panel-title {
    font-family: 'Boogaloo', cursive;
    font-size: clamp(2.5rem, 7vw, 5rem);
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.drawer-title, .booth-number {
    font-family: 'Lilita One', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: clamp(1.2rem, 3vw, 2rem);
}

.booth-number {
    font-size: 0.75em;
}

.fortune-result, .ticket-button, .strongman-hit {
    font-family: 'Permanent Marker', cursive;
}

/* --- Gate Overlay --- */
#gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    pointer-events: none;
}

#gate-overlay.gate-active {
    pointer-events: auto;
}

.gate-panel {
    width: 50%;
    height: 100%;
    background: #120826;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 2.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: left center;
    border: 3px solid #2D1B4E;
    will-change: transform;
}

#gate-left {
    transform-origin: left center;
    border-right: 2px solid #FF2D7B;
}

#gate-right {
    transform-origin: right center;
    border-left: 2px solid #2DE8FF;
}

#gate-overlay.gate-opening #gate-left {
    transform: perspective(1200px) rotateY(-105deg);
}

#gate-overlay.gate-opening #gate-right {
    transform: perspective(1200px) rotateY(105deg);
}

#gate-overlay.gate-done {
    display: none;
}

.gate-decor {
    width: 60%;
    max-width: 200px;
    height: auto;
}

.gate-light {
    animation: chase 1.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.12s);
}

@keyframes chase {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* --- Particles (embers) --- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    opacity: 0;
    animation: particle-rise linear infinite;
    will-change: transform, opacity;
}

@keyframes particle-rise {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) translateX(var(--drift));
    }
}

/* --- Ferris Wheel Home Button --- */
#ferris-home {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 52px;
    height: 52px;
    background: rgba(18, 8, 38, 0.7);
    border: 2px solid #2DE8FF;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    padding: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ferris-home:hover {
    transform: scale(1.15);
}

.ferris-svg {
    width: 100%;
    height: 100%;
    animation: spin 20s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Popcorn Drawer Toggle --- */
#popcorn-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
    background: rgba(18, 8, 38, 0.7);
    border: 2px solid #FF8C2D;
    border-radius: 12px;
    cursor: pointer;
    z-index: 100;
    padding: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#popcorn-toggle:hover {
    transform: scale(1.1) rotate(-5deg);
}

#popcorn-toggle svg {
    width: 100%;
    height: 100%;
}

/* --- Booth Drawer --- */
#booth-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: rgba(45, 27, 78, 0.95);
    border-left: 3px solid #FF8C2D;
    z-index: 200;
    transition: right 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    padding: 20px;
}

#booth-drawer.drawer-open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #FF8C2D;
}

.drawer-title {
    color: #FF8C2D;
    font-size: 1.5rem;
}

.drawer-close-btn {
    font-size: 2rem;
    background: none;
    border: none;
    color: #FFF5E6;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.drawer-close-btn:hover {
    color: #FF2D7B;
}

#booth-list {
    list-style: none;
}

#booth-list li {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(18, 8, 38, 0.6);
    border-left: 3px dashed #FFF5E6;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    color: #FFF5E6;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

#booth-list li::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #120826;
    transform: translateY(-50%);
}

#booth-list li:hover {
    background: rgba(255, 45, 123, 0.2);
    border-left-color: #FF2D7B;
    transform: translateX(6px);
}

#booth-list li .booth-number {
    color: #E8FF2D;
    margin-right: 8px;
    font-size: 0.7em;
}

/* --- Main Carousel --- */
#carousel-viewport {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

#carousel-scene {
    width: 100%;
    height: 100%;
    perspective: 1200px;
    perspective-origin: 50% 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#carousel-ring {
    position: relative;
    width: min(90vw, 600px);
    height: 80vh;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.carousel-panel {
    position: absolute;
    width: min(90vw, 600px);
    height: 80vh;
    max-height: 700px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateY(var(--angle)) translateZ(450px);
    backface-visibility: hidden;
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.5s ease, filter 0.5s ease;
    will-change: transform, opacity;
}

.carousel-panel .panel-inner {
    width: 100%;
    height: 100%;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #2D1B4E;
    border: 4px solid transparent;
    border-image: repeating-linear-gradient(
        45deg,
        var(--panel-accent, #FF2D7B),
        var(--panel-accent, #FF2D7B) 8px,
        #FFF5E6 8px,
        #FFF5E6 16px
    ) 4;
    border-radius: 24px;
    overflow-y: auto;
    position: relative;
}

.carousel-panel.panel-inactive {
    opacity: 0.6;
    filter: blur(2px);
    pointer-events: none;
}

.carousel-panel.panel-active {
    opacity: 1;
    filter: blur(0);
    pointer-events: auto;
}

.carousel-panel.panel-hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Panel Illustration --- */
.panel-illustration {
    width: 100%;
    height: 40%;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.panel-illustration svg {
    width: 100%;
    height: 100%;
    max-height: 200px;
}

.twinkle {
    animation: twinkle 2s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* --- Panel Title --- */
.panel-title {
    text-align: center;
    margin-bottom: 12px;
    color: #FFF5E6;
    text-shadow: 1px 1px 0 var(--panel-accent, #FF2D7B),
                 -1px -1px 0 var(--panel-accent, #FF2D7B),
                 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.panel-title .jiggle-letter {
    display: inline-block;
    transition: transform 0.3s;
}

/* --- Panel Body --- */
.panel-body {
    text-align: center;
    color: #FFF5E6;
    max-width: 480px;
    margin-bottom: 20px;
    font-size: clamp(0.85rem, 1.6vw, 1rem);
}

.panel-body strong {
    color: #E8FF2D;
    font-weight: 700;
}

/* --- Panel Action --- */
.panel-action {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* --- Ticket Button --- */
.ticket-button {
    padding: 14px 36px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #FF2D7B, #FF8C2D);
    color: #FFF5E6;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 45, 123, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: relative;
    overflow: hidden;
}

.ticket-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.ticket-button:hover {
    transform: scale(1.08) rotate(-1deg);
    box-shadow: 0 6px 24px rgba(255, 45, 123, 0.6);
}

.ticket-button:hover::after {
    left: 100%;
}

/* --- Strongman Meter --- */
.strongman-meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.strongman-track {
    width: 30px;
    height: 120px;
    background: #120826;
    border: 2px solid #FF8C2D;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.strongman-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #FF2D7B, #E8FF2D);
    border-radius: 0 0 13px 13px;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.strongman-bell {
    width: 30px;
    height: 20px;
}

.strongman-bell.bell-ring {
    animation: bell-shake 0.4s ease-in-out;
}

@keyframes bell-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
    75% { transform: rotate(-10deg); }
}

.strongman-hit {
    padding: 10px 28px;
    font-size: 1.2rem;
    background: #E8FF2D;
    color: #120826;
    border: 3px solid #FF8C2D;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.strongman-hit:hover {
    transform: scale(1.1);
}

/* --- Prize Wheel --- */
.prize-wheel-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.prize-wheel {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: conic-gradient(
        #FF2D7B 0deg 60deg,
        #E8FF2D 60deg 120deg,
        #2DE8FF 120deg 180deg,
        #FF8C2D 180deg 240deg,
        #2DFF8C 240deg 300deg,
        #FF2D7B 300deg 360deg
    );
    border: 4px solid #FFF5E6;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
    will-change: transform;
    position: relative;
}

.wheel-segment {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 18px;
    font-family: 'Permanent Marker', cursive;
    font-size: 0.65rem;
    color: #120826;
    transform: rotate(calc(var(--seg) * 60deg + 30deg));
    pointer-events: none;
}

.wheel-pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid #FFF5E6;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* --- Fortune Result --- */
.fortune-result {
    background: rgba(18, 8, 38, 0.8);
    border: 2px solid #2DE8FF;
    border-radius: 12px;
    padding: 12px 20px;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #E8FF2D;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;
}

/* --- Carousel Navigation Arrows --- */
.carousel-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(18, 8, 38, 0.6);
    border: 2px solid #2DE8FF;
    border-radius: 50%;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease;
}

.carousel-arrow:hover {
    background: rgba(45, 232, 255, 0.2);
    transform: translateY(-50%) scale(1.15);
}

.carousel-arrow svg {
    width: 100%;
    height: 100%;
}

.carousel-arrow-left {
    left: 16px;
}

.carousel-arrow-right {
    right: 16px;
}

/* --- Carousel Dots --- */
#carousel-dots {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 50;
}

.carousel-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #FFF5E6;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.carousel-dot.dot-active {
    background: #E8FF2D;
    border-color: #E8FF2D;
    transform: scale(1.3);
}

.carousel-dot:hover:not(.dot-active) {
    background: rgba(255, 245, 230, 0.3);
    transform: scale(1.1);
}

/* --- Panel Overlay (expanded booth) --- */
#panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 8, 38, 0.9);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow-y: auto;
    padding: 40px 20px;
}

#panel-overlay.panel-overlay-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#panel-overlay.panel-overlay-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.panel-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #FF2D7B, #FF8C2D);
    color: #FFF5E6;
    border: 3px solid #FFF5E6;
    border-radius: 50%;
    cursor: pointer;
    z-index: 310;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.panel-close-btn:hover {
    transform: scale(1.15) rotate(90deg);
}

#panel-overlay-content {
    max-width: 800px;
    width: 100%;
    background: #2D1B4E;
    border-radius: 24px;
    padding: 40px 32px;
    border: 4px solid #FF2D7B;
    transform: scale(0.8);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#panel-overlay.panel-overlay-visible #panel-overlay-content {
    transform: scale(1);
}

#panel-overlay-content .panel-illustration {
    height: auto;
    min-height: 200px;
    margin-bottom: 24px;
}

#panel-overlay-content .panel-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 16px;
}

#panel-overlay-content .panel-body {
    font-size: 1.05rem;
    margin-bottom: 24px;
}

/* --- Floating Decorations --- */
#floating-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.floating-deco {
    position: absolute;
    bottom: -60px;
    width: 30px;
    height: 50px;
    animation: float var(--float-dur, 4s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-15px) rotate(3deg);
    }
}

/* --- Tent Stripe Divider --- */
.tent-stripe-divider {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: repeating-linear-gradient(
        15deg,
        #FF2D7B,
        #FF2D7B 20px,
        #FFF5E6 20px,
        #FFF5E6 40px
    );
    z-index: 50;
}

/* --- Chaser Light Border Mixin via box-shadow --- */
.chaser-border {
    position: relative;
}

.chaser-light-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    animation: chase 1.2s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
}

/* --- Responsive: Mobile (< 768px) --- */
@media (max-width: 767px) {
    #carousel-ring {
        transform-style: flat;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 20px;
        width: 100%;
        height: auto;
        min-height: 80vh;
        padding: 10vh 5vw;
        transform: none !important;
    }

    .carousel-panel {
        position: relative;
        top: auto;
        left: auto;
        transform: none !important;
        flex: 0 0 min(85vw, 400px);
        width: min(85vw, 400px);
        height: auto;
        min-height: 70vh;
        max-height: none;
        scroll-snap-align: center;
        opacity: 1 !important;
        filter: none !important;
        pointer-events: auto !important;
    }

    .carousel-arrow {
        top: auto;
        bottom: 60px;
        transform: none;
        width: 44px;
        height: 44px;
    }

    .carousel-arrow:hover {
        transform: scale(1.1);
    }

    .carousel-arrow-left {
        left: 20px;
    }

    .carousel-arrow-right {
        right: 20px;
    }

    #carousel-dots {
        bottom: 16px;
    }

    .carousel-dot {
        width: 10px;
        height: 10px;
    }

    #booth-drawer {
        width: 85vw;
        right: -85vw;
    }

    .panel-close-btn {
        width: 44px;
        height: 44px;
        font-size: 2rem;
    }

    .strongman-track {
        height: 80px;
    }

    .prize-wheel-container,
    .prize-wheel {
        width: 140px;
        height: 140px;
    }
}

/* --- Responsive: Large desktop (> 1200px) --- */
@media (min-width: 1201px) {
    .carousel-panel.panel-active {
        transform: translate(-50%, -50%) rotateY(var(--angle)) translateZ(450px) scale(1.15);
    }

    .carousel-panel.panel-adjacent {
        opacity: 0.7;
        filter: blur(1px);
    }
}

/* --- Utility animations --- */
@keyframes entrance-slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entrance-anim {
    animation: entrance-slide-up 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Staggered children */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
