/* ===== CSS Variables - Christmas Theme ===== */
:root {
    --forest-green: #0d3320;
    --deep-green: #1a4731;
    --pine-green: #2d5a45;
    --gold: #d4af37;
    --bright-gold: #ffd700;
    --snow-white: #f8f9fa;
    --cream: #fef9e7;
    --crimson: #dc143c;
    --berry-red: #8b0000;
    --warm-glow: rgba(255, 215, 0, 0.15);
    
    --font-heading: 'Mountains of Christmas', cursive;
    --font-body: 'Quicksand', sans-serif;
    
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.12);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ===== Base Styles ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(180deg, var(--forest-green) 0%, var(--deep-green) 50%, #0a1f15 100%);
    color: var(--snow-white);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
}

/* Hide main interactive content until the app is ready to avoid SSR/hydration flicker */
body:not(.app-ready) .snowfall,
body:not(.app-ready) .christmas-container,
body:not(.app-ready) .gift-section {
    opacity: 0;
}

body.app-ready .snowfall,
body.app-ready .christmas-container,
body.app-ready .gift-section {
    opacity: 1;
    transition: opacity 0.25s ease-out;
}

/* ===== Snowfall Animation ===== */
.snowfall {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: white;
    opacity: 0.8;
    font-size: 1rem;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes fall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Snowflake variations */
.snowflake:nth-child(1) { left: 5%; animation-duration: 8s; animation-delay: 0s; font-size: 0.8rem; }
.snowflake:nth-child(2) { left: 15%; animation-duration: 12s; animation-delay: 1s; font-size: 1.2rem; }
.snowflake:nth-child(3) { left: 25%; animation-duration: 10s; animation-delay: 2s; font-size: 0.9rem; }
.snowflake:nth-child(4) { left: 35%; animation-duration: 14s; animation-delay: 0.5s; font-size: 1rem; }
.snowflake:nth-child(5) { left: 45%; animation-duration: 9s; animation-delay: 3s; font-size: 1.1rem; }
.snowflake:nth-child(6) { left: 55%; animation-duration: 11s; animation-delay: 1.5s; font-size: 0.7rem; }
.snowflake:nth-child(7) { left: 65%; animation-duration: 13s; animation-delay: 2.5s; font-size: 1.3rem; }
.snowflake:nth-child(8) { left: 75%; animation-duration: 8s; animation-delay: 4s; font-size: 0.85rem; }
.snowflake:nth-child(9) { left: 85%; animation-duration: 10s; animation-delay: 0.8s; font-size: 1rem; }
.snowflake:nth-child(10) { left: 95%; animation-duration: 15s; animation-delay: 2s; font-size: 0.95rem; }
.snowflake:nth-child(11) { left: 10%; animation-duration: 11s; animation-delay: 3.5s; font-size: 1.15rem; }
.snowflake:nth-child(12) { left: 30%; animation-duration: 9s; animation-delay: 4.5s; font-size: 0.75rem; }
.snowflake:nth-child(13) { left: 50%; animation-duration: 13s; animation-delay: 1.2s; font-size: 1.05rem; }
.snowflake:nth-child(14) { left: 70%; animation-duration: 10s; animation-delay: 2.8s; font-size: 0.9rem; }
.snowflake:nth-child(15) { left: 90%; animation-duration: 12s; animation-delay: 0.3s; font-size: 1.2rem; }

/* ===== Typography ===== */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--bright-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
}

h1 { font-size: clamp(2.5rem, 8vw, 4rem); }
h2 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
h3 { font-size: clamp(1.3rem, 4vw, 1.8rem); }

p {
    line-height: 1.7;
    font-weight: 500;
}

/* ===== Content Container ===== */
.christmas-container {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 4rem;
}

/* ===== Section Styles ===== */
.section {
    margin-bottom: 3rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Hero Section ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
}

.hero h1 {
    margin-bottom: 1rem;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 2px 2px 4px rgba(0, 0, 0, 0.3);
    }
    to {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4), 2px 2px 4px rgba(0, 0, 0, 0.3);
    }
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--cream);
    opacity: 0.9;
}

.christmas-tree {
    font-size: 4rem;
    margin-bottom: 1rem;
}

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

/* ===== Card Styles (Glassmorphism) ===== */
.christmas-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.christmas-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.christmas-card h3 {
    margin-bottom: 0.5rem;
}

.christmas-card p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-size: 0.95rem;
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* ===== Section Headers ===== */
.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    color: var(--gold);
    opacity: 0.6;
}

.section-divider::before,
.section-divider::after {
    content: '';
    height: 1px;
    width: 50px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ===== YouTuber Cards ===== */
.youtuber-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.youtuber-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--crimson), var(--berry-red));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.youtuber-info {
    flex: 1;
}

.youtuber-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--snow-white);
    font-family: var(--font-body);
    font-weight: 700;
}

.youtuber-info p {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ===== Language Cards ===== */
.language-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.language-card {
    text-align: center;
    padding: 1.5rem 1rem;
}

.language-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.language-card h3 {
    font-size: 1rem;
    color: var(--snow-white);
    font-family: var(--font-body);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.language-card p {
    font-size: 0.8rem;
}

/* ===== Fun Facts ===== */
.fact-card {
    border-left: 4px solid var(--gold);
    padding-left: 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0 15px 15px 0;
    padding: 1rem 1rem 1rem 1.5rem;
}

.fact-card p {
    margin: 0;
    font-size: 0.95rem;
}

.fact-emoji {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* ===== Gift Box Styles ===== */
.gift-section {
    text-align: center;
    padding: 2rem 0;
}

.gift-container {
    perspective: 1000px;
    margin: 2rem auto;
}

.gift-box {
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gift-box:hover {
    transform: scale(1.05);
}

.gift-box-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--crimson) 0%, var(--berry-red) 100%);
    border-radius: 10px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.gift-ribbon-vertical {
    position: absolute;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, #c4a000, var(--bright-gold), #c4a000);
    left: 50%;
    transform: translateX(-50%);
    border-radius: 5px;
}

.gift-ribbon-horizontal {
    position: absolute;
    width: 100%;
    height: 30px;
    background: linear-gradient(180deg, #c4a000, var(--bright-gold), #c4a000);
    top: 50%;
    transform: translateY(-50%);
    border-radius: 5px;
}

.gift-bow {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
}

/* Gift box shake animation */
.gift-box.shake {
}

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    20% { transform: translateX(-10px) rotate(-5deg); }
    40% { transform: translateX(10px) rotate(5deg); }
    60% { transform: translateX(-10px) rotate(-5deg); }
    80% { transform: translateX(10px) rotate(5deg); }
}

/* Gift box opened state */
.gift-box.opened {
}

@keyframes openGift {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

/* Passphrase input */
.passphrase-container {
    margin: 1.5rem 0;
}

.passphrase-input {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--gold);
    border-radius: 30px;
    padding: 1rem 1.5rem;
    color: var(--snow-white);
    font-family: var(--font-body);
    font-size: 1rem;
    width: 100%;
    max-width: 280px;
    text-align: center;
    transition: all 0.3s ease;
}

.passphrase-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.passphrase-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.unlock-btn {
    background: linear-gradient(135deg, var(--gold), var(--bright-gold));
    color: var(--forest-green);
    border: none;
    border-radius: 30px;
    padding: 1rem 2.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.unlock-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.6);
}

.unlock-btn:active {
    transform: translateY(0);
}

.error-message {
    color: var(--crimson);
    margin-top: 1rem;
    font-weight: 600;
}

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

/* Gift Code Reveal */
.gift-revealed {
}

@keyframes revealGift {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0);
    }
}

.gift-code-container {
    background: linear-gradient(135deg, var(--gold), var(--bright-gold));
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(212, 175, 55, 0.5);
}

.gift-code-label {
    color: var(--forest-green);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.gift-code {
    color: var(--forest-green);
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    word-break: break-all;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    margin-top: 0.5rem;
}

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

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -20px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.celebration-text {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: var(--bright-gold);
    margin-bottom: 1rem;
}

/* ===== Animation gating for initial load ===== */
/* Animations only start once body has 'animations-ready' to avoid SSR/hydration jank */
body.animations-ready .snowflake {
    animation: fall linear infinite;
}

body.animations-ready .section {
    animation: fadeInUp 0.6s ease-out;
}

body.animations-ready .hero h1 {
    animation: glow 2s ease-in-out infinite alternate;
}

body.animations-ready .christmas-tree {
    animation: bounce 2s ease-in-out infinite;
}

body.animations-ready .gift-box.shake {
    animation: shake 0.5s ease-in-out;
}

body.animations-ready .gift-box.opened {
    animation: openGift 0.8s ease-out forwards;
}

body.animations-ready .gift-revealed {
    animation: revealGift 0.8s ease-out;
}

body.animations-ready .error-message {
    animation: fadeIn 0.3s ease;
}

body.animations-ready .confetti-piece {
    animation: confettiFall 3s ease-out forwards;
}

body.animations-ready .celebration-text {
    animation: celebratePulse 1s ease-in-out infinite;
}

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

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .snowflake {
        display: none;
    }
}

/* ===== Error UI (keep for Blazor) ===== */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1N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