/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-nav: rgba(15,15,26,.92);
    --text: #e0e0e0;
    --text-dim: #888;
    --accent: #7c5cfc;
    --accent-light: #a78bfa;
    --border: #2a2a40;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,.3);
    --tabbar-height: 64px;
}

html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    background: #0f0f1a;
    background: var(--bg);
    color: #e0e0e0;
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 64px;
    padding-bottom: var(--tabbar-height);
}

a { color: #a78bfa; color: var(--accent-light); text-decoration: none; }
a:hover { color: #c4b5fd; }

img { max-width: 100%; height: auto; border-radius: 8px; }

/* ===== Header ===== */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(15,15,26,.92);
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #2a2a40;
    border-bottom: 1px solid var(--border);
    text-align: center;
    padding: 14px 16px;
}
.header-brand {
    font-size: 17px; font-weight: 700; color: #e0e0e0;
    color: var(--text);
    letter-spacing: .3px;
}

/* ===== Container ===== */
.container {
    max-width: 640px; margin: 0 auto; padding: 16px;
    min-height: calc(100vh - 140px);
}

/* ===== Home — Post List ===== */
.post-list { display: flex; flex-direction: column; gap: 12px; }

.post-card {
    background: #1a1a2e; background: var(--bg-card);
    border-radius: 12px; border-radius: var(--radius);
    padding: 18px; border: 1px solid #2a2a40;
    border: 1px solid var(--border);
    cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.post-card:active { transform: scale(.98); }
.post-card .meta {
    font-size: 12px; color: #888; color: var(--text-dim);
    display: flex; gap: 10px; margin-bottom: 6px;
}
.post-card .meta .tag {
    background: rgba(124,92,252,.15); color: #a78bfa;
    color: var(--accent-light);
    padding: 1px 8px; border-radius: 10px; font-size: 11px;
}
.post-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.post-card p {
    font-size: 13px; color: #888; color: var(--text-dim);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Post Detail ===== */
.post-detail { animation: fadeIn .3s ease; }
.post-detail .back-btn {
    display: inline-flex; align-items: center; gap: 4px;
    color: #888; color: var(--text-dim);
    font-size: 14px; margin-bottom: 16px; cursor: pointer;
    background: none; border: none; padding: 4px 0;
}
.post-detail .back-btn:hover { color: #a78bfa; color: var(--accent-light); }
.post-detail .post-header { margin-bottom: 20px; }
.post-detail .post-header h1 {
    font-size: 22px; font-weight: 700; line-height: 1.35; margin-bottom: 8px;
}
.post-detail .post-header .meta {
    font-size: 13px; color: #888; color: var(--text-dim);
    display: flex; flex-wrap: wrap; gap: 10px;
}
.post-detail .post-header .meta .tag {
    background: rgba(124,92,252,.15); color: #a78bfa;
    color: var(--accent-light);
    padding: 1px 8px; border-radius: 10px; font-size: 11px;
}
.post-detail .post-body {
    font-size: 15px; line-height: 1.8; color: #e0e0e0;
    color: var(--text);
}
.post-detail .post-body h2 { font-size: 19px; margin: 24px 0 10px; }
.post-detail .post-body h3 { font-size: 17px; margin: 20px 0 8px; }
.post-detail .post-body p { margin-bottom: 14px; }
.post-detail .post-body ul, .post-detail .post-body ol { margin: 0 0 14px 20px; }
.post-detail .post-body li { margin-bottom: 6px; }
.post-detail .post-body code {
    background: #232340; padding: 2px 6px; border-radius: 4px;
    font-size: 13px; font-family: "JetBrains Mono", "Fira Code", monospace;
}
.post-detail .post-body pre {
    background: #0a0a14; border: 1px solid #2a2a40;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px; overflow-x: auto; margin-bottom: 14px;
}
.post-detail .post-body pre code {
    background: none; padding: 0; font-size: 13px;
}
.post-detail .post-body blockquote {
    border-left: 3px solid #7c5cfc; border-left: 3px solid var(--accent);
    padding-left: 14px; color: #888; color: var(--text-dim);
    margin-bottom: 14px;
}

/* ===== Blog (Archive) ===== */
.archive-list { display: flex; flex-direction: column; gap: 12px; }
.archive-item {
    background: #1a1a2e; background: var(--bg-card);
    border-radius: 12px; border-radius: var(--radius);
    padding: 14px 18px; border: 1px solid #2a2a40;
    border: 1px solid var(--border);
    cursor: pointer; transition: transform .15s;
    display: flex; justify-content: space-between; align-items: center;
}
.archive-item:active { transform: scale(.98); }
.archive-item .title { font-size: 15px; flex: 1; }
.archive-item .date {
    font-size: 12px; color: #888; color: var(--text-dim);
    white-space: nowrap; margin-left: 12px;
}

/* ===== Projects ===== */
.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-card {
    background: #1a1a2e; background: var(--bg-card);
    border-radius: 12px; border-radius: var(--radius);
    padding: 18px; border: 1px solid #2a2a40;
    border: 1px solid var(--border);
    transition: transform .15s;
}
.project-card:active { transform: scale(.98); }
.project-card .project-icon {
    font-size: 28px; margin-bottom: 8px;
}
.project-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.project-card .project-desc {
    font-size: 13px; color: #888; color: var(--text-dim);
    line-height: 1.6;
}
.project-card .project-tags {
    display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.project-card .project-tags span {
    background: rgba(124,92,252,.15); color: #a78bfa;
    color: var(--accent-light);
    padding: 2px 10px; border-radius: 10px; font-size: 11px;
}

/* ===== About ===== */
.about-card {
    background: #1a1a2e; background: var(--bg-card);
    border-radius: 12px; border-radius: var(--radius);
    padding: 24px; border: 1px solid #2a2a40;
    border: 1px solid var(--border);
    text-align: center;
}
.about-card .avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #7c5cfc, #ec4899);
    background: linear-gradient(135deg, var(--accent), #ec4899);
    margin: 0 auto 16px; display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: #fff;
}
.about-card h2 { font-size: 20px; margin-bottom: 4px; }
.about-card .title-tag { color: #888; color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.about-card p { font-size: 14px; color: #888; color: var(--text-dim); line-height: 1.8; text-align: left; }

/* ===== Bottom Tab Bar ===== */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: rgba(15,15,26,.92);
    background: var(--bg-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #2a2a40;
    border-top: 1px solid var(--border);
    display: flex;
    height: 64px;
    height: var(--tabbar-height);
    /* 安全区域适配 */
    padding-bottom: constant(safe-area-inset-bottom, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    background: none; border: none; cursor: pointer;
    color: #888;
    color: var(--text-dim);
    font-size: 10px;
    transition: color .2s;
    -webkit-tap-highlight-color: transparent;
    padding: 6px 0;
    font-family: inherit;
}

.tab-item .tab-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform .2s;
}

.tab-item .tab-label {
    font-size: 10px;
    line-height: 1;
}

.tab-item.active {
    color: #a78bfa;
    color: var(--accent-light);
}

.tab-item.active .tab-icon {
    transform: scale(1.1);
}

.tab-item:active .tab-icon {
    transform: scale(.9);
}

/* ===== Back Top ===== */
.back-top {
    position: fixed; bottom: calc(64px + 12px); bottom: calc(var(--tabbar-height) + 12px);
    right: 20px;
    width: 42px; height: 42px; border-radius: 50%;
    background: #7c5cfc; background: var(--accent);
    color: #fff; border: none;
    font-size: 18px; cursor: pointer; opacity: 0; pointer-events: none;
    transition: opacity .3s, transform .2s;
    box-shadow: 0 2px 12px rgba(0,0,0,.3);
    box-shadow: var(--shadow);
    z-index: 99;
}
.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:active { transform: scale(.9); }

/* ===== Page Title ===== */
.page-title {
    font-size: 20px; font-weight: 700; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

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

/* ===== Desktop fine-tune ===== */
@media (min-width: 768px) {
    .header { padding: 16px; }
    .container { padding: 24px 16px; }
    .tabbar {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 16px 16px 0 0;
    }
    .back-top { bottom: calc(64px + 16px); bottom: calc(var(--tabbar-height) + 16px); right: calc(50% - 260px); }
}
