/* Zen Chat Page Styles */

/* 偈语专用字体 - 霞鹜文楷（书法风格） */
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.1.0/style.css');

/* 备选字体 - 思源宋体（传统优雅） */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@300;400;500&display=swap');

:root {
    --zen-primary: #2c2c2c;
    --zen-secondary: #666;
    --zen-border: #e0e0e0;
    --zen-bg: #fafafa;
    --zen-card-bg: #ffffff;
    --zen-shadow: rgba(0, 0, 0, 0.08);
    --zen-accent: #8b7355;
    --transition: 0.3s ease;
}

body {
    background: var(--zen-bg);
    /* padding-top is set by base.css via --navbar-height-mobile/desktop */
    min-height: 100vh;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
}

/* Main Container */
.zen-container {
    max-width: var(--container-max-width-md);
    width: 100%;
    margin: 0 auto;
    padding: var(--container-padding-top) var(--container-padding-horizontal);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    box-sizing: border-box;
}

/* ============================================
   Container Mode System (容器模式系统)
   
   使用模式类来控制不同的页面布局和功能。
   每个模式可以有独特的布局、显示/隐藏规则和样式。
   
   当前支持的模式：
   - mode-dialogue: 对话模式
   - mode-meditation: 冥想模式
   
   未来可扩展的模式示例：
   - mode-journal: 日记模式
   - mode-wisdom: 智慧模式
   - mode-reflection: 反思模式
   ============================================ */

/* Mode: Dialogue (对话模式) */
.zen-container.mode-dialogue {
    /* 对话模式使用默认布局 */
}

/* Mode: Meditation (冥想模式) */
.zen-container.mode-meditation {
    /* 保持与对话模式相同的 padding-top，确保位置一致 */
    padding-bottom: 0;
    justify-content: flex-start;
}

/* Greeting Section */
.zen-greeting {
    text-align: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

/* Header styles are now in page-header.css */

/* 固定头部容器 - 防止切换时跳动 */
.zen-header-container {
    min-height: 180px; /* 固定容器高度，预留统计信息和引导语的空间 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.zen-title {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--zen-primary);
    margin: 0 0 0.75rem 0;
    letter-spacing: 0.1em;
}

.zen-subtitle {
    font-size: 1rem;
    font-weight: 300;
    color: var(--zen-secondary);
    margin: 0;
    line-height: 1.8;
    min-height: 1.8rem; /* 固定最小高度 */
}

/* Zen Stats - 统计信息（分割线下方） */
.zen-stats {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--zen-secondary);
    opacity: 0.5;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 1.8rem; /* 固定最小高度，与引导语保持一致 */
}

.zen-stats-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.zen-stats-label {
    font-weight: 300;
}

.zen-stats-value {
    font-weight: 400;
    color: var(--zen-accent);
    opacity: 0.7;
}

.zen-stats-separator {
    opacity: 0.3;
    margin: 0 0.25rem;
}

/* ============================================
   Zen Divider (分割线)
   
   位置：输入框下方，统计信息和偈语墙上方
   ============================================ */

.zen-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--zen-border), transparent);
    margin: 2rem auto 1.5rem;
}

/* ============================================
   Gatha Wall (偈语墙 - 网格布局)
   
   位置：统计信息下方，分割线下方
   使用自适应网格，自动计算每行卡片数量
   ============================================ */

.zen-gatha-wall {
    display: grid;
    /* 弹性布局：每个卡片最小280px，最大1fr，浏览器自动计算一行能放几个 */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1400px; /* 增大最大宽度，支持更多列 */
    margin: 0 auto 2rem;
    padding: 0 1rem;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 0.3s;
}

/* 平板：调整最小宽度 */
@media (min-width: 600px) and (max-width: 999px) {
    .zen-gatha-wall {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* 桌面：调整最小宽度 */
@media (min-width: 1000px) {
    .zen-gatha-wall {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

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

/* 偈语卡片 - 便签纸风格 */
.zen-gatha-card {
    background: #fffffb;
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    padding: 3rem; /* 增大2倍：原1.5rem → 3rem */
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 4px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* 使用 flexbox 让底部元素始终靠下 */
    display: flex;
    flex-direction: column;
    min-height: 200px; /* 设置最小高度，保持卡片整齐 */
}

/* 空偈语卡片 - 如实呈现失败 */
.zen-gatha-card.empty {
    background: #fafafa;
    opacity: 0.6;
    cursor: default;
    border-style: dashed;
}

.zen-gatha-card.empty:hover {
    transform: none;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 4px 8px rgba(0, 0, 0, 0.04);
}

.zen-gatha-card.empty::before {
    display: none; /* 隐藏图钉 */
}

.zen-gatha-empty {
    /* 空内容区域 */
    min-height: 0;
}

/* 悬停效果 - 像便签纸被提起 */
/* .zen-gatha-card:hover {
    transform: translateY(-4px) rotate(0.5deg);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 8px 20px rgba(0, 0, 0, 0.06);
} */

/* 卡片顶部装饰 - 图钉效果 */
.zen-gatha-card::before {
    content: '📌';
    position: absolute;
    top: 1rem; /* 随 padding 增大：0.5rem → 1rem */
    right: 1rem; /* 随 padding 增大：0.5rem → 1rem */
    font-size: 0.75rem;
    opacity: 0.3;
}

.zen-gatha-content {
    font-size: 0.95rem; /* 增大字体：0.9rem → 0.95rem，与输入框一致 */
    line-height: 1.8;
    color: var(--zen-primary);
    font-weight: 400;
    white-space: pre-line;
    letter-spacing: 0.05em;
    text-align: center; /* 文字居中 */
    /* 显示完整文字，不截断 */
    flex: 1; /* 占据剩余空间，将 meta 推到底部 */
    
    /* 字体栈 - 优先使用书法字体，依次回退 */
    font-family: 
        'LXGW WenKai',           /* 霞鹜文楷 - 书法风格 */
        'Noto Serif TC',         /* 思源宋体繁体 - 传统优雅 */
        'Source Han Serif TC',   /* 思源宋体繁体（本地版） */
        'STKaiti',               /* macOS 楷体 */
        'STSong',                /* macOS 宋体 */
        'SimSun',                /* Windows 宋体 */
        'FangSong',              /* 仿宋 */
        serif;                   /* 通用衬线字体 */
}

.zen-gatha-meta {
    text-align: center;
    font-size: 0.75rem;
    color: var(--zen-secondary);
    opacity: 0.7;
    border-top: 1px solid var(--zen-border);
    padding-top: 1.5rem; /* 随 padding 增大：0.75rem → 1.5rem */
    margin-top: 1.5rem; /* 随 padding 增大：0.75rem → 1.5rem */
    /* 自动贴在底部 */
    /* 期数使用系统字体，保持简洁 */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.zen-gatha-iteration {
    font-weight: 400;
}

/* Gatha Detail Modal - 偈语详情弹窗 */
.zen-gatha-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.zen-gatha-modal-content {
    background: var(--zen-bg);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: modalSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.zen-gatha-modal-header {
    padding: 1.5rem 1.5rem 0.75rem;
    border-bottom: 1px solid var(--zen-border);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.zen-gatha-modal-title {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--zen-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.8;
}

.zen-gatha-modal-close {
    position: absolute;
    right: 1rem;
    top: 1.25rem;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--zen-secondary);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zen-gatha-modal-close:hover {
    background: var(--zen-border);
    color: var(--zen-primary);
}

.zen-gatha-modal-body {
    padding: 3rem; /* 与卡片保持一致：1.5rem → 3rem */
}

.zen-gatha-modal-text {
    font-size: 0.95rem; /* 与卡片内容字体一致：1rem → 0.95rem */
    font-weight: 400;
    color: var(--zen-primary);
    line-height: 1.9;
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
    text-align: center;
    /* 使用相同的字体栈 */
    font-family: 
        'LXGW WenKai',
        'Noto Serif TC',
        'Source Han Serif TC',
        'STKaiti',
        'STSong',
        'SimSun',
        'FangSong',
        serif;
}

.zen-gatha-modal-divider {
    height: 1px;
    background: var(--zen-border);
    margin: 1.5rem 0;
}

.zen-gatha-modal-explanation-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--zen-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.7;
    margin-bottom: 0.75rem;
    display: block;
}

.zen-gatha-modal-explanation {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--zen-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 冥想模式下隐藏偈语墙 */
.zen-container.mode-meditation .zen-gatha-wall {
    display: none !important;
}

/* 移动端优化 */
@media (max-width: 599px) {
    .zen-gatha-wall {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* 移动端最小宽度 */
        gap: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .zen-gatha-card {
        padding: 2.5rem; /* 增大2倍：原1.25rem → 2.5rem */
    }
    
    .zen-gatha-content {
        font-size: 0.9rem; /* 移动端也增大：0.85rem → 0.9rem */
    }
}

/* Meditation Guide - 冥想引导语（分割线下方，与统计信息位置对应） */
.zen-meditation-guide {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding: 0 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    min-height: 1.8rem; /* 固定最小高度，与统计信息保持一致 */
}

.meditation-guide-text {
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--zen-secondary);
    opacity: 0.7;
    line-height: 1.8;
    letter-spacing: 0.05em;
    margin: 0;
    text-align: center;
}

/* ============================================
   Chat Area (对话区域)
   
   显示规则：
   - mode-dialogue: 显示
   - mode-meditation: 隐藏
   
   位置：分割线上方，输入框上方
   ============================================ */
.zen-chat-area {
    flex: 0 0 auto; /* 不拉伸，自然高度 */
    overflow-y: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
    margin-bottom: 1rem; /* 与输入框之间的间距 */
    width: 100%;
    max-width: 100%;
}

.zen-container.mode-meditation .zen-chat-area {
    display: none !important;
}

.zen-cards {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 100%;
}

/* Zen Card */
.zen-card {
    background: var(--zen-card-bg);
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    padding: 2rem;
    padding-bottom: 3.5rem;
    box-shadow: 0 1px 3px var(--zen-shadow);
    animation: slideUp 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    width: 500px;
    max-width: 100%;
    margin: 0 auto;
    min-height: auto;
}

/* Thinking State Card */
.zen-card.thinking {
    padding: 3rem 2rem;
    text-align: center;
    animation: fadeIn 0.6s ease;
}

.zen-card.thinking .thinking-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.thinking-dots {
    display: flex;
    gap: 0.5rem;
}

.thinking-dots .dot {
    width: 8px;
    height: 8px;
    background: var(--zen-accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.thinking-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.thinking-text {
    font-size: 0.9rem;
    color: var(--zen-secondary);
    font-weight: 300;
}

/* Card Content (for image export) */
.zen-card-content {
    position: relative;
    /* 确保内容区域有正确的内边距，用于图片导出 */
    padding: 0;
    padding-bottom: 3.5rem; /* 为底部按钮和monk图片留出空间 */
}

.zen-card-question {
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--zen-border);
    animation: fadeIn 0.6s ease 0.2s both;
}

.zen-card-question-label {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--zen-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.6;
}

/* Monk图片 - 右下角装饰，按钮上方 */
.zen-card-monk-icon {
    position: absolute;
    bottom: 4rem; /* 在按钮上方，按钮高度约32px + 间距 */
    right: 1rem;
    width: 96px;
    height: 96px;
    object-fit: contain;
    opacity: 0.5;
    transition: opacity var(--transition);
    pointer-events: none; /* 不阻挡按钮点击 */
    z-index: 1;
    animation: fadeIn 0.6s ease 0.8s both;
}

.zen-card-monk-icon:hover {
    opacity: 0.7;
}

.zen-card-question-text {
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--zen-primary);
    line-height: 1.8;
    margin: 0;
    /* 允许文本选择 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.zen-card-answer {
    margin: 0;
    animation: expandFromTop 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
    transform-origin: top;
}

.zen-card-answer-label {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--zen-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.6;
    animation: fadeIn 0.6s ease 0.6s both;
}

.zen-card-answer-text {
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--zen-primary);
    line-height: 1.9;
    white-space: pre-wrap;
    margin: 0;
    animation: fadeIn 0.8s ease 1.8s both;
    /* 允许文本选择 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Explanation Section */
.zen-card-explanation {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--zen-border);
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Explanation Card - 独立卡片 */
.zen-explanation-card {
    background: var(--zen-bg);
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    width: 500px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.explanation-header {
    margin-bottom: 0.75rem;
}

.explanation-label {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--zen-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.6;
    display: inline-block;
}

.explanation-content {
    /* 移除背景色，让独立卡片更简洁 */
}

.explanation-text {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--zen-secondary);
    line-height: 1.8;
    margin: 0;
    white-space: pre-wrap;
    /* 允许文本选择 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Watermark (only shown in exported image) */
.zen-card-watermark {
    display: none; /* 默认隐藏 */
    text-align: center;
    padding: 1.5rem 0 0 0;
    margin-top: 1.5rem;
    border-top: 1px solid var(--zen-border);
    font-size: 0.9rem;
    color: var(--zen-secondary);
    opacity: 0.6;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Card Retry Button (top-right) */
.card-retry-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--zen-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    opacity: 0.4;
    z-index: 10;
    animation: fadeIn 0.6s ease 0.5s both;
}

.card-retry-btn:hover {
    color: var(--zen-accent);
    background: var(--zen-bg);
    opacity: 1;
    transform: rotate(180deg);
}

.card-retry-btn:active {
    transform: rotate(180deg) scale(0.95);
}

/* Card Action Buttons */
.zen-card-actions {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    animation: fadeIn 0.6s ease 0.8s both;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--zen-secondary);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    opacity: 0.5;
}

.card-action-btn:hover {
    color: var(--zen-accent);
    background: var(--zen-bg);
    opacity: 1;
}

.card-action-btn.active {
    color: var(--zen-accent);
    opacity: 1;
}

.card-action-btn.loading {
    opacity: 0.5;
    cursor: wait;
    animation: pulse 1.5s ease-in-out infinite;
}

.card-explain-btn {
    color: #fbbf24; /* Yellow color for explain/question icon */
    opacity: 0.8;
}

.card-explain-btn:hover {
    color: #f59e0b; /* Slightly darker yellow on hover */
    opacity: 1;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
}

/* Reply Section (回复输入框) */
.zen-reply-section {
    background: var(--zen-card-bg);
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px var(--zen-shadow);
    margin-top: 1rem;
    width: 500px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.reply-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.zen-reply-textarea {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--zen-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--zen-primary);
    background: var(--zen-bg);
    resize: none;
    font-family: inherit;
    transition: border-color var(--transition);
    /* 允许文本选择和编辑 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    /* 移动端优化 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.zen-reply-textarea:focus {
    outline: none;
    border-color: var(--zen-accent);
}

.zen-reply-textarea::placeholder {
    color: var(--zen-secondary);
    opacity: 0.5;
}

.reply-submit-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: none;
    background: var(--zen-accent);
    color: white;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.reply-submit-btn:hover {
    background: var(--zen-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--zen-shadow);
}

.reply-submit-btn:active {
    transform: translateY(0);
}

.reply-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* ============================================
   Input Section (输入框)
   
   显示规则：
   - mode-dialogue: 动态显示/隐藏（由JS控制）
   - mode-meditation: 隐藏
   
   位置：分割线上方，对话区域下方
   ============================================ */
.zen-input-section {
    background: var(--zen-card-bg);
    border: 1px solid var(--zen-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px var(--zen-shadow);
    margin-top: 2rem;
    margin-bottom: 2rem; /* 与分割线之间的间距 */
    max-width: 600px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.zen-container.mode-meditation .zen-input-section {
    display: none;
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.zen-textarea {
    flex: 1;
    min-height: 24px;
    max-height: 120px;
    padding: 0.5rem 0;
    border: none;
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--zen-primary);
    background: transparent;
    resize: none;
    font-family: inherit;
    overflow: hidden;
    /* 允许文本选择和编辑 */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    /* 移动端优化 */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.zen-textarea:focus {
    outline: none;
}

.zen-textarea::placeholder {
    color: var(--zen-secondary);
    opacity: 0.4;
}

.zen-send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    background: var(--zen-accent);
    color: white;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    opacity: 0.9;
}

.zen-send-btn:hover {
    background: var(--zen-primary);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px var(--zen-shadow);
}

.zen-send-btn:active {
    transform: translateY(0);
}

.zen-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.zen-privacy-hint {
    font-size: 0.75rem;
    color: var(--zen-secondary);
    opacity: 0.5;
    text-align: center;
    margin: 0.5rem 0 0 0;
    line-height: 1.4;
    font-weight: 300;
    letter-spacing: 0.05em;
}


/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes expandFromTop {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ============================================
   Tab Switcher
   ============================================ */
.zen-tabs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0 0;
    padding: 0;
}

.zen-tab {
    background: none;
    border: none;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--zen-secondary);
    padding: 0.5rem 0;
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
    letter-spacing: 0.05em;
}

.zen-tab:hover {
    color: var(--zen-primary);
}

.zen-tab.active {
    color: var(--zen-primary);
    font-weight: 400;
}

.zen-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--zen-accent);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

/* ============================================
   Meditation Area (冥想区域)
   
   显示规则：
   - mode-dialogue: 隐藏
   - mode-meditation: 显示
   ============================================ */
.zen-meditation-area {
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
    opacity: 1;
    transition: opacity 0.3s ease;
    flex-shrink: 0; /* 不要收缩 */
    width: 100%;
    max-width: 100%;
}

.zen-container.mode-dialogue .zen-meditation-area {
    display: none !important;
}

.zen-container.mode-meditation .zen-meditation-area {
    display: flex !important;
    margin-bottom: 2rem;
}

.meditation-container {
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

/* Circular Timer */
.meditation-timer {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto 2rem;
}

.timer-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring-bg {
    fill: none;
    stroke: var(--zen-border);
    stroke-width: 3;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--zen-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 0.3s linear;
    opacity: 0.8;
}

/* Subtle breathing effect on ring when playing */
.meditation-timer.playing .timer-ring-progress {
    animation: ringBreathe 8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes ringBreathe {
    0%, 100% {
        opacity: 0.7;
        stroke-width: 3;
    }
    50% {
        opacity: 1;
        stroke-width: 3.5;
    }
}

/* Play Button in Center */
.meditation-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--zen-card-bg);
    border: 1px solid var(--zen-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 12px var(--zen-shadow);
    padding: 0;
}

.meditation-play-btn:hover {
    box-shadow: 0 6px 16px var(--zen-shadow);
    border-color: var(--zen-accent);
}

/* Only scale on hover when not playing */
.meditation-timer:not(.playing) .meditation-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.meditation-timer:not(.playing) .meditation-play-btn:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.play-icon {
    display: block;
    color: var(--zen-primary);
}

.pause-icon {
    display: block;
    color: var(--zen-secondary);
    opacity: 0.5;
}

/* Time Display - Hidden */
.meditation-time {
    display: none;
}

/* Meditation Title */
.meditation-title {
    font-size: 1rem;
    color: var(--zen-primary);
    font-weight: 300;
    margin: 0;
    letter-spacing: 0.1em;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

/* Subtle breathing effect on title when playing */
.meditation-container.playing .meditation-title {
    animation: textBreathe 8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

/* Loading state - audio preloading */
.meditation-play-btn.loading {
    pointer-events: none;
    opacity: 0.5;
    animation: loadingPulse 1.2s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
        opacity: 0.6;
    }
}

/* Breathing animation when playing */
.meditation-timer.playing .meditation-play-btn {
    animation: breathe 8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes breathe {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0.85;
        box-shadow: 0 4px 12px var(--zen-shadow);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 1;
        box-shadow: 0 8px 24px rgba(139, 115, 85, 0.4);
    }
}


@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    60% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Empty State */
.zen-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--zen-secondary);
    opacity: 0.7;
}

.zen-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.zen-empty-text {
    font-size: 1rem;
    font-weight: 300;
}

/* Mobile Design Overrides */
@media (max-width: 768px) {
    .zen-container {
        padding: 2rem 1rem 1.5rem;
    }

    .zen-container.mode-meditation {
        /* 只调整左右和底部padding，保持顶部padding与对话模式一致 */
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: 0;
    }

    .zen-input-section {
        margin-top: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .zen-title {
        font-size: 2rem;
    }

    .zen-subtitle {
        font-size: 0.9rem;
    }

    .zen-stats {
        font-size: 0.7rem;
    }

    .zen-meditation-guide {
        padding: 0 1rem;
    }

    .meditation-guide-text {
        font-size: 0.8rem;
    }

    .zen-card {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    .zen-card-content {
        padding-bottom: 3.5rem; /* 移动端也保持底部空间 */
    }

    .zen-card-monk-icon {
        width: 80px;
        height: 80px;
        bottom: 3.5rem; /* 移动端按钮稍小，调整位置 */
        right: 0.25rem; /* 移动端更靠右，避免遮挡文字 */
    }

    .zen-card-question-text {
        font-size: 0.9rem;
    }

    .zen-card-answer-text {
        font-size: 0.9rem;
    }

    .zen-textarea {
        font-size: 0.9rem;
        min-height: 44px; /* Touch target size */
    }

    .card-action-btn {
        min-width: 44px; /* Touch target size */
        min-height: 44px;
    }
    
    .card-retry-btn {
        min-width: 44px; /* Touch target size */
        min-height: 44px;
    }
    
    .meditation-timer {
        width: 240px;
        height: 240px;
    }
    
    .meditation-play-btn {
        width: 70px;
        height: 70px;
    }
    
    .zen-tabs {
        gap: 1.5rem;
    }
    
    .zen-reply-section {
        width: 100%;
        padding: 0.75rem;
    }
    
    .zen-reply-textarea {
        font-size: 0.9rem;
        min-height: 44px; /* Touch target size */
    }
    
    .reply-submit-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
    
    .zen-explanation-card {
        width: 100%;
        padding: 1rem;
    }
}

/* Desktop Design */
@media (min-width: 769px) {
    /* body padding-top is set by base.css via --navbar-height-desktop */
    
    .zen-container.mode-meditation {
        padding-bottom: 0;
        justify-content: flex-start;
    }

    .zen-input-section {
        margin-top: 2rem;
        margin-bottom: 2rem;
    }

    .zen-title {
        font-size: 2.5rem;
    }

    .zen-subtitle {
        font-size: 1rem;
    }

    .meditation-guide-text {
        font-size: 0.85rem;
    }

    .zen-card {
        padding: 2rem;
        width: 500px;
        max-width: 100%;
    }

    .zen-card-question-text {
        font-size: 0.95rem;
    }

    .zen-card-answer-text {
        font-size: 0.95rem;
    }

    .zen-textarea {
        font-size: 0.95rem;
        min-height: 24px;
    }
    
    .zen-reply-section {
        width: 500px;
        max-width: 100%;
        padding: 1rem;
    }
    
    .zen-reply-textarea {
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .reply-submit-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    
    .zen-explanation-card {
        width: 500px;
        max-width: 100%;
        padding: 1.5rem;
    }
}


/* Toast Message */
.zen-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--zen-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: slideInUp 0.3s ease, fadeOut 0.3s ease 2.7s;
    z-index: 1000;
    text-align: center;
}

@keyframes slideInUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}
