/* ═══════════════════════════════════════════
   书写页样式 — Tumanydays
   与主站风格一致：极简灰调
   ═══════════════════════════════════════════ */

/* ── 页面基础 ── */
html, body {
    width: 100%; height: 100%;
    margin: 0; padding: 0;
    overflow: hidden;
    position: fixed;
    background: var(--bg);
    font-family: var(--font-serif);
}

/* ── 页面容器 ── */
.diary-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 60px 24px 48px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ── 标题 ── */
.diary-title {
    font-family: "ZCOOL XiaoWei", serif;
    font-weight: 400;
    font-size: 1.3rem;
    color: var(--text, #333);
    letter-spacing: 3px;
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.diary-subtitle {
    font-family: "Noto Serif SC", serif;
    font-weight: 300;
    font-size: 0.82rem;
    color: var(--text-dim, #999);
    letter-spacing: 2px;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

/* ── 模式切换 ── */
.mode-toggle {
    text-align: right;
    font-family: "Noto Serif SC", serif;
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 2px;
    margin-bottom: 16px;
    user-select: none;
    -webkit-user-select: none;
}

.mode-opt {
    color: var(--text-faint, #bbb);
    cursor: pointer;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.mode-opt:hover {
    color: var(--text-dim, #999);
}
.mode-opt.active {
    color: var(--seal);
}
.mode-opt.active::after {
    content: '';
    display: block;
    height: 1px;
    background: var(--seal);
    margin-top: 2px;
}

.mode-sep {
    color: var(--text-faint, #bbb);
    margin: 0 4px;
}

/* ── 书写区域 ── */
.writing-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border, #e8e8e8);
    border-radius: 4px;
    background: var(--bg, #fafafa);
    min-height: 300px;
    padding: 16px;
    position: relative;
}

#paper-canvas {
    cursor: crosshair;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
#paper-canvas.hidden-canvas {
    display: none;
}

/* ── 文字输入框 ── */
.text-input {
    width: 100%;
    flex: 1;
    min-height: 120px;
    padding: 12px 14px;
    font-family: "ZCOOL XiaoWei", serif;
    font-size: 0.95rem;
    line-height: 1.9;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    transition: opacity 0.75s ease;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}
.text-input::placeholder {
    color: var(--text-faint, #bbb);
}
.text-input.fade-hidden {
    opacity: 0;
}
.text-input.hidden {
    display: none;
}

/* ── 发送行 ── */
.send-row {
    width: 100%;
    text-align: right;
    padding: 8px 4px 0 0;
    box-sizing: border-box;
    transition: opacity 0.75s ease;
}
.send-row.fade-hidden {
    opacity: 0;
}
.send-row.hidden {
    display: none;
}

.send-btn {
    font-family: "Noto Serif SC", serif;
    font-size: 0.82rem;
    color: var(--text-faint, #bbb);
    letter-spacing: 2px;
    cursor: pointer;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.send-btn:hover {
    color: var(--ink, #4a6b80);
}

/* ── 返回链接 ── */
.diary-back {
    position: fixed;
    top: 20px;
    left: 24px;
    z-index: 10;
    font-family: "Noto Serif SC", serif;
    font-size: 0.85rem;
    color: var(--ink, #4a6b80); /* 常驻墨蓝（2026.8.16 全站返回链接统一决议，原 --text-faint 淡灰） */
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.diary-back:hover {
    color: var(--hover, #5a7685);
}

/* ── 思考态提示 ── */
#thinking-indicator {
    text-align: center;
    font-family: "Noto Serif SC", serif;
    font-size: 0.78rem;
    color: var(--text-faint, #bbb);
    letter-spacing: 2px;
    margin-top: 24px;
    transition: opacity 0.6s ease;
}
#thinking-indicator.hidden { opacity: 0; }
#thinking-indicator.visible {
    opacity: 1;
    animation: think-breath 3s ease-in-out infinite;
}

@keyframes think-breath {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.55; }
}

/* ── 响应式 ── */
@media (max-width: 600px) {
    .diary-page {
        padding: 48px 16px 32px;
    }

    .diary-title {
        font-size: 1.15rem;
    }

    .diary-subtitle {
        margin-bottom: 8px;
    }

    .mode-toggle {
        font-size: 0.72rem;
        margin-bottom: 12px;
    }

    .writing-area {
        padding: 12px;
        min-height: 240px;
    }

    .text-input {
        font-size: 0.9rem;
        padding: 8px 10px;
        min-height: 100px;
    }
}
