* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-glow: #4ecdc4;
    --secondary-glow: #95e1d3;
    --accent-glow: #ffd93d;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --shadow-deep: rgba(0, 0, 0, 0.6);
}

body {
    font-family: 'Righteous', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    background: #0a0e27;
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    width: 100vw;
    position: relative;
    touch-action: none; /* Prevent scrolling on mobile */
    -webkit-overflow-scrolling: touch;
}

.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    contain: layout style paint;
}

/* Background with Northern Lights */
.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/RegTechNorthernLights.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
    animation: auroraFlow 25s ease-in-out infinite;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes auroraFlow {
    0%, 100% {
        transform: scale(1) translate3d(0, 0, 0);
        opacity: 1;
    }
    33% {
        transform: scale(1.08) translate3d(-2%, 1%, 0);
        opacity: 1.15;
    }
    66% {
        transform: scale(1.05) translate3d(2%, -1%, 0);
        opacity: 1.1;
    }
}

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

.snowflake {
    position: absolute;
    top: -20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1em;
    font-family: Arial;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    animation: snowfall linear forwards;
    opacity: 0;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes snowfall {
    0% {
        transform: translate3d(var(--drift, 0), 0, 0) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: 0.9;
    }
    95% {
        opacity: 0.9;
    }
    100% {
        transform: translate3d(var(--drift, 0), calc(100vh + 20px), 0) rotate(360deg);
        opacity: 0;
    }
}

/* Modern Greeting Section */
.greeting-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    text-align: center;
    pointer-events: none;
    animation: fadeInUp 1.2s ease-out;
    width: 90%;
    max-width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

@media (max-height: 800px) {
    .greeting-container {
        bottom: 60px;
    }
}

@media (max-height: 600px) {
    .greeting-container {
        bottom: 40px;
    }
    
    .greeting-main {
        font-size: clamp(32px, 6vw, 56px) !important;
        margin-bottom: 10px;
    }
    
    .greeting-sub {
        font-size: clamp(12px, 2vw, 18px) !important;
    }
    
    .sled-instruction {
        font-size: 12px !important;
        margin-top: 10px !important;
    }
}

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

.greeting-main {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(48px, 8vw, 120px);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.1;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    letter-spacing: -0.02em;
    max-width: 100%;
    word-break: break-word;
}

.greeting-main span {
    display: inline-block;
    color: var(--text-primary);
    text-shadow: 
        0 0 10px rgba(78, 205, 196, 0.5),
        0 0 20px rgba(78, 205, 196, 0.3),
        0 0 30px rgba(78, 205, 196, 0.2),
        0 4px 20px var(--shadow-deep);
    animation: letterGlow 3s ease-in-out infinite;
    animation-delay: calc(var(--delay) * 0.08s);
}

@keyframes letterGlow {
    0%, 100% {
        filter: brightness(1);
        text-shadow: 
            0 0 10px rgba(78, 205, 196, 0.5),
            0 0 20px rgba(78, 205, 196, 0.3),
            0 0 30px rgba(78, 205, 196, 0.2),
            0 4px 20px var(--shadow-deep);
    }
    50% {
        filter: brightness(1.3);
        text-shadow: 
            0 0 15px rgba(78, 205, 196, 0.8),
            0 0 30px rgba(78, 205, 196, 0.5),
            0 0 45px rgba(78, 205, 196, 0.3),
            0 4px 20px var(--shadow-deep);
    }
}

.greeting-sub {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(18px, 2.5vw, 32px);
    font-weight: 300;
    color: var(--text-secondary);
    text-shadow: 0 2px 10px var(--shadow-deep);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Center Sled Container (Initially Clickable) */
.sled-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
    z-index: 3;
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: sledAppear 1s ease-out 0.5s both;
    will-change: transform;
    backface-visibility: hidden;
    background: transparent;
    /* Force GPU acceleration for Safari */
    -webkit-transform: translate3d(-50%, -50%, 0);
    -webkit-backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

@keyframes sledAppear {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.8);
        -webkit-transform: translate3d(-50%, -50%, 0) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) scale(1);
    }
}

.sled-container:hover {
    transform: translate3d(-50%, -50%, 0) scale(1.05);
}

.sled-container:active {
    transform: translate3d(-50%, -50%, 0) scale(0.98);
}

.sled-container.flying {
    pointer-events: none;
    transition: none;
}

.sled-image {
    width: clamp(320px, 36vw, 520px);
    height: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.5));
    pointer-events: none;
    transition: filter 0.3s ease;
    background: transparent;
    border: none;
    outline: none;
}

.sled-container:hover .sled-image {
    filter: drop-shadow(0 25px 60px rgba(78, 205, 196, 0.4)) 
            drop-shadow(0 20px 50px rgba(0, 0, 0, 0.5));
}

/* Sled Instruction Text */
.sled-instruction {
    position: relative;
    margin-top: 20px;
    font-family: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(14px, 1.8vw, 20px);
    font-weight: 400;
    color: var(--text-secondary);
    text-align: center;
    text-shadow: 0 2px 10px var(--shadow-deep);
    letter-spacing: 0.05em;
    opacity: 0;
    animation: instructionFadeIn 1s ease-out 1.5s forwards;
    pointer-events: none;
}

.sled-instruction.hidden {
    opacity: 0;
    animation: none;
}

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

/* Looping Flying Animation */
.sled-container.looping {
    animation: sledUp 2s ease-out forwards, 
               sledMoveLeft 1.5s linear 2s forwards,
               sledLoopHorizontal 6s linear 3.5s infinite;
    pointer-events: none;
    transition: none !important;
    will-change: transform;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
    isolation: isolate;
    /* Force GPU acceleration for Safari */
    -webkit-transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

@keyframes sledUp {
    /* Start at center, move up while scaling down - using transform only */
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
    }
    100% {
        transform: translate3d(-50%, calc(-50% - 35vh), 0) rotate(0deg) scale(0.6);
        -webkit-transform: translate3d(-50%, calc(-50% - 35vh), 0) rotate(0deg) scale(0.6);
    }
}

@keyframes sledMoveLeft {
    /* Move from center to left, going off screen - using transform only */
    0% {
        transform: translate3d(-50%, calc(-50% - 35vh), 0) rotate(0deg) scale(0.6);
        -webkit-transform: translate3d(-50%, calc(-50% - 35vh), 0) rotate(0deg) scale(0.6);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
    }
}

@keyframes sledLoopHorizontal {
    /* Start from right edge, move left continuously in infinite loop - using transform only */
    0% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 35vh), 0) rotate(3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 35vh), 0) rotate(3deg) scale(0.6);
    }
    49.999% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
    }
    /* Seamlessly transition to appear from right (snake effect) */
    50% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 35vh), 0) rotate(3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 35vh), 0) rotate(3deg) scale(0.6);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 35vh), 0) rotate(-3deg) scale(0.6);
    }
}

/* Motion Lines/Trails */
.motion-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Behind the sleigh (z-index: 3) */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.motion-lines.active {
    opacity: 1;
}

.motion-line {
    position: absolute;
    width: 150px;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(78, 205, 196, 0.4) 10%,
        rgba(149, 225, 211, 0.7) 30%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(149, 225, 211, 0.7) 70%,
        rgba(78, 205, 196, 0.4) 90%,
        transparent 100%);
    transform-origin: left center;
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
    animation: motionLineFade 0.6s ease-out forwards;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

@keyframes motionLineFade {
    from {
        opacity: 0.9;
        transform: scaleX(0) scaleY(1);
    }
    50% {
        opacity: 0.6;
    }
    to {
        opacity: 0;
        transform: scaleX(1.2) scaleY(0.3);
    }
}

/* Present with Message Overlay */
.present-container {
    position: absolute;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease;
    background: transparent;
}

.present-container.show {
    opacity: 1;
    animation: presentReveal 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes presentReveal {
    from {
        opacity: 0;
        transform: translate(-50%, -30%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.present {
    width: clamp(196px, 22.4vw, 400px);
    height: clamp(196px, 22.4vw, 400px);
    position: relative;
    pointer-events: none;
    background: transparent;
}

.present img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.5));
    background: transparent;
    border: none;
    outline: none;
}

.present-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 7;
    pointer-events: none;
}

.present-message h1 {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(28px, 4vw, 56px);
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    text-shadow: 
        0 0 20px rgba(78, 205, 196, 0.8),
        0 0 40px rgba(78, 205, 196, 0.5),
        0 4px 20px var(--shadow-deep);
    letter-spacing: -0.02em;
}

.present-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    line-height: 1.05;
    text-align: center;
    width: 100%;
}

.title-line {
    display: block;
    white-space: nowrap;
}

.present-message p {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(16px, 2vw, 24px);
    font-weight: 300;
    color: var(--text-secondary);
    text-shadow: 
        0 0 10px rgba(78, 205, 196, 0.4),
        0 2px 10px var(--shadow-deep);
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* Click Ripple Effect */
.click-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(78, 205, 196, 0.6) 0%, transparent 70%);
    pointer-events: none;
    z-index: 6;
}

.click-ripple.active {
    animation: rippleExpand 0.8s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 800px;
        height: 800px;
        opacity: 0;
    }
}

/* Enhanced Confetti Canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 7;
    /* Safari performance optimizations */
    will-change: contents;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Reset Present Button */
.reset-present-container {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease, transform 0.3s ease;
    cursor: pointer;
    display: flex;
    gap: 12px;
    align-items: center;
}

.challenge-input-container.show ~ .reset-present-container {
    bottom: 40px;
}

.reset-present-container.show {
    opacity: 1;
    pointer-events: auto;
}

.reset-present-container button {
    cursor: pointer;
}

.reset-button {
    font-family: 'Righteous', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 12px 24px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.reset-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(78, 205, 196, 0.5);
    color: var(--text-primary);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
    transform: translateY(-2px);
}

/* Challenge Input */
.challenge-input-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.challenge-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    max-width: 600px;
}

.challenge-input-container.show {
    opacity: 1;
    pointer-events: auto;
}

.challenge-input-label {
    display: block;
    font-family: 'Righteous', sans-serif;
    font-size: clamp(14px, 1.8vw, 18px);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px var(--shadow-deep);
    letter-spacing: 0.05em;
}

.challenge-input {
    font-family: 'Righteous', sans-serif;
    font-size: 16px;
    padding: 12px 20px;
    border: 2px solid rgba(78, 205, 196, 0.5);
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    min-width: 400px;
    outline: none;
    transition: all 0.3s ease;
}

.challenge-input:focus {
    border-color: rgba(78, 205, 196, 0.8);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
}

.challenge-input::placeholder {
    color: var(--text-secondary);
}

.submit-challenge-btn {
    font-family: 'Righteous', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    border: 2px solid rgba(78, 205, 196, 0.5);
    border-radius: 24px;
    background: rgba(78, 205, 196, 0.2);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.submit-challenge-btn:hover {
    background: rgba(78, 205, 196, 0.3);
    border-color: rgba(78, 205, 196, 0.8);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
    transform: translateY(-2px);
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 15;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(78, 205, 196, 0.5);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
    padding: 0;
    outline: none;
}

.sound-toggle:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: rgba(78, 205, 196, 0.8);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
    transform: scale(1.1);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted .sound-icon {
    opacity: 0.5;
}

.sound-icon {
    display: block;
    transition: opacity 0.3s ease;
    font-size: 24px;
    line-height: 1;
}

/* Challenge Text Display */
.challenge-text-container {
    position: absolute;
    left: 10%;
    top: 66%;
    transform: translateY(-50%);
    z-index: 6;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    will-change: transform, opacity;
    backface-visibility: hidden;
    /* Force GPU acceleration for Safari */
    -webkit-transform: translateY(-50%);
    -webkit-backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
}

.challenge-text-container.show {
    opacity: 1;
    animation: moveToSanta 3s ease-out forwards;
}

@media (max-width: 768px) {
    .challenge-text-container.show {
        animation: moveToSantaTablet 3s ease-out forwards;
    }
}

@media (max-width: 480px) {
    .challenge-text-container.show {
        animation: moveToSantaPhone 3s ease-out forwards;
    }
}

@media (max-width: 768px) and (max-height: 700px) {
    .challenge-text-container.show {
        animation: moveToSantaSmall 3s ease-out forwards;
    }
}

@media (max-width: 480px) and (max-height: 600px) {
    .challenge-text-container.show {
        animation: moveToSantaTiny 3s ease-out forwards;
    }
}

.challenge-text-container.smashed {
    animation: smashToPieces 0.5s ease-out forwards !important;
    pointer-events: none;
}

@keyframes moveToSanta {
    0% {
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
    }
    100% {
        transform: translateY(calc(-50% - 51vh));
        -webkit-transform: translateY(calc(-50% - 51vh));
    }
}

@keyframes moveToSantaTablet {
    0% {
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
    }
    100% {
        transform: translateY(calc(-50% - 45vh));
        -webkit-transform: translateY(calc(-50% - 45vh));
    }
}

@keyframes moveToSantaPhone {
    0% {
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
    }
    100% {
        transform: translateY(calc(-50% - 43vh));
        -webkit-transform: translateY(calc(-50% - 43vh));
    }
}

@keyframes moveToSantaSmall {
    0% {
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
    }
    100% {
        transform: translateY(calc(-50% - 43vh));
        -webkit-transform: translateY(calc(-50% - 43vh));
    }
}

@keyframes moveToSantaTiny {
    0% {
        transform: translateY(-50%);
        -webkit-transform: translateY(-50%);
    }
    100% {
        transform: translateY(calc(-50% - 40vh));
        -webkit-transform: translateY(calc(-50% - 40vh));
    }
}

@keyframes smashToPieces {
    0% {
        opacity: 1;
        transform: translateY(-50%) scale(1) rotate(0deg);
        -webkit-transform: translateY(-50%) scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.5;
        transform: translateY(-50%) scale(1.2) rotate(5deg);
        -webkit-transform: translateY(-50%) scale(1.2) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0) rotate(180deg);
        -webkit-transform: translateY(-50%) scale(0) rotate(180deg);
    }
}

.challenge-text {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(32px, 4vw, 64px);
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 
        0 0 20px rgba(78, 205, 196, 0.8),
        0 0 40px rgba(78, 205, 196, 0.5),
        0 4px 20px var(--shadow-deep);
    line-height: 1.2;
    text-align: center;
    max-width: 400px;
    word-wrap: break-word;
}


@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .greeting-container {
        bottom: 120px;
        z-index: 6;
    }

    .greeting-main {
        font-size: clamp(36px, 6vw, 80px);
        gap: 4px;
    }

    .greeting-main span.mobile-line-break {
        display: block;
        width: 100%;
        height: 0;
        line-height: 0;
    }

    .sled-container {
        z-index: 3;
    }

    .sled-image {
        width: clamp(240px, 40vw, 440px);
    }
}

@media (max-width: 768px) {
    .greeting-container {
        bottom: clamp(40px, 8vh, 80px);
        width: 95%;
        padding: 0 15px;
    }

    .greeting-main {
        font-size: clamp(32px, 7vw, 56px);
        gap: 4px;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    .greeting-main span.mobile-line-break {
        display: block;
        width: 100%;
        height: 0;
        line-height: 0;
    }

    .greeting-sub {
        font-size: clamp(12px, 2.5vw, 20px);
    }
    
    .sled-instruction {
        font-size: clamp(12px, 1.5vw, 16px);
        margin-top: 12px;
    }

    .sled-container {
        z-index: 3;
    }

    .sled-image {
        width: clamp(280px, 50vw, 420px);
    }

    .present {
        width: clamp(126px, 24.5vw, 196px);
        height: clamp(126px, 24.5vw, 196px);
    }

    .present-message h1 {
        font-size: clamp(26px, 6vw, 44px);
    }
    
    .present-container {
        top: 48%;
    }

    .challenge-input-wrapper {
        width: 100%;
    }

    .challenge-input {
        min-width: 280px;
        width: 100%;
    }

    .challenge-input {
        font-size: 14px;
    }
    
    .challenge-input-container {
        bottom: clamp(110px, 16vh, 140px);
    }
    
    .reset-present-container {
        bottom: clamp(10px, 2vh, 20px);
    }
    
    .challenge-input-wrapper {
        margin-bottom: 10px;
    }

    .challenge-text {
        font-size: clamp(20px, 5vw, 40px);
    }

    .challenge-text-container {
        left: 5%;
        top: 66%;
    }
    
    .sled-container.looping {
        animation: sledUpTablet 2s ease-out forwards, 
                   sledMoveLeftTablet 1.5s linear 2s forwards,
                   sledLoopHorizontalTablet 6s linear 3.5s infinite;
    }
}

@keyframes sledUpTablet {
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
    }
    100% {
        transform: translate3d(-50%, calc(-50% - 30vh), 0) rotate(0deg) scale(0.6);
        -webkit-transform: translate3d(-50%, calc(-50% - 30vh), 0) rotate(0deg) scale(0.6);
    }
}

@keyframes sledMoveLeftTablet {
    0% {
        transform: translate3d(-50%, calc(-50% - 30vh), 0) rotate(0deg) scale(0.6);
        -webkit-transform: translate3d(-50%, calc(-50% - 30vh), 0) rotate(0deg) scale(0.6);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
    }
}

@keyframes sledLoopHorizontalTablet {
    0% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 30vh), 0) rotate(3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 30vh), 0) rotate(3deg) scale(0.6);
    }
    49.999% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
    }
    50% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 30vh), 0) rotate(3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 30vh), 0) rotate(3deg) scale(0.6);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 30vh), 0) rotate(-3deg) scale(0.6);
    }
}

@media (max-width: 480px) {
    .greeting-container {
        bottom: clamp(30px, 6vh, 60px);
        width: 98%;
        padding: 0 10px;
    }

    .greeting-main {
        font-size: clamp(28px, 8vw, 42px);
        gap: 2px;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .greeting-main span.mobile-line-break {
        display: block;
        width: 100%;
        height: 0;
        line-height: 0;
    }

    .greeting-sub {
        font-size: clamp(11px, 3vw, 16px);
    }

    .sled-container {
        z-index: 3;
    }

    .sled-image {
        width: clamp(300px, 60vw, 380px);
    }

    .present {
        width: clamp(112px, 28vw, 154px);
        height: clamp(112px, 28vw, 154px);
    }
    
    .present-message h1 {
        font-size: clamp(24px, 7vw, 36px);
    }

    .present-title {
        gap: 2px;
    }

    .present-container {
        top: 46%;
    }
    
    .challenge-input-container {
        bottom: clamp(120px, 18vh, 160px);
    }
    
    .reset-present-container {
        bottom: clamp(8px, 1.5vh, 15px);
    }
    
    .challenge-input-wrapper {
        margin-bottom: 8px;
    }

    .sled-instruction {
        font-size: 11px;
        margin-top: 8px;
    }
    
    .challenge-text {
        font-size: clamp(18px, 4.5vw, 32px);
    }
    
    .sled-container.looping {
        animation: sledUpPhone 2s ease-out forwards, 
                   sledMoveLeftPhone 1.5s linear 2s forwards,
                   sledLoopHorizontalPhone 6s linear 3.5s infinite;
    }
}

@keyframes sledUpPhone {
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
    }
    100% {
        transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
        -webkit-transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
    }
}

@keyframes sledMoveLeftPhone {
    0% {
        transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
        -webkit-transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
}

@keyframes sledLoopHorizontalPhone {
    0% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
    }
    49.999% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
    50% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
}

/* Additional mobile height constraints */
@media (max-width: 768px) and (max-height: 700px) {
    .greeting-container {
        bottom: clamp(20px, 4vh, 50px);
    }
    
    .greeting-main {
        font-size: clamp(28px, 6vw, 48px) !important;
        margin-bottom: 8px;
    }
    
    .sled-image {
        width: clamp(280px, 50vw, 400px) !important;
    }
    
    .present {
        width: clamp(105px, 21vw, 168px) !important;
        height: clamp(105px, 21vw, 168px) !important;
    }
    
    .challenge-input-container {
        bottom: clamp(70px, 11vh, 100px) !important;
    }
    
    .reset-present-container {
        bottom: clamp(8px, 1.5vh, 15px) !important;
    }
    
    .sled-container.looping {
        animation: sledUpSmall 2s ease-out forwards, 
                   sledMoveLeftSmall 1.5s linear 2s forwards,
                   sledLoopHorizontalSmall 6s linear 3.5s infinite;
    }
}

@keyframes sledUpSmall {
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
    }
    100% {
        transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
        -webkit-transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
    }
}

@keyframes sledMoveLeftSmall {
    0% {
        transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
        -webkit-transform: translate3d(-50%, calc(-50% - 28vh), 0) rotate(0deg) scale(0.55);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
}

@keyframes sledLoopHorizontalSmall {
    0% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
    }
    49.999% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
    50% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 28vh), 0) rotate(3deg) scale(0.55);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 28vh), 0) rotate(-3deg) scale(0.55);
    }
}

@media (max-width: 480px) and (max-height: 600px) {
    .greeting-container {
        bottom: clamp(15px, 3vh, 40px);
    }
    
    .greeting-main {
        font-size: clamp(24px, 7vw, 36px) !important;
        margin-bottom: 6px;
    }
    
    .sled-image {
        width: clamp(240px, 55vw, 340px) !important;
    }
    
    .present {
        width: clamp(98px, 24.5vw, 140px) !important;
        height: clamp(98px, 24.5vw, 140px) !important;
    }
    
    .challenge-input-container {
        bottom: clamp(60px, 10vh, 90px) !important;
    }
    
    .reset-present-container {
        bottom: clamp(5px, 1vh, 10px) !important;
    }
    
    .sled-container.looping {
        animation: sledUpTiny 2s ease-out forwards, 
                   sledMoveLeftTiny 1.5s linear 2s forwards,
                   sledLoopHorizontalTiny 6s linear 3.5s infinite;
    }
}

@keyframes sledUpTiny {
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
        -webkit-transform: translate3d(-50%, -50%, 0) rotate(0deg) scale(1);
    }
    100% {
        transform: translate3d(-50%, calc(-50% - 25vh), 0) rotate(0deg) scale(0.5);
        -webkit-transform: translate3d(-50%, calc(-50% - 25vh), 0) rotate(0deg) scale(0.5);
    }
}

@keyframes sledMoveLeftTiny {
    0% {
        transform: translate3d(-50%, calc(-50% - 25vh), 0) rotate(0deg) scale(0.5);
        -webkit-transform: translate3d(-50%, calc(-50% - 25vh), 0) rotate(0deg) scale(0.5);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
    }
}

@keyframes sledLoopHorizontalTiny {
    0% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 25vh), 0) rotate(3deg) scale(0.5);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 25vh), 0) rotate(3deg) scale(0.5);
    }
    49.999% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
    }
    50% {
        transform: translate3d(calc(-50% + 65vw), calc(-50% - 25vh), 0) rotate(3deg) scale(0.5);
        -webkit-transform: translate3d(calc(-50% + 65vw), calc(-50% - 25vh), 0) rotate(3deg) scale(0.5);
    }
    100% {
        transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
        -webkit-transform: translate3d(calc(-50% - 65vw), calc(-50% - 25vh), 0) rotate(-3deg) scale(0.5);
    }
}

