:root {
    --bg-color: #0b0f19;
    --envelope-front: #e2e8f0;
    --envelope-back: #f1f5f9;
    --envelope-inside: #1e293b;
    --paper-color: #ffffff;
    --seal-color: #a82e36;
    --seal-highlight: #d64a54;
    --text-heading: #0f172a;
    --text-body: #334155;
    --accent-gold: #d4af37;
    --env-width: min(85vw, 380px);
    --env-height: min(56vw, 253px);
    --flap-h: calc(var(--env-height) * 0.5);
    --flap-w: calc(var(--env-width) * 0.5);
    --flap-top-h: calc(var(--env-height) * 0.59);
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
}

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

html {
    touch-action: manipulation;
}

body {
    background-color: var(--bg-color);
    font-family: 'Montserrat', sans-serif;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    color: #fff;
    perspective: 1200px;
    -webkit-user-select: none;
    user-select: none;
}

#particlesCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 45;
    pointer-events: none;
}

/* --- Aurora --- */
.aurora-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
    background-color: #0b0f19;
}

.aurora-blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    animation: auroraDance 20s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
    opacity: 0.7;
    transition: background 3s ease;
}

.blob-1 {
    width: 60vmax;
    height: 60vmax;
    background: #1e3a8a;
    top: -10vw;
    left: -10vw;
}

.blob-2 {
    width: 50vmax;
    height: 50vmax;
    background: #4c1d95;
    bottom: -10vw;
    right: -10vw;
    animation-delay: -5s;
    animation-duration: 25s;
}

.blob-3 {
    width: 55vmax;
    height: 55vmax;
    background: #0f172a;
    top: 30%;
    left: 40%;
    animation-delay: -10s;
    animation-duration: 30s;
}

.blob-4 {
    width: 40vmax;
    height: 40vmax;
    background: #831843;
    top: 10%;
    right: 10%;
    animation-delay: -15s;
    animation-duration: 22s;
}

.aurora-bg.warm .blob-1 {
    background: #b45309;
}

.aurora-bg.warm .blob-2 {
    background: #9f1239;
}

.aurora-bg.warm .blob-3 {
    background: #78350f;
}

.aurora-bg.warm .blob-4 {
    background: #d97706;
}

@keyframes auroraDance {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(10vw, 8vh) scale(1.1) rotate(90deg);
    }

    66% {
        transform: translate(-8vw, 15vh) scale(0.9) rotate(180deg);
    }

    100% {
        transform: translate(-15vw, -10vh) scale(1.2) rotate(360deg);
    }
}

.bg-noise {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(212, 175, 55, 0.3));
    z-index: 100;
    pointer-events: none;
    opacity: 0;
}

.flash-overlay.flash-active {
    animation: flashPulse 0.6s ease-out forwards;
}

@keyframes flashPulse {
    0% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
    }
}

/* --- Screen Shake --- */
@keyframes screenShake {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-4px, 3px);
    }

    20% {
        transform: translate(5px, -4px);
    }

    30% {
        transform: translate(-3px, 5px);
    }

    40% {
        transform: translate(4px, -2px);
    }

    50% {
        transform: translate(-5px, 3px);
    }

    60% {
        transform: translate(3px, -4px);
    }

    70% {
        transform: translate(-2px, 5px);
    }

    80% {
        transform: translate(4px, -3px);
    }

    90% {
        transform: translate(-3px, 2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

body.shaking {
    animation: screenShake 0.5s ease-in-out;
}

/* --- Music --- */
.music-toggle {
    position: fixed;
    bottom: calc(24px + var(--sab));
    right: 24px;
    z-index: 60;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.music-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.18);
}

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

.music-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    color: rgba(255, 255, 255, 0.9);
}

.music-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.4);
    animation: musicPulse 2s ease-out infinite;
}

.music-toggle.muted .music-pulse {
    animation: none;
    opacity: 0;
}

@keyframes musicPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* ================================ */
/* ===== LOCK SCREEN              */
/* ================================ */
.ios-lock-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.8s ease;
    padding: 20px;
    padding-top: calc(20px + var(--sat));
    backdrop-filter: blur(2px);
}

.ios-status-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: white;
    padding: 10px 15px;
    letter-spacing: 0.5px;
}

.status-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-icon {
    display: flex;
    align-items: center;
    line-height: 0;
}

.lock-time {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Helvetica Neue", sans-serif;
    font-size: clamp(60px, 18vw, 86px);
    font-weight: 600;
    margin-top: 2vh;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1;
    letter-spacing: 1px;
}

.lock-date {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 8px;
    margin-bottom: 4vh;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Countdown */
.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeInUp 1s ease forwards;
}

.countdown-label {
    font-size: clamp(11px, 3vw, 14px);
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.countdown-timer {
    display: flex;
    align-items: center;
    gap: clamp(4px, 2vw, 8px);
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.countdown-number {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", sans-serif;
    font-size: clamp(36px, 10vw, 52px);
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: clamp(12px, 3vw, 16px);
    padding: clamp(8px, 2vw, 12px) clamp(14px, 4vw, 20px);
    min-width: clamp(60px, 18vw, 80px);
    text-align: center;
    line-height: 1;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.countdown-number.tick {
    animation: numberTick 0.3s ease;
}

@keyframes numberTick {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

.countdown-text {
    font-size: clamp(9px, 2.5vw, 11px);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.4);
}

.countdown-sep {
    font-size: clamp(28px, 8vw, 40px);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
}

.countdown-hint {
    font-size: clamp(11px, 3vw, 13px);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    margin-top: 10px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Notification */
.ios-notification {
    background: rgba(200, 200, 200, 0.15);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 24px;
    width: 100%;
    max-width: 380px;
    padding: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transform: translateY(20px);
    opacity: 0;
    animation: dropIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.2s;
    transition: transform 0.2s ease, background 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

.ios-notification:active {
    transform: scale(0.97);
    background: rgba(200, 200, 200, 0.25);
}

.ios-notification.notif-clicked {
    animation: notifRipple 0.6s ease-out;
}

@keyframes dropIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes notifRipple {
    0% {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 0 0 rgba(255, 255, 255, 0.4);
    }

    50% {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 0 20px rgba(255, 255, 255, 0);
    }

    100% {
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    }
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.notif-app-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-icon {
    width: 22px;
    height: 22px;
    background: #34d399;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.notif-app-name {
    font-size: 13px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

.notif-time {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.notif-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.notif-body p {
    font-size: 15px;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.swipe-bar {
    position: absolute;
    bottom: calc(12px + var(--sab));
    width: 130px;
    height: 5px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 100px;
}

/* ================================ */
/* ===== ENVELOPE                 */
/* ================================ */
.container {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.container.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(40px);
    pointer-events: none;
}

.envelope-scene {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

.envelope-wrapper {
    position: relative;
    width: var(--env-width);
    height: var(--env-height);
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), filter 0.6s ease;
    filter: drop-shadow(0 25px 40px rgba(0, 0, 0, 0.5));
}

.envelope-wrapper:hover {
    filter: drop-shadow(0 35px 50px rgba(0, 0, 0, 0.6));
}

.envelope-wrapper.open {
    cursor: default;
    transform: translateY(18vh) scale(1) !important;
}

.envelope {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--envelope-inside);
    border-radius: 4px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.flap {
    position: absolute;
    z-index: 3;
    width: 0;
    height: 0;
}

.flap-left {
    border-top: var(--flap-h) solid transparent;
    border-bottom: var(--flap-h) solid transparent;
    border-left: var(--flap-w) solid var(--envelope-back);
    left: 0;
    top: 0;
}

.flap-right {
    border-top: var(--flap-h) solid transparent;
    border-bottom: var(--flap-h) solid transparent;
    border-right: var(--flap-w) solid var(--envelope-back);
    right: 0;
    top: 0;
}

.flap-bottom {
    border-left: var(--flap-w) solid transparent;
    border-right: var(--flap-w) solid transparent;
    border-bottom: var(--flap-top-h) solid var(--envelope-front);
    bottom: 0;
    left: 0;
    z-index: 4;
}

.flap-top {
    border-left: var(--flap-w) solid transparent;
    border-right: var(--flap-w) solid transparent;
    border-top: var(--flap-top-h) solid var(--envelope-front);
    top: 0;
    left: 0;
    transform-origin: top;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.2));
}

.envelope-wrapper.open .flap-top {
    transform: rotateX(180deg);
    z-index: 1;
}

.letter {
    position: absolute;
    bottom: 0;
    left: 4%;
    width: 92%;
    height: 94%;
    background: var(--paper-color);
    border-radius: 8px 8px 4px 4px;
    z-index: 2;
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 1s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transform-origin: bottom;
    padding: clamp(14px, 4vw, 22px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.letter-texture {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.envelope-wrapper.open .letter {
    transform: translateY(-100%) scale(1.4);
    z-index: 10;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(212, 175, 55, 0.25);
    animation: letterGlow 3s ease-in-out infinite alternate;
}

@keyframes letterGlow {
    0% {
        box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(212, 175, 55, 0.2);
    }

    100% {
        box-shadow: 0 40px 80px rgba(0, 0, 0, 0.5), 0 0 80px rgba(212, 175, 55, 0.35);
    }
}

.envelope-wrapper.open .letter-border {
    border-color: rgba(212, 175, 55, 0.5);
    animation: borderShimmer 2s ease-in-out infinite alternate;
}

@keyframes borderShimmer {
    0% {
        border-color: rgba(212, 175, 55, 0.3);
    }

    100% {
        border-color: rgba(212, 175, 55, 0.6);
    }
}

.letter-border {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 4px;
    pointer-events: none;
    z-index: 0;
}

.letter-stamp {
    width: clamp(32px, 8vw, 44px);
    height: clamp(32px, 8vw, 44px);
    margin: 0 auto 10px auto;
    opacity: 0.9;
    color: var(--accent-gold);
}

.letter-content {
    position: relative;
    z-index: 1;
    color: var(--text-body);
    text-align: center;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: 0.6s;
    overflow-y: auto;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
}

.letter-content::-webkit-scrollbar {
    width: 0;
}

.envelope-wrapper.open .letter-content {
    opacity: 1;
    transform: translateY(0);
}

.letter-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(20px, 5vw, 26px);
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.divider {
    width: 40px;
    height: 2px;
    background: var(--accent-gold);
    margin: 0 auto 10px auto;
    border-radius: 1px;
    opacity: 0.7;
}

.letter-text {
    font-size: clamp(11px, 3vw, 13px);
    line-height: 1.6;
    margin-bottom: 10px;
    font-weight: 400;
}

.letter-signature {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(15px, 4vw, 18px);
    color: #64748b;
    text-align: right;
}

.wax-seal {
    position: absolute;
    width: clamp(52px, 14vw, 64px);
    height: clamp(52px, 14vw, 64px);
    top: var(--flap-top-h);
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.4));
}

.seal-inner {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, var(--seal-highlight), var(--seal-color));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3), inset 0 4px 8px rgba(255, 255, 255, 0.3);
    position: relative;
}

.seal-ring {
    position: absolute;
    width: 82%;
    height: 82%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.seal-inner span {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(15px, 4vw, 18px);
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.envelope-wrapper.open .wax-seal {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
    pointer-events: none;
}

.hint-text {
    position: absolute;
    bottom: -50px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: clamp(10px, 3vw, 12px);
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    animation: floatHint 3s ease-in-out infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: opacity 0.4s ease;
}

.hint-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.6);
}

.envelope-wrapper.open~.hint-text {
    opacity: 0;
    animation: none;
}

@keyframes floatHint {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* ================================ */
/* ===== CAKE SCENE               */
/* ================================ */
.cake-scene {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 46;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 1s ease, transform 1s ease;
}

.cake-scene.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.cake-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(16px, 4vh, 24px);
    z-index: 2;
}

/* ===== GIANT 19 WATERMARK ===== */
.age-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Playfair Display', serif;
    font-size: clamp(200px, 50vw, 400px);
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    pointer-events: none;
    z-index: 1;
    user-select: none;
    animation: watermarkFloat 8s ease-in-out infinite alternate;
    text-shadow: none;
    letter-spacing: -10px;
    line-height: 1;
}

.age-watermark.glow {
    -webkit-text-stroke: 1px rgba(212, 175, 55, 0.15);
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.15) 0%, rgba(255, 255, 255, 0.06) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    animation: watermarkGlow 3s ease-in-out infinite alternate, watermarkFloat 8s ease-in-out infinite alternate;
}

@keyframes watermarkFloat {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1.03);
    }
}

@keyframes watermarkGlow {
    0% {
        -webkit-text-stroke: 1px rgba(212, 175, 55, 0.1);
    }

    100% {
        -webkit-text-stroke: 1px rgba(212, 175, 55, 0.25);
    }
}

/* ===== CAKE ===== */
.cake {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: cakeEntry 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: scale(var(--cake-scale, 1));
}

@keyframes cakeEntry {
    from {
        opacity: 0;
        transform: scale(calc(0.5 * var(--cake-scale, 1))) translateY(40px);
    }

    to {
        opacity: 1;
        transform: scale(var(--cake-scale, 1)) translateY(0);
    }
}

.cake-candles {
    display: flex;
    gap: clamp(16px, 5vw, 24px);
    margin-bottom: -4px;
    z-index: 2;
    align-items: flex-end;
}

/* Enhanced candles — alternating heights */
.candle {
    width: clamp(9px, 3vw, 12px);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    border-radius: 3px 3px 0 0;
    position: relative;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4), inset 0 -10px 15px rgba(217, 119, 6, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
    padding: 14px;
    margin: -14px;
    background-clip: content-box;
}

.candle-tall {
    height: clamp(44px, 12vw, 56px);
}

.candle-short {
    height: clamp(34px, 9vw, 44px);
}

.candle:active {
    transform: scale(1.15);
}

.candle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 7px;
    background: #374151;
    border-radius: 1px;
    z-index: 1;
}

/* Candle stripe */
.candle::after {
    content: '';
    position: absolute;
    top: 30%;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
}

.flame {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(14px, 4.5vw, 18px);
    height: clamp(20px, 6vw, 26px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    cursor: pointer;
    z-index: 2;
}

.flame-inner {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at bottom, #fef3c7 10%, #fbbf24 30%, #f59e0b 50%, #ef4444 80%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 0.12s ease-in-out infinite alternate;
    box-shadow: 0 0 8px #fbbf24, 0 0 16px rgba(245, 158, 11, 0.6), 0 0 32px rgba(239, 68, 68, 0.3);
}

.flame-glow {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
    animation: glowPulse 1.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes glowPulse {
    0% {
        opacity: 0.5;
        transform: translateX(-50%) scale(1);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1.3);
    }
}

.flame.blown-out {
    opacity: 0;
    transform: translateX(-50%) scale(0.3) translateY(-10px);
}

.flame.blown-out .flame-glow {
    opacity: 0;
}

.flame.near .flame-inner {
    animation: flameBend 0.3s ease-in-out infinite alternate;
}

@keyframes flameBend {
    0% {
        transform: rotate(-12deg) scaleY(0.8);
    }

    100% {
        transform: rotate(12deg) scaleY(0.85);
    }
}

.smoke {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: smokeRise 1.5s ease-out forwards;
}

@keyframes smokeRise {
    0% {
        opacity: 0.6;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px) scale(4);
    }
}

@keyframes flicker {
    0% {
        transform: scaleY(1) scaleX(1) rotate(-1deg);
    }

    100% {
        transform: scaleY(1.06) scaleX(0.94) rotate(1deg);
    }
}

.cake-top {
    width: clamp(170px, 55vw, 240px);
    height: clamp(18px, 5vw, 24px);
    background: linear-gradient(to bottom, #ec4899, #db2777);
    border-radius: 12px 12px 0 0;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.cake-sprinkle {
    position: absolute;
    width: 4px;
    height: 10px;
    border-radius: 2px;
}

.cake-sprinkle:nth-child(1) {
    transform: rotate(30deg);
}

.cake-sprinkle:nth-child(2) {
    transform: rotate(-45deg);
}

.cake-sprinkle:nth-child(3) {
    transform: rotate(60deg);
}

.cake-sprinkle:nth-child(4) {
    transform: rotate(-20deg);
}

.cake-sprinkle:nth-child(5) {
    transform: rotate(75deg);
}

.cake-sprinkle:nth-child(6) {
    transform: rotate(-55deg);
}

.cake-sprinkle:nth-child(7) {
    transform: rotate(15deg);
}

.cake-sprinkle:nth-child(8) {
    transform: rotate(-35deg);
}

.cake-frosting {
    width: clamp(170px, 55vw, 240px);
    height: clamp(16px, 4vw, 20px);
    background: #fbcfe8;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.frosting-drip {
    position: absolute;
    bottom: -12px;
    width: 16px;
    background: #fbcfe8;
    border-radius: 0 0 50% 50%;
}

.drip-1 {
    left: 8%;
    height: 20px;
}

.drip-2 {
    left: 25%;
    height: 14px;
}

.drip-3 {
    left: 48%;
    height: 22px;
}

.drip-4 {
    left: 68%;
    height: 12px;
}

.drip-5 {
    left: 85%;
    height: 18px;
}

.cake-middle {
    width: clamp(170px, 55vw, 240px);
    height: clamp(45px, 14vw, 60px);
    background: linear-gradient(to bottom, #be185d, #9d174d);
}

.cake-stripe {
    width: clamp(170px, 55vw, 240px);
    height: 10px;
    background: repeating-linear-gradient(90deg, #fbcfe8 0px, #fbcfe8 10px, transparent 10px, transparent 20px);
}

.cake-base {
    width: clamp(190px, 60vw, 260px);
    height: clamp(20px, 6vw, 28px);
    background: linear-gradient(to bottom, #831843, #701a3e);
    border-radius: 0 0 10px 10px;
}

.cake-plate {
    width: clamp(220px, 68vw, 300px);
    height: 14px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-radius: 0 0 50% 50%;
    margin-top: -2px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== WISH STEP (dramatic) ===== */
.cake-step {
    text-align: center;
    animation: fadeInUp 0.8s ease forwards;
}

.cake-step.hidden {
    display: none;
}

.wish-ring {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 16px auto;
}

.wish-ring-circle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    animation: wishRingSpin 6s linear infinite;
}

.wish-ring-2 {
    border-color: rgba(192, 132, 252, 0.2);
    animation-duration: 8s;
    animation-direction: reverse;
    transform: scale(1.3);
}

.wish-ring-3 {
    border-color: rgba(255, 255, 255, 0.1);
    animation-duration: 10s;
    transform: scale(1.6);
    border-style: dashed;
}

@keyframes wishRingSpin {
    from {
        transform: scale(var(--ws, 1)) rotate(0deg);
    }

    to {
        transform: scale(var(--ws, 1)) rotate(360deg);
    }
}

.wish-ring-2 {
    --ws: 1.3;
}

.wish-ring-3 {
    --ws: 1.6;
}

.wish-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(20px, 5.5vw, 26px);
    font-style: italic;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
    animation: wishPulse 3s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.wish-subtext {
    font-size: clamp(12px, 3.2vw, 14px);
    color: rgba(212, 175, 55, 0.5);
    letter-spacing: 2px;
    margin-bottom: 20px;
}

@keyframes wishPulse {

    0%,
    100% {
        opacity: 0.7;
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
    }
}

.wish-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: clamp(14px, 3.5vw, 16px) clamp(24px, 7vw, 32px);
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(13px, 3.5vw, 15px);
    font-weight: 500;
    letter-spacing: 1px;
    color: #fff;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(192, 132, 252, 0.1));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: pulseBtn 2.5s ease-in-out infinite;
    min-height: 52px;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

.wish-btn:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(192, 132, 252, 0.2));
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
}

.wish-btn:active {
    transform: scale(0.95);
}

@keyframes pulseBtn {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.3), 0 0 20px rgba(212, 175, 55, 0.1);
    }

    50% {
        box-shadow: 0 0 0 14px rgba(212, 175, 55, 0), 0 0 30px rgba(212, 175, 55, 0.2);
    }
}

.blow-hint {
    font-size: clamp(13px, 3.5vw, 15px);
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.candles-left {
    font-size: clamp(12px, 3vw, 14px);
    color: rgba(212, 175, 55, 0.7);
    font-weight: 500;
    letter-spacing: 1px;
}

/* ===== CINEMATIC TITLE ===== */
.cake-message {
    text-align: center;
    transition: opacity 0.5s ease;
}

.cake-message.hidden {
    opacity: 0;
    pointer-events: none;
}

.cinematic-title {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 16px;
}

.cine-letter {
    font-family: 'Playfair Display', serif;
    font-size: clamp(38px, 11vw, 60px);
    font-weight: 900;
    color: #fff;
    display: inline-block;
    opacity: 0;
    transform: scale(0) rotate(-15deg);
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.6), 0 0 60px rgba(212, 175, 55, 0.3);
    letter-spacing: 2px;
}

.cine-letter.animate {
    animation: cineReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cine-space {
    width: clamp(10px, 3vw, 16px);
    display: inline-block;
}

@keyframes cineReveal {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-15deg);
        filter: blur(10px);
    }

    60% {
        opacity: 1;
        transform: scale(1.3) rotate(3deg);
        filter: blur(0);
    }

    80% {
        transform: scale(0.95) rotate(-1deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

.cake-subtitle {
    font-size: clamp(15px, 4.5vw, 20px);
    color: rgba(255, 255, 255, 0.6);
    opacity: 0;
    transform: translateY(15px);
    font-style: italic;
}

.cake-subtitle.animate {
    animation: subtitleIn 0.8s ease forwards;
}

@keyframes subtitleIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================ */
/* ===== RESPONSIVE               */
/* ================================ */
@media (max-width: 375px) {
    .lock-time {
        margin-top: 1vh;
    }

    .lock-date {
        margin-bottom: 3vh;
    }

    .ios-notification {
        padding: 14px;
        border-radius: 20px;
    }
}

@media (max-height: 650px) {
    .lock-time {
        font-size: 56px;
        margin-top: 1vh;
    }

    .lock-date {
        margin-bottom: 2vh;
        font-size: 16px;
    }

    .countdown-number {
        font-size: 32px;
        padding: 8px 14px;
        min-width: 54px;
    }

    .envelope-wrapper.open {
        transform: translateY(10vh) scale(0.9) !important;
    }

    .envelope-wrapper.open .letter {
        transform: translateY(-85%) scale(1.2);
    }
}

@media (max-height: 550px) {
    .lock-time {
        font-size: 44px;
    }

    .countdown-number {
        font-size: 28px;
        padding: 6px 10px;
        min-width: 46px;
    }

    .cake {
        --cake-scale: 0.75;
    }
}

/* Samsung Tab S9 FE & iPad */
@media (min-width: 768px) {
    .ios-notification {
        max-width: 420px;
    }

    .lock-time {
        font-size: 86px;
    }

    .lock-date {
        font-size: 22px;
    }

    .countdown-number {
        font-size: 56px;
        min-width: 90px;
        padding: 14px 24px;
    }

    .ios-lock-screen {
        padding: 30px;
    }

    .cake {
        --cake-scale: 1.2;
    }

    .age-watermark {
        font-size: 450px;
    }
}

@media (min-width: 1024px) {
    .ios-notification {
        max-width: 440px;
    }

    .cake {
        --cake-scale: 1.3;
    }

    .cine-letter {
        font-size: 68px;
    }

    .age-watermark {
        font-size: 500px;
    }
}

@media (min-width: 768px) and (orientation: landscape) {
    .cake {
        --cake-scale: 0.95;
    }

    .cake-container {
        gap: 14px;
    }
}