@charset "UTF-8";

/* =========================================
   全局样式重置
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* 柔和的粉紫色渐变背景 */
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%); 
    /* 或者用更浪漫的： */
    background: linear-gradient(to top, #fad0c4 0%, #ffd1ff 100%);
    font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", "Ma Shan Zheng", cursive;
    color: #5e5e5e;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* =========================================
   Canvas 背景
   ========================================= */
#heartCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto; /* 允许点击 */
}

/* =========================================
   主内容容器 (卡片式)
   ========================================= */
.container {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 20px;
    box-shadow: 0 8px 32px 0 rgba(255, 192, 203, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: center;
    animation: floatCard 6s ease-in-out infinite;
    transition: transform 0.3s, opacity 1s ease; /* Added opacity transition */
}

.container:hover {
    transform: scale(1.02);
}

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

@keyframes floatCard {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* =========================================
   文本样式
   ========================================= */
.title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(255, 107, 107, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 30px;
}

/* =========================================
   恋爱计时器
   ========================================= */
.timer-box {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.time-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    min-width: 70px;
}

.time-item .number {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #ff8fa3;
    font-family: 'Georgia', serif; /* 数字用衬线体更优雅 */
}

.time-item .label {
    font-size: 0.9rem;
    color: #999;
}

/* =========================================
   情话展示区
   ========================================= */
.message-box {
    min-height: 80px;
    font-size: 1.5rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
    position: relative;
    padding: 0 10px;
    transition: opacity 0.5s ease;
}

.message-box.fade-out {
    opacity: 0;
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: #ff6b6b;
    vertical-align: bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* =========================================
   交互提示
   ========================================= */
.tip {
    font-size: 0.9rem;
    color: #aaa;
    margin-top: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0.6; transform: scale(0.98); }
}

/* =========================================
   新年情书模式样式 (新增)
   ========================================= */
#letter-container {
    display: none; /* Initially hidden */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    height: 80vh;
    overflow-y: auto;
    
    /* 信纸样式 */
    background-color: #fffdf7; /* 奶油色纸张背景 */
    /* 淡淡的粉色横线，间距 40px */
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 39px,
        rgba(255, 182, 193, 0.4) 40px
    );
    background-attachment: local; /* 背景随内容滚动 */
    
    border-radius: 5px; /* 纸张圆角较小 */
    border: 1px solid #e6e6e6;
    padding: 10px 30px 40px 30px; /* 调整顶部留白，使第一行字对齐第一条线 */
    box-shadow: 
        0 1px 4px rgba(0,0,0,0.05), 
        0 10px 40px rgba(0,0,0,0.2);
    z-index: 100;
    text-align: center;
}

/* 隐藏滚动条但保留功能 */
#letter-container::-webkit-scrollbar {
    width: 6px;
}
#letter-container::-webkit-scrollbar-track {
    background: transparent;
}
#letter-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 182, 193, 0.5);
    border-radius: 3px;
}

.letter-line {
    font-size: 1.4rem; /* 调整字体大小以适配行高 */
    line-height: 40px; /* 严格对齐背景线高 */
    color: #444;       /* 字体颜色加深一点，像墨水 */
    font-family: "STKaiti", "KaiTi", cursive; /* 强调楷体/手写感 */
    margin-bottom: 0;  /* 移除底部边距，依靠行高对齐 */
    
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.letter-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.letter-line.highlight {
    color: #ff4757;
    font-weight: bold;
    font-size: 1.6rem;
    margin-top: 30px;
    text-shadow: 0 2px 4px rgba(255, 71, 87, 0.2);
    animation: heartbeat 1.5s infinite;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* =========================================
   媒体查询适配
   ========================================= */
@media (max-width: 600px) {
    .title { font-size: 2rem; }
    .timer-box { gap: 10px; }
    .time-item { min-width: 60px; padding: 8px 10px; }
    .time-item .number { font-size: 1.4rem; }
    .message-box { font-size: 1.3rem; }
    
    #letter-container {
        padding: 30px 20px;
    }
    .letter-line {
        font-size: 1.1rem;
    }
    .letter-line.highlight {
        font-size: 1.3rem;
    }
}
