:root {
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.6);
    --xmas-green: #1b5e20;
    --cny-red: #b71c1c;
    --bg-dark: #0f172a;
}

body {
    margin: 0;
    padding: 20px;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.header {
    text-align: center;
    margin-bottom: 25px;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    background: linear-gradient(to right, #fff, var(--gold), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Dashboard for the Go Button and Player Status */
.dashboard {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
    position: relative;
}

#goButton {
    background: linear-gradient(145deg, #ffd700, #b8860b);
    color: #000;
    border: none;
    padding: 20px 60px;
    font-size: 1.8rem;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px var(--gold-glow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
}

#goButton:hover:not(:disabled) {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 15px 35px var(--gold-glow);
}

#goButton:disabled {
    background: #334155;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: scale(0.95);
}

#statusText {
    margin-top: 25px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    min-height: 1.6em;
}

/* Ticket Grid */
#grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 550px;
    perspective: 1000px;
}

.ticket-container {
    width: 100%;
    aspect-ratio: 1.5;
    cursor: default;
}

.ticket-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.is-flipped .ticket-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
    overflow: hidden;
}

/* Face Down Design (Back) */
.ticket-back {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    background-image: radial-gradient(circle at 2px 2px, rgba(255, 215, 0, 0.1) 1px, transparent 0);
    background-size: 15px 15px;
}

.ticket-back::before {
    content: "🧧";
    font-size: 3rem;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5));
}

/* Highlighting animation during shuffle */
.is-highlighted .ticket-back {
    border: 4px solid #fff;
    box-shadow: 0 0 30px #fff, inset 0 0 20px #fff;
    transform: scale(1.05);
    z-index: 50;
}

/* Face Up Design (Front) */
.ticket-front {
    background: #fff;
    color: #111;
    transform: rotateY(180deg);
}

.ticket-front.christmas {
    border: 5px solid var(--xmas-green);
    background: #f0fdf4;
    color: var(--xmas-green);
}

.ticket-front.cny {
    border: 5px solid var(--cny-red);
    background: #fef2f2;
    color: var(--cny-red);
}

.holiday-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.holiday-name {
    font-size: 1rem;
    font-weight: 900;
    text-align: center;
    line-height: 1.1;
    padding: 0 10px;
}

.player-label {
    margin-top: 12px;
    padding: 5px 15px;
    background: #000;
    color: var(--gold);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 900;
    text-transform: uppercase;
}

/* Glow animation for newly revealed cards */
.is-flipped .ticket-front {
    animation: pulseGlow 2s alternate infinite;
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 5px var(--gold);
    }

    to {
        box-shadow: 0 0 25px var(--gold);
    }
}

/* Year-Specific Themes (Overrides basic holiday colors) */
/* Year-Specific Themes (Dynamic assignment) */
.ticket-front.bg-theme-0 {
    background: #e0f2fe;
    /* Sky Blue */
    color: #0c4a6e;
    border-color: #0284c7;
}

.ticket-front.bg-theme-1 {
    background: #f3e8ff;
    /* Purple */
    color: #581c87;
    border-color: #9333ea;
}

.ticket-front.bg-theme-2 {
    background: #ffedd5;
    /* Orange */
    color: #7c2d12;
    border-color: #ea580c;
}

.ticket-front.bg-theme-3 {
    background: #fce7f3;
    /* Pink */
    color: #831843;
    border-color: #db2777;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        margin-bottom: 10px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .dashboard {
        padding: 15px;
        margin-bottom: 20px;
        width: 90%;
    }

    #goButton {
        padding: 12px 30px;
        font-size: 1.2rem;
    }

    #resetButton {
        padding: 12px 20px;
        /* Match height roughy */
    }

    #statusText {
        margin-top: 15px;
        font-size: 1.1rem;
    }

    #grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns for visibility */
        gap: 10px;
        /* Tighter gap */
        max-width: 100%;
        padding-bottom: 20px;
        /* Scroll buffer */
    }

    .ticket-container {
        aspect-ratio: 1.4;
        /* Slightly taller */
    }

    .holiday-icon {
        font-size: 1.2rem;
    }

    .holiday-name {
        font-size: 0.85rem;
    }

    .player-label {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}