/* ============================================================
   MAGIC BOX NEW YEAR TEMPLATE STYLES
   ============================================================ */

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

.magic-box-page-wrapper {
    min-height: 100vh;
    background: radial-gradient(circle at center, #1a1c2c 0%, #0a0e17 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Start from top but center horizontally */
    padding: 60px 20px;
    overflow-x: hidden;
    position: relative;
    color: #fff;
    text-align: center;
    width: 100%;
}

/* Sender Badge - Premium Style */
.sender-wish {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 60px;
    z-index: 10;
}

.sender-name {
    display: inline-block;
    background: #ff4757;
    color: white;
    padding: 5px 25px;
    border-radius: 50px;
    font-weight: 900;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
    letter-spacing: 1px;
    margin-right: 5px;
}

/* Box Container */
.box-wrapper {
    position: relative;
    width: 270px;
    /* Matched to widest element (lid) */
    height: 280px;
    margin: 40px auto;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: box-float 3s infinite ease-in-out;
}

@keyframes box-float {

    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    33% {
        transform: translateY(-10px) rotate(2deg);
    }

    66% {
        transform: translateY(-5px) rotate(-2deg);
    }
}

.box-wrapper:hover {
    transform: scale(1.1) rotate(0deg) !important;
    animation-play-state: paused;
}

/* Magic Glow Behind Box */
.box-wrapper::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 211, 42, 0.3), transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: magic-glow 2s infinite ease-in-out;
}

@keyframes magic-glow {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.8;
    }
}

.box-shadow-base {
    position: absolute;
    bottom: -30px;
    left: 10%;
    width: 80%;
    height: 20px;
    background: radial-gradient(rgba(0, 0, 0, 0.6), transparent 70%);
    border-radius: 50%;
    filter: blur(8px);
    animation: shadow-breath 3s infinite ease-in-out;
}

@keyframes shadow-breath {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.4;
    }
}

/* Illustrative Gift Box */
.gift-box {
    position: relative;
    width: 100%;
    height: 100%;
}

.box-body {
    position: absolute;
    bottom: 0;
    left: 10px;
    /* Centered in 270px: (270 - 250) / 2 = 10 */
    width: 250px;
    height: 180px;
    background: linear-gradient(135deg, #ff4757, #e43345);
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.box-lid {
    position: absolute;
    top: 55px;
    left: 0;
    /* Perfectly fills the 270px container */
    width: 270px;
    height: 55px;
    background: linear-gradient(135deg, #ff5e62, #ff4757);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Ribbons */
.ribbon-v,
.lid-ribbon {
    position: absolute;
    left: 50%;
    width: 45px;
    height: 100%;
    background: linear-gradient(to right, #ffd32a, #ff9f1a, #ffd32a);
    transform: translateX(-50%);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
}

.ribbon-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, #ffd32a, #ff9f1a, #ffd32a);
    transform: translateY(-50%);
}

/* Puffy Illustrative Bow */
.box-bow {
    position: absolute;
    top: -65px;
    left: 50%;
    width: 160px;
    height: 80px;
    transform: translateX(-50%);
}

.bow-loop-l1,
.bow-loop-r1,
.bow-loop-l2,
.bow-loop-r2 {
    position: absolute;
    background: radial-gradient(circle at 70% 30%, #ffd32a, #ff9f1a);
    border-radius: 50% 50% 10% 50%;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bow-loop-l1 {
    width: 80px;
    height: 70px;
    left: 0;
    transform: rotate(-25deg);
}

.bow-loop-r1 {
    width: 80px;
    height: 70px;
    right: 0;
    transform: scaleX(-1) rotate(-25deg);
}

.bow-loop-l2 {
    width: 65px;
    height: 55px;
    left: 20px;
    top: -10px;
    transform: rotate(-50deg);
    background: #ff9f1a;
}

.bow-loop-r2 {
    width: 65px;
    height: 55px;
    right: 20px;
    top: -10px;
    transform: scaleX(-1) rotate(-50deg);
    background: #ff9f1a;
}

.bow-knot {
    position: absolute;
    top: 15px;
    left: 50%;
    width: 45px;
    height: 45px;
    background: radial-gradient(circle at 30% 30%, #ffd32a, #ff9f1a);
    transform: translateX(-50%);
    border-radius: 50%;
    z-index: 20;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.bow-tail-l,
.bow-tail-r {
    position: absolute;
    top: 40px;
    width: 40px;
    height: 70px;
    background: #ffd32a;
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    z-index: -1;
}

.bow-tail-l {
    left: 25px;
    transform: rotate(35deg);
}

.bow-tail-r {
    right: 25px;
    transform: rotate(-35deg);
}

/* Click Instruction */
.click-instruction {
    margin-top: 60px;
    font-size: 1.3rem;
    font-weight: 900;
    color: #ffd32a;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(255, 211, 42, 0.5);
    animation: instr-pulse 1.5s infinite ease-in-out;
    text-align: center;
    width: 100%;
}

/* Intensely Shaking State */
.box-wrapper.shaking {
    animation: box-shake 0.1s infinite cubic-bezier(.36, .07, .19, .97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes box-shake {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0) rotate(-1deg);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0) rotate(1deg);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-6px, 0, 0) rotate(-2deg);
    }

    40%,
    60% {
        transform: translate3d(6px, 0, 0) rotate(2deg);
    }
}

@keyframes instr-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Opening Sequence */
.box-wrapper.opening .box-lid {
    transform: translateY(-400px) rotate(45deg) scale(1.5);
    opacity: 0;
    filter: blur(10px);
    transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.box-wrapper.opening .box-body {
    transform: scale(0.9) translateY(20px);
    opacity: 0.5;
    filter: blur(10px);
    transition: all 0.6s ease;
}

.box-wrapper.opened .gift-box,
.box-wrapper.opened .box-shadow-base,
.box-wrapper.opened .click-instruction {
    display: none;
}

/* Reveal Result */
.reveal-content {
    display: none;
    text-align: center;
    max-width: 90vw;
    z-index: 10;
}

.reveal-content.show {
    display: block;
    animation: zoom-pop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoom-pop {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ad Units Styling */
.ad-unit-wrapper {
    width: 100%;
    margin: 30px auto;
    display: flex;
    justify-content: center;
    overflow: hidden;
    z-index: 5;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

.top-ad {
    min-height: 100px;
}

.middle-ad {
    min-height: 250px;
}

.footer-ad {
    min-height: 100px;
    margin-top: 40px;
}

@media (max-width: 600px) {
    .ad-unit-wrapper {
        margin: 20px auto;
    }
}

.happy-new-year-text {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1.1;
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.happy-new-year-text .word {
    display: block;
    background: linear-gradient(to bottom, #fff, #ffd32a);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.happy-new-year-text .year {
    font-size: 8rem;
    color: #ff4757;
    -webkit-text-fill-color: #ff4757;
    display: block;
    margin-top: 10px;
    text-shadow: 0 10px 40px rgba(255, 71, 87, 0.6);
    animation: year-pulse 1.5s infinite;
}

.wish-msg {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 20px;
    line-height: 1.6;
    animation: fadeInUp 1s ease 1s both;
}

@keyframes year-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Confetti Styles */
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 1;
    animation: fall 3s linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

.sparkle {
    position: absolute;
    z-index: 2;
    animation: twinkle 2s ease-in-out forwards;
    opacity: 0;
}

@keyframes twinkle {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }

    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* Generator Card */
.link-generator-section {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.generator-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 500px;
    margin: 0 auto;
}

.generator-card h3 {
    color: #f1c40f;
    margin-bottom: 20px;
}

.generator-card input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    margin-bottom: 20px;
    font-size: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.primary-btn:hover {
    transform: scale(1.05);
}

.copy-success-msg {
    display: none;
    color: #2ecc71;
    margin-top: 10px;
    font-size: 0.9rem;
}

.copy-success-msg.show {
    display: block;
}

.social-share-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-share-buttons a {
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}

.share-wa {
    background: #25D366;
}

.share-fb {
    background: #1877F2;
}

@media (max-width: 600px) {
    .happy-new-year-text {
        font-size: 3.2rem;
    }

    .happy-new-year-text .year {
        font-size: 5rem;
    }

    .box-wrapper {
        transform: scale(0.8);
        transform-origin: center center;
        margin: 20px auto;
    }

    .box-wrapper:hover {
        transform: scale(0.9) !important;
    }

    .sender-wish {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }

    .click-instruction {
        font-size: 1rem;
        margin-top: 20px;
    }
}