@import url('https://fonts.googleapis.com/css2?family=Coiny&family=Titan+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Nerko+One&family=Sriracha&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap');

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

html {
    height: 100%;
}

:root {
    --color-aqua: #eafcfe;
    --color-white: #fff;
    --color-black: #333;
    --color-text-aqua: #78ceff;
    --color-heart: #df000f;
    --color-bg-letter: #fff8e4;
    --color-border: #DACCBF;
    --color-border-aqua: #3baff1;
    --color-purple: #b200d6;
}

body {
    position: relative;
    font-size: 16px;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    background-color: var(--color-aqua);
    background-image: radial-gradient(#a9dfff 10%, transparent 10%);
    background-size: 30px 30px;
    overflow: hidden;
}

#wrapper {
    position: relative;
    background-color: transparent;
    height: 100vh;
    background-size: 80px 80px;
    overflow-y: hidden;
    overflow-x: hidden;
    z-index: 1;
    padding-bottom: 50px;
}

/*La co*/
.flag_birthday {
    display: flex;
    justify-content: space-between;
    transform: translateY(-200px);
    animation: flagTranslateY 2s forwards;
    width: 100%;
}

@keyframes flagTranslateY {
    to {
        transform: translateY(0);
    }
}

.flag_birthday .flag__left {
    transform: rotate(-15deg) translate(-20px, 30px);
}

.flag_birthday .flag__right {
    transform: rotate(15deg) translate(20px, 30px) scaleX(-1);
}

.content {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 1rem;
    gap: 100px;
}

/*chu happy birthday*/
.title {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    font-family: "Titan One", sans-serif;
    font-size: 4rem;
    perspective: 1000px;
    gap: 50px;
}

.title .happy, .title .birthday {
    position: relative;
    text-shadow: 5px 5px var(--color-black),
        -5px 5px var(--color-black),
        5px -5px var(--color-black),
        -5px -5px var(--color-black),
        5px 8px 0 var(--color-aqua);
    font-weight: bold;
    display: flex;
    justify-content: center;
}

.title .happy {
    color: var(--color-white);
}

.title .birthday {
    color: var(--color-text-aqua)
}

.title .happy span, .title .birthday span {
    transform: translateY(-50px);
    opacity: 0;
    visibility: hidden;
    animation: textTranslateY 0.5s var(--t) forwards;
}

@keyframes textTranslateY {
    100% {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
}

.title .happy span:hover {
    transform: translateY(-15px) !important;
    color: var(--color-text-aqua);
    cursor: pointer;
    transition: all 0.3s ease;
}

.title .birthday span:hover {
    transform: translateY(-15px) !important;
    color: var(--color-white);
    cursor: pointer;
    transition: all 0.3s ease;
}

/*cai non*/
.title .hat {
    position: absolute;
    left: 17%;
    top: -350px;
    transform: rotate(-25deg);
    z-index: -1;
    animation: topHat 6s 5s forwards ease;
}

@keyframes topHat {
    20%, 30% {
        top: -60px;
        transform-origin: rotate(-25deg);
    }

    35%, 100% {
        top: -60px;
        transform: rotate(260deg);
    }
}

.hat:hover {
    transform: translateY(-5px) rotate(265deg) !important;
}

/*phan ben trai*/
.left {
    align-self: flex-start;
    margin-left: 20%;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    transform: translateY(-80px);
}

/*ngay sinh*/
.date_of_birth {
    border: 3px solid var(--color-black);
    position: relative;

    text-align: center;
    font-size: 35px;
    font-weight: bold;
    font-family: "Sriracha", cursive;
    color: var(--color-black);

    border-radius: 50px;
    background-color: var(--color-text-aqua);
    box-shadow: 1px 1px 0.5px 0.5px var(--color-black);

    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    width: 0;
    height: 60px;

    animation: dateOfBirth 5s 7s forwards;
}


@keyframes dateOfBirth {
    0% {
        opacity: 0;
        visibility: visible;
        width: 0;
        transform: translateX(-50px);
    }

    50% {
        opacity: 1;
        width: 400px;
        transform: translateX(0);
    }

    100% {
        opacity: 1;
        visibility: visible;
        width: 340px;
        height: 60px;
        transform: translateY(0);
    }
}

.date_of_birth:hover {
    transform: rotate(2deg) !important;
    box-shadow: 0 2px 4px rgba(90, 170, 210, 0.5),
        0 8px 16px rgba(90, 170, 210, 0.3);
}

/*nut bam banh kem*/
.cake_btn {
    border: 3px solid #000;
    position: relative;

    align-self: center;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-radius: 50px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    text-align: center;
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
    font-family: "Sriracha", cursive;
    color: #000;
    cursor: pointer;
    height: 50px;
    padding: 10px;
    box-shadow: 0 6px 0 #000;

    transition: transform 0.3s ease;

    white-space: nowrap;
    opacity: 0;
    width: 0;
    visibility: hidden;
    overflow: hidden;
    animation: cakeButton 3s 8s forwards;
}

.cake_btn:hover {
    transform: translateY(-15px) scale(1.1) !important;
    background: linear-gradient(135deg, #ffec82 0%, #ffbb5c 100%);
    box-shadow: 0 15px 0 #000;
    color: var(--color-purple);
}


.cake_btn:active {
    transition: all 0.05s !important;
    transform: translateY(2px) scale(0.95) !important;
    box-shadow: 0 2px 0 #000 !important;
    filter: brightness(0.9);
}

@keyframes cakeButton {
    0% {
        opacity: 0;
        visibility: visible;
        width: 0;
        transform: translateX(-50px);
    }

    50% {
        opacity: 1;
        width: 300px;
        transform: translateX(0);
    }

    100% {
        opacity: 1;
        visibility: visible;
        width: 240px;
        height: 50px;
        transform: translateY(0);
    }
}

/*thiep*/
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: rotate(-5deg);
    gap: 20px;
    position: relative;
}

/*nut bam thiep*/
.open-card_btn {
    border: 3px solid var(--color-black);
    background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
    border-radius: 50px;
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    padding: 10px 25px;
    font-size: 20px;
    font-weight: 800;
    font-family: "Sriracha", cursive;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--color-black);
    transition: all 0.3s ease;
    white-space: nowrap;
    opacity: 0;
    animation: showBtn 3s 12s forwards;
}

@keyframes showBtn {
    to {
        opacity: 1;
    }
}

.open-card_btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 var(--color-black);
}

.open-card-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--color-black);
}

.card-wrapper {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.5) translateY(50px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    perspective: 1000px;
    z-index: 100;
}

#card-toggle {
    display: none;
}

#card-toggle:checked~.card-wrapper {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1) translateY(-60px);
}

#card-toggle:checked~.open-card_btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.birthday-card {
    position: relative;
    width: 400px;
    height: 400px;
    transform-style: preserve-3d;
    transform: transform 0.5s;
    background-color: var(--color-text-aqua);
    border: 2px solid var(--color-border-aqua);

    animation: cardPulse 2s infinite alternate;

}

@keyframes cardPulse {
    to {
        transform: rotate(-5deg) scale(1.02);
    }
}

.card-front {
    position: absolute;
    top: -1px;
    left: -1px;
    width: 360px;
    height: 400px;
    background-color: var(--color-text-aqua);
    border: 1px solid var(--color-black);
    z-index: 2;
    transform-origin: left;
    transition: transform 1s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid var(--color-border-aqua);

}

.birthday-card:hover .card-front {
    transform: rotateY(-150deg);
}

.portrait {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--color-black);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.glow {
    font-family: 'Dancing Script', cursive;
    color: #fff;
    text-align: center;
    font-size: 2.5rem;
    line-height: 1.1;
    text-shadow:
        0 0 10px #fff,
        0 0 20px var(--color-border-aqua),
        0 0 30px var(--color-border-aqua);
}

.card-inside {
    padding: 20px;

    font-family: "Sriracha", cursive;
    color: var(--color-black);

}

.card-inside pre {
    text-align: left;
    font-family: monospace;
    font-weight: bold;
    font-size: 16px;
    background-color: #d2efff;
    padding: 10px;
    border-radius: 10px;
    line-height: 1.5;
    border: 1px solid #d2efff;
}

/*phan ben phai*/
.right {
    align-self: flex-end;
    margin-right: 20%;
    perspective: 1000px;
}

/*hinh anh va ten*/
.info {
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateY(1000px);
    animation: flyingInfo 10s 7s forwards;
}

.image {
    position: relative;

    width: 400px;
    height: 400px;
    border-radius: 50%;

    transition: transform 0.3s ease-in-out;
    border: 6px solid var(--color-black);
}

.image:hover{
    transform: scale(1.05) translateY(-10px)!important;
}

.image img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;

}

.name {
    border: 2px solid var(--color-black);
    position: absolute;
    bottom: 0px;
    align-self: center;

    text-align: center;
    font-size: 30px;
    font-weight: bold;
    font-family: 'Dancing Script', cursive;
    color: var(--color-black);

    width: 300px;
    height: auto;
    padding: 5px;
    border-radius: 50px;
    background-color: var(--color-text-aqua);
    box-shadow: 1px 1px 0.5px 0.5px var(--color-black);

    transition: all 0.3s ease-in-out;
}

.name:hover{
    color: var(--color-heart);
    font-weight: bold;
    font-size: 33px;
}

.name span {
    font-weight: 700;
}

.balloon1, .balloon1 img {
    position: absolute;
    width: 250px;
    height: auto;
    top: -100px;
    right: 0;
    transform: rotate(10deg);
    z-index: -1;
    animation: flyingBalloon1 6s 15s forwards;
}

@keyframes flyingInfo {
    100% {
        transform: translateY(-50px);
    }
}

@keyframes flyingBalloon1 {
    80% {
        transform: translateY(-500px);
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/*hinh tron happy birthday*/
.circle {
    position: absolute;
    top: -250px;
    right: -330px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0);
    animation: scaleCircle 3s 15s forwards ease-in-out;
}

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

    10% {
        transform: scale(1.3);
    }

    20% {
        transform: scale(0.7);
    }

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

.text_circle {
    width: 100px;
    height: 100px;
    background-color: var(--color-text-aqua);
    border-radius: 50%;
    border: 5px solid var(--color-black);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: rotateCircle 5s linear infinite;
}

@keyframes rotateCircle {
    to {
        transform: rotate(360deg);
    }
}

.text_circle span {
    top: 0%;
    left: 50%;
    position: absolute;
    color: var(--color-black);
    transform: rotate(calc(var(--i) * 24deg));
    transform-origin: 0 45px;
    font-family: "Sriracha", cursive;
    text-transform: uppercase;
    font-size: 0.7rem;
}

/*icon trang tri*/
.decorations i {
    position: absolute;
    color: var(--color-border-aqua);
    opacity: 0.7;
    z-index: 0;
    opacity: 0;
    animation: float 6s ease-in-out infinite;
    transition: all 0.3s ease-in-out;
}

.cake-decor.c1 {
    font-size: 2rem;
    animation-delay: 9s;
}

.star-decor.s1 {
    top: 20%;
    left: 5%;
    font-size: 2rem;
    animation-delay: 9s;
}

.star-decor.s2 {
    top: 70%;
    left: 15%;
    color: var(--color-aqua);
    font-size: 1.5rem;
    animation-delay: 8s;
}

.heart-decor.h1 {
    top: 15%;
    right: 10%;
    font-size: 2rem;
    color: var(--color-purple);
    animation-delay: 4s;
}

.heart-decor.h2 {
    bottom: 20%;
    right: 5%;
    font-size: 2.5rem;
    animation-delay: 5s;
}

.gift-decor.g1 {

    bottom: 10%;
    left: 45%;
    font-size: 1.8rem;
    color: var(--color-purple);
    animation-delay: 6s;
}

.music-decor.m1 {
    top: 50%;
    left: 2%;
    font-size: 1.5rem;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        opacity: 1;
        transform: translateY(-20px) rotate(20deg);
    }
}

/* --- PHẦN HIỂN THỊ TRÊN ĐIỆN THOẠI --- */

@media screen and (max-width: 768px) {
    body {
        overflow-y: auto;
        background-size: 20px 20px;
    }

    #wrapper {
        height: auto;
        padding-bottom: 100px;
    }

    .flag_birthday img {
        width: 170px;
    }

    .flag_birthday {
        margin-top: -20px;
    }

    .content {
        flex-direction: column;
        align-items: center;
        gap: 50px;
        padding-top: 5rem;
    }

    .title {
        font-size: 2rem;
        gap: 20px;
        flex-wrap: wrap;
    }

    .title .hat {
        left: 13%;
        transform: rotate(-15deg) translateY(30px);

    }

    @keyframes topHat {
        20%, 30% {
            top: -60px;
            transform-origin: rotate(-25deg);
        }

        35%, 100% {
            top: -40px;
            transform: rotate(260deg);
        }
    }

    .title .hat img {
        width: 75px;
    }

    .left, .right {
        margin: 0;
        align-self: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .left {
        transform: translateY(0);
        order: 2;
    }

    .right {
        order: 1;
    }

    .image {
        width: 280px;
        height: 280px;
    }

    .date_of_birth {
        font-size: 20px;
        width: 280px !important;
    }

    .cake_btn {
        width: 200px !important;
        font-size: 18px;
    }

    .birthday-card {
        width: 320px;
        height: 320px;
    }

    .card-front {
        width: 300px;
        height: 320px;
    }

    .card-inside pre {
        font-size: 12px;
    }

    .circle {
        right: 0;
        top: -50px;
    }

    .card-wrapper {
        position: relative;
        top: 0;
        left: 0;
        opacity: 0;
        display: none;
        transition: all 0.5s ease;
        margin: 20px auto;
        z-index: 100;
    }

    #card-toggle:checked~.card-wrapper {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: scale(1);
    }

    .birthday-card {
        width: 100%;
        max-width: 340px;
        height: 400px;
        margin: 0 auto;
    }

    .card-front, .card-inside {
        width: 100%;
        height: 100%;
    }
}