/* ==================== 全局重置与樱花风格 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pink-bg: #ffeef5;
    --pink-light: #ffdde4;
    --pink-dark: #f8a5c2;
    --white: #ffffff;
    --text-dark: #6b3e4e;
    --text-light: #a06b7a;
    --gold: #d4a373;
    --rose: #e8837c;
    --sakura-pink: #ffb7c5;
    --font-script: 'Georgia', '华文楷体', 'KaiTi', '楷体', serif;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-script);
    background: linear-gradient(to bottom, #fce4ec 0%, #fff0f5 50%, #fdf6f0 100%);
    color: var(--text-dark);
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== Canvas 背景 ==================== */
#sakuraCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ==================== 覆盖层主容器 ==================== */
.overlay {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 20px;
    pointer-events: none;
}

.overlay > * {
    pointer-events: auto;
}

/* ==================== 名字区域 ==================== */
.names-container {
    display: flex;
    align-items: baseline;          /* 基线对齐保证字形均匀 */
    justify-content: center;
    gap: 0.2em;
    margin-bottom: 15px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.name {
    font-family: var(--font-script);
    font-size: clamp(3rem, 10vw, 5rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    text-shadow: 3px 3px 6px rgba(255, 182, 193, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    line-height: 1;
}

.name:hover {
    transform: scale(1.1) translateY(-3px);
    color: var(--rose);
    text-shadow: 0 0 20px rgba(232, 131, 124, 0.6);
}

.heart-symbol {
    font-size: clamp(2rem, 6vw, 3.5rem);
    color: var(--rose);
    text-shadow: 0 0 15px rgba(232, 131, 124, 0.5);
    animation: heartBeat 1.5s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s;
    display: inline-block;
    line-height: 1;
}

.heart-symbol:hover {
    transform: scale(1.3);
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    10% { transform: scale(1.15); }
    20% { transform: scale(1.05); }
    30% { transform: scale(1.2); }
    45% { transform: scale(1); }
    60% { transform: scale(1.1); }
    75% { transform: scale(1); }
}

/* ==================== 计时器卡片 ==================== */
.timer-card {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 182, 193, 0.6);
    border-radius: 20px;
    padding: clamp(16px, 3vw, 28px) clamp(20px, 4vw, 40px);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 30px rgba(244, 143, 177, 0.25);
    margin-bottom: 15px;
    text-align: center;
    pointer-events: auto;
    transition: transform 0.3s;
}

.timer-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(244, 143, 177, 0.35);
}

.timer-title {
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: var(--text-light);
    letter-spacing: 0.25em;
    margin-bottom: 10px;
    font-weight: 400;
    text-transform: uppercase;
    opacity: 0.9;
}

.timer-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1.5vw, 12px);
    flex-wrap: wrap;
}

.time-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: clamp(50px, 10vw, 80px);
}

.time-value {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    font-weight: 700;
    color: var(--text-dark);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    line-height: 1.1;
}

.time-label {
    font-size: clamp(0.55rem, 1.2vw, 0.7rem);
    color: var(--text-light);
    letter-spacing: 0.15em;
    margin-top: 4px;
    font-weight: 300;
}

.time-colon {
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    color: var(--rose);
    opacity: 0.7;
    line-height: 1;
    padding-bottom: 15px;
    animation: colonPulse 1s ease-in-out infinite;
}

@keyframes colonPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.2; }
}

/* 天数特殊高亮 */
.time-unit:first-child .time-value {
    color: var(--rose);
    font-size: clamp(2.2rem, 6vw, 4rem);
    text-shadow: 0 0 15px rgba(232, 131, 124, 0.4);
}

.total-days {
    font-size: clamp(0.8rem, 1.8vw, 1rem);
    color: var(--text-light);
    letter-spacing: 0.15em;
    margin-top: 8px;
    font-weight: 400;
}

.total-days span {
    font-weight: 700;
    font-size: 1.3em;
    color: var(--rose);
}

/* ==================== 浪漫文案 ==================== */
.quote-container {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    position: relative;
    pointer-events: none;
    width: 100%;
}

.quote {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    color: var(--text-dark);
    letter-spacing: 0.1em;
    line-height: 1.8;
    font-weight: 400;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
    pointer-events: none;
    white-space: nowrap;               /* 强制单行显示，禁止换行 */
    overflow: hidden;
    text-overflow: ellipsis;           /* 超长时显示省略号 */
    display: none;                     /* 默认全部隐藏 */
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    text-align: center;
    max-width: 90vw;                   /* 限制最大宽度，避免溢出 */
}

.quote.active {
    display: block;                    /* 当前文案显示 */
    opacity: 0.9;
}

.quote::before {
    content: '❀ ';
    color: var(--sakura-pink);
    font-size: 1.2em;
}
.quote::after {
    content: ' ❀';
    color: var(--sakura-pink);
    font-size: 1.2em;
}

/* ==================== 提示文字 ==================== */
.hint {
    font-size: clamp(0.65rem, 1.5vw, 0.8rem);
    color: var(--text-light);
    opacity: 0.6;
    letter-spacing: 0.2em;
    margin-top: 15px;
    font-weight: 300;
    pointer-events: auto;
    transition: opacity 0.3s;
}

.hint:hover {
    opacity: 0.9;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .names-container {
        gap: 0.1em;
    }
    .name {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
    .heart-symbol {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    .timer-card {
        padding: 12px 16px;
        border-radius: 16px;
    }
    .time-unit {
        min-width: 35px;
    }
    .time-colon {
        font-size: 1.2rem;
        padding-bottom: 10px;
    }
    .quote {
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    .time-unit {
        min-width: 28px;
    }
    .time-value {
        font-size: 1.3rem;
    }
    .time-unit:first-child .time-value {
        font-size: 1.6rem;
    }
    .time-colon {
        font-size: 1rem;
        padding-bottom: 8px;
    }
    .time-label {
        font-size: 0.5rem;
    }
    .name {
        font-size: clamp(2rem, 8vw, 3rem);
    }
}

/* ==================== 减少动画偏好 ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}