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

:root {
    --rose: #ffb7c5;
    --rose-dark: #e68a9f;
    --cream: #fff8f5;
    --text: #4a3f3f;
    --text-light: #8a7a7a;
    --shadow: rgba(74, 63, 63, 0.08);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Serif SC', 'Nunito', serif;
    color: var(--text);
    background: var(--cream);
    line-height: 1.8;
    overflow-x: hidden;
}

/* 音乐播放按钮 */
.music-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    color: white;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 183, 197, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.music-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

.music-toggle.playing {
    animation: rotate 6s linear infinite;
}

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

/* 飘落的爱心背景 */
.hearts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.heart-float {
    position: absolute;
    color: var(--rose);
    opacity: 0.5;
    animation: floatUp linear infinite;
    font-size: 1.2rem;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* Hero */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #fff0f3 0%, #fff8f5 50%, #ffeef2 100%);
    z-index: 1;
}

.hero-content {
    padding: 2rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
}

.title {
    font-size: clamp(4rem, 15vw, 10rem);
    font-weight: 700;
    background: linear-gradient(45deg, var(--rose-dark), var(--rose));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin: 0.5rem 0;
}

.domain {
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    color: var(--text-light);
    letter-spacing: 0.2em;
    margin: 1.5rem 0 2.5rem;
}

.btn {
    display: inline-block;
    padding: 0.9rem 2.2rem;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1rem;
    letter-spacing: 0.1em;
    box-shadow: 0 8px 24px rgba(255, 183, 197, 0.4);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--rose-dark);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* 通用容器 */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: 6rem 0;
    position: relative;
    z-index: 1;
}

section h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 3rem;
    color: var(--text);
}

/* 信纸 */
.letter {
    background: white;
}

.envelope {
    background: linear-gradient(135deg, #fff5f7, #fff);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px var(--shadow);
    border: 1px solid rgba(255, 183, 197, 0.3);
}

.paper h2 {
    text-align: left;
    margin-bottom: 2rem;
    font-size: 1.6rem;
}

.paper p {
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    color: var(--text);
}

.signature {
    text-align: right;
    color: var(--rose-dark) !important;
    font-style: italic;
}

/* 回忆卡片 */
.moments {
    background: var(--cream);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    border-radius: 16px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    box-shadow: 0 8px 30px var(--shadow);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
}

.placeholder {
    border: 2px dashed var(--rose);
    color: var(--text-light);
    font-size: 0.95rem;
}

.photo-card {
    flex-direction: column;
    padding: 0.8rem;
    overflow: hidden;
    background: linear-gradient(135deg, #fff5f7, #fff);
    border: 2px dashed var(--rose);
    transition: all 0.3s ease;
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.photo-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

/* 情话空间 */
.love-lines {
    background: white;
    text-align: center;
}

.love-lines .love-line-card {
    max-width: 420px;
    min-height: 220px;
    margin: 0 auto;
    flex-direction: column;
    cursor: pointer;
    background: linear-gradient(135deg, #fff5f7, #fff);
    border: 2px dashed var(--rose);
    transition: all 0.3s ease;
}

.love-lines .love-line-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

.love-line-label {
    display: block;
    font-size: 0.85rem;
    color: var(--rose-dark);
    margin-bottom: 0.8rem;
    letter-spacing: 0.1em;
}

.love-line-text {
    display: block;
    font-size: clamp(1.1rem, 4vw, 1.4rem);
    color: var(--text);
    line-height: 1.6;
    transition: opacity 0.2s ease;
}

/* 留言板 */
.message-board {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    background: linear-gradient(135deg, #fff5f7, #fff);
    border: 2px dashed var(--rose);
    padding: 1.2rem 1.2rem 1rem;
    gap: 0.5rem;
}

.message-board-title {
    font-size: 0.9rem;
    color: var(--rose-dark);
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 0.2rem;
}

.message-list {
    list-style: none;
    width: 100%;
    height: 200px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.5rem;
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.message-list::-webkit-scrollbar {
    height: 4px;
}

.message-list::-webkit-scrollbar-thumb {
    background: var(--rose);
    border-radius: 2px;
}

.message-empty {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    height: 100%;
}

.message-item {
    flex: 0 0 80%;
    max-width: 240px;
    height: 100%;
    background: white;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    text-align: left;
    box-shadow: 0 2px 10px var(--shadow);
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    gap: 0.5rem;
    flex-shrink: 0;
}

.message-nickname {
    font-size: 0.85rem;
    color: var(--rose-dark);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.message-body {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
    overflow-y: auto;
}

.message-body::-webkit-scrollbar {
    width: 3px;
}

.message-body::-webkit-scrollbar-thumb {
    background: var(--rose);
    border-radius: 2px;
}

.message-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: auto;
}

.message-input,
.message-textarea {
    width: 100%;
    border: 1px solid rgba(255, 183, 197, 0.5);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: white;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.message-input:focus,
.message-textarea:focus {
    border-color: var(--rose-dark);
    box-shadow: 0 0 0 3px rgba(255, 183, 197, 0.2);
}

.message-textarea {
    min-height: 52px;
    resize: vertical;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.message-count {
    font-size: 0.75rem;
    color: var(--text-light);
}

.message-count-full {
    color: var(--rose-dark);
    font-weight: 600;
}

.message-submit {
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1.2rem;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 183, 197, 0.4);
    transition: all 0.3s ease;
}

.message-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 183, 197, 0.5);
}

.message-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.message-tip {
    min-height: 1.2em;
    font-size: 0.8rem;
    text-align: center;
}

.message-tip-error {
    color: #e74c3c;
}

.message-tip-success {
    color: #27ae60;
}

/* 删除按钮 */
.delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

.message-delete-btn {
    margin-left: auto;
}

.photo-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-delete-btn:hover {
    background: #e74c3c;
    color: white;
}

.photo-slider {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.photo-slider::-webkit-scrollbar {
    height: 4px;
}

.photo-slider::-webkit-scrollbar-thumb {
    background: var(--rose);
    border-radius: 2px;
}

.photo-slide {
    flex: 0 0 100%;
    height: 100%;
    min-width: 0;
    scroll-snap-align: start;
    position: relative;
}

.photo-slide img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

.photo-upload-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 183, 197, 0.15);
    cursor: pointer;
    transition: background 0.3s ease;
}

.photo-upload-slide:hover {
    background: rgba(255, 183, 197, 0.3);
}

.photo-upload-placeholder {
    color: var(--rose-dark);
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
}

.photo-input {
    display: none;
}

/* 旧浏览器兜底 */
@supports not (aspect-ratio: 1 / 1) {
    .photo-slider {
        padding-top: 100%;
    }
    .photo-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
    .photo-slide img {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.photo-card-title {
    font-size: 0.9rem;
    color: var(--rose-dark);
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 0.2rem;
}

/* 倒计时 */
.countdown {
    background: white;
    text-align: center;
}

.timer {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.timer div {
    background: linear-gradient(135deg, #fff5f7, #fff);
    border: 1px solid rgba(255, 183, 197, 0.4);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    min-width: 90px;
}

.timer span {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--rose-dark);
    line-height: 1;
}

.timer small {
    font-size: 0.85rem;
    color: var(--text-light);
}

.hint {
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* 联系方式 */
.contact {
    background: linear-gradient(135deg, #fff5f7, #fff);
    text-align: center;
}

.contact-hint {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    color: white;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(255, 183, 197, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.contact-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

.contact-item.revealed {
    width: 170px;
    border-radius: 28px;
}

.action-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    color: white;
    text-decoration: none;
    border-radius: 50%;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(255, 183, 197, 0.4);
    transition: all 0.3s ease;
}

.chat-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(255, 183, 197, 0.5);
}

.contact-icon {
    font-size: 1.5rem;
    transition: all 0.3s ease;
    position: absolute;
}

.contact-value {
    font-size: 1rem;
    color: white;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    position: absolute;
    text-align: center;
    padding: 0 0.8rem;
    white-space: nowrap;
}

.contact-item.revealed .contact-icon {
    opacity: 0;
    transform: translateY(-10px);
}

.contact-item.revealed .contact-value {
    opacity: 1;
    transform: translateY(0);
}

/* 页脚 */
footer {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--cream);
    color: var(--text-light);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

footer .heart {
    color: var(--rose-dark);
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.2); }
    30% { transform: scale(1); }
    45% { transform: scale(1.15); }
}

/* 响应式 */
@media (max-width: 640px) {
    .subtitle {
        font-size: 1rem;
        letter-spacing: 0.2em;
    }

    .envelope {
        padding: 2rem 1.5rem;
    }

    .timer div {
        padding: 1.2rem 1.5rem;
        min-width: 70px;
    }

    .timer span {
        font-size: 2rem;
    }

    section {
        padding: 4rem 0;
    }

    .gallery {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .love-lines .love-line-card {
        max-width: 100%;
        width: 100%;
        padding: 1.5rem 1rem;
        min-height: 190px;
    }

    .love-line-text {
        font-size: 1.1rem;
    }

    .photo-card {
        padding: 0.6rem;
    }

    .message-board {
        padding: 1rem;
    }

    .message-list {
        height: 180px;
    }

    .message-item {
        flex: 0 0 85%;
    }
}
