*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', 'Helvetica Neue', sans-serif;

    --c-bg: #fafaf9;
    --c-surface: #ffffff;
    --c-text: #1a1a1a;
    --c-text2: #666666;
    --c-text3: #aaaaaa;
    --c-border: #e8e8e8;
    --c-border2: #f0f0f0;
    --c-accent: #e8734a;
    --c-accent-soft: rgba(232,115,74,0.08);
    --c-hover: #f5f5f5;
    --c-danger: #e85d4a;
    --c-success: #4caf50;

    --r: 10px;
    --r-lg: 16px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode {
    --c-bg: #111111;
    --c-surface: #1a1a1a;
    --c-text: #e8e8e8;
    --c-text2: #888888;
    --c-text3: #555555;
    --c-border: #2a2a2a;
    --c-border2: #222222;
    --c-accent: #f0a070;
    --c-accent-soft: rgba(240,160,112,0.1);
    --c-hover: #222222;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
}

.header-inner {
    max-width: 640px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1.5px solid var(--c-accent);
    color: var(--c-accent);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.01em;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-surface);
    color: var(--c-text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
}

.icon-btn:hover { border-color: var(--c-text3); color: var(--c-text); }

.icon-sun { display: block; }
.icon-moon { display: none; }
body.light-mode .icon-sun { display: none; }
body.light-mode .icon-moon { display: block; }
body.dark-mode .icon-sun { display: block; }
body.dark-mode .icon-moon { display: none; }

/* ===== Main ===== */
.main {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 20px 100px;
}

/* ===== Tabs ===== */
.tab-bar {
    display: flex;
    gap: 4px;
}

.tab {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: none;
    color: var(--c-text3);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s var(--ease);
    line-height: 1;
}

.tab:hover { color: var(--c-text2); }

.tab.on {
    color: var(--c-accent);
}

.tab.on svg { opacity: 1; stroke: var(--c-accent); }

/* ===== Skeleton ===== */
.sk-list { display: flex; flex-direction: column; gap: 1px; background: var(--c-border); border: 1px solid var(--c-border); border-radius: var(--r); overflow: hidden; }

.sk {
    background: var(--c-surface);
    padding: 20px;
}

.sk-line {
    height: 12px;
    border-radius: 4px;
    background: var(--c-border2);
    animation: sk-pulse 1.2s ease-in-out infinite;
}

.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; height: 10px; margin-top: 10px; }
.sk-line.w80 { width: 80%; margin-top: 8px; }
.sk-line.w90 { width: 90%; margin-top: 4px; }

@keyframes sk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Text List ===== */
.txt-list {
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r);
    overflow: hidden;
}

.txt-item {
    padding: 18px 20px;
    border-bottom: 1px solid var(--c-border);
    transition: background 0.15s var(--ease);
}

.txt-item:last-child { border-bottom: none; }
.txt-item:hover { background: var(--c-hover); }

.txt-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.txt-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    color: var(--c-accent);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--c-accent-soft);
}

.txt-nick {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
}

.txt-meta {
    font-size: 12px;
    color: var(--c-text3);
    margin-left: auto;
}

.txt-body {
    font-size: 15px;
    line-height: 1.7;
    color: var(--c-text);
    word-break: break-word;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.img-post {
    margin-bottom: 12px;
}

.img-post img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

.txt-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.abtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--c-text3);
    font-family: var(--sans);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.abtn svg { width: 14px; height: 14px; }

.abtn:hover { background: var(--c-border2); color: var(--c-text2); }
.abtn:active { transform: scale(0.96); }
.abtn:disabled { opacity: 0.3; cursor: not-allowed; }

.abtn.liked { color: var(--c-accent); background: var(--c-accent-soft); }

/* ===== Hot List (mixed) ===== */
.hot-list {
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r);
    overflow: hidden;
}

.hot-item {
    padding: 18px 20px;
    border-bottom: 1px solid var(--c-border);
    transition: background 0.15s var(--ease);
}

.hot-item:last-child { border-bottom: none; }
.hot-item:hover { background: var(--c-hover); }

.hot-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}

.hot-badge.img { background: var(--c-accent-soft); color: var(--c-accent); }
.hot-badge.txt { background: var(--c-border2); color: var(--c-text2); }

/* ===== Replies ===== */
.replies { overflow: hidden; }

.replies-inner {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--c-border);
}

.rpl {
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--c-border2);
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--c-text2);
}

.rpl:last-child { margin-bottom: 0; }

.rpl-head {
    font-size: 11px;
    color: var(--c-text3);
    margin-bottom: 2px;
}

.rpl-nick { font-weight: 600; color: var(--c-accent); margin-right: 4px; }

.rpl-row {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--c-border);
}

.rpl-input {
    flex: 1;
    font-family: var(--sans);
    font-size: 13px;
    padding: 7px 10px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text);
    outline: none;
    transition: border-color 0.15s var(--ease);
}

.rpl-input:focus { border-color: var(--c-accent); }

.rpl-send {
    padding: 7px 14px;
    border: 1px solid var(--c-accent);
    border-radius: 6px;
    background: transparent;
    color: var(--c-accent);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    white-space: nowrap;
}

.rpl-send:hover { background: var(--c-accent); color: #fff; }
.rpl-send:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== Empty ===== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text3);
    border: 1px solid var(--c-border);
    border-radius: var(--r);
    background: var(--c-surface);
}

.empty svg { width: 36px; height: 36px; margin: 0 auto 12px; opacity: 0.3; }
.empty p { font-size: 14px; }
.empty .sub { font-size: 12px; margin-top: 4px; }

/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border: 1px solid var(--c-accent);
    border-radius: 12px;
    background: var(--c-surface);
    color: var(--c-accent);
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}

.fab:hover { background: var(--c-accent); color: #fff; transform: translateY(-2px); }
.fab:active { transform: scale(0.95); }

/* ===== Modal ===== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s var(--ease);
}

.modal-mask.show { opacity: 1; visibility: visible; }

.modal-box {
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-bottom: none;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s var(--ease);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.modal-mask.show .modal-box { transform: translateY(0); }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border);
}

.modal-head h2 { font-size: 15px; font-weight: 700; }

.modal-x {
    width: 28px;
    height: 28px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: transparent;
    color: var(--c-text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
}

.modal-x:hover { border-color: var(--c-text3); color: var(--c-text); }

.modal-body { padding: 16px 20px 24px; }

/* ===== Pills ===== */
.pills {
    display: flex;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.pill {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-right: 1px solid var(--c-border);
    background: var(--c-surface);
    color: var(--c-text3);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.pill:last-child { border-right: none; }
.pill:hover { background: var(--c-hover); color: var(--c-text2); }

.pill.on {
    background: var(--c-accent-soft);
    color: var(--c-accent);
}

/* ===== Fields ===== */
.fld {
    margin-bottom: 12px;
    position: relative;
}

.fld input,
.fld textarea {
    width: 100%;
    font-family: var(--sans);
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-surface);
    color: var(--c-text);
    outline: none;
    transition: border-color 0.15s var(--ease);
}

.fld input::placeholder,
.fld textarea::placeholder { color: var(--c-text3); }

.fld input:focus,
.fld textarea:focus { border-color: var(--c-accent); }

.fld input.err,
.fld textarea.err { border-color: var(--c-danger); }

.fld textarea { resize: vertical; min-height: 100px; line-height: 1.7; }

.fld-icon {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease);
}

.fld-icon:hover { border-color: var(--c-accent); color: var(--c-accent); }

.fld-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 12px;
    color: var(--c-text3);
}

.fld-foot .warn { color: var(--c-accent); }
.fld-foot .err { color: var(--c-danger); }

.fld-hint { font-size: 12px; color: var(--c-text3); margin-top: 4px; }

.img-prev {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--c-border);
    display: none;
}

.img-prev img { width: 100%; max-height: 160px; object-fit: cover; display: block; }
.img-prev.show { display: block; }

.submit-btn {
    width: 100%;
    padding: 10px 0;
    border: 1px solid var(--c-accent);
    border-radius: 8px;
    background: transparent;
    color: var(--c-accent);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.submit-btn:hover { background: var(--c-accent); color: #fff; }
.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-spin { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Pagination ===== */
.pg-info {
    text-align: center;
    font-size: 12px;
    color: var(--c-text3);
    margin-top: 12px;
}

.pg-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
}

.pg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    color: var(--c-text2);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.pg:hover:not(.on):not(:disabled) { border-color: var(--c-text3); color: var(--c-text); }
.pg.on { border-color: var(--c-accent); color: var(--c-accent); background: var(--c-accent-soft); }
.pg:disabled { opacity: 0.25; cursor: not-allowed; }
.pg-dots { width: 28px; text-align: center; color: var(--c-text3); font-size: 12px; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s var(--ease);
    pointer-events: none;
}

.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.toast-pill {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--c-border);
    background: var(--c-surface);
    font-size: 13px;
    color: var(--c-text);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.toast.ok .toast-pill { border-color: var(--c-success); color: var(--c-success); }
.toast.err .toast-pill { border-color: var(--c-danger); color: var(--c-danger); }

/* ===== BTT ===== */
.btt {
    position: fixed;
    bottom: 24px;
    right: 82px;
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    background: var(--c-surface);
    color: var(--c-text3);
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btt.show { opacity: 1; visibility: visible; transform: translateY(0); }
.btt:hover { border-color: var(--c-text3); color: var(--c-text); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .main { padding: 12px 12px 100px; }
    .tab { padding: 6px 8px; font-size: 13px; }
    .fab { bottom: 16px; right: 16px; width: 44px; height: 44px; }
    .btt { right: 70px; bottom: 16px; width: 32px; height: 32px; }
    .modal-box { max-width: 100%; }
}

::selection { background: rgba(232,115,74,0.15); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 2px; }

.hidden { display: none !important; }
