:root {
    --page: #ffffff;
    --text: #1f2329;
    --muted: #7b818a;
    --line: #e6e8eb;
    --wechat-blue: #576b95;
    --wechat-green: #07c160;
    --feedback: #f3f4f6;
    --danger: #c0392b;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    background: none;
    cursor: pointer;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(12px);
}

.brand {
    font-size: 17px;
    font-weight: 600;
    max-width: 46%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--wechat-blue);
    font-size: 14px;
}

.inline-form {
    margin: 0;
}

.inline-form button {
    color: var(--wechat-blue);
    padding: 0;
}

.top-camera {
    display: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f0f2f5;
    color: #252b35;
    font-size: 22px;
    line-height: 1;
}

.page {
    width: min(720px, 100%);
    margin: 0 auto 72px;
    background: #fff;
}

.moments-cover {
    position: relative;
    height: 260px;
    margin-bottom: 52px;
    background:
        radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.2), transparent 22%),
        linear-gradient(180deg, rgba(21, 30, 44, 0.08), rgba(12, 18, 26, 0.42)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='520' viewBox='0 0 900 520'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2397b6c3'/%3E%3Cstop offset='.48' stop-color='%23789276'/%3E%3Cstop offset='1' stop-color='%233d5d70'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='900' height='520' fill='url(%23g)'/%3E%3Cpath d='M0 390c90-58 152-72 244-46 97 27 148 89 249 71 90-16 141-92 235-93 71-1 122 30 172 75v123H0z' fill='%23edf1ee' fill-opacity='.44'/%3E%3Cpath d='M0 429c108-22 192-17 302 18 122 39 224 44 348 6 88-27 167-28 250-5v72H0z' fill='%23ffffff' fill-opacity='.34'/%3E%3C/svg%3E") center / cover;
}

.moments-cover::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 72px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.26));
}

.cover-shade {
    position: absolute;
    inset: 0;
    padding: 20px;
    z-index: 1;
}

.cover-title {
    position: absolute;
    left: 18px;
    bottom: 22px;
    color: #fff;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.28);
}

.cover-title h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 700;
}

.cover-title p {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.cover-profile {
    position: absolute;
    right: 14px;
    bottom: -38px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.cover-profile span {
    margin-bottom: 12px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.cover-profile img {
    width: 78px;
    height: 78px;
    border: 3px solid #fff;
    border-radius: 6px;
    object-fit: cover;
    background: #dde4e1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

.tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 10px;
    border-bottom: 1px solid var(--line);
}

.tabs a {
    padding: 5px 10px;
    border-radius: 4px;
    color: var(--wechat-blue);
    font-size: 14px;
}

.tabs a.active {
    background: #edf0f5;
    color: #253858;
    font-weight: 600;
}

.tabs .compose-tab {
    margin-left: auto;
    color: var(--wechat-green);
}

.post-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 15px 14px 13px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.detail-card {
    border-top: 1px solid var(--line);
}

.avatar,
.avatar img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 4px;
}

.avatar img {
    object-fit: cover;
    background: #dfe5e2;
}

.post-main {
    min-width: 0;
}

.post-author-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 22px;
}

.nickname {
    color: var(--wechat-blue);
    font-weight: 700;
}

.badge {
    padding: 1px 6px;
    border-radius: 3px;
    background: #f0f3f7;
    color: var(--muted);
    font-size: 12px;
}

.post-body,
.post-text {
    display: block;
    margin-top: 4px;
    color: #111;
    font-size: 15px;
    line-height: 1.48;
    word-break: break-word;
    white-space: pre-wrap;
}

.post-text a {
    display: block;
    color: #111;
    min-height: 1.4em;
}

.post-body.full {
    margin-bottom: 10px;
}

.text-only-body {
    margin-top: 5px;
    padding-right: 2px;
    color: #111;
    font-size: 16px;
    line-height: 1.62;
    min-height: 1.62em;
}

.text-only-post .moment-foot {
    margin-top: 10px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 82px);
    gap: 5px;
    margin-top: 8px;
}

.image-grid.count-1 {
    grid-template-columns: minmax(150px, 230px);
}

.image-grid a {
    display: block;
    overflow: hidden;
    width: 82px;
    height: 82px;
    background: #eef0f2;
}

.image-grid.count-1 a {
    width: min(230px, 100%);
    height: auto;
    aspect-ratio: 4 / 3;
}

.image-grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moment-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.moment-time {
    color: var(--muted);
}

.moment-actions {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.more-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 22px;
    border-radius: 3px;
    background: #f0f2f5;
    color: var(--wechat-blue);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 1px;
}

.moment-tools {
    position: absolute;
    right: 36px;
    top: 50%;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    min-height: 28px;
    padding: 0 4px;
    border-radius: 4px;
    background: #4c5665;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(6px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

.moment-tools::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    margin-top: -6px;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #4c5665;
}

.moment-tools.is-open,
.moment-actions:hover .moment-tools,
.moment-actions:focus-within .moment-tools {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.moment-tools form {
    margin: 0;
}

.moment-tools button,
.moment-tools a {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 9px;
    color: #fff;
    white-space: nowrap;
}

.moment-tools button:hover,
.moment-tools a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.moment-feedback {
    position: relative;
    margin-top: 8px;
    padding: 7px 9px;
    background: var(--feedback);
    color: #30343b;
    font-size: 14px;
}

.moment-feedback p + p {
    border-top: 1px solid #e5e7eb;
    padding-top: 4px;
}

.moment-feedback::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 14px;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--feedback);
    border-left: 6px solid transparent;
}

.moment-feedback p {
    margin: 2px 0;
}

.moment-feedback strong,
.likes-line {
    color: var(--wechat-blue);
}

.panel {
    margin: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.compose-panel {
    min-height: calc(100vh - 46px);
    padding: 18px 14px 90px;
    background: #fff;
}

.compose-form {
    display: grid;
    gap: 14px;
}

.compose-author {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wechat-blue);
    font-weight: 700;
}

.compose-author img {
    width: 42px;
    height: 42px;
    border-radius: 4px;
    object-fit: cover;
    background: #dfe5e2;
}

.compose-form textarea {
    min-height: 170px;
    padding: 4px 0;
    border: 0;
    border-radius: 0;
    outline: none;
    font-size: 18px;
    line-height: 1.58;
}

.compose-form textarea::placeholder {
    color: #b2b6bd;
}

.upload-preview {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    gap: 7px;
}

.upload-preview:empty {
    display: none;
}

.upload-preview div,
.upload-box {
    width: 80px;
    height: 80px;
    background: #f0f1f3;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.upload-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9aa0a8;
    font-size: 38px;
}

.upload-box input {
    display: none;
}

.compose-options {
    display: grid;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.compose-options label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    color: #222;
}

.compose-options label + label {
    border-top: 1px solid var(--line);
}

.compose-options select {
    width: auto;
    min-width: 124px;
    padding: 0 22px 0 0;
    border: 0;
    color: var(--muted);
    text-align: right;
}

.switch-line input {
    width: 20px;
    height: 20px;
    accent-color: var(--wechat-green);
}

.publish-button {
    justify-self: end;
    min-width: 72px;
    height: 34px;
    border-radius: 4px;
    background: var(--wechat-green);
    color: #fff;
}

.panel h1,
.panel h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.stack-form label {
    display: grid;
    gap: 6px;
}

.stack-form span,
.muted {
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid #d8dce2;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: auto;
}

.primary-link,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 4px;
    background: var(--wechat-green);
    color: #fff;
}

.auth-panel {
    width: min(420px, calc(100% - 28px));
    margin: 32px auto;
}

.closed-register {
    display: grid;
    gap: 10px;
    padding: 12px 0 4px;
}

.closed-register strong {
    font-size: 18px;
}

.closed-register p {
    margin: 0;
    color: var(--muted);
}

.alert {
    margin: 10px 14px;
    padding: 9px 11px;
    border-radius: 4px;
}

.alert.success {
    color: #0b5d35;
    background: #e6f4ea;
}

.alert.error {
    color: var(--danger);
    background: #fce8e6;
}

.empty {
    padding: 42px 16px;
    text-align: center;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.comment-form input {
    flex: 1;
}

.comment-form button {
    flex: 0 0 auto;
    border-radius: 4px;
    background: var(--wechat-green);
    color: #fff;
    padding: 0 12px;
}

.comment-list {
    display: grid;
    gap: 0;
}

.comment-item {
    display: grid;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.comment-item strong {
    color: var(--wechat-blue);
}

.comment-item time {
    color: var(--muted);
    font-size: 12px;
}

.user-cover {
    margin-bottom: 48px;
}

.user-bio {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px 14px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.user-bio p {
    margin: 2px 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 14px;
}

.stats div {
    display: grid;
    gap: 2px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.stats strong {
    font-size: 24px;
}

.stats span {
    color: var(--muted);
}

.settings-form {
    display: grid;
    gap: 14px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.setting-row span {
    display: grid;
    gap: 4px;
}

.setting-row em {
    color: var(--muted);
    font-style: normal;
    font-size: 13px;
}

.setting-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 46px;
    height: 26px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: #d8dde5;
    padding: 0;
    position: relative;
    cursor: pointer;
    transition: background 0.16s ease;
}

.setting-row input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    transition: transform 0.16s ease;
}

.setting-row input[type="checkbox"]:checked {
    background: var(--wechat-green);
}

.setting-row input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 9px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
}

td form {
    margin: 0;
}

td button {
    color: var(--wechat-blue);
    padding: 0;
}

.bottomnav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 14px;
    z-index: 22;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    width: min(520px, calc(100% - 32px));
    min-height: 62px;
    padding: 6px;
    border: 1px solid rgba(225, 229, 235, 0.9);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    text-align: center;
    font-size: 12px;
    box-shadow: 0 10px 32px rgba(31, 35, 41, 0.12);
    backdrop-filter: blur(16px);
    transform: translateX(-50%);
}

.bottomnav a {
    display: grid;
    align-content: center;
    justify-items: center;
    min-height: 50px;
    border-radius: 16px;
    color: #535b66;
    transition: color 0.16s ease, background 0.16s ease;
}

.bottomnav a.active {
    color: var(--wechat-green);
    background: #edf9f2;
}

.bottomnav .publish {
    color: var(--wechat-green);
    font-weight: 700;
}

.bottomnav .publish .tab-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    border-radius: 13px;
    background: var(--wechat-green);
    color: #fff;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.22);
}

.bottomnav .publish.active {
    background: #edf9f2;
}

.tab-icon {
    position: relative;
    display: block;
    width: 24px;
    height: 24px;
    margin: 0 auto 3px;
}

.icon-home::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 8px;
    width: 16px;
    height: 12px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 2px;
}

.icon-home::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 3px;
    width: 14px;
    height: 14px;
    border-left: 2px solid currentColor;
    border-top: 2px solid currentColor;
    transform: rotate(45deg);
}

.icon-follow::before,
.icon-follow::after {
    content: "";
    position: absolute;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.icon-follow::before {
    left: 3px;
    top: 5px;
    width: 10px;
    height: 10px;
}

.icon-follow::after {
    right: 2px;
    top: 4px;
    width: 8px;
    height: 8px;
}

.icon-me::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.icon-me::after {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 2px;
    width: 16px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 10px 10px 3px 3px;
}

.icon-plus {
    width: 30px;
    height: 30px;
    margin-top: -3px;
}

.icon-plus::before,
.icon-plus::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.icon-plus::before {
    width: 18px;
    height: 2px;
}

.icon-plus::after {
    width: 2px;
    height: 18px;
}

@media (min-width: 760px) {
    body {
        background: #eef0f3;
    }

    .page {
        min-height: calc(100vh - 46px);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
        margin-bottom: 98px;
    }
}

@media (max-width: 640px) {
    .topnav {
        display: none;
    }

    .brand {
        max-width: 70%;
    }

    .top-camera {
        display: inline-flex;
    }

    .moments-cover {
        height: 238px;
    }

    .cover-title h1 {
        font-size: 23px;
    }

    .image-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: min(267px, 100%);
    }

    .image-grid a {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .image-grid.count-1 {
        width: 72%;
        min-width: 180px;
    }

    .moment-tools {
        gap: 0;
    }

    .upload-preview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .upload-preview div,
    .upload-box {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .bottomnav {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        min-height: 62px;
        padding: 5px 10px max(5px, env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 0;
        box-shadow: 0 -6px 18px rgba(22, 28, 36, 0.06);
        transform: none;
    }

    .bottomnav a {
        min-height: 52px;
        border-radius: 14px;
    }

    .bottomnav .publish {
        transform: none;
    }

    .bottomnav .publish .tab-icon {
        width: 34px;
        height: 34px;
        border-radius: 12px;
        box-shadow: 0 4px 10px rgba(7, 193, 96, 0.18);
    }

    .bottomnav .publish span:last-child {
        color: var(--wechat-green);
    }

    .setting-row {
        align-items: flex-start;
    }
}
