/* ============================================
   Valentine Heart — 手机端样式
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: #000;
    color: #fff;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    position: relative;
    z-index: 1;
}

/* ---- 标题 ---- */
header {
    text-align: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 400;
    font-style: italic;
    color: #D4726A;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(-20px);
    animation: titleFadeIn 1s ease-out 0.2s forwards;
    text-shadow: 0 0 30px rgba(212, 114, 106, 0.3);
}

@keyframes titleFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Canvas 容器 ---- */
.canvas-container {
    position: relative;
    width: 95vw;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.5s forwards;
}

#heart-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pause-indicator.visible {
    opacity: 1;
}

/* ---- 公式展示 ---- */
.formula-display {
    text-align: center;
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 0.8s ease-out 1s forwards;
    flex-shrink: 0;
}

.formula {
    font-size: 16px;
    margin-bottom: 8px;
}

.k-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    color: #E07A5F;
    font-weight: 400;
    transition: text-shadow 0.3s ease;
}

.k-value.glow {
    text-shadow: 0 0 20px rgba(224, 122, 95, 0.6), 0 0 40px rgba(224, 122, 95, 0.3);
}

#k-number {
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 60px;
}

/* ---- 控制按钮 ---- */
.controls {
    margin-top: 20px;
    text-align: center;
    flex-shrink: 0;
}

.replay-btn {
    background: transparent;
    border: 1.5px solid rgba(212, 114, 106, 0.5);
    color: #D4726A;
    padding: 10px 28px;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.5s ease, transform 0.3s ease;
    letter-spacing: 1px;
    visibility: hidden;
    opacity: 0;
    -webkit-tap-highlight-color: transparent;
}

.replay-btn.visible {
    visibility: visible;
    opacity: 1;
}

.replay-btn:active {
    background: rgba(212, 114, 106, 0.15);
    border-color: #D4726A;
    transform: scale(0.95);
}

.replay-icon {
    display: inline-block;
    font-size: 16px;
}

/* ---- 背景粒子层 ---- */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- 通用动画 ---- */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* 辉光效果由 JS Canvas shadowBlur 实现，不使用 CSS filter */

/* ---- 小屏微调 ---- */
@media (max-height: 650px) {
    .container {
        padding: 12px 16px;
    }

    .title {
        font-size: 26px;
    }

    .canvas-container {
        width: 80vw;
    }

    .formula {
        font-size: 14px;
    }

    .k-value {
        font-size: 18px;
    }
}

/* 横屏提示 */
@media (orientation: landscape) {
    .canvas-container {
        width: auto;
        height: 55vh;
        aspect-ratio: 1 / 1;
    }

    .title {
        font-size: 24px;
        margin-bottom: 4px;
    }
}