/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: #1a1a1a;
    color: #eaeaea;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea { font-family: inherit; outline: none; }
::placeholder { color: rgba(255, 255, 255, 0.3); }

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

/* ========== 页面切换 ========== */
.page-section { display: none; }

#home-page.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px 120px;
    animation: fadeIn 0.4s ease;
}

.write-center,
.read-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px 120px;
    animation: fadeIn 0.4s ease;
}
#write-page.active,
#read-page.active { display: block; }

/* ========== 首页 ========== */
.hero { text-align: center; }
.site-title {
    font-size: 2rem;
    font-weight: 400;
    color: #fff;
    letter-spacing: 0.35em;
    text-indent: 0.35em;
}
.site-subtitle {
    margin-top: 16px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.12em;
}

.nav-cards {
    width: min(610px, 92vw);
    margin-top: 70px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.nav-card {
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 20px 10px;
    text-align: center;
    font-size: 1rem;
    letter-spacing: 0.25em;
    text-indent: 0.25em;
    color: #eaeaea;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
}
.nav-card:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
}

/* ========== 写 / 看留言 ========== */
.page-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    color: #fff;
    margin-bottom: 40px;
}

.form-box {
    width: min(610px, 92vw);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.form-box input,
.search-box input {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 14px 16px;
    color: #eaeaea;
    font-size: 0.95rem;
    transition: border-color 0.25s ease;
}
.form-box textarea {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 14px 16px;
    color: #eaeaea;
    font-size: 0.95rem;
    line-height: 1.8;
    resize: none;
    transition: border-color 0.25s ease;
}
.form-box input:focus,
.form-box textarea:focus,
.search-box input:focus { border-color: rgba(255, 255, 255, 0.6); }

#w-content { scrollbar-width: none; -ms-overflow-style: none; }
#w-content::-webkit-scrollbar { display: none; }

.submit-btn,
.search-btn {
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: transparent;
    color: #eaeaea;
    padding: 14px 10px;
    font-size: 0.95rem;
    letter-spacing: 0.25em;
    text-indent: 0.25em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
}
.submit-btn:hover,
.search-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
}
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.search-box {
    width: min(610px, 92vw);
    margin: 0 auto 30px;
    display: flex;
    gap: 12px;
}
.search-box input { flex: 1; }
.search-btn { width: 110px; flex-shrink: 0; }

.back-btn {
    display: block;
    margin: 40px auto 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: color 0.25s ease;
}
.back-btn:hover { color: rgba(255, 255, 255, 0.7); }

/* ========== 留言卡片 ========== */
#result-area { width: min(610px, 92vw); margin: 0 auto; }
.msg-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    padding: 18px 20px;
    margin-bottom: 18px;
    animation: fadeIn 0.4s ease;
}
.msg-header { display: flex; justify-content: space-between; align-items: baseline; }
.msg-name { color: #fff; font-size: 0.95rem; letter-spacing: 0.1em; }
.msg-time { color: rgba(255, 255, 255, 0.3); font-size: 0.75rem; }
.msg-content {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

.loader, .end-cap {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    padding: 18px 0;
}

/* ========== 返回顶部 ========== */
.back-to-top {
    position: fixed;
    right: 26px;
    bottom: 120px;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(26, 26, 26, 0.8);
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    cursor: pointer;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
    z-index: 60;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { border-color: rgba(255, 255, 255, 0.6); color: #fff; }

/* ========== Toast 提示 ========== */
#toast-container {
    position: fixed;
    top: 24px; left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}
.toast {
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ddd;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    padding: 10px 20px;
    margin-bottom: 10px;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ========== 全局页脚 ========== */
.site-footer {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    text-align: center;
    padding: 16px 16px 14px;
    font-size: 12px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.35);
    user-select: none;
    z-index: 50;
    background: linear-gradient(to top, rgba(26, 26, 26, 0.95), rgba(26, 26, 26, 0));
    transition: opacity 0.2s ease;
}
/* 移动端键盘弹起时隐藏页脚，避免遮挡输入 */
.site-footer.kb-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.footer-slogan {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.28);
    letter-spacing: 0.2em;
    margin-bottom: 6px;
    font-style: italic;
}
.site-footer p { margin: 0; }
.site-footer a {
    color: rgba(255, 255, 255, 0.45);
    text-decoration: none;
    transition: color 0.2s ease;
    margin: 0 6px;
}
.site-footer a:hover { color: rgba(255, 255, 255, 0.75); text-decoration: underline; }

/* ========== 公告弹窗 ========== */
.notice-mask {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center; justify-content: center;
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.notice-mask.show { opacity: 1; }
.notice-box {
    width: min(520px, calc(100vw - 48px));
    max-height: 70vh;
    overflow-y: auto;
    background: #161616;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 24px 26px;
    scrollbar-width: none;
}
.notice-box::-webkit-scrollbar { display: none; }
.notice-title {
    text-align: left;
    font-size: 1rem; font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.15em;
    padding-left: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.35);
    margin-bottom: 14px;
}
.notice-content {
    text-align: left;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.9;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ========== 移动端适配 ========== */
@media (max-width: 480px) {
    .site-title { font-size: 1.6rem; }
    .site-footer { font-size: 11px; padding: 12px 12px 10px; }
    .footer-slogan { font-size: 12px; letter-spacing: 0.15em; }
    .site-footer a { display: inline-block; margin: 2px 4px; }
    .back-to-top { right: 16px; bottom: 110px; }
}
