/* --- 基础重置 --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body, html { 
    width: 100%; height: 100%; overflow: hidden; 
    background-color: #f4f0e6; /* 更暖一点的米色 */
    color: #2b2b2b; 
    font-family: 'Noto Serif SC', serif; 
    user-select: none; -webkit-user-select: none; touch-action: none; 
}

/* --- 环境层 (纸张纹理) --- */
.bg-paper {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    /* 模拟宣纸的光照不均，中间亮四周暗 */
    background: radial-gradient(ellipse at center, #fbf9f2 0%, #f0eadd 60%, #e3dac1 100%);
    z-index: 0;
}

/* 纸浆纤维层 */
.bg-grain {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0.5; pointer-events: none; z-index: 1;
    mix-blend-mode: multiply;
    /* 使用更高频的噪声模拟纸纤维 */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.25'/%3E%3C/svg%3E");
}

/* 画布层：墨点粒子 */
#canvas-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2;
    mix-blend-mode: multiply; /* 正片叠底，像墨渗入纸里 */
    opacity: 0.85; /* 稍微透明一点，透出纸纹 */
}

/* 晕染暗角 */
.vignette {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 35%, rgba(120, 110, 100, 0.2) 100%);
    z-index: 3; pointer-events: none;
}

/* --- 内容层 --- */
#app {
    position: relative; width: 100%; height: 100%;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 10; cursor: pointer;
}

/* 墨韵背景 */
.ink-aura {
    position: absolute;
    top: 50%; left: 50%;
    width: 300px; height: 300px;
    /* 极淡的墨色晕染 */
    background: radial-gradient(circle, rgba(30, 30, 30, 0.06) 0%, rgba(50, 50, 50, 0.01) 50%, transparent 70%);
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none; z-index: 15;
    border-radius: 50%; filter: blur(50px);
    transition: opacity 4s ease-out, transform 4s ease-out;
}

body.is-holding .ink-aura {
    opacity: 1;
    transform: translate(-50%, -50%) scale(3.5); /* 扩散更大 */
    transition: opacity 6s cubic-bezier(0.25, 0.1, 0.25, 1), transform 6s ease-out;
}

.poem-wrapper {
    max-width: 90%; width: 600px;
    text-align: center;
    opacity: 0; transform: scale(0.96); filter: blur(10px);
    transition: opacity 4s ease-out, filter 4s ease-out, transform 4s ease-out;
    position: relative; z-index: 20;
    padding: 20px;
}

body.is-holding .poem-wrapper {
    opacity: 1; filter: blur(0px); transform: scale(1);
    transition: opacity 5s cubic-bezier(0.25, 0.1, 0.25, 1), 
                filter 5s cubic-bezier(0.25, 0.1, 0.25, 1), 
                transform 5s ease-out;
}

.poem-content {
    font-family: 'Ma Shan Zheng', cursive; /* 书法字体 */
    font-size: 3rem; 
    /* 关键：允许换行 */
    white-space: pre-line; 
    line-height: 1.6; /* 行间距加大 */
    
    /* 墨色：不是纯黑，是带褐色的焦墨 */
    color: #2c2622; 
    
    margin-bottom: 2.5rem;
    
    /* 墨迹特效组合拳 */
    /* 1. 稍微透明，透出一点纸纹 */
    opacity: 0.9; 
    /* 2. 应用 SVG 滤镜产生洇墨效果 */
    filter: url(#ink-wash); 
    /* 3. 文字阴影模拟重墨堆积 */
    text-shadow: 1px 1px 2px rgba(40, 30, 20, 0.15); 
}

.meta-info {
    border-top: 1px solid rgba(100, 90, 80, 0.2); /* 线条也要淡 */
    padding-top: 25px; 
    display: flex; flex-direction: column; gap: 8px;
    font-family: 'Noto Serif SC', serif; color: #5a4f4f;
    font-size: 0.9rem; letter-spacing: 0.12em;
    filter: blur(0.3px); /* 落款也稍微模糊一点点，不要太锐利 */
}

.meta-dynasty {
    font-size: 0.75rem;
    color: #8c7e7e;
    border: 1px solid #8c7e7e;
    border-radius: 3px;
    padding: 2px 8px;
    display: inline-block;
    width: fit-content;
    margin: 0 auto;
    margin-bottom: 5px;
}

.meta-author { 
    font-weight: 500; 
    font-size: 1.1rem;
}

.meta-stamp {
    width: 26px; height: 26px;
    background-color: #bc3e36; /* 朱砂色更暗沉一点 */
    margin: 15px auto 0;
    opacity: 0.85;
    border-radius: 4px;
    /* 模拟印泥不均匀 */
    box-shadow: 0 0 0 1px rgba(188, 62, 54, 0.2); 
    /* 使用 mask-image 可以做印章残缺，这里简化处理 */
}

/* --- 提示语 --- */
.hint-container {
    position: absolute; bottom: 10%;
    text-align: center; pointer-events: none;
    opacity: 0.5;
    transition: opacity 2s ease-in-out; 
    animation: breathe-hint 5s ease-in-out infinite;
}

body.is-holding .hint-container {
    opacity: 0;
    transition: opacity 0.5s;
    animation: none;
}

.hint-text {
    font-family: 'Ma Shan Zheng', cursive; 
    font-size: 1.4rem;
    color: #4a403a; letter-spacing: 0.3em; 
    margin-bottom: 5px;
    opacity: 0.8;
}
.hint-sub {
    font-family: 'Noto Serif SC', serif; font-size: 0.7rem;
    color: #8c7e7e; letter-spacing: 0.1em; font-style: italic;
    text-transform: uppercase;
    transform: scale(0.9);
}

@keyframes breathe-hint {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

@media (max-width: 768px) {
    .poem-content { font-size: 2.2rem; line-height: 1.5; }
    .ink-aura { transform: translate(-50%, -50%) scale(0.6); }
    .poem-wrapper { width: 90%; padding: 0; }
}
