/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #070B19;
    --bg-gradient: linear-gradient(135deg, #070B19 0%, #1A1B41 100%);
    --text-light: #E2E8F0;
    --text-gold: #FCD34D;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow-color: rgba(252, 211, 77, 0.6);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
	padding: 20px;
}

/* Canvas background */
#sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    /* Let clicks pass through to stars-to-tap */
}

.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: translateY(20px);
    opacity: 0;
    animation: fadeUp 1s ease forwards;
}

/* Typography */
h1.title,
h2.title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--text-gold);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px var(--glow-color);
}

.subtitle {
    font-size: 1.1rem;
    color: #CBD5E1;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.personalized-message {
    font-size: 1.25rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: #F8FAFC;
    font-weight: 300;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input,
select {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--text-gold);
    box-shadow: 0 0 15px rgba(252, 211, 77, 0.2);
}

select option {
    background: var(--bg-dark);
    color: white;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.primary-btn {
    background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
    color: #451A03;
    width: 100%;
    margin-top: 1rem;
}

.primary-btn.glow-btn:hover {
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
    transform: translateY(-2px);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--text-gold);
    color: var(--text-gold);
    margin-top: 1rem;
}

.secondary-btn:hover {
    background: rgba(252, 211, 77, 0.1);
}

.compact-btn {
    padding: 0.5rem 1rem;
    background: #475569;
    color: white;
    font-size: 0.9rem;
    border-radius: 8px;
}

.text-link-btn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94A3B8;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: none;
    z-index: 50;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.text-link-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-gold);
    border-color: rgba(252, 211, 77, 0.3);
}

/* Action Styles - Result Area */
.result-area {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.link-box {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.link-box input {
    flex: 1;
    min-width: 0;
}

/* Viewer Mode - Interactive Stage */
.instructions {
    text-align: center;
    margin-bottom: 2rem;
    pointer-events: none;
}

.instructions h1 {
    font-size: 2rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.instructions .sender-name {
    color: var(--text-gold);
    font-size: 2.2rem;
    display: block;
    margin-top: 5px;
    font-family: 'Playfair Display', serif;
    font-weight: 800;
}

.instructions p {
    font-size: 1.2rem;
    color: #94A3B8;
}

.hand-pointer {
    position: absolute;
    bottom: -60px;
    left: 50%;
    margin-left: -24px;
    animation: clickTutorial 1.5s infinite;
    filter: drop-shadow(0 0 10px rgba(252, 211, 77, 0.4));
    pointer-events: none;
    z-index: 100;
}

@keyframes clickTutorial {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(0.9);
    }
}

/* Playable Lanterns */
.lanterns-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    perspective: 1000px;
}

.lantern {
    width: 60px;
    height: 120px;
    cursor: pointer;
    transform-origin: top center;
    transition: all 0.3s ease;
    animation: swing 4s infinite ease-in-out alternate;
}

/* Add slight offset to swinging so they don't look artificial */
.lantern:nth-child(1) {
    animation-delay: 0s;
}

.lantern:nth-child(2) {
    animation-delay: -1.5s;
    width: 70px;
    height: 140px;
    margin-top: 20px;
}

.lantern:nth-child(3) {
    animation-delay: -3s;
}

.lantern:active {
    transform: scale(0.95);
}

.lantern.unlit .bulb {
    fill: rgba(255, 255, 255, 0.05);
}

.lantern.unlit .candle,
.lantern.unlit .flame {
    fill: none;
    display: none;
}

.lantern:hover.unlit {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.lantern.lit .candle {
    fill: #fcd34d;
}

.lantern.lit .flame {
    fill: #fbbf24;
    animation: flicker 0.1s infinite alternate;
}

.lantern.lit .bulb {
    fill: rgba(252, 211, 77, 0.3);
    stroke: #fcd34d;
    filter: drop-shadow(0 0 25px var(--glow-color));
}

@keyframes swing {
    0% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(5deg);
    }
}

@keyframes flicker {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.1) translate(0, -2px);
        opacity: 1;
    }
}

/* Pop in animation for finale card */
.pop-in {
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -30%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Gift Stage */
.gift-stage {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    z-index: 25;
}

.gift-instruction {
    font-size: 1.5rem;
    color: var(--text-gold);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(252, 211, 77, 0.5);
    animation: pulseText 2s infinite ease-in-out;
}

.gift-box {
    cursor: pointer;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 0 15px rgba(252, 211, 77, 0.3));
}

.gift-box:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 25px rgba(252, 211, 77, 0.6));
}

.shake {
    animation: shakeGift 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeGift {

    10%,
    90% {
        transform: translate3d(-4px, 0, 0) scale(1.05);
    }

    20%,
    80% {
        transform: translate3d(8px, 0, 0) scale(1.05);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-12px, 0, 0) scale(1.05);
    }

    40%,
    60% {
        transform: translate3d(12px, 0, 0) scale(1.05);
    }
}

/* Finale Reveal */
.finale-reveal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 500px;
    z-index: 30;
    text-align: center;
}

.moon-container {
    margin-bottom: -40px;
    position: relative;
    z-index: 2;
}

.moon-glow {
    width: 150px;
    filter: drop-shadow(0 0 30px var(--glow-color));
}

.moon-glow.sm {
    width: 80px;
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* Utility Animations */
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUpCentered {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pulseText {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

@keyframes floatMoon {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.pulse {
    animation: floatMoon 4s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
        box-shadow: 0 0 20px #fff;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    h1.title,
    h2.title {
        font-size: 1.8rem;
    }

    .instructions h1 {
        font-size: 1.5rem;
    }

    .instructions .sender-name {
        font-size: 1.8rem;
    }

    .personalized-message {
        font-size: 1.05rem;
        margin-bottom: 1rem;
    }

    /* Form specific */
    input,
    select {
        padding: 0.8rem;
    }

    .btn {
        padding: 0.8rem 1.5rem;
    }

    /* Lanterns sizing */
    .lanterns-container {
        gap: 1rem;
        margin-top: 2rem;
    }

    .lantern {
        width: 50px;
        height: 100px;
    }

    .lantern:nth-child(2) {
        width: 60px;
        height: 120px;
        margin-top: 15px;
    }

    /* Gift & Moon */
    .gift-box svg {
        width: 120px;
        height: 120px;
    }

    .moon-glow {
        width: 120px;
    }

    .hand-pointer {
        bottom: -50px;
    }

    /* Fixed bottom link */
    .text-link-btn {
        width: auto;
        max-width: 90%;
        text-align: center;
        white-space: normal;
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
        bottom: 1rem;
    }

    .finale-reveal,
    .gift-stage {
        top: 42%;
    }
}