:root {
    /* Color Palette from Poster */
    --color-bg-top: #3e204f;
    --color-bg-bottom: #21102e;

    --color-accent-orange: #f59e42;
    --color-accent-pink: #d896c0;
    --color-accent-yellow: #fedc97;
    --color-text-stroke: #4a1c1c;

    --font-heading: 'Titan One', cursive;
    --font-body: 'Nunito', sans-serif;

    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-pop: 5px 5px 0px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--color-bg-top), var(--color-bg-bottom));
    color: white;
    overflow: hidden;
    /* Fix double scrollbar: Only main should scroll */
    height: 100vh;
    /* Lock body height */
    min-height: 100vh;
}

main {
    scroll-snap-type: y mandatory;
    height: 100vh;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

.scene {
    height: 100vh;
    width: 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
    overflow: hidden;
}

.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.game-title {
    font-size: 6rem;
    text-align: center;
    color: white;
    margin-bottom: 2rem;
    animation: bounce 2s infinite;
    -webkit-text-stroke: 4px var(--color-text-stroke);
    text-shadow:
        5px 5px 0px var(--color-text-stroke),
        0px 0px 20px var(--color-accent-yellow);
    line-height: 1.1;
    transform: rotate(-3deg);
}

.game-subtitle {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-accent-pink);
    text-align: center;
    margin-top: -1rem;
    /* Pull it closer to title */
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    transform: rotate(-2deg);
}

.section-title {
    font-size: 4rem;
    color: var(--color-accent-yellow);
    text-align: center;
    margin-bottom: 2rem;
    -webkit-text-stroke: 2px var(--color-text-stroke);
}

.split-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.header-candy {
    max-height: 80px;
    width: auto;
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 0.2));
    order: 3;
}

.split-header span {
    display: block;
}

.header-text-1 {
    order: 1;
}

.header-text-2 {
    order: 2;
}

/* Glass Panel */
.glass-panel {
    background: rgba(62, 32, 79, 0.85);
    border: 3px solid var(--color-accent-pink);
    border-radius: 30px;
    padding: 2rem;
    box-shadow: var(--shadow-soft), inset 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Scene 1: Intro */
#scene-intro {
    align-items: flex-start;
    padding-top: 5vh;
}

#scene-intro .container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#scene-intro .intro-layout {
    margin-top: auto;
    margin-bottom: auto;
}

.intro-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1rem;
    /* Reduced from 4rem per user request */
}

.intro-content {
    width: 100%;
    position: relative;
    /* Anchor for background image */
    z-index: 2;
}

.intro-action-bg {
    position: absolute;
    right: -120px;
    /* Peek out more */
    top: -190px;
    /* Peek out more */
    width: 300px;
    /* Larger */
    z-index: -1;
    transform: rotate(10deg);
    opacity: 0.9;
    pointer-events: none;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.3));
}

.intro-text.glass-panel {
    z-index: 2;
    /* Ensure on top */
    position: relative;
    background: rgba(62, 32, 79, 0.9);
    /* Slightly more opaque to hide image overlap cleanly */
}

.intro-grid {
    display: grid;
    /* Desktop Layout: Title top left, text bottom left, image spans right column */
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header image"
        "text   image";
    gap: 2rem;
    align-items: start;
}

.intro-heading {
    grid-area: header;
    color: var(--color-accent-yellow);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    -webkit-text-stroke: 2px var(--color-text-stroke);
}

.intro-paragraphs {
    grid-area: text;
}

.intro-paragraphs p {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Specific Max Placeholder */
.max-photo-placeholder {
    grid-area: image;
    max-height: 360px;
    /* Desktop height */
    background: #ddd;
    border: 5px solid white;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: bold;
    transform: rotate(3deg);
    align-self: center;
    margin-bottom: 2rem;
}

.howto-photo-placeholder {
    max-height: 220px;
}


/* Scene 2: Creation Grid */
.creation-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.creation-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

/* Row 1 & 3: Image | Text (default order) */
.creation-item .photo-placeholder-rect {
    order: 1;
}

.creation-item .caption {
    order: 2;
    text-align: left;
}

/* Row 2: Text | Image (reversed) */
.creation-item:nth-child(2) .photo-placeholder-rect {
    order: 2;
}

.creation-item:nth-child(2) .caption {
    order: 1;
    text-align: right;
}

.photo-placeholder-rect {
    width: 100%;
    height: 240px;
    background: var(--color-accent-yellow);
    /* Placeholder tint */
    border: 3px solid var(--color-text-stroke);
    border-radius: 10px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-stroke);
    font-weight: bold;
    font-size: 1.2rem;
}

.caption {
    font-size: 1.2rem;
    color: white;
}

/* Scene 3: Reveal */
.reveal-stage {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.magic-btn {
    background: var(--color-accent-orange);
    color: white;
    border: 3px solid white;
    padding: 1.5rem 3rem;
    font-size: 2rem;
    border-radius: 50px;
    font-family: var(--font-heading);
    cursor: pointer;
    margin-bottom: 2rem;
    animation: bounce 3s infinite;
    box-shadow: 0 0 20px var(--color-accent-yellow);
}

.product-showcase {
    position: relative;
    width: 100%;
    max-width: 600px;
}

.final-product-img {
    width: 100%;
    border-radius: 20px;
    border: 5px solid var(--color-accent-pink);
    box-shadow: var(--shadow-pop);
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 40px;
    height: auto;
    top: -50px;
    /* Start slightly higher */
    animation: fall 3s linear forwards;
}

/* Scene 4: Order Form */
#scene-order {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

.scene-order-layout {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
}

.order-wrapper {
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 120px auto;
}

/* Mascot Positioning */
.mascot-container {
    position: absolute;
    /* Anchor to the LEFT side of the wrapper bounding box */
    right: 100%;
    bottom: 20px;
    margin-right: -20px;
    /* Slight overlap */
    width: 250px;
    z-index: 1;
    /* Behind card */
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
}

.mascot-monster {
    width: 100%;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
    transform: rotate(-10deg);
}

.order-card {
    width: 100%;
    background: var(--color-bg-top);
    border: 4px solid var(--color-accent-orange);
    border-radius: 30px;
    padding: 2rem;
    position: relative;
    z-index: 5;
    /* On top of mascot */
}

.order-card h2 {
    text-align: center;
    font-weight: normal;
}

.order-subtitle {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: var(--color-accent-pink);
    font-style: italic;
}

.fun-form .form-group {
    margin-bottom: 1.5rem;
}

.fun-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: normal;
    font-size: 1.2rem;
    color: var(--color-accent-yellow);
    font-family: var(--font-heading);
}

.fun-form input {
    width: 100%;
    padding: 1rem;
    border-radius: 15px;
    border: 3px solid var(--color-accent-pink);
    font-size: 1.2rem;
    font-family: var(--font-body);
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
}

/* Quantity dropdown for pre-orders */
.quantity-select {
    width: 100%;
    padding: 1rem;
    border-radius: 15px;
    border: 3px solid var(--color-accent-pink);
    font-size: 1.2rem;
    font-family: var(--font-body);
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d896c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em;
}

.quantity-select:focus {
    outline: none;
    border-color: var(--color-accent-orange);
    box-shadow: 0 0 0 3px rgba(245, 158, 66, 0.3);
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-group-half {
    flex: 1;
}

/* Stripe Card Element */
.stripe-card-element {
    padding: 1rem;
    border-radius: 15px;
    border: 3px solid var(--color-accent-pink);
    background: rgba(62, 32, 79, 0.8);
}

.card-errors {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    min-height: 1.2em;
}

/* Price Breakdown */
.price-breakdown {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.price-row:last-child {
    border-bottom: none;
}

.price-total {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--color-accent-yellow);
    border-top: 2px solid var(--color-accent-pink);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.static-input-text {
    width: 100%;
    padding: 1rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px dashed var(--color-accent-pink);
    font-size: 1.2rem;
    font-family: var(--font-body);
    font-weight: bold;
    color: white;
}

.btn-primary {
    width: 100%;
    padding: 1.2rem;
    background: var(--color-accent-orange);
    color: white;
    border: 3px solid white;
    border-radius: 15px;
    font-size: 2rem;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow: var(--shadow-pop);
    transition: transform 0.1s;
    text-transform: uppercase;
}

.btn-primary:active {
    transform: translate(5px, 5px);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Inventory Status */
.inventory-status {
    text-align: center;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.2);
}

.inventory-loading {
    color: var(--color-accent-pink);
    font-style: italic;
}

.inventory-in-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.inventory-out-of-stock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stock-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-transform: uppercase;
}

.stock-badge.in-stock {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.stock-badge.out-of-stock {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Promo Code Styles */
.promo-group {
    margin-bottom: 0.5rem;
}

.promo-input-row {
    display: flex;
    gap: 0.5rem;
}

.promo-input-row input {
    flex: 1;
}

.promo-input-row .btn-secondary {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.promo-input-row .btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.promo-input-row .btn-secondary:disabled {
    opacity: 0.7;
    cursor: default;
}

.promo-status {
    font-size: 0.85rem;
    margin-top: 0.25rem;
    min-height: 1.2rem;
}

.promo-status.promo-success {
    color: #4ade80;
}

.promo-status.promo-error {
    color: #f87171;
}

/* Applied Promo Codes List */
.applied-codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.applied-code-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid rgba(74, 222, 128, 0.5);
    border-radius: 20px;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    color: #4ade80;
}

.applied-code-tag .code-name {
    font-weight: 600;
}

.applied-code-tag .code-desc {
    opacity: 0.8;
    margin-left: 0.25rem;
}

.applied-code-tag .remove-code {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
    font-size: 1.1rem;
    line-height: 1;
}

.applied-code-tag .remove-code:hover {
    opacity: 1;
}

/* Discount row in price breakdown */
.price-row.discount-row {
    color: #4ade80;
}

.price-row.discount-row span:last-child {
    color: #4ade80;
}

.stock-count {
    font-size: 1.1rem;
    color: var(--color-accent-yellow);
    font-weight: bold;
}

.restock-info {
    font-size: 1rem;
    color: white;
    margin-top: 0.5rem;
}

.restock-info strong {
    color: var(--color-accent-yellow);
}

/* Order Result Messages */
.order-result {
    text-align: center;
    padding: 1.5rem;
}

.order-success, .order-reservation {
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid #22c55e;
    border-radius: 15px;
    padding: 1.5rem;
}

.order-reservation {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.order-success h3, .order-reservation h3 {
    color: var(--color-accent-yellow);
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.order-id {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: white;
    margin: 1rem 0;
}

.order-note {
    font-size: 0.9rem;
    color: var(--color-accent-pink);
    font-style: italic;
    margin-top: 1rem;
}

.eta {
    font-size: 1.1rem;
    color: white;
    margin-top: 1rem;
}

.eta strong {
    color: var(--color-accent-yellow);
}

.order-error {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid #ef4444;
    border-radius: 15px;
    padding: 1.5rem;
    color: white;
}

/* Track Link */
.track-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 1rem;
    color: var(--color-accent-pink);
}

.track-link a {
    color: var(--color-accent-yellow);
    text-decoration: underline;
    font-weight: bold;
}

.track-link a:hover {
    color: white;
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0) rotate(-3deg);
    }

    50% {
        transform: translateY(-15px) rotate(-3deg);
    }
}

/* Background Layer */
#background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind everything */
    pointer-events: none;
    overflow: hidden;
}

.floating-asset {
    position: absolute;
    opacity: 0.15;
    /* Subtle */
    animation: floatAround linear infinite;
}

@keyframes floatAround {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(50px, 50px) rotate(90deg);
    }

    50% {
        transform: translate(0, 100px) rotate(180deg);
    }

    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }

    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

/* Static Scene Decorations */
.deco-item {
    position: absolute;
    pointer-events: none;
    z-index: -1;
    filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.4));
}

.deco-scene2-1 {
    top: -20px;
    left: -20px;
    width: 80px;
    transform: rotate(-15deg);
}

.deco-scene2-2 {
    bottom: -20px;
    right: -20px;
    width: 100px;
    transform: rotate(15deg);
}

.deco-scene2-3 {
    bottom: 10%;
    left: -40px;
    width: 70px;
    transform: rotate(45deg);
}

.deco-scene4-1 {
    top: -40px;
    right: 20px;
    width: 90px;
    transform: rotate(20deg);
}

.deco-scene4-2 {
    bottom: -30px;
    left: 20px;
    width: 80px;
    transform: rotate(-10deg);
}
.monster-scene-4-end {
    max-width: 580px;
}

/* Medium desktop screens - fix order form clipping */
@media (max-width: 1650px) and (min-width: 769px) {
    #scene-order {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    #scene-order .order-wrapper {
        margin: 40px auto;
    }
}

@media (max-width: 768px) {
    .deco-scene2-1 {
        width: 60px;
        left: 10px;
    }

    .deco-scene2-2 {
        width: 70px;
        right: 10px;
        bottom: 10px;
    }

    .deco-scene2-3 {
        display: none;
    }

    /* Hide some on mobile */
    .deco-scene4-1 {
        width: 70px;
        top: -2px;
        right: 7px;
        z-index: 5;
    }

    .deco-scene4-2 {
        width: 60px;
        bottom: -20px;
        left: 1px;
    }
}

@keyframes fall {
    to {
        transform: translateY(500px) rotate(720deg);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .scene {
        padding: 1rem;
        height: auto;
        min-height: 100vh;
        position: relative;
    }

    .order-wrapper {
        margin: 0 auto;
        width: 100%;
    }

    /* Scene 4: Align to bottom */
    #scene-order {
        align-items: flex-end;
        padding-bottom: 30px;
    }

    .scene-order-layout {
        padding: 0;
        /* Remove desktop padding */
        width: 100%;
    }

    .intro-action-bg {
        /* Mobile: Show it! */
        display: block;
        position: relative;
        width: 100%;
        max-width: 160px;
        right: auto;
        top: auto;
        margin: 0 auto;
        margin-bottom: -50px;
        /* Tuck behind the glass panel */
        z-index: 0;
        transform: rotate(5deg);
    }

    .intro-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "header"
            "image"
            "text";
        gap: 1.5rem;
    }

    .max-photo-placeholder {
        /* Requested 400x500 mobile sizing roughly */
        width: 100%;
        max-width: 360px;
        height: 500px;
        margin: 0 auto;
        transform: rotate(0deg);
    }

    .creation-grid {
        gap: 1.5rem;
    }

    .creation-item {
        grid-template-columns: 1fr;
        /* Stack vertically on mobile */
    }

    /* Reset order for mobile - text first, then image */
    .creation-item .caption,
    .creation-item:nth-child(2) .caption {
        order: 1;
        text-align: center;
    }

    .creation-item .photo-placeholder-rect,
    .creation-item:nth-child(2) .photo-placeholder-rect {
        order: 2;
    }

    .scene-order-layout {
        display: block;
    }

    .mascot-container {
        position: absolute;
        right: auto;
        left: 50%;
        transform: translateX(-50%) rotate(0deg);
        bottom: 100%;
        margin-bottom: -30px;
        /* Overlap top */
        margin-right: 0;
        width: 140px;
        z-index: 0;
    }

    .mascot-monster {
        transform: rotate(0deg);
    }

    .order-card {
        z-index: 2;
    }

    .section-title {
        font-size: 2.5rem;
    }

    /* Mobile Header: Text Left, Image Right */
    .split-header {
        display: grid;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        grid-template-areas:
            "text1 img"
            "text2 img";
        align-items: center;
        justify-content: center;
        gap: 0.2rem 1rem;
        line-height: 1.1;
    }

    .header-candy {
        grid-area: img;
        order: unset;
        max-height: 80px;
        max-width: 100px;
        margin: 0;
    }

    .header-text-1 {
        grid-area: text1;
        order: unset;
        text-align: right;
    }

    .header-text-2 {
        grid-area: text2;
        order: unset;
        text-align: right;
    }

    .magic-btn {
        font-size: 1.5rem;
        padding: 1rem 2rem;
    }

    .monster-scene-4-end {
        max-width: 380px;
    }
}