/* ============================================================
   树洞1号 - 首页
   ============================================================ */
:root {
    --bg: #f5f1e8;
    --bg-deep: #ede7da;
    --ink: #1d2b26;
    --muted: #6d7b75;
    --brand: #1f5a49;
    --brand-2: #2f7a63;
    --accent: #d97757;
    --accent-dark: #c46343;
    --line: #e5ded0;
    --card: #fffdf9;
    --shadow: 0 14px 38px rgba(35, 64, 54, .09);
    --radius: 18px;
    --max: 1160px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(1100px 520px at 8% -10%, rgba(217, 119, 87, .14), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, rgba(47, 122, 99, .14), transparent 55%),
        var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }

button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 22px;
}

/* ---------------- header ---------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(245, 241, 232, .86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(31, 90, 73, .08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    height: 66px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: .5px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 6px 16px rgba(31, 90, 73, .3);
    font-size: 18px;
}

.brand small {
    display: block;
    font-weight: 400;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nav a,
.nav button.link {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
}

.nav a:hover,
.nav button.link:hover {
    color: var(--ink);
    background: rgba(31, 90, 73, .07);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    font-size: 14px;
}

.user-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-2);
}

.user-chip strong { font-weight: 600; }

/* ---------------- buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 8px 18px rgba(217, 119, 87, .28);
}
.btn-primary:hover { color: #fff; box-shadow: 0 10px 24px rgba(217, 119, 87, .36); }

.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 8px 18px rgba(31, 90, 73, .24);
}
.btn-brand:hover { color: #fff; }

.btn-ghost {
    border-color: rgba(255, 255, 255, .35);
    color: #fff;
    background: rgba(255, 255, 255, .08);
}
.btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, .16); }

.btn-outline {
    border-color: var(--line);
    background: var(--card);
    color: var(--ink);
}
.btn-outline:hover { border-color: rgba(31, 90, 73, .3); color: var(--brand); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ---------------- hero ---------------- */
.hero { margin-top: 26px; }

.hero-card {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .8fr);
    gap: 36px;
    padding: 50px;
    border-radius: 30px;
    color: #fff;
    background:
        radial-gradient(700px 300px at 85% 10%, rgba(232, 168, 124, .3), transparent 60%),
        linear-gradient(135deg, #173f35 0%, #1f5a49 55%, #2f7a63 100%);
    box-shadow: 0 30px 60px rgba(23, 63, 53, .25);
}

.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .12);
    pointer-events: none;
}
.hero-card::before { width: 340px; height: 340px; right: -90px; top: -140px; }
.hero-card::after { width: 520px; height: 520px; right: -190px; bottom: -300px; }

.hero-copy { position: relative; z-index: 1; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .16);
    font-size: 12px;
    letter-spacing: 1px;
    color: #f4e9dd;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(28px, 4.2vw, 46px);
    line-height: 1.18;
    letter-spacing: 1px;
    font-weight: 700;
}
.hero h1 em {
    font-style: normal;
    color: #ffd9c7;
}

.hero p {
    margin: 0 0 26px;
    max-width: 560px;
    color: rgba(255, 255, 255, .78);
    font-size: 15px;
    line-height: 1.8;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, .14);
}
.hero-stats div strong {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}
.hero-stats div span {
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
}

.entry-card {
    position: relative;
    z-index: 1;
    align-self: center;
    padding: 24px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.entry-card h3 {
    margin: 0 0 4px;
    font-size: 17px;
}
.entry-card p {
    margin: 0 0 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, .65);
    line-height: 1.7;
}
.entry-row { display: flex; gap: 8px; }
.entry-row input {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    outline: none;
}
.entry-row input::placeholder { color: rgba(255, 255, 255, .5); }
.entry-row input:focus { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .2); }
.entry-row .btn { height: 42px; }

/* ---------------- layout ---------------- */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 26px;
    /* 注意：这里必须保留 auto，否则会覆盖 .container 的左右居中 */
    margin: 30px auto 64px;
}

.feed-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.feed-head h2 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.feed-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.post-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(35, 64, 54, .04);
    transition: box-shadow .2s ease, transform .2s ease;
}
.post-card:hover { box-shadow: var(--shadow); }

.post-head { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 17px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    box-shadow: 0 6px 14px rgba(31, 90, 73, .2);
}
.avatar.alt { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }

.post-meta { min-width: 0; }
.post-meta strong { display: block; font-size: 14px; }
.post-meta span { display: block; color: var(--muted); font-size: 12px; }

.post-content {
    margin: 16px 0 10px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 15px;
    line-height: 1.9;
    color: #2a3833;
}
.post-content.clamped {
    max-height: 9.5em;
    overflow: hidden;
    position: relative;
}
.post-content.clamped::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3em;
    background: linear-gradient(rgba(255, 253, 249, 0), var(--card));
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}
.post-actions .stat { color: var(--muted); font-size: 12px; }
.post-actions .spacer { flex: 1; }

.link-btn {
    border: 0;
    background: transparent;
    color: var(--brand);
    padding: 4px 6px;
    border-radius: 7px;
    font-size: 13px;
}
.link-btn:hover { background: rgba(31, 90, 73, .08); }

.reply-list {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f7f3ea;
    border: 1px solid #eee7d9;
}
.reply-item { padding: 8px 0; border-bottom: 1px dashed #e7dfd0; }
.reply-item:last-child { border-bottom: 0; }
.reply-meta { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.reply-meta strong { font-size: 13px; }
.reply-meta span { color: var(--muted); font-size: 11px; }
.reply-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; color: #35433e; }

.reply-form {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffaf0;
}
.reply-form textarea,
.post-form textarea {
    width: 100%;
    min-height: 92px;
    resize: vertical;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    outline: none;
    line-height: 1.7;
}
.reply-form textarea:focus,
.post-form textarea:focus,
.field input:focus { border-color: rgba(31, 90, 73, .45); box-shadow: 0 0 0 3px rgba(31, 90, 73, .08); }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.form-row .hint { color: var(--muted); font-size: 12px; }

.load-more-wrap { text-align: center; padding: 10px 0 0; }
.empty {
    text-align: center;
    padding: 46px 20px;
    color: var(--muted);
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

/* ---------------- sidebar ---------------- */
.side-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(35, 64, 54, .04);
}
.side-card h3 { margin: 0 0 10px; font-size: 16px; }
.side-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.side-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--line);
}
.side-user .avatar { width: 46px; height: 46px; flex-basis: 46px; }
.side-user strong { display: block; font-size: 15px; }
.side-user span { color: var(--muted); font-size: 12px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.side-card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.9; }
.side-card li { margin-bottom: 4px; }

/* ---------------- modal ---------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 20px 48px;
    background: rgba(20, 34, 29, .48);
    backdrop-filter: blur(3px);
}
.modal.is-open { display: flex; }
.modal-card {
    width: 100%;
    max-width: 430px;
    max-height: calc(100vh - 80px);
    overflow: auto;
    border-radius: 20px;
    background: var(--card);
    box-shadow: 0 30px 80px rgba(20, 34, 29, .3);
    padding: 24px;
    animation: pop .18s ease-out;
}
.modal-card.wide { max-width: 560px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.modal-close {
    border: 0;
    background: #f3eee3;
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
}
.modal-close:hover { background: #ece4d5; color: var(--ink); }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    background: #f3eee3;
    border-radius: 12px;
}
.auth-tabs button {
    border: 0;
    background: transparent;
    padding: 9px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 14px;
}
.auth-tabs button.active { background: var(--card); color: var(--ink); box-shadow: 0 3px 10px rgba(35, 64, 54, .08); }

.field { margin-bottom: 13px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }
.field input {
    width: 100%;
    height: 42px;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    outline: none;
}
.form-msg { min-height: 18px; margin: 4px 0 10px; font-size: 12px; color: #b4492f; }
.form-msg.ok { color: var(--brand); }

.post-form textarea { min-height: 160px; }
.settings-section h4 { margin: 0 0 10px; font-size: 15px; }
.settings-divider { height: 1px; background: var(--line); margin: 18px 0; }
.settings-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

.my-list { display: grid; gap: 10px; }
.my-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffaf0;
}
.my-item .my-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.my-item .my-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.status { padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.status.pending { background: #fff1d6; color: #a86a12; }
.status.pass { background: #e2f3ea; color: #1f6a4f; }
.status.refuse { background: #fde5e0; color: #a63d2a; }

/* ---------------- footer ---------------- */
.site-footer {
    border-top: 1px solid rgba(31, 90, 73, .08);
    padding: 28px 0 38px;
    color: var(--muted);
    font-size: 12px;
}
.site-footer .footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
    justify-content: space-between;
}
.footer-audit {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}
.footer-audit:hover { color: var(--brand-2); }

/* ---------------- toast ---------------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 120;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    padding: 11px 18px;
    border-radius: 12px;
    background: rgba(29, 43, 38, .94);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(20, 34, 29, .25);
    transition: opacity .2s ease, transform .2s ease;
    max-width: min(90vw, 520px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- notice ---------------- */
.notice-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 70;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(31, 90, 73, .35);
    transition: transform .18s ease, box-shadow .18s ease;
}
.notice-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(31, 90, 73, .4); }
.notice-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    display: grid;
    place-items: center;
    border: 2px solid var(--bg);
}
.notice-card { max-width: 560px; }
.notice-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    background: #f3eee3;
    border-radius: 12px;
}
.notice-tabs button {
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}
.notice-tabs button.active {
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 3px 10px rgba(35, 64, 54, .08);
}
.notice-tabs.has-audit { grid-template-columns: repeat(3, 1fr); }
.notice-list { display: grid; gap: 8px; }
.notice-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffaf0;
}
.notice-item.unread { border-color: rgba(217, 119, 87, .4); background: #fff4ee; }
.notice-type {
    flex: 0 0 auto;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    background: #e2f3ea;
    color: #1f6a4f;
}
.notice-type.audit { background: #fff1d6; color: #a86a12; }
.notice-body { min-width: 0; flex: 1; }
.notice-text { font-size: 14px; line-height: 1.6; word-break: break-word; }
.notice-time { margin-top: 4px; color: var(--muted); font-size: 11px; }

.audit-item { display: block; }
.audit-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
}
.audit-meta strong { color: var(--ink); font-size: 13px; }
.audit-parent {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f7f2e7;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}
.audit-actions { display: flex; gap: 8px; margin-top: 10px; }

.hidden { display: none !important; }

#appendMsgBox { display: none !important; }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
    .layout { grid-template-columns: minmax(0, 1fr); }
    .sidebar { order: 2; }
    .hero-card { grid-template-columns: 1fr; padding: 36px; gap: 26px; }
    .entry-card { max-width: 520px; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .header-inner { height: 60px; }
    .nav { display: none; }
    .hero-card { padding: 26px 22px; border-radius: 22px; }
    .hero p { font-size: 14px; }
    .hero-stats { gap: 18px; }
    .post-card { padding: 18px; }
    .feed-head h2 { font-size: 19px; }
    .modal { padding: 16px 12px 24px; }
    .modal-card { padding: 20px; max-height: calc(100vh - 40px); }
    .header-actions .btn span.long { display: none; }
    .notice-fab { right: 16px; bottom: 16px; width: 50px; height: 50px; }
}
