:root {
    --primary-hue: 210;
    /* Winter Blue */
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: 1px solid rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --accent-color: #38bdf8;
    --font-serif: 'Noto Serif SC', serif;
    --font-display: 'ZCOOL XiaoWei', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-serif);
    background: #c8d8e8;
    /* Fallback color */
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Background Image Layer - WeChat Compatible */
#bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1491002052546-bf38f186af56?w=1920&q=80') center/cover no-repeat;
    z-index: 0;
}

/* Overlay for better card contrast */
#bg-layer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(200, 220, 240, 0.15);
}

#snowCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#app {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100vh;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s;
    overflow-y: auto;
    /* Allow scrolling for content */
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* Glass Panel */
.glass-panel {
    background: rgba(50, 50, 80, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    padding: 3rem 2rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Typography */
.main-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to bottom, #fff, #e0e7ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.sub-title {
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fbbf24;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.message {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ffffff;
    margin-bottom: 3rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Gift Box Animation */
.gift-box-container {
    cursor: pointer;
    perspective: 1000px;
    display: inline-block;
}

.gift-box {
    width: 100px;
    height: 100px;
    position: relative;
    margin: 0 auto;
    transition: transform 0.3s ease;
    animation: bounce 2s infinite ease-in-out;
    transform-style: preserve-3d;
}

.gift-box-container:hover .gift-box {
    transform: scale(1.1) rotateY(10deg);
}

.box {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e11d48, #be123c);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    position: absolute;
    bottom: 0;
}

.lid {
    width: 110%;
    height: 25px;
    background: #fb7185;
    position: absolute;
    top: -10px;
    left: -5%;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.ribbon {
    width: 20px;
    height: 100%;
    background: #fde047;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    z-index: 1;
}

.lid::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 100%;
    background: #facc15;
    left: 50%;
    transform: translateX(-50%);
}

.click-hint {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0.8;
    animation: pulse 2s infinite;
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Game Scene */
#game-scene {
    overflow: hidden;
    /* Hide cards leaving screen */
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
}

.score-board {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#card-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

.floating-card {
    position: absolute;
    /* Base Glass Style */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    min-width: 180px;
    cursor: pointer;
    pointer-events: auto;
    /* Enable click events on cards */
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    overflow: hidden;
    transition: transform 0.2s;
    user-select: none;
    display: flex;
    flex-direction: column;
}

/* Color Variants (Gradients similar to image) */
.card-blue {
    background: linear-gradient(135deg, rgba(135, 206, 250, 0.6), rgba(100, 149, 237, 0.4));
}

.card-purple {
    background: linear-gradient(135deg, rgba(221, 160, 221, 0.6), rgba(147, 112, 219, 0.4));
}

.card-pink {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.6), rgba(219, 112, 147, 0.4));
}

.card-orange {
    background: linear-gradient(135deg, rgba(255, 218, 185, 0.6), rgba(255, 160, 122, 0.4));
}

.floating-card:hover {
    transform: scale(1.1);
    z-index: 999 !important;
    /* Ensure it pops to top on hover */
    border-color: rgba(255, 255, 255, 0.8);
}

.card-header {
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dots-group {
    display: flex;
    gap: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.red {
    background: #ff5f57;
}

.dot.yellow {
    background: #febc2e;
}

.dot.green {
    background: #28c840;
}

.sys-msg {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
    letter-spacing: 1px;
}

.card-body {
    padding: 15px 20px;
    text-align: center;
    position: relative;
}

.blessing-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.text-large {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.emoji-small {
    font-size: 1.2rem;
}

.decoration-line {
    width: 40%;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    margin: 8px auto 0;
    border-radius: 2px;
}

/* Animations for Cards */
@keyframes appearAndVanish {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    10% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        transform: scale(1.02) translateY(-5px);
        /* Gentle hover breath */
    }

    90% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes collectEffect {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
    }

    30% {
        transform: scale(1.3);
        opacity: 0.9;
        filter: blur(0);
    }

    60% {
        transform: scale(1.5);
        opacity: 0.5;
        filter: blur(2px);
    }

    100% {
        transform: scale(2);
        opacity: 0;
        filter: blur(8px);
    }
}

.bottom-controls {
    position: absolute;
    transform: translateX(-50%);
    z-index: 100;
}

/* Firework Particle */
.firework-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}