:root {
    --primary-hue: 350;
    /* Red */
    --primary: hsl(355, 78%, 56%);
    /* Christmas Red */
    --primary-dark: hsl(355, 78%, 40%);
    --secondary: hsl(145, 65%, 25%);
    /* Christmas Green */
    --accent: #16a34a;
    /* Christmas Green Accent */
    --bg-dark: #0f172a;
    --text-light: #fefce8;
    /* Slightly warm white */
    --text-muted: #cbd5e1;
    --glass-bg: rgba(22, 91, 51, 0.4);
    /* Green tint glass */
    --glass-border: rgba(255, 255, 255, 0.15);
    --font-main: 'Outfit', sans-serif;
    --radius: 20px;
    --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 20px 0 0 0;
    font-family: 'Outfit', sans-serif;
    /* Christmas Red Background */
    background: radial-gradient(circle at top, #b91c1c, #7f1d1d, #450a0a);
    color: #f1f5f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Start from top with padding */
    align-items: center;
    /* Center Horizontally */
    overflow-x: hidden;
}

/* Snow - Styles moved to Christmas Animations section at bottom */

/* Main Container */
main {
    width: 100%;
    max-width: 500px;
    /* Mobile width optimized */
    margin: 60px 1rem 4rem 1rem;
    z-index: 1;
}

/* Glass Card */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    /* Christmas decoration top border */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: repeating-linear-gradient(45deg,
            var(--primary),
            var(--primary) 10px,
            #fff 10px,
            #fff 20px,
            var(--secondary) 20px,
            var(--secondary) 30px);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

p {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    text-align: center;
}

/* Counter Box */
.counter-box {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.counter-number {
    font-size: 2.2rem;
    color: var(--accent);
    font-weight: 800;
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.counter-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

/* Countdown Section */
.countdown-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.5rem;
}

@media (max-width: 450px) {
    .countdown-section {
        grid-template-columns: 1fr;
    }
}

.countdown-box {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.5) 100%);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.countdown-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.christmas-countdown::before {
    background: linear-gradient(90deg, #dc2626, #16a34a, #dc2626);
}

.amigo-countdown::before {
    background: linear-gradient(90deg, #fbbf24, #ef4444, #fbbf24);
}

.countdown-icon {
    font-size: 2rem;
    margin-bottom: 5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.countdown-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 5px;
}

.countdown-date {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 10px;
}

.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
}

.time-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    min-width: 35px;
    text-align: center;
}

.time-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.6;
    letter-spacing: 0.5px;
    margin-top: 3px;
}

.time-separator {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    margin-top: -10px;
}

/* Grid for Names */
.name-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 cols on mobile is tight but ok for short names, maybe 2 */
    gap: 0.8rem;
    margin-top: 1rem;
}

@media (max-width: 380px) {
    .name-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.name-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: 0.8rem;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.name-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.name-btn:active {
    transform: scale(0.96);
}

.name-btn.filled {
    background: rgba(22, 163, 74, 0.4);
    /* Green tint */
    border-color: #4ade80;
    color: #fff;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.2);
}

/* Pseudo-element removed as emoji is now inline */

/* Inputs and Lists */
.gift-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.gift-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="text"] {
    width: 100%;
    padding: 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(212, 36, 38, 0.4);
    transition: transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
    margin-top: 0.8rem;
}

/* Trending Section */
.trending-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.trending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    margin: 40px auto 2rem;
    padding: 2rem;
    border-radius: 20px;
}

.trending-name {
    font-weight: 600;
}

.trending-count {
    background: var(--accent);
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.remove-btn {
    background: #ef4444;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Access Counter */
.access-watermark {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-content h2 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.modal-item {
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.modal-owner {
    font-size: 0.8rem;
    color: #94a3b8;
    display: block;
}

.modal-gift {
    font-size: 1rem;
    color: #fff;
}

/* Word Cloud */
.trending-canvas {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-top: 1rem;
    cursor: pointer;
}

/* =============================================
   CHRISTMAS ANIMATIONS - Santa & Snow
   ============================================= */

/* Santa Container */
.santa-container {
    position: fixed;
    top: -300px;
    left: 5%;
    z-index: 9000;
    pointer-events: none;
    /* Hidden by default, JS toggles it via inline style or class, but lets force block on animate just in case */
    animation: santaSwing 3s ease-in-out infinite;
}

.santa-container.santa-animate {
    display: block !important;
    animation: santaDescend 4s ease-out forwards, santaSwing 3s ease-in-out 4s infinite;
}

@keyframes santaDescend {
    0% {
        top: -600px;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        top: -50px;
        /* Positions the santa body in view, wire goes up */
        opacity: 1;
    }
}

@keyframes santaSwing {

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

    50% {
        transform: rotate(5deg);
    }
}

.santa-container.santa-animate {
    display: block !important;
    transform-origin: 20px -800px;
    /* Pivot point high up on the wire */
    animation: santaDescend 4s ease-out forwards, santaSwing 4s ease-in-out infinite;
}

/* Santa Figure */
.santa-figure {
    width: 130px;
    height: 150px;
    position: relative;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.4));
}

.santa-svg {
    width: 100%;
    height: 100%;
}

/* Christmas Lights String */
.christmas-lights {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 30px;
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
}

.christmas-lights::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
            transparent 0%,
            #1f2937 10%,
            #1f2937 90%,
            transparent 100%);
    border-radius: 2px;
}

.light {
    width: 12px;
    height: 16px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    position: relative;
    animation: lightGlow 1.5s ease-in-out infinite;
    animation-delay: var(--delay);
}

.light:nth-child(1) {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.light:nth-child(2) {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.light:nth-child(3) {
    background: #3b82f6;
    box-shadow: 0 0 10px #3b82f6;
}

.light:nth-child(4) {
    background: #fbbf24;
    box-shadow: 0 0 10px #fbbf24;
}

.light:nth-child(5) {
    background: #f472b6;
    box-shadow: 0 0 10px #f472b6;
}

.light:nth-child(6) {
    background: #22c55e;
    box-shadow: 0 0 10px #22c55e;
}

.light:nth-child(7) {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.light::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: #374151;
    border-radius: 2px;
}

@keyframes lightGlow {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.6;
        filter: brightness(1.3);
    }
}

/* Enhanced Snow Styles */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: #fff;
    font-size: 1rem;
    user-select: none;
    animation: snowfall linear infinite;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

@keyframes snowfall {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
    }

    25% {
        transform: translateY(25vh) rotate(90deg) translateX(10px);
    }

    50% {
        transform: translateY(50vh) rotate(180deg) translateX(-10px);
    }

    75% {
        transform: translateY(75vh) rotate(270deg) translateX(5px);
    }

    100% {
        transform: translateY(105vh) rotate(360deg) translateX(0);
    }
}

/* Mobile adjustments for Santa */
@media (max-width: 480px) {
    .santa-container {
        left: 2%;
        transform: scale(0.8);
        transform-origin: top left;
    }

    .santa-figure {
        width: 80px;
        height: 104px;
    }

    .christmas-lights {
        width: 110px;
    }
}