:root {
    --paper-bg: #F4EBD0;
    --ink-black: #1A1A1A;
    --seal-red: #B82E2E;
    --font-stack: "Songti SC", "SimSun", "STSong", "AR PL New Sung", serif;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden; /* 强制一屏，禁止全局滚动 */
}

body {
    background-color: var(--paper-bg);
    color: var(--ink-black);
    font-family: var(--font-stack);
    position: relative;
}

/* --- 纸张质感 & 纹理 --- */
.paper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/aged-paper.png'); 
    opacity: 0.4;
    pointer-events: none;
    z-index: 999;
    mix-blend-mode: multiply;
}

/* --- 氛围组：背景水印 --- */
.bg-watermark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem; /* 减小字号 */
    font-weight: 900;
    color: var(--ink-black);
    opacity: 0.05; /* 稍微增加一点点不透明度，因为字变小了 */
    pointer-events: none;
    z-index: 0;
    line-height: 1.2;
    font-family: "KaiTi", serif;
}

.bg-watermark.left {
    left: 0; /* 紧贴边缘 */
    writing-mode: vertical-rl;
}

.bg-watermark.right {
    right: 0; /* 紧贴边缘 */
    writing-mode: vertical-rl;
}

/* --- 氛围组：墨渍 --- */
/* 已移除 */

/* --- 装饰性边框 (四角风格) --- */
.border-container {
    position: absolute;
    top: 12px; left: 12px; right: 12px; bottom: 12px;
    pointer-events: none;
    z-index: 900;
    /* 仅作为定位容器 */
}

/* 定义 L 形角标 */
.corner-tl, .corner-tr, .corner-bl, .corner-br {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--ink-black);
    border-style: solid;
}

.corner-tl { top: 0; left: 0; border-width: 4px 0 0 4px; }
.corner-tr { top: 0; right: 0; border-width: 4px 4px 0 0; }
.corner-bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.corner-br { bottom: 0; right: 0; border-width: 0 4px 4px 0; }

/* --- 布局容器 --- */
#app {
    max-width: 500px; /* 稍微收窄，更像一张传单 */
    height: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* --- 阶段过渡 --- */
.phase {
    transition: opacity 0.4s ease;
    height: 100%; /* 占满容器 */
}

.phase.hidden {
    display: none;
    opacity: 0;
}

.phase.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    flex: 1;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- 阶段一：首页 (紧凑布局) --- */
.main-header {
    text-align: center;
    margin-bottom: 1rem;
    border-bottom: 3px double var(--ink-black); /* 文武线效果 */
    padding-bottom: 0.8rem;
    flex-shrink: 0; /* 防止标题被压缩 */
    position: relative;
}

/* 鲁迅设计风格装饰条 */
.luxun-deco-bar {
    width: 40px;
    height: 8px;
    background-color: var(--seal-red);
    margin: 0 auto 10px auto;
    position: relative;
}
.luxun-deco-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 8px solid var(--ink-black);
    border-left: 8px solid transparent;
}
.luxun-deco-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 0;
    height: 0;
    border-bottom: 8px solid var(--ink-black);
    border-right: 8px solid transparent;
}

h1 {
    font-size: 2.2rem;
    margin: 0;
    color: var(--seal-red);
    letter-spacing: 0.1em;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
    font-weight: 900;
    line-height: 1.1;
}

.subtitle {
    font-size: 0.9rem;
    margin-top: 0.4rem;
    font-weight: bold;
    opacity: 0.9;
}

.guide-text {
    font-size: 0.85rem;
    margin-top: 0.4rem;
    color: #444;
    font-style: italic;
    font-family: "KaiTi", serif;
}

/* 垂直排列，均匀分布 */
.poster-wall {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly; /* 均匀分布 */
    flex: 1; /* 占满剩余高度 */
    gap: 0.8rem;
    padding-bottom: 0.5rem;
}

.era-footer {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    font-family: "KaiTi", serif;
    opacity: 0.6;
    margin-top: auto;
    padding-top: 5px;
}

/* 撕纸条样式 */
.poster-item {
    background: var(--paper-bg);
    border: 2px solid var(--ink-black);
    padding: 0.8rem 1rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
    font-size: 1.3rem; /* 加大字号 */
    font-weight: bold;
    text-align: left;
    box-shadow: 4px 4px 0px var(--ink-black);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.poster-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--ink-black);
    background-color: #fff5db;
}

.poster-item:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px var(--ink-black);
}

/* 装饰性前缀：菱形 */
.poster-item::before {
    content: '◆';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--seal-red);
    font-size: 1rem; /* 加大装饰符号 */
}

.poster-item div:first-child {
    padding-left: 1.8rem; /* 增加左边距 */
    line-height: 1.2;
}

.poster-item div:last-child {
    padding-left: 1.8rem;
    font-size: 0.9rem; /* 加大副标题 */
    font-weight: normal; 
    margin-top: 4px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 阶段二：审视 --- */
.scrutiny-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: shake 3s infinite;
}

/* 抖动动画保持不变 */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-2px, 0px) rotate(1deg); }
    30% { transform: translate(2px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-2px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.luxun-portrait {
    width: 160px;
    height: 160px;
    background-color: var(--ink-black);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--paper-bg);
    font-size: 5rem;
    border-radius: 50%;
    mask-image: repeating-radial-gradient(black, transparent 2px);
    border: 4px solid var(--ink-black);
}

.typing-text {
    font-size: 1.4rem;
    font-weight: bold;
    min-height: 2em;
}

/* --- 阶段三：大字报结果 --- */
.dazibao-container {
    flex: 1; /* 自动撑满剩余空间 */
    border: 3px solid var(--ink-black);
    padding: 1.2rem;
    background: #fff;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 12px);
    position: relative;
    margin-bottom: 1rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* 确保内容垂直分布 */
}

.dazibao-header {
    border: 3px double var(--seal-red); /* 双线 */
    color: var(--seal-red);
    padding: 0.4rem;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.patient-section {
    font-size: 1rem;
    border-bottom: 1px dashed var(--ink-black);
    padding-bottom: 0.5rem;
    flex-shrink: 0;
}

.selected-symptom {
    font-size: 1.2rem;
    font-weight: bold;
    display: block;
    margin-top: 0.4rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--ink-black);
}

.prescription-section {
    flex: 1; /* 占据主要空间 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.5rem 0;
}

.quote-main {
    font-size: 2rem; /* 再次加大 */
    line-height: 1.3;
    font-weight: 900;
    color: var(--ink-black);
    margin: 0.5rem 0;
    text-align: justify;
    letter-spacing: 0.02em;
}

.quote-source {
    text-align: right;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 0.5rem;
    font-family: "KaiTi", serif;
}

.footer-section {
    font-size: 0.85rem;
    color: #444;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    min-height: 70px;
    flex-shrink: 0;
}

/* --- 优化后的印章 --- */
.seal {
    width: 80px;
    height: 80px;
    /* 双重边框模拟篆刻印章 */
    border: 4px solid var(--seal-red);
    outline: 2px solid var(--seal-red);
    outline-offset: -6px;
    
    color: var(--seal-red);
    
    /* 改用 Grid 布局实现 2x2 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    align-items: center;
    justify-items: center;
    
    font-size: 1.6rem; /* 加大印章字号 */
    font-weight: 900;
    font-family: "LiSu", "隶书", "KaiTi", "楷体", serif; /* 强制隶书 */
    
    /* 取消竖排，通过 Grid 控制顺序 */
    /* writing-mode: vertical-rl; */
    line-height: 1;
    
    transform: rotate(-2deg);
    opacity: 0.9;
    background: radial-gradient(circle, transparent 40%, rgba(184, 46, 46, 0.05) 100%);
    
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 10;
    padding: 4px; /* 内边距，防止字贴边 */
}

/* 印章文字 Grid 位置 */
.seal span:nth-child(1) { grid-area: 1 / 2; } /* 周 (右上) */
.seal span:nth-child(2) { grid-area: 2 / 2; } /* 树 (右下) */
.seal span:nth-child(3) { grid-area: 1 / 1; } /* 人 (左上) */
.seal span:nth-child(4) { grid-area: 2 / 1; } /* 印 (左下) */


.stamp-animate {
    animation: stamp-fall 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stamp-fall {
    0% { transform: scale(3) rotate(10deg); opacity: 0; }
    100% { transform: scale(1) rotate(-2deg); opacity: 0.9; }
}

.actions {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

.wood-btn {
    background: var(--seal-red);
    color: var(--paper-bg);
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
    font-family: var(--font-stack);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 4px 4px 0 var(--ink-black);
    transition: all 0.1s;
    border: 2px solid var(--ink-black);
}

.wood-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--ink-black);
}

/* --- 移动端适配微调 --- */
@media (max-width: 380px) {
    h1 { font-size: 1.8rem; }
    .quote-main { font-size: 1.4rem; }
    .poster-item { padding: 0.6rem 0.8rem; }
    .dazibao-header { font-size: 1.4rem; }
}
