/* ================= 全局设定与青绿活力主题 ================= */
:root {
    --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #d1fae5 50%, #ecfdf5 100%);
    --card-bg: rgba(255, 255, 255, 0.88);
    --primary-teal: #0d9488;
    --dark-green: #047857;
    --light-mint: #f0fdf4;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --accent-gold: #d97706;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    line-height: 1.8;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    padding: 30px 15px 90px;
}

/* ================= 漂浮 Emoji 背景 ================= */
.emoji-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.emoji-bg .emoji {
    position: absolute;
    font-size: 32px;
    opacity: 0.25;
    animation: floatUp 6s ease-in-out infinite alternate;
}

@keyframes floatUp {
    0% { transform: translateY(0px) rotate(0deg); }
    100% { transform: translateY(-20px) rotate(10deg); }
}

/* ================= 全屏强引导互动层（核心逻辑排版） ================= */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 120, 87, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.welcome-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay-card {
    background: #ffffff;
    padding: 36px 28px;
    border-radius: 20px;
    text-align: center;
    max-width: 85%;
    width: 380px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    animation: pulseCard 2s infinite alternate ease-in-out;
}

.pulsing-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: bounce 1.5s infinite ease-in-out;
}

.overlay-card h3 {
    color: var(--dark-green);
    font-size: 1.3em;
    margin-bottom: 12px;
}

.overlay-card p {
    color: var(--text-muted);
    font-size: 0.95em;
    line-height: 1.5;
}

@keyframes pulseCard {
    0% { transform: scale(0.98); box-shadow: 0 10px 25px rgba(4, 120, 87, 0.2); }
    100% { transform: scale(1.02); box-shadow: 0 20px 40px rgba(4, 120, 87, 0.4); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ================= 信件主体容器 ================= */
.letter-container {
    position: relative;
    z-index: 10;
    max-width: 780px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 45px 50px;
    box-shadow: 0 12px 35px rgba(13, 148, 136, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* 信头排版 */
.letter-header {
    text-align: center;
    padding-bottom: 25px;
    margin-bottom: 30px;
    border-bottom: 2px dashed #99f6e4;
}

.letter-header .sub-title {
    display: inline-block;
    background: var(--light-mint);
    color: var(--primary-teal);
    font-size: 0.85em;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 50px;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.letter-header h1 {
    color: var(--dark-green);
    font-size: 2.2em;
    letter-spacing: 3px;
    font-weight: 700;
}

/* ================= 正文排版与严格缩进 ================= */
.letter-body .section {
    margin-bottom: 32px;
}

.greeting-section h2 {
    color: var(--dark-green);
    font-size: 1.3em;
    margin-bottom: 14px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    border-left: 4px solid var(--primary-teal);
    padding-left: 12px;
}

.section-title span {
    font-size: 0.8em;
    font-weight: 800;
    color: #ffffff;
    background: var(--primary-teal);
    padding: 2px 6px;
    border-radius: 4px;
}

.section-title h3 {
    color: var(--primary-teal);
    font-size: 1.2em;
    font-weight: 600;
}

/* --- 绝对保证首行缩进两字符 --- */
.letter-body p {
    text-indent: 2em;
    margin-bottom: 16px;
    color: var(--text-main);
    font-size: 1.05em;
    text-align: justify;
    letter-spacing: 0.04em;
}

.highlight-section {
    background: var(--light-mint);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #ccfbf1;
}

.highlight-section p strong {
    color: #b45309;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 1.1em;
}

/* ================= 信尾署名 ================= */
.letter-footer {
    text-align: right;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.letter-footer p {
    text-indent: 0;
    margin-bottom: 6px;
}

.letter-footer .signature {
    font-size: 1.15em;
    color: var(--dark-green);
}

.letter-footer .date {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* ================= 悬浮控制按钮 ================= */
.float-btn {
    position: fixed;
    bottom: 25px;
    border: none;
    border-radius: 50px;
    height: 46px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(4, 120, 87, 0.25);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.music-btn {
    right: 25px;
    width: 46px;
    background: linear-gradient(135deg, #10b981, #047857);
    color: #ffffff;
    font-size: 20px;
}

.music-btn.playing {
    animation: spinMusic 3s linear infinite;
}

@keyframes spinMusic {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.back-btn {
    left: 25px;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--dark-green);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #a7f3d0;
}

.float-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(4, 120, 87, 0.35);
}

/* ================= 移动端适配 ================= */
/* 手机端细腻适配 */
@media (max-width: 600px) {
    .container {
        padding: 24px 20px;
        margin: 30px auto 80px auto;
    }
    
    /* 专门优化手机端标题间距 */
    h1 { 
        font-size: 1.5em;       /* 字体稍微收一点 */
        letter-spacing: 0px;    /* 取消字间距，让字挨得更紧 */
        line-height: 1.3;       /* 如果标题太长换行了，控制上下两行的紧凑度 */
        padding-bottom: 12px;   /* 减小标题与下方横线的距离 */
        margin-bottom: 20px;    /* 减小标题与第一段正文的距离 */
    }
    
    .section p { font-size: 15px; }
    
    #music-toggle {
        width: 44px; height: 44px; font-size: 18px;
        bottom: 20px; right: 20px;
    }
    .envelope { padding: 30px 20px; }
    .envelope h3 { font-size: 20px; }
}