/* =============================================
   GLOBAL RESET & BASE
   ============================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --gold: #c9a84c;
    --gold-light: #e8cc7a;
    --cream: #fdf6e3;
    --deep: #1a0a2e;
    --purple: #6d28d9;
    --purple-light: #a78bfa;
    --pink: #ec4899;
    --pink-light: #f9a8d4;
}

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--deep);
    overflow: hidden;
}

/* =============================================
   SCREENS
   ============================================= */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    z-index: 1;
    overflow: hidden;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

/* =============================================
   BACKGROUND ORBS
   ============================================= */
.bg-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: floatOrb 8s ease-in-out infinite;
}

.orb1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, #7c3aed, transparent);
    top: -80px;
    left: -80px;
    animation-delay: 0s;
}

.orb2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #ec4899, transparent);
    bottom: -60px;
    right: -60px;
    animation-delay: -3s;
}

.orb3 {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, #c9a84c, transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -5s;
}

@keyframes floatOrb {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(20px, -20px);
    }

    66% {
        transform: translate(-15px, 15px);
    }
}

/* =============================================
   INPUT SCREEN CARD
   ============================================= */
.input-card {
    position: relative;
    z-index: 5;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 52px 48px 44px;
    width: min(520px, 92vw);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.input-icon {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 12px;
    animation: gentlePulse 2.5s ease-in-out infinite;
}

@keyframes gentlePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.12);
    }
}

.input-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    color: #fff;
    text-align: center;
    line-height: 1.25;
    margin-bottom: 8px;
}

.input-subtitle {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 0.95rem;
    margin-bottom: 36px;
}

.input-group {
    margin-bottom: 28px;
}

.fancy-label {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 4vw, 1.65rem);
    font-style: italic;
    color: var(--gold-light);
    margin-bottom: 14px;
}

.fancy-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 16px 22px;
    font-size: 1.15rem;
    color: #fff;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    -moz-appearance: textfield;
}

.fancy-input::-webkit-outer-spin-button,
.fancy-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.fancy-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.fancy-input:focus {
    border-color: var(--purple-light);
    background: rgba(167, 139, 250, 0.1);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

/* Gender buttons */
.gender-buttons {
    display: flex;
    gap: 14px;
}

.gender-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 16px 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gender-icon {
    font-size: 1.3rem;
}

.gender-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: var(--purple-light);
    color: #fff;
}

.gender-btn.selected {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.5), rgba(236, 72, 153, 0.4));
    border-color: var(--pink-light);
    color: #fff;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.25);
}

/* Submit button */
.submit-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    border: none;
    border-radius: 16px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.4);
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(124, 58, 237, 0.55);
    filter: brightness(1.1);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-arrow {
    font-size: 1.3rem;
    transition: transform 0.2s;
}

.submit-btn:hover .btn-arrow {
    transform: translateX(4px);
}

.error-msg {
    color: #f87171;
    text-align: center;
    font-size: 0.88rem;
    margin-top: 12px;
    min-height: 20px;
    transition: opacity 0.3s;
}

/* =============================================
   ANIMATION SCREEN
   ============================================= */
.animation-stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Paper airplane */
.airplane {
    position: absolute;
    width: 100px;
    left: -130px;
    top: 50%;
    transform: translateY(-50%);
    filter: drop-shadow(0 4px 16px rgba(167, 139, 250, 0.7));
    z-index: 20;
}

/* Envelope */
.envelope-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.envelope-container.hidden {
    opacity: 0;
}

.envelope-wrap {
    perspective: 800px;
}

.envelope-body {
    position: relative;
    width: min(380px, 88vw);
    height: min(260px, 60vw);
}

/* Envelope front (base) */
.envelope-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, #fdf6e3 0%, #f5e6c8 100%);
    border-radius: 4px 4px 14px 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(201, 168, 76, 0.3);
}

/* Left/right triangles of front */
.envelope-front::before,
.envelope-front::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
}

.envelope-front::before {
    left: 0;
    border-width: 0 0 min(130px, 30vw) min(190px, 44vw);
    border-color: transparent transparent #e8d5aa transparent;
}

.envelope-front::after {
    right: 0;
    border-width: 0 min(190px, 44vw) min(130px, 30vw) 0;
    border-color: transparent transparent #e8d5aa transparent;
}

/* Envelope flap (top) */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #f0ddb0 0%, #e8cc7a 100%);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: top center;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
}

.envelope-flap.open {
    transform: rotateX(-180deg);
}

/* Seal */
.envelope-seal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #c9a84c, #e8cc7a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
    box-shadow: 0 4px 20px rgba(201, 168, 76, 0.45), 0 0 0 3px rgba(201, 168, 76, 0.25);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.envelope-seal.hidden-seal {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.seal-letter {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: #6b3e00;
    font-weight: 700;
}

/* =============================================
   INVITATION SCREEN
   ============================================= */
#screen-invite {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    padding: 32px 16px;
}

.invite-card {
    position: relative;
    z-index: 5;
    background: linear-gradient(170deg, #fdf6e3 0%, #f5e6c8 60%, #ede0c0 100%);
    border-radius: 24px;
    padding: clamp(32px, 7vw, 64px) clamp(24px, 7vw, 60px);
    width: min(640px, 96vw);
    margin: auto;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 168, 76, 0.3);
    opacity: 0;
    transform: scale(0.6) translateY(60px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.invite-card.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Decorative border */
.invite-card::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1.5px solid rgba(201, 168, 76, 0.35);
    border-radius: 18px;
    pointer-events: none;
}

.invite-header {
    text-align: center;
    margin-bottom: 32px;
}

.flower-row {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    margin-bottom: 16px;
    letter-spacing: 8px;
}

.invite-pre {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: #9a7040;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.invite-main-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 7vw, 3.2rem);
    color: #4a2800;
    line-height: 1.15;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #6b3e00, #c9a84c, #6b3e00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.divider-fancy {
    font-size: 1.8rem;
    color: var(--gold);
    margin: 0 auto;
    line-height: 1;
}

.invite-body {
    color: #4a2800;
}

.dear-line {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    margin-bottom: 16px;
    color: #5c3400;
}

.name-highlight {
    font-style: italic;
    color: var(--purple);
    border-bottom: 2px solid rgba(109, 40, 217, 0.3);
    padding-bottom: 2px;
}

.invite-text {
    font-size: clamp(0.9rem, 2.8vw, 1.05rem);
    color: #6b4a20;
    line-height: 1.75;
    margin-bottom: 32px;
}

/* Details block */
.invite-details {
    background: rgba(201, 168, 76, 0.12);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.detail-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.detail-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gold);
    margin-bottom: 3px;
}

.detail-value {
    display: block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1rem, 3vw, 1.18rem);
    color: #3d2000;
    font-weight: 700;
}

/* Joke block */
.invite-joke {
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.08), rgba(236, 72, 153, 0.08));
    border-left: 3px solid var(--purple-light);
    border-radius: 0 12px 12px 0;
    padding: 18px 22px;
    margin-bottom: 32px;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(0.9rem, 2.8vw, 1.05rem);
    color: #5c3080;
    line-height: 1.65;
}

.invite-footer {
    text-align: center;
    border-top: 1px solid rgba(201, 168, 76, 0.3);
    padding-top: 24px;
}

.rsvp-text {
    font-style: italic;
    color: #9a7040;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.from-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 5vw, 2rem);
    color: #4a2800;
    font-weight: 700;
}

.confetti-row {
    text-align: center;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    letter-spacing: 10px;
    margin-top: 28px;
    animation: confettiBounce 2s ease-in-out infinite;
}

@keyframes confettiBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* invite bg orbs: golden tones */
.invite-orbs .orb1 {
    background: radial-gradient(circle, #c9a84c, transparent);
    opacity: 0.2;
}

.invite-orbs .orb2 {
    background: radial-gradient(circle, #ec4899, transparent);
    opacity: 0.15;
}

.invite-orbs .orb3 {
    background: radial-gradient(circle, #7c3aed, transparent);
    opacity: 0.1;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 480px) {
    .input-card {
        padding: 38px 24px 32px;
    }

    .gender-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .invite-details {
        padding: 18px 16px;
    }

    .invite-card::before {
        inset: 6px;
    }
}