@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap');

:root {
    --primary-color: #34495e;
    --secondary-color: #e74c3c;
    --background-start: #f6e6e4;
    --background-end: #ffe5ec;
    --text-color: #2c3e50;
    --quote-bg: rgba(231, 76, 60, 0.08);
    --letter-bg: #fff9f9;
    --shadow-color: rgba(231, 76, 60, 0.15);
}

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

/* 修复移动端滑动问题 */
html, body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100%;
    -webkit-overflow-scrolling: touch;
}

html {
    overflow-y: scroll;
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

body {
    background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
    background-attachment: fixed;
    font-family: 'Ma Shan Zheng', cursive;
    padding: 2rem 0;
}

.hero-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 40vh;
    background-image: url('images/little-prince-bg.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.85;
    z-index: 0;
    transform: translateZ(0);
    will-change: transform;
    pointer-events: none;
}

.hero-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(to bottom, 
        rgba(246, 230, 228, 0) 0%,
        rgba(246, 230, 228, 0.4) 30%,
        rgba(246, 230, 228, 0.8) 60%,
        rgba(246, 230, 228, 1) 100%
    );
    pointer-events: none;
}

/* 信纸效果 */
.letter-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    opacity: 1;
    visibility: visible;
    transition: opacity 1.5s ease, visibility 10s ease;
}

.letter {
    width: 100%;
    margin: 0 auto;
    padding: 3.5rem;
    border-radius: 20px;
    position: relative;
    z-index: 3;
    background-color: var(--letter-bg);
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    box-shadow: 
        0 2.8px 2.2px rgba(231, 76, 60, 0.02),
        0 6.7px 5.3px rgba(231, 76, 60, 0.028),
        0 12.5px 10px rgba(231, 76, 60, 0.035),
        0 22.3px 17.9px rgba(231, 76, 60, 0.042),
        0 41.8px 33.4px rgba(231, 76, 60, 0.05),
        0 100px 80px rgba(231, 76, 60, 0.07);
}

.letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    background: 
        linear-gradient(to right, rgba(231, 76, 60, 0.03) 1px, transparent 1px) 0 0 / 25px 25px,
        linear-gradient(to bottom, rgba(231, 76, 60, 0.03) 1px, transparent 1px) 0 0 / 25px 25px;
    pointer-events: none;
}

.letter::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    background: 
        repeating-linear-gradient(
            transparent 0px,
            transparent 24px,
            rgba(231, 76, 60, 0.05) 25px
        );
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* 内容样式 */
.content {
    font-size: 1.2rem;
    line-height: 2;
    color: var(--text-color);
    margin: 2rem 0 3rem;
    position: relative;
    text-align: justify;
    padding: 0 1rem;
    letter-spacing: 1px;
}

.content p {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    text-indent: 2em;
    opacity: 0.9;
    line-height: 2.5;
}

h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin: 1rem 0 3rem;
    text-align: right;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s forwards;
    font-weight: normal;
    letter-spacing: 3px;
}

blockquote {
    border-left: 4px solid var(--secondary-color);
    padding: 2rem 2.5rem;
    margin: 3rem -1rem;
    font-style: italic;
    color: var(--secondary-color);
    background: var(--quote-bg);
    border-radius: 0 10px 10px 0;
    position: relative;
    box-shadow: 
        inset 0 0 10px rgba(231, 76, 60, 0.05),
        0 2px 4px rgba(231, 76, 60, 0.1);
    line-height: 2;
    letter-spacing: 1px;
}

blockquote::before {
    content: '"';
    position: absolute;
    left: 1rem;
    top: 1rem;
    font-size: 3rem;
    color: rgba(231, 76, 60, 0.2);
    font-family: serif;
}

.signature {
    text-align: right;
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px dashed rgba(231, 76, 60, 0.2);
    line-height: 2;
}

.signature p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.9;
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.name {
    font-size: 1.6rem;
    color: var(--secondary-color);
    margin-top: 1rem;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
    position: relative;
    display: inline-block;
    letter-spacing: 4px;
}

.date {
    position: absolute;
    top: 2rem;
    right: 3rem;
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.6;
    letter-spacing: 1px;
}

/* 适配 iPhone 刘海屏和状态栏 */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .hero-image {
        height: calc(40vh + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -5px, 0);
    }
}

/* 移除音乐控制相关样式 */
.controls,
.music-btn,
.music-icon {
    display: none;
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .letter-container {
        width: 95%;
        margin: 30vh auto 4rem;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .letter {
        padding: 2rem;
        border-radius: 15px;
        transform: none;
        will-change: auto;
        margin-bottom: 2rem;
    }

    h1 {
        font-size: 2rem;
        margin: 1rem 0 2rem;
        letter-spacing: 2px;
    }

    .content {
        font-size: 1.1rem;
        line-height: 2.2;
        margin: 1.5rem 0 2rem;
        letter-spacing: 0.5px;
    }

    .content p {
        line-height: 2.2;
    }

    blockquote {
        padding: 1.5rem 2rem;
        margin: 2rem -0.5rem;
        letter-spacing: 0.5px;
    }

    .signature {
        margin-top: 3rem;
        padding-top: 1.5rem;
    }

    .name {
        font-size: 1.4rem;
        letter-spacing: 2px;
    }

    .date {
        top: 1.5rem;
        right: 2rem;
        font-size: 0.9rem;
    }
}

/* iPhone SE 和其他小屏设备 */
@media (max-width: 375px) {
    .letter-container {
        margin: 25vh auto 4rem;
    }

    .letter {
        padding: 1.2rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .content {
        font-size: 1rem;
        line-height: 2;
    }

    .name {
        font-size: 1.3rem;
    }
}

/* 生日祝福页面样式 */
.birthday-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    background-image: url('images/little-prince-bg.jpg');
    background-size: cover;
    background-position: center;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all;
}



.hidden {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.birthday-page.hidden {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.birthday-content {
    text-align: center;
    color: #fff;
}

.birthday-greeting {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #4a69bd;  /* 小王子的深蓝色 */
}

.birthday-subtitle {
    font-size: 1.5rem;
    color: #b06b22;  /* 温暖的金色 */
    font-family: 'Ma Shan Zheng', cursive;
}

/* Remove redundant styles since we handle scroll lock in JavaScript */

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

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}
