/* Pop Art Style CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial Black', 'Impact', sans-serif;
    background: linear-gradient(135deg, #ff006e 0%, #8338ec 25%, #3a86ff 50%, #06ffa5 75%, #ffbe0b 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Pop Art Box */
.pop-art-box {
    background: #fff;
    border: 8px solid #000;
    box-shadow: 
        12px 12px 0px #ff006e,
        24px 24px 0px #8338ec,
        36px 36px 0px #3a86ff;
    padding: 40px;
    margin: 40px auto;
    max-width: 700px;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
}

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

.pop-art-title {
    font-size: 3em;
    text-align: center;
    color: #000;
    text-shadow: 
        4px 4px 0px #ff006e,
        8px 8px 0px #8338ec;
    margin-bottom: 20px;
    letter-spacing: 3px;
    animation: titleBounce 1s ease-in-out infinite;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    text-align: center;
    font-size: 1.5em;
    color: #333;
    margin-bottom: 30px;
    font-weight: bold;
}

/* Ticket Entry */
.ticket-entry-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.ticket-form {
    margin: 30px 0;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group input {
    flex: 1;
    padding: 20px;
    font-size: 1.5em;
    border: 5px solid #000;
    font-family: 'Arial Black', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.input-group input:focus {
    outline: none;
    border-color: #ff006e;
    box-shadow: 0 0 0 5px rgba(255, 0, 110, 0.3);
}

.pop-art-button {
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: bold;
    background: #ff006e;
    color: #fff;
    border: 5px solid #000;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.2s;
    box-shadow: 6px 6px 0px #000;
    font-family: 'Arial Black', sans-serif;
}

.pop-art-button:hover {
    transform: translate(-3px, -3px);
    box-shadow: 9px 9px 0px #000;
    background: #ff3385;
}

.pop-art-button:active {
    transform: translate(3px, 3px);
    box-shadow: 3px 3px 0px #000;
}

.pop-art-button.secondary {
    background: #8338ec;
    width: 100%;
    margin-top: 20px;
}

.pop-art-button.secondary:hover {
    background: #9d5aff;
}

.error-message {
    background: #ff006e;
    color: #fff;
    padding: 15px;
    border: 5px solid #000;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
}

/* QR Section */
.qr-section {
    margin-top: 30px;
}

#qr-video {
    width: 100%;
    max-width: 400px;
    border: 5px solid #000;
    margin: 20px auto;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pop-art-title {
        font-size: 2em;
    }
    
    .pop-art-box {
        padding: 20px;
        margin: 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group input {
        font-size: 1.2em;
    }
    
    .pop-art-button {
        font-size: 1.2em;
        padding: 15px 30px;
    }
    
    .icon .label {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .pop-art-title {
        font-size: 1.5em;
    }
    
    .icon .label {
        font-size: 16px !important;
    }
}


/* === Slot Machine Styles (HTML-slot-machine-example) === */
:root {
    --item-height: 200px;
    /* Background image dimensions */
    --bg-width-px: 1090px;
    --bg-height-px: 1024px;
    --bg-aspect-ratio: 1090 / 1024; /* ≈ 1.0645 */
    /* Actual rendered dimensions (updated by JavaScript) */
    --bg-actual-width: 1090px; /* Default, will be updated by JS */
    --bg-actual-height: 1024px; /* Default, will be updated by JS */
    /* Background image positioning - easy to adjust */
    --bg-top: 50%;
    --bg-left: 50%;
    --bg-width: 90vw;
    --bg-height: 90vh;
    /* Slot machine container positioning - relative to background image container (0-100%) */
    --slot-offset-top: 0%;
    --slot-offset-left: -11.5%;
    --slot-width: 44.77%;
    --slot-height: 290px;
}

.slot-machine-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.background-image {
    position: absolute;
    top: var(--bg-top, 50%);
    left: var(--bg-left, 50%);
    width: var(--bg-width, 90vw);
    max-width: 1000px;
    height: var(--bg-height, 90vh);
    max-height: 938px;
    transform: translate(-50%, -50%);
    z-index: 0;
    object-fit: fill;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

/* Container matching background image size and position */
.bg-image-container {
    position: absolute;
    top: var(--bg-top, 50%);
    left: var(--bg-left, 50%);
    /* Match the scaling behavior of the background image */
    width: var(--bg-width, 90vw);
    max-width: 1000px;
    height: var(--bg-height, 90vh);
    max-height: 938px;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

#container {
    position: absolute;
    /* Position relative to bg-image-container center
       Uses JavaScript-measured actual rendered dimensions of background image
       This accounts for object-fit: contain and max-width/max-height constraints */
    top: 38%;
    left: 43.5%;
    transform: translate(-50%, -50%);
    z-index: 1;
    /* Width is percentage of actual rendered background image width */
    width: 60%;
    max-width: 600px;
    height: 25%;
}

/* Left center line marker */
#container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0px;
    width: 5%;
    height: 6px;
    background-color: #000000;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 70;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Right center line marker */
#container::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0px;
    width: 5%;
    height: 6px;
    background-color: #000000;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 70;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.window {
    position: relative;
    overflow: hidden;
    /*height: var(--slot-height, 600px); */
}

/* center line markers - removed as we use outer-col::after for the winning box */

.window-border {
    padding: 0;
    background: none;
    box-shadow: none;
}

/*
 * Reels and icon styling
 */

.icon {
    width: 100%;
    /* Each icon takes 1/3 of the viewport height (3 items visible) */
    /* Height will be set by CSS variable --icon-height from JavaScript */
    height: var(--icon-height, 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    /* Pop Art styling */
    box-shadow: 0 6px 28px 0 rgba(40, 40, 40, 0.23), 0 1.5px 7px 0 #ff57b1;
    border: 4px solid #000;
    overflow: hidden;
}


.icon .label {
    font-family: 'Impact', 'Arial Black', 'Arial', sans-serif;
    font-size: 2.2rem;
    color: #000;
    text-shadow:
        2px 0 0 #fff,
        -2px 0 0 #fff,
        0 2px 0 #fff,
        0 -2px 0 #fff,
        1.4px 1.4px 0 #fff,
        -1.4px -1.4px 0 #fff,
        1.4px -1.4px 0 #fff,
        -1.4px 1.4px 0 #fff;
    letter-spacing: 2px;
    line-height: 1.1;
    padding: 16px 30px;
    text-align: center;
    text-transform: capitalize;
    user-select: none;
    word-break: break-word;
    position: relative;
    z-index: 2;
}

.outer-col {
    overflow-y: hidden;
    width: 100%;
    background: black;
    /*height: var(--slot-height, 600px); */
    height: 100%;
    border: 10px solid #000;
    border-radius: 5px;
    position: relative;
}

.outer-col::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    background: linear-gradient(
        to bottom,
        #000000 0%,
        rgba(255, 255, 255, 0) 40%,
        rgba(255, 255, 255, 0) 60%,
        #000000 100%
    );
}

.outer-col::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%; 
    /* Height matches one icon (1/3 of viewport) to frame the winning character */
    height: var(--icon-height, 100px);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 60;
    background: transparent;
    border: 5px solid #000000;
    box-sizing: border-box;
    box-shadow: 
        inset 0 0 20px rgba(255, 0, 110, 0.3),
        0 0 20px rgba(255, 0, 110, 0.5);
}

.outer-spacer {
    display: none;
}

.col {
    padding: 0;
    will-change: true;
    /* Start with items positioned at the top (items flow down) */
    transform: translateY(0); 
}

/*
 * Spinning animation
 */

#container.spinning .col {
    animation-name: scroll;
    animation-iteration-count: 1;
    /* Fast initial speed with smooth deceleration at the end */
    animation-timing-function: cubic-bezier(0.1, 0.85, 0.7, 0.95);
    animation-fill-mode: forwards;
}

@keyframes scroll {
    from {
        transform: translateY(0);
    }
    to {
        /* Will be dynamically set by JavaScript to show winning item */
        transform: translateY(-100%);
    }
}

/* Result display */
.result-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #ff006e;
    color: #fff;
    padding: 40px 60px;
    border: 8px solid #000;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    box-shadow: 
        12px 12px 0px #8338ec,
        24px 24px 0px #3a86ff;
    animation: modalPop 0.5s ease-out;
}

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

/* Winner Overlay with Blur */
.winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out;
    pointer-events: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Winner Popup */
.winner-popup {
    background: linear-gradient(135deg, #ff006e 0%, #8338ec 50%, #3a86ff 100%);
    border: 12px solid #000;
    border-radius: 30px;
    padding: 80px 100px;
    text-align: center;
    box-shadow: 
        0 0 0 8px #ff006e,
        0 0 0 16px #8338ec,
        0 0 0 24px #3a86ff,
        0 0 80px rgba(255, 0, 110, 0.8);
    animation: winnerPopIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 90vw;
    max-height: 90vh;
}

@keyframes winnerPopIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.winner-title {
    font-size: 4em;
    font-weight: 900;
    color: #fff;
    text-shadow: 
        5px 5px 0px #000,
        -2px -2px 0px #000,
        2px -2px 0px #000,
        -2px 2px 0px #000,
        2px 2px 0px #000,
        0 0 20px rgba(255, 190, 11, 0.8);
    margin-bottom: 40px;
    letter-spacing: 8px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 
            5px 5px 0px #000,
            -2px -2px 0px #000,
            2px -2px 0px #000,
            -2px 2px 0px #000,
            2px 2px 0px #000,
            0 0 20px rgba(255, 190, 11, 0.8);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 
            5px 5px 0px #000,
            -2px -2px 0px #000,
            2px -2px 0px #000,
            -2px 2px 0px #000,
            2px 2px 0px #000,
            0 0 40px rgba(255, 190, 11, 1);
    }
}

.winner-name {
    font-size: 5em;
    font-weight: 900;
    color: #ffbe0b;
    text-shadow: 
        6px 6px 0px #000,
        -3px -3px 0px #000,
        3px -3px 0px #000,
        -3px 3px 0px #000,
        3px 3px 0px #000,
        0 0 30px rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    line-height: 1.2;
    animation: nameBounce 1s ease-in-out infinite;
    word-wrap: break-word;
    max-width: 100%;
}

@keyframes nameBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.google-link {
    display: inline-block;
    margin-top: 40px;
    font-size: 1.8em;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.4);
    border: 3px solid #fff;
    border-radius: 15px;
    text-shadow: 
        2px 2px 0px #000,
        -1px -1px 0px #000,
        1px -1px 0px #000,
        -1px 1px 0px #000;
    transition: all 0.3s ease;
    cursor: pointer;
}

.google-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffbe0b;
    color: #ffbe0b;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 190, 11, 0.6);
}

/* Responsive adjustments for winner popup */
@media (max-width: 768px) {
    .winner-popup {
        padding: 50px 60px;
    }
    
    .winner-title {
        font-size: 2.5em;
        letter-spacing: 4px;
        margin-bottom: 30px;
    }
    
    .winner-name {
        font-size: 3em;
    }
    
    .google-link {
        font-size: 1.4em;
        padding: 12px 25px;
        margin-top: 30px;
    }
    
    /* Adjust icon label for tablet screens */
    .icon .label {
        font-size: 1.8rem;
        padding: 12px 20px;
        letter-spacing: 1.5px;
    }
}

@media (max-width: 480px) {
    .winner-popup {
        padding: 40px 40px;
        border-width: 8px;
    }
    
    .winner-title {
        font-size: 2em;
        letter-spacing: 2px;
        margin-bottom: 20px;
    }
    
    .winner-name {
        font-size: 2em;
    }
    
    .google-link {
        font-size: 1.1em;
        padding: 10px 20px;
        margin-top: 25px;
    }
    
    /* Adjust icon label for mobile screens */
    .icon .label {
        font-size: 1.3rem;
        padding: 8px 12px;
        letter-spacing: 1px;
        text-shadow:
            1.5px 0 0 #fff,
            -1.5px 0 0 #fff,
            0 1.5px 0 #fff,
            0 -1.5px 0 #fff,
            1px 1px 0 #fff,
            -1px -1px 0 #fff,
            1px -1px 0 #fff,
            -1px 1px 0 #fff;
    }
    
    .icon {
        border: 3px solid #000;
    }
}