* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root {
    --bg: #f3f4f7;
    --card: #ffffff;
    --line: #e9ebf0;
    --line-soft: #f1f3f6;
    --text: #1f2937;
    --text-2: #4b5563;
    --text-3: #8b95a7;
    --primary: #ff8200;
    --primary-soft: #fff2e8;
    --success: #16a34a;
    --danger: #ef4444;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, .05);
}
body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.app-shell {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    border-left: 1px solid #111;
    border-right: 1px solid #111;
    position: relative;
}
.app-shell::before {
    content: "";
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: min(100vw, 760px);
    height: 100vh;
    background: linear-gradient(180deg, rgba(255,255,255,.36), rgba(255,255,255,0));
    pointer-events: none;
    z-index: 0;
}
.app, .page-wrap { width: 100%; max-width: 720px; margin: 0 auto; min-height: 100vh; padding: 0 12px 14px; position: relative; z-index: 1; }
.icon { display: inline-flex; align-items: center; justify-content: center; margin-right: 6px; line-height: 1; }
.icon-svg { width: 16px; height: 16px; display: block; stroke: currentColor; }
.topbar-left .icon-svg { width: 18px; height: 18px; }
.search-icon .icon-svg { width: 15px; height: 15px; color: #9ca3af; }
.icon-only { margin-right: 0; }
.title-with-icon,
.desc-with-icon,
.btn-with-icon,
.nav-with-icon,
.action-with-icon { display: inline-flex; align-items: center; }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.section-heading .panel-title,
.section-heading .form-title,
.section-heading .hero-title { margin: 0; }
.topbar {
    position: relative; top: 0; z-index: 20; height: 60px; background: #f8fbff;
    border-bottom: 1px solid #111; display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px; gap: 10px;
    margin: 0 -12px 12px;
}
.topbar.is-scrolled { box-shadow: none; }
.topbar-left { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 18px; border-radius: 10px; }
.topbar-center { flex: 1; min-width: 0; }
.topbar-right { flex: 0 0 auto; }
.searchbar-form { margin: 0; }
.searchbar {
    width: 100%; height: 40px; border-radius: 8px; background: #ffffff; color: var(--text-3);
    display: flex; align-items: center; padding: 0 12px; overflow: hidden; border: 1px solid #cddcf5;
    transition: background .2s ease, border-color .2s ease;
}
.searchbar:focus-within { background: #fff; border-color: #7eaef8; }
.searchbar input { width: 100%; border: 0; outline: none; background: transparent; color: var(--text); font-size: 13px; }
.search-icon { margin-right: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.hero {
    background: linear-gradient(180deg, #ff8d4d 0%, #ff7f34 100%); color: #fff; padding: 18px 16px 20px;
    position: relative; overflow: hidden; border-radius: 10px; margin-top: 14px; box-shadow: 0 8px 18px rgba(255, 130, 0, .14);
}
.hero::before, .hero::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none; opacity: .22; filter: blur(6px);
    animation: heroFloat 10s ease-in-out infinite;
}
.hero::before { width: 160px; height: 160px; right: -40px; top: -50px; background: radial-gradient(circle, rgba(255,255,255,.85), rgba(255,255,255,0)); }
.hero::after { width: 140px; height: 140px; left: -35px; bottom: -50px; background: radial-gradient(circle, rgba(255,214,180,.9), rgba(255,214,180,0)); animation-delay: -4s; }
.hero-title { font-size: 24px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.2px; }
.hero-desc { margin: 0; font-size: 13px; line-height: 1.75; color: rgba(255,255,255,.92); max-width: 92%; }
.stats { display: flex; gap: 10px; margin-top: 14px; }
.stat { flex: 1; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 12px; animation: statPulse 5s ease-in-out infinite; }
.stat:nth-child(2) { animation-delay: -1.4s; }
.stat:nth-child(3) { animation-delay: -2.8s; }
.stat strong { display: block; font-size: 18px; margin-bottom: 2px; }
.stat span { font-size: 12px; color: rgba(255,255,255,.88); }
.authbar, .card, .loading-box, .panel { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(15, 23, 42, .04); }
.auth-row, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.auth-meta { flex: 1; min-width: 0; }
.auth-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.auth-tip, .muted { font-size: 13px; color: var(--text-3); }
.auth-actions, .row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.avatar {
    width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #ffd7c2, #ffb88f);
    color: #9c4b1e; display: grid; place-items: center; font-weight: 700; flex: 0 0 40px; box-shadow: inset 0 1px 0 rgba(255,255,255,.45);
}
.btn {
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    min-height: 38px;
    min-width: 72px;
    transition: transform .15s ease, opacity .2s ease, background .2s ease, box-shadow .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}
.btn:active { transform: scale(.97); }
.btn-light { background: #f4f5f7; color: var(--text-2); border: 1px solid #e7eaf0; }
.btn-primary { background: var(--primary); color: #fff; font-weight: 700; box-shadow: 0 8px 18px rgba(255,130,0,.2); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-post { min-height: 34px; min-width: 68px; padding: 0 12px; font-size: 13px; }
.tabs {
    margin-top: 10px; background: transparent;
    display: flex; align-items: center; overflow-x: auto; white-space: nowrap; gap: 8px; padding: 2px 0 4px;
}
.tab { padding: 10px 14px; font-size: 14px; color: var(--text-2); position: relative; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.tab.active { color: var(--primary); font-weight: 700; background: var(--primary-soft); border-color: #ffd8bb; }
.tab.active::after { display: none; }
.tab .icon { margin-right: 5px; }
.feed { padding-top: 10px; }
.post {
    background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 12px;
    opacity: 0; transform: translateY(18px); animation: cardIn .5s ease forwards;
    box-shadow: 0 1px 6px rgba(15, 23, 42, .03);
}
.post-head { display: flex; align-items: flex-start; gap: 10px; }
.post-user { flex: 1; min-width: 0; }
.post-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.name { font-size: 15px; font-weight: 700; color: var(--text); }
.tag { font-size: 12px; color: var(--primary); background: var(--primary-soft); border-radius: 4px; padding: 3px 8px; }
.meta { font-size: 12px; color: var(--text-3); }
.more { color: #999; font-size: 18px; line-height: 1; padding: 4px; }
.post-title { margin: 12px 0 8px; font-size: 17px; color: var(--text); letter-spacing: -.1px; }
.post-title a { color: var(--text); }
.post-content { margin: 0; font-size: 15px; line-height: 1.85; color: var(--text-2); word-break: break-word; }
.post-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}
.action {
    border: 1px solid #eceff4;
    background: #fafbfc;
    color: var(--text-2);
    font-size: 13px;
    padding: 0 12px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action.liked { color: var(--primary); font-weight: 700; background: var(--primary-soft); border-color: #ffd8bb; }
.loading-box, .footer-tip { text-align: center; color: #999; font-size: 12px; }
.loading-box { display: none; border-style: dashed; background: #fffdfb; }
.loading-box.show { display: block; }
.loading-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #ff8200; margin: 0 3px; animation: loadingDots 1s infinite ease-in-out; vertical-align: middle; }
.loading-dot:nth-child(2) { animation-delay: .15s; }
.loading-dot:nth-child(3) { animation-delay: .3s; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 80; opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s ease; }
.modal-mask.show { opacity: 1; visibility: visible; }
.editor-modal {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: #fff; border-radius: 10px 10px 0 0;
    transform: translateY(100%); transition: transform .26s ease; box-shadow: 0 -8px 30px rgba(0,0,0,.14); max-height: 88vh;
    display: flex; flex-direction: column;
}
.editor-modal.show { transform: translateY(0); }
.editor-head { height: 54px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.editor-title { font-size: 16px; font-weight: 700; color: #222; }
.editor-close { border: 0; background: none; color: #666; font-size: 22px; padding: 0 4px; cursor: pointer; }
.editor-body { padding: 16px; overflow: auto; }
.editor-foot { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 8px; background: #fff; }
.field + .field { margin-top: 10px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .textarea, .select {
    width: 100%; border: 1px solid #e7eaf0; border-radius: 8px; background: #f9fafb; outline: none; color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input, .select { height: 44px; padding: 0 14px; }
.textarea { min-height: 150px; padding: 13px 14px; resize: vertical; line-height: 1.75; }
.input:focus, .textarea:focus, .select:focus { border-color: #ffb067; box-shadow: 0 0 0 4px rgba(255, 130, 0, .08); background: #fff; }
.form-page { max-width: 520px; margin: 0 auto; padding: 20px 14px 30px; }
.form-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 22px; margin-top: 18px; box-shadow: 0 2px 8px rgba(15, 23, 42, .04); }
.form-title { margin: 0 0 8px; font-size: 22px; color: var(--text); }
.form-desc { margin: 0 0 16px; color: var(--text-3); font-size: 13px; line-height: 1.75; }
.alert { padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.install-shell { max-width: 900px; margin: 0 auto; padding: 20px 14px 40px; }
.install-header { background: linear-gradient(180deg, #ff8d4d 0%, #ff7f34 100%); color: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 8px 18px rgba(255, 130, 0, .14); }
.install-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
.panel-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; color: var(--text); }
.panel-desc { font-size: 13px; color: var(--text-3); line-height: 1.7; margin: 0 0 14px; }
.admin-shell { max-width: 1120px; margin: 0 auto; padding: 16px; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 16px; }
.admin-nav a { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; color: var(--text-2); font-weight: 600; box-shadow: 0 1px 4px rgba(15, 23, 42, .03); }
.admin-nav a.active { color: var(--primary); border-color: #ffd1ac; background: #fff7ef; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(15, 23, 42, .03); }
.stat-card strong { display: block; font-size: 24px; color: var(--text); margin-bottom: 4px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 4px rgba(15, 23, 42, .03); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 13px; vertical-align: middle; }
th { color: var(--text-2); background: #fafbfc; }
.badge { display: inline-block; border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.badge-admin { background: #fff7ed; color: #c2410c; }
.badge-user { background: #eff6ff; color: #1d4ed8; }
.badge-off { background: #f3f4f6; color: #6b7280; }
.empty-tip { text-align: center; color: var(--text-3); padding: 18px; }
.switch-form { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; }
.toggle-switch {
    appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 24px;
    background: #d1d5db; position: relative; cursor: pointer; border: 0; outline: none;
    transition: background .2s ease;
}
.toggle-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); transition: transform .2s ease;
}
.toggle-switch:checked { background: #22c55e; }
.toggle-switch:checked::after { transform: translateX(18px); }
.bottom-nav {
    position: relative;
    z-index: 10;
    margin: 14px auto 0;
    width: min(100%, 720px);
    background: #f8fbff;
    border-top: 1px solid #111;
    border-bottom: 1px solid #111;
    border-radius: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px 6px;
    box-shadow: none;
}
.bottom-nav-item {
    min-height: 52px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 600;
}
.bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
}
.bottom-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}
.bottom-nav-icon .icon-svg {
    width: 18px;
    height: 18px;
}
@keyframes heroFloat { 0%,100%{transform:translate3d(0,0,0) scale(1);} 50%{transform:translate3d(0,-8px,0) scale(1.04);} }
@keyframes statPulse { 0%,100%{transform:translateY(0);background:rgba(255,255,255,.16);} 50%{transform:translateY(-1px);background:rgba(255,255,255,.2);} }
@keyframes cardIn { from{opacity:0;transform:translateY(18px);} to{opacity:1;transform:translateY(0);} }
@keyframes loadingDots { 0%,80%,100%{transform:scale(.7);opacity:.45;} 40%{transform:scale(1);opacity:1;} }
@media (max-width: 780px) {
    .app, .page-wrap { padding-left: 10px; padding-right: 10px; }
    .stat-grid, .grid-2 { grid-template-columns: 1fr; }
    .panel-head,
    .auth-row {
        align-items: flex-start;
        flex-direction: column;
    }
    .auth-actions,
    .row-actions {
        width: 100%;
    }
    .row-actions .btn,
    .auth-actions .btn {
        flex: 1 1 auto;
    }
    th, td {
        padding: 12px 10px;
        font-size: 12px;
    }
    .post-footer {
        flex-wrap: wrap;
    }
    .post-footer .action {
        flex: 1 1 calc(50% - 10px);
    }
    .admin-nav a {
        flex: 1 1 calc(50% - 10px);
        justify-content: center;
    }
    .hero-desc { max-width: 100%; }
    .topbar { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
    .bottom-nav {
        bottom: 8px;
    }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
