body {
    margin: 0;
    overflow: hidden;
    background-color: #000000;
    font-family: "Microsoft YaHei", "Heiti SC", "Verdana", sans-serif;
    touch-action: none;
    overscroll-behavior: none;
    width: 100vw;
    height: 100vh;
}

#bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; 
    z-index: 0;
}

#planet-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 100;
    transition: opacity 1.5s;
}

.start-btn {
    padding: 18px 45px;
    font-size: 22px;
    color: #fff;
    background: linear-gradient(45deg, #ff6b8b, #ff9a9e, #4834d4); 
    background-size: 200% 200%;
    border: 1px solid rgba(255, 255, 255, 0.4); 
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 107, 139, 0.6), 
                0 0 40px rgba(72, 52, 212, 0.4),
                inset 0 0 15px rgba(255, 255, 255, 0.2);
                
    animation: gradientMove 3s ease infinite, pulse 2s infinite;
    font-family: "Microsoft YaHei", sans-serif;
    font-weight: bold;
    letter-spacing: 3px; 
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8); 
    outline: none;
    transition: all 0.3s ease;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(255, 107, 139, 0.8), 
                0 0 60px rgba(72, 52, 212, 0.6);
    letter-spacing: 5px;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 154, 158, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(255, 154, 158, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 154, 158, 0.5);
    }
}

#subtitle {
    position: absolute;
    bottom: 12%;
    width: 100%;
    text-align: center;
    
   
    background-image: linear-gradient(to bottom, #ffffff 20%, #ff9a9e 100%);
    background-size: 100% 1.3em;
    background-repeat: repeat-y;  
    line-height: 1.3;             
    background-position: center top;
   
    
    -webkit-background-clip: text;
    background-clip: text;
    
    color: transparent;
    -webkit-text-fill-color: transparent;
    
    font-size: 2.2rem;
    z-index: 10;
    
    text-shadow: 0 0 20px rgba(255, 154, 158, 0.3);
                 
    pointer-events: none;
    letter-spacing: 4px;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-weight: 800;
}

#letter-box {
    display: none;
    position: absolute;
    top: 45%; 
    left: 50%;
    transform: translate(-50%, -45%); 
    width: 90%;
    max-width: 850px;
    background: linear-gradient(135deg, #ffffff 0%, #fffaf0 100%);
    padding: 40px 30px; 
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 0 0 100px rgba(255, 182, 193, 0.15);
    z-index: 999;
    opacity: 0;
    transition: opacity 1.5s ease;
    box-sizing: border-box;

    overflow: hidden; 
    max-height: none; 
    
    backdrop-filter: blur(15px);
}

#letter-box img {
    max-width: 100%;
    height: auto;
}

#letter-box::before {
    display: none; 
}

.letter-line b {
    color: #d63384;
    border-bottom: 1px dashed #d63384;
}

.letter-line {
    margin-bottom: 18px;
    line-height: 1.8;
    color: #333333;
    font-size: 1.2rem;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-weight: 600;
    opacity: 0;
    text-align: justify;
}

.letter-line.show {
    animation: letterFadeIn 0.8s ease forwards;
}

@keyframes letterFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#letter-box h2 {
    color: #c92a2a;
    margin: 0 0 30px 0;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-align: left;
    border-bottom: 2px solid rgba(201, 42, 42, 0.1);
    padding-bottom: 10px;
}

.close-letter {
    text-align: right;
    margin-top: 50px;
    font-size: 1.1rem;
    color: #888;
    font-weight: bold;
    font-style: italic;
    opacity: 0;
    transition: opacity 2s ease;
    padding-bottom: 20px;
}

#letter-box::-webkit-scrollbar { width: 5px; }
#letter-box::-webkit-scrollbar-thumb {
    background: rgba(201, 42, 42, 0.2);
    border-radius: 10px;
}

#music-control {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    cursor: pointer;
    color: white;
    animation: spin 5s linear infinite;
    display: none;
    font-size: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

#music-control.paused {
    animation: none;
    opacity: 0.8;
}

.floating-cake {
    position: absolute;
    left: 0;
    top: 90vh;
    width: auto;
    height: auto;
    font-size: 50px;
    pointer-events: none;
    animation: rise 16s linear forwards;
    z-index: 5;
    opacity: 0;
    background: none;
    box-shadow: none;
    text-shadow: 0 0 10px rgba(255, 200, 200, 0.5);
}

@keyframes rise {
    0% {
        transform: translateY(0) scale(0.8) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120vh) scale(1.2) rotate(20deg);
        opacity: 0;
    }
}

@media screen and (max-width: 768px) {
    .start-btn {
        padding: 12px 25px; 
        font-size: 16px;   
        letter-spacing: 1px;
    }

    #cake-container {
        transform: translate(-50%, -50%) scale(0.9) !important;
        top: 40% !important; 
    }

    #subtitle {
        z-index: 20; 
        bottom: 15%; 
        font-size: 1.6rem; 
        font-weight: 900;  
    }


    #letter-box {
        top: 50%; 
        transform: translate(-50%, -50%); 
        padding: 25px 20px;
        width: 85%;
        max-height: 80vh; 
        overflow-y: auto; 
        -webkit-overflow-scrolling: touch; 
    }
    
    .letter-line { 
        font-size: 0.95rem; 
        margin-bottom: 12px;
    }
    #letter-box h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
}

#cake-container {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.6);
    z-index: 10;
    width: 200px;
    height: 500px;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    filter: drop-shadow(0 0 15px rgba(255, 182, 193, 0.4));
}

#cake {
    display: block;
    position: relative;
    z-index: 2;
}

.cake-plate {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 192, 203, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.1);
    z-index: 1;
}

.ambient-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 200, 100, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    animation:
        ambientFadeIn 2s forwards 5.6s,
        ambientPulse 4s infinite ease-in-out 7.6s;
}

@keyframes ambientFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes ambientPulse {
    0%,
    100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.cake-topper {
    position: absolute;
    top: 290px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    text-align: center;
    font-family: 'Brush Script MT', cursive;
    font-size: 32px;
    color: #ffd700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.8), 0 0 10px rgba(255, 215, 0, 0.5);
    z-index: 4;
    opacity: 0;
    animation: fadeInTopper 2s 5.5s forwards;
}

.cake-topper span {
    display: block;
    line-height: 1.1;
}

@keyframes fadeInTopper {
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-10px);
    }
}

.strawberry {
    position: absolute;
    width: 14px;
    height: 16px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #c92a2a);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    z-index: 3;
    box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.3);

    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.strawberry::after {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 4px;
    background: #51cf66;
    border-radius: 50%;
}

.strawberry:nth-child(4) {
    animation-delay: 4.8s;
}

.strawberry:nth-child(5) {
    animation-delay: 5.0s;
}

.strawberry:nth-child(6) {
    animation-delay: 5.2s;
}

.strawberry:nth-child(7) {
    animation-delay: 5.4s;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0);
    }

    to {
        opacity: 1;
        transform: scale(1.1);
    }
}

.velas {
    background: #ffffff;
    border-radius: 10px;
    position: absolute;
    top: 370px;
    left: 50%;
    margin-left: -2.5px;
    width: 5px;
    height: 35px;
    opacity: 0;
    transform: translateY(-300px);
    backface-visibility: hidden;
    animation: in 500ms ease-out forwards 4.8s;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
    z-index: 3;
}

.velas:after,
.velas:before {
    background: rgba(255, 100, 100, 0.6);
    content: "";
    position: absolute;
    width: 100%;
    height: 2.22222222px;
}

.velas:after {
    top: 25%;
    left: 0;
}

.velas:before {
    top: 45%;
    left: 0;
}


.fuego {
    display: block;
    position: absolute;
    top: -20px;
    left: 50%;
    margin-left: -3.3px;
    width: 6.66666667px;
    height: 18px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: rgba(255, 200, 50, 0.9);
    box-shadow: 0 0 20px 5px rgba(255, 200, 50, 0.6), 0 0 40px 10px rgba(255, 100, 0, 0.3);
    transform-origin: center bottom;
    opacity: 0;
    animation: fuego 2s infinite, candleOn 1s 5.6s forwards;
}

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

.fuego:nth-child(1) {
    animation-duration: 2s;
}

.fuego:nth-child(2) {
    animation-duration: 1.5s;
}

.fuego:nth-child(3) {
    animation-duration: 1s;
}

.fuego:nth-child(4) {
    animation-duration: 0.5s;
}

.fuego:nth-child(5) {
    animation-duration: 0.2s;
}


@keyframes fuego {
    0%,
    100% {
        background: rgba(255, 220, 50, 0.9);
        box-shadow: 0 0 20px 5px rgba(255, 220, 50, 0.6), 0 0 40px 10px rgba(255, 100, 0, 0.3);
        transform: translateY(0) scale(1);
    }
    50% {
        background: rgba(255, 100, 0, 0.8);
        box-shadow: 0 0 15px 2px rgba(255, 200, 50, 0.4), 0 0 30px 5px rgba(255, 100, 0, 0.2);
        transform: translateY(-2px) scale(1.1) rotate(2deg);
    }
}

@keyframes in {
    0% {
        opacity: 0;
        transform: translateY(-300px);
    }
    1% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.come {
    animation: coming 2s forwards;
}

@keyframes coming {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-hint {
    position: absolute;
    bottom: 110px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 2px;
    font-family: "Microsoft YaHei", sans-serif;
    pointer-events: none;
    
   
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6), 
                 0 0 20px rgba(72, 52, 212, 0.4);
    
    animation: hintPulse 2.5s infinite ease-in-out;
    z-index: 101;
}


@keyframes hintPulse {
    0%, 100% {
        opacity: 0.5;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-3px);
    }
}


@media screen and (max-width: 768px) {
    .user-hint {
       
        bottom: 18%; 
        font-size: 13px;
        width: 100%;
        padding: 0 20px;
        box-sizing: border-box;
    }
}