/* ============================================================
   土豆的信息小屋 - 共享样式
   现代编辑风格：暖纸底色、墨色文字、单一强调色
   ============================================================ */

:root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --ink: #17171c;
    --ink-2: #4b4b55;
    --ink-3: #8a8a94;
    --line: rgba(var(--ink-rgb), 0.08);
    --accent: #4f46e5;
    --accent-soft: rgba(79, 70, 229, 0.08);
    --accent-ink: #4338ca;
    --rose: #e11d48;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(var(--ink-rgb), 0.05);
    --shadow-md: 0 4px 16px rgba(var(--ink-rgb), 0.08);
    --shadow-lg: 0 12px 40px rgba(var(--ink-rgb), 0.14);
    --ink-rgb: 23, 23, 28;
    --on-ink: #ffffff;
    --header-bg: rgba(247, 246, 243, 0.82);
    --img-bg: #eceae6;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--accent); color: #fff; }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--line);
}

.site-header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--on-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.header-date {
    font-size: 13px;
    color: var(--ink-3);
    white-space: nowrap;
}

.header-spacer { flex: 1; }

/* 分段式导航 */
.nav-pills {
    display: flex;
    gap: 4px;
    background: rgba(var(--ink-rgb), 0.05);
    padding: 4px;
    border-radius: 999px;
}

.nav-pills a {
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

/* 周报入口新刊红点 */
#nav-weekly { position: relative; }
.weekly-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e5484d;
}

.nav-pills a:hover { color: var(--ink); }

.nav-pills a.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    border: 1px solid var(--line);
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.header-nickname {
    font-size: 13px;
    color: var(--ink-2);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 详情页返回按钮 */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    background: rgba(var(--ink-rgb), 0.05);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.back-btn:hover { background: rgba(var(--ink-rgb), 0.09); color: var(--ink); }

.header-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-2);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ---------- 布局 ---------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.container-narrow { max-width: 780px; }

/* ---------- 分类筛选栏 ---------- */
.filter-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    margin: -6px -24px 20px;
    padding: 10px 24px;
    border-radius: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-label {
    font-size: 13px;
    color: var(--ink-3);
    margin-right: 4px;
}

.filter-tag {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    color: var(--ink-2);
    border: 1px solid var(--line);
    transition: all 0.2s;
}

.filter-tag:hover { border-color: rgba(var(--ink-rgb), 0.2); color: var(--ink); }

.filter-tag.active {
    background: var(--ink);
    color: var(--on-ink);
    border-color: var(--ink);
}

.filter-tag .count { font-size: 11px; opacity: 0.6; margin-left: 4px; }

/* ---------- 瀑布流卡片 ---------- */
.masonry { column-count: 4; column-gap: 20px; }
@media (max-width: 1200px) { .masonry { column-count: 3; } }
@media (max-width: 900px) { .masonry { column-count: 2; } }
@media (max-width: 600px) { .masonry { column-count: 1; } }

.card {
    break-inside: avoid;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: card-in 0.4s ease both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card-image-wrap {
    display: block;
    overflow: hidden;
    background: var(--img-bg);
}

.card-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

.card:hover .card-image { transform: scale(1.03); }

.card-body { padding: 18px 18px 14px; }

.card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.card-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.card-score.high { background: rgba(225, 29, 72, 0.1); color: var(--rose); }

.card-source {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-title {
    font-size: 16.5px;
    font-weight: 650;
    line-height: 1.45;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a { color: var(--ink); transition: color 0.2s; }
.card-title a:hover { color: var(--accent); }

.card-summary {
    font-size: 13.5px;
    color: var(--ink-2);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 搜索关键词高亮 */
.card-title mark,
.card-summary mark {
    background: rgba(255, 213, 79, 0.55);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.card-actions .feedback-btn {
    white-space: nowrap;
    min-width: 0;
    padding: 8px 6px;
    font-size: 13px;
}

.card-actions .feedback-btn.favorite { flex: 0 0 46px; }

.feedback-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    color: var(--ink-3);
    transition: all 0.2s;
}

.feedback-btn:hover { background: rgba(var(--ink-rgb), 0.05); color: var(--ink-2); }

.feedback-btn.like.active {
    background: rgba(22, 163, 74, 0.1);
    color: var(--green);
    font-weight: 600;
}

.feedback-btn.dislike.active {
    background: rgba(220, 38, 38, 0.08);
    color: var(--red);
    font-weight: 600;
}

/* ---------- 空状态 / 错误 / 加载 ---------- */
.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--ink-3);
}

.empty-icon { font-size: 44px; margin-bottom: 16px; opacity: 0.7; }
.empty h3 { color: var(--ink-2); font-size: 17px; margin-bottom: 8px; font-weight: 600; }
.empty p { font-size: 14px; }

.loading-spinner {
    text-align: center;
    padding: 60px;
    color: var(--ink-3);
    font-size: 14px;
}

.notice-banner {
    background: var(--accent-soft);
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-2);
}

.notice-banner a { font-weight: 600; }

/* hidden 属性的 UA 样式优先级低于本类的 display:flex，需显式兜底 */
.notice-banner[hidden] { display: none; }

/* ---------- 分页（分段胶囊控件） ---------- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.pagination .pager {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.pagination button {
    padding: 9px 18px;
    border: none;
    background: transparent;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.pagination button:hover:not(.disabled) { background: rgba(var(--ink-rgb), 0.06); color: var(--ink); }

.pagination button.disabled {
    color: var(--ink-3);
    opacity: 0.5;
    cursor: default;
}

.pagination .page-info {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 0 12px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* ---------- 刷新悬浮按钮 ---------- */
.refresh-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--on-ink);
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.2s;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover { transform: scale(1.08); }
.refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.refresh-btn.spinning { animation: spin 1s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---------- 采集进度遮罩 ---------- */
.progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 23, 28, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.progress-overlay.active { display: flex; }

.progress-card {
    position: relative;
    background: var(--surface);
    border-radius: 20px;
    padding: 32px 36px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: card-in 0.3s ease both;
}

.progress-title { font-size: 18px; font-weight: 650; margin-bottom: 22px; }

.progress-bar-container {
    background: rgba(var(--ink-rgb), 0.07);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-message {
    font-size: 13.5px;
    color: var(--ink-2);
    min-height: 40px;
    line-height: 1.5;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-3);
}

.progress-step.active { color: var(--accent-ink); font-weight: 600; }
.progress-step.done { color: var(--green); }

.step-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(var(--ink-rgb), 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s;
}

.progress-step.active .step-icon { background: var(--accent); color: #fff; }
.progress-step.done .step-icon { background: var(--green); color: #fff; }

/* ---------- 详情页 ---------- */
.article-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: card-in 0.4s ease both;
}

.article-hero { background: var(--img-bg); }
.article-image { width: 100%; max-height: 420px; object-fit: cover; display: block; }

.article-body { padding: 36px 40px 32px; }

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    font-size: 13px;
    color: var(--ink-3);
}

.article-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.article-score.high { background: rgba(225, 29, 72, 0.1); color: var(--rose); }

.article-source {
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(var(--ink-rgb), 0.05);
    color: var(--ink-2);
    font-size: 12.5px;
}

.article-date { font-variant-numeric: tabular-nums; }

.article-title {
    font-size: 30px;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.author-info { color: var(--ink-3); font-size: 14px; margin-bottom: 14px; }

.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.article-tag {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.section { margin-bottom: 30px; }

.section-title {
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.section-content {
    background: var(--bg);
    padding: 22px 24px;
    border-radius: var(--radius-sm);
    font-size: 15.5px;
    color: var(--ink-2);
    white-space: pre-wrap;
    line-height: 1.85;
}

.original-content { background: transparent; padding: 4px 0; }

.summary-box {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.overall-box {
    background: rgba(217, 119, 6, 0.07);
    border-left: 3px solid var(--amber);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.collection-note { color: var(--ink-3); font-size: 13.5px; margin-bottom: 14px; }

.source-paragraph { white-space: pre-wrap; margin: 0 0 18px; font-size: 16px; line-height: 1.9; color: var(--ink); }

.inline-analysis {
    display: none;
    white-space: pre-wrap;
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--accent-ink);
    font-size: 14.5px;
    line-height: 1.7;
    padding: 14px 18px;
    margin: -8px 0 20px;
}

.inline-analysis.visible { display: block; animation: card-in 0.3s ease both; }

.analysis-form {
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 20px 22px;
    border-radius: var(--radius-sm);
}

.analysis-form label { font-size: 14px; font-weight: 500; color: var(--ink-2); display: block; margin-bottom: 10px; }

textarea {
    width: 100%;
    min-height: 92px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    resize: vertical;
    font: inherit;
    font-size: 14.5px;
    color: var(--ink);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.analysis-controls { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

.btn-primary {
    background: var(--ink);
    color: var(--on-ink);
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.5; cursor: wait; transform: none; box-shadow: none; }

.analysis-status { min-height: 22px; margin-top: 10px; color: var(--ink-3); font-size: 13.5px; }
.analysis-status.error { color: var(--red); }

.quota-text { font-size: 13px; color: var(--ink-3); }

.original-link-section { text-align: center; margin-top: 36px; }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 28px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.detail-actions .feedback-btn {
    min-width: 140px;
    padding: 13px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 14.5px;
}

.detail-actions .feedback-btn:hover { border-color: rgba(var(--ink-rgb), 0.25); color: var(--ink); }

.detail-actions .feedback-btn.like.active {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.4);
    color: var(--green);
}

.detail-actions .feedback-btn.dislike.active {
    background: rgba(220, 38, 38, 0.06);
    border-color: rgba(220, 38, 38, 0.35);
    color: var(--red);
}

.page-error {
    padding: 60px 30px;
    text-align: center;
    color: var(--red);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
    .site-header-inner { padding: 12px 16px; flex-wrap: wrap; }
    .header-date { display: none; }
    .nav-pills { order: 3; width: 100%; justify-content: center; }
    .nav-pills a { flex: 1; text-align: center; padding: 7px 10px; }
    .container { padding: 20px 16px 60px; }
    .article-body { padding: 24px 20px; }
    .article-title { font-size: 23px; }
    .section-content { padding: 16px 18px; font-size: 15px; }
    .source-paragraph { font-size: 15.5px; }
    .detail-actions { flex-direction: column; }
    .refresh-btn { bottom: 20px; right: 20px; }
}

/* ---------- 通用按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 550;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s, background 0.2s, color 0.2s;
}

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(220, 38, 38, 0.3);
}
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.btn-small { padding: 6px 14px; font-size: 12.5px; }

.btn-collecting {
    background: rgba(var(--ink-rgb), 0.06) !important;
    color: var(--ink-3) !important;
    cursor: not-allowed !important;
}
.btn-collecting::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--ink-3);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
}

.btn-group { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 550;
    font-size: 14px;
    color: var(--ink);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-textarea { min-height: 110px; resize: vertical; line-height: 1.7; }

.form-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------- 面板 ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.panel-title { font-size: 16.5px; font-weight: 650; margin-bottom: 10px; letter-spacing: -0.01em; }

.panel-desc { color: var(--ink-2); font-size: 14px; margin-bottom: 20px; line-height: 1.7; }

/* ---------- 用户卡片 ---------- */
.user-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 14px; }

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 650;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name { font-size: 16.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.user-phone { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.logout-link { color: var(--red); font-size: 13.5px; cursor: pointer; }
.logout-link:hover { text-decoration: underline; }

/* ---------- 标签页切换 ---------- */
.tabs {
    display: flex;
    background: rgba(var(--ink-rgb), 0.05);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--ink-2);
    transition: all 0.2s;
}

.tab:hover { color: var(--ink); }

.tab.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: card-in 0.3s ease both; }

/* ---------- 列表项 ---------- */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
.item-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.tag.source { background: rgba(var(--ink-rgb), 0.06); color: var(--ink-2); }

.item-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-state { text-align: center; padding: 44px 20px; color: var(--ink-3); font-size: 14px; }

/* ---------- 快捷标签 ---------- */
.quick-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.quick-tag {
    padding: 7px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.2s;
}

.quick-tag:hover { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* ---------- 推荐关键词 ---------- */
.suggested-keywords {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.suggested-label {
    font-size: 13px;
    color: var(--ink-2);
    margin-bottom: 8px;
    font-weight: 500;
}

.suggested-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggested-tag {
    padding: 6px 14px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.suggested-tag:hover {
    background: var(--accent);
    color: var(--on-ink);
    transform: translateY(-1px);
}

.suggested-tag.added {
    background: rgba(var(--green-rgb, 22, 163, 74), 0.1);
    color: var(--green);
    cursor: default;
    border-color: transparent;
}

.suggested-tag.added:hover {
    background: rgba(var(--green-rgb, 22, 163, 74), 0.1);
    color: var(--green);
    transform: none;
}

/* ---------- 提示条 ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
    animation: card-in 0.25s ease both;
}

.alert-success { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.25); color: var(--green); }
.alert-error { background: rgba(220, 38, 38, 0.07); border-color: rgba(220, 38, 38, 0.22); color: var(--red); }
.alert-info { background: var(--accent-soft); border-color: rgba(79, 70, 229, 0.2); color: var(--accent-ink); }

/* ---------- 加载圈 ---------- */
.loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
}

/* ---------- 内联进度区 ---------- */
.progress-section {
    display: none;
    margin-top: 20px;
    padding: 18px 20px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}

.progress-section .progress-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }

.progress-section .progress-bar {
    background: rgba(var(--ink-rgb), 0.08);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background: var(--accent);
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.progress-text { font-size: 13px; color: var(--ink-2); margin-top: 8px; }

/* ---------- 采集进度弹窗 ---------- */
.collect-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 23, 28, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.collect-overlay.active { display: flex; }

.collect-modal {
    position: relative;
    background: var(--surface);
    border-radius: 20px;
    padding: 30px 32px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: card-in 0.3s ease both;
}

.collect-modal h3 { font-size: 17px; font-weight: 650; margin-bottom: 18px; }

.collect-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}

.collect-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.collect-step { flex: 1; text-align: center; position: relative; }

.collect-step::after {
    content: '';
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: rgba(var(--ink-rgb), 0.08);
    z-index: 0;
}

.collect-step:last-child::after { display: none; }

.collect-step .step-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(var(--ink-rgb), 0.06);
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    position: relative;
    z-index: 1;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.collect-step.active .step-icon { background: var(--accent); color: #fff; }
.collect-step.done .step-icon { background: var(--green); color: #fff; }

.step-label { font-size: 11.5px; color: var(--ink-3); }
.collect-step.active .step-label { color: var(--accent-ink); font-weight: 600; }
.collect-step.done .step-label { color: var(--green); }

.collect-progress-bar {
    background: rgba(var(--ink-rgb), 0.07);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 14px;
}

.collect-progress-fill {
    background: var(--accent);
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.collect-message { font-size: 13.5px; color: var(--ink-2); min-height: 40px; line-height: 1.5; }

.collect-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--ink-3);
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.collect-close:hover { color: var(--ink); background: rgba(var(--ink-rgb), 0.05); }

@media (max-width: 600px) {
    .panel { padding: 20px 18px; }
    .user-card { padding: 16px 18px; }
    .list-item { flex-direction: column; align-items: flex-start; }
    .item-actions { width: 100%; }
    .item-actions .btn { flex: 1; }
}

/* ---------- 登录/注册页 ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    animation: card-in 0.4s ease both;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-header .logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--ink);
    color: var(--on-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 14px;
}

.login-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
.login-header p { color: var(--ink-3); font-size: 14px; }

.tab-bar {
    display: flex;
    background: rgba(var(--ink-rgb), 0.05);
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 9px;
    background: none;
    border: none;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

.input-wrapper { position: relative; }

.form-input.with-prefix { padding-left: 56px; }

.phone-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    font-size: 14.5px;
    pointer-events: none;
    border-right: 1px solid var(--line);
    padding-right: 10px;
}

.submit-btn {
    width: 100%;
    padding: 13px;
    background: var(--ink);
    color: var(--on-ink);
    border: none;
    border-radius: 999px;
    font-size: 15.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    margin-top: 4px;
}

.submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg, .success-msg {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    border: 1px solid transparent;
}

.error-msg { background: rgba(220, 38, 38, 0.07); border-color: rgba(220, 38, 38, 0.22); color: var(--red); }
.success-msg { background: rgba(22, 163, 74, 0.08); border-color: rgba(22, 163, 74, 0.25); color: var(--green); }
.error-msg.show, .success-msg.show { display: block; animation: card-in 0.25s ease both; }

.auth-tips {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-3);
    font-size: 13px;
}

@media (max-width: 480px) {
    .auth-page { padding: 16px; }
    .login-container { padding: 28px 22px; border-radius: 16px; }
}

/* ---------- 个人中心 ---------- */
.profile-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }

.avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 650;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid var(--line);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(23, 23, 28, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    /* Scrim is always dark regardless of theme, so the label must stay light-on-dark
       too -- var(--on-ink) flips to near-black in dark mode and disappears here. */
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
}

.avatar:hover .avatar-overlay { opacity: 1; }

.avatar-sm {
    width: 48px;
    height: 48px;
    font-size: 19px;
}

.avatar-sm .avatar-overlay { font-size: 9px; }

/* ---------- 弹窗（头像生成 / 昵称编辑） ---------- */
.profile-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.profile-dialog-box {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.profile-dialog-box h3 {
    margin: 0 0 16px;
    color: var(--ink);
    font-size: 20px;
}

.profile-dialog-box p.profile-dialog-hint {
    color: var(--ink-2);
    font-size: 14px;
    margin-bottom: 16px;
}

.profile-dialog-box label {
    display: block;
    color: var(--ink-2);
    font-size: 14px;
    margin-bottom: 8px;
}

.profile-dialog-box textarea,
.profile-dialog-box input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
}

.profile-dialog-box textarea { min-height: 80px; resize: vertical; }

.profile-dialog-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.profile-dialog-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.profile-dialog-btn-cancel {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

.profile-dialog-btn-primary {
    border: none;
    background: var(--accent);
    color: var(--on-ink);
    font-weight: 500;
}

.profile-dialog-btn-primary:disabled { opacity: 0.6; cursor: wait; }

.profile-dialog-divider {
    text-align: center;
    color: var(--ink-3);
    margin: 16px 0;
    font-size: 13px;
}

.profile-dialog-ai-btn {
    margin-top: 8px;
    padding: 8px 16px;
    border: 1px solid var(--accent);
    background: var(--surface);
    color: var(--accent);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    font-family: inherit;
}

.profile-dialog-length-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--ink-3);
}

.profile-dialog-validation {
    margin-top: 8px;
    font-size: 13px;
    display: none;
}

.profile-dialog-error-box {
    margin-bottom: 8px;
    font-size: 13px;
    display: none;
    padding: 8px 12px;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 6px;
    color: var(--red);
}

.profile-info h2 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-info p { color: var(--ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }

.edit-nickname-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--ink-3);
}

.edit-nickname-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.edit-nickname-btn svg {
    display: block;
}

.membership-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.membership-badge.free { background: rgba(var(--ink-rgb), 0.06); color: var(--ink-2); }
.membership-badge.monthly, .membership-badge.yearly { background: var(--accent-soft); color: var(--accent-ink); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

.menu-list { list-style: none; }

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--bg); margin: 0 -28px; padding: 14px 28px; }
.menu-item-left { display: flex; align-items: center; gap: 12px; }
.menu-icon { font-size: 19px; }
.menu-text { font-size: 15px; }
.menu-arrow { color: var(--ink-3); font-size: 18px; }

.menu-item.highlight {
    background: var(--accent-soft);
    margin: 0 -28px;
    padding: 14px 28px;
    border-radius: var(--radius-sm);
}

.menu-item.highlight .menu-text { font-weight: 600; color: var(--accent-ink); }
.menu-item.highlight .menu-arrow { color: var(--accent-ink); }
.menu-item.highlight:hover { background: rgba(79, 70, 229, 0.13); }

.logout-btn {
    width: 100%;
    padding: 13px;
    background: var(--surface);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--red);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

.quota-bar { background: rgba(var(--ink-rgb), 0.07); border-radius: 999px; height: 8px; margin-top: 10px; overflow: hidden; }
.quota-fill { background: var(--accent); height: 100%; border-radius: 999px; transition: width 0.3s; }
.quota-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.upgrade-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--ink);
    color: var(--on-ink);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 550;
    margin-top: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upgrade-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- 设置页 ---------- */
.tips-box {
    background: rgba(217, 119, 6, 0.06);
    border: 1px solid rgba(217, 119, 6, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.tips-box h4 { color: var(--amber); font-size: 14.5px; margin-bottom: 8px; }
.tips-box p { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; }
.tips-box code, .panel code {
    background: rgba(var(--ink-rgb), 0.06);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 12.5px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.panel-head h2, h2.panel-head { font-size: 16.5px; font-weight: 650; letter-spacing: -0.01em; }

.interest-item {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 15px 18px;
    margin-bottom: 12px;
}

.interest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.interest-name { font-weight: 600; font-size: 15px; }

.interest-weight {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.keywords { display: flex; flex-wrap: wrap; gap: 8px; }

.keyword {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
}

.keyword.danger { background: rgba(220, 38, 38, 0.08); color: var(--red); }

.btn-refresh { background: var(--green); font-size: 13px; padding: 7px 16px; }

/* 偏好树 */
.preference-tree { padding: 6px 0; }
.tree-node { margin-bottom: 14px; }

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.tree-node-header:hover { background: rgba(var(--ink-rgb), 0.04); }
.tree-node.like .tree-node-header { border-left: 3px solid var(--green); }
.tree-node.dislike .tree-node-header { border-left: 3px solid var(--red); }
.tree-node-icon { font-size: 17px; }
.tree-node-name { font-weight: 600; flex: 1; font-size: 14.5px; }

.tree-node-weight {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.tree-node.dislike .tree-node-weight { background: rgba(220, 38, 38, 0.08); color: var(--red); }
.tree-node-sentiment { font-size: 15px; }

.tree-children {
    margin-left: 24px;
    padding-left: 14px;
    border-left: 2px solid var(--line);
    margin-top: 10px;
}

.tree-child {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.tree-child-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tree-child-name { font-weight: 550; flex: 1; font-size: 14px; }
.tree-child-keywords { display: flex; flex-wrap: wrap; gap: 6px; }

.tree-keyword {
    background: var(--accent-soft);
    color: var(--accent-ink);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.tree-child.dislike .tree-keyword { background: rgba(220, 38, 38, 0.08); color: var(--red); }

.preference-summary {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    padding: 14px 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 20px;
    font-size: 14.5px;
    color: var(--ink-2);
    line-height: 1.7;
}

.preference-stats { display: flex; gap: 20px; margin-bottom: 15px; }

.pref-stat-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.stat-icon { font-size: 16px; }

.loading-box { text-align: center; padding: 40px; color: var(--ink-3); font-size: 14px; }

.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(var(--ink-rgb), 0.08);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.empty-state-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.7; }

/* ============================================================
   深色主题
   ============================================================ */
[data-theme="dark"] {
    --bg: #131316;
    --surface: #1d1d23;
    --ink: #e9e9ef;
    --ink-2: #b3b3bf;
    --ink-3: #7c7c89;
    --ink-rgb: 233, 233, 239;
    --line: rgba(233, 233, 239, 0.1);
    --accent: #818cf8;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --accent-ink: #a5b4fc;
    --rose: #fb7185;
    --green: #4ade80;
    --red: #f87171;
    --amber: #fbbf24;
    --on-ink: #17171c;
    --header-bg: rgba(19, 19, 22, 0.78);
    --img-bg: #26262d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

body { transition: background-color 0.3s ease, color 0.3s ease; }

.card, .panel, .user-card, .profile-card, .login-container, .list-item,
.interest-item, .filter-tag, .form-input, .form-select, .form-textarea,
textarea, .section-content, .analysis-form {
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.theme-toggle:hover { background: rgba(var(--ink-rgb), 0.06); transform: rotate(15deg); }

/* ---------- 头部滚动自动隐藏 ---------- */
.site-header { transition: transform 0.32s ease, background 0.3s ease; }
.site-header.header-hidden { transform: translateY(-101%); }

/* ---------- 阅读进度条 ---------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    z-index: 300;
    background: transparent;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s linear;
}

/* ---------- 返回顶部 ---------- */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--ink-2);
    font-size: 17px;
    cursor: pointer;
    z-index: 900;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--surface); color: var(--ink); }
.back-to-top.above-fab { bottom: 94px; right: 34px; }

/* ---------- 骨架屏加载 ---------- */
.skeleton-card { pointer-events: none; }

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(var(--ink-rgb), 0.06) 25%,
        rgba(var(--ink-rgb), 0.11) 37%,
        rgba(var(--ink-rgb), 0.06) 63%
    );
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.skeleton-img { width: 100%; height: 160px; border-radius: 0; }
.skeleton-line { height: 13px; margin-bottom: 10px; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-80 { width: 80%; }

/* ---------- 微交互 ---------- */
.card:hover { border-color: rgba(var(--ink-rgb), 0.16); }

@keyframes feedback-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.feedback-btn.active { animation: feedback-pop 0.28s ease; }

.filter-tag:active, .quick-tag:active, .nav-pills a:active, .tab:active { transform: scale(0.96); }

/* 键盘可访问性 */
a:focus-visible, button:focus-visible, [onclick]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.form-input:focus-visible, .form-textarea:focus-visible, textarea:focus-visible {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- 全局轻提示 Toast ---------- */
.toast-container {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(420px, calc(100vw - 48px));
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--on-ink);
    font-size: 14px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.18));
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.toast.show { opacity: 1; transform: translateY(0); }

.toast-success { background: var(--green); color: #fff; }
.toast-error { background: var(--red); color: #fff; }

.toast-action {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
    border: none;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.toast-action:hover { background: rgba(255, 255, 255, 0.32); }

/* ---------- 卡片图片固定比例占位（防瀑布流抖动） ---------- */
.card-image-wrap { aspect-ratio: 16 / 9; }

.card-image {
    height: 100%;
    object-fit: cover;
}

/* ---------- 收藏按钮 ---------- */
.feedback-btn.favorite.active {
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
    font-weight: 600;
    border-color: rgba(217, 119, 6, 0.4);
}

/* ---------- 详情页骨架屏 ---------- */
.detail-skeleton { padding: 24px 0; }
.detail-skeleton .skeleton { margin-bottom: 14px; }

/* ---------- AI 注解插入高亮脉冲 ---------- */
@keyframes annotation-pulse {
    0% { background: rgba(var(--ink-rgb), 0.14); }
    100% { background: transparent; }
}

.inline-analysis.pulse { animation: annotation-pulse 1.6s ease-out 2; border-radius: 8px; }

/* ---------- 详情页浮动迷你反馈条 ---------- */
.fab-feedback {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 80;
    display: flex;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.16)), 0 0 0 1px var(--line);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fab-feedback.visible { transform: translate(-50%, 0); opacity: 1; }

.fab-feedback .feedback-btn { flex: none; padding: 8px 16px; }

/* ---------- 内容截断提示 ---------- */
.truncation-notice {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(var(--ink-rgb), 0.05);
    color: var(--ink-2);
    font-size: 13.5px;
    text-align: center;
}

.truncation-notice a { color: var(--accent); }

/* ---------- 首页搜索框（与筛选标签同款胶囊，图标+输入+清除内嵌） ---------- */
.filter-search {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 33px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-search .search-icon {
    width: 14px;
    height: 14px;
    flex: none;
    color: var(--ink-3);
}

.filter-search input {
    width: 130px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.filter-search input:focus { outline: none; }
.filter-search input::placeholder { color: var(--ink-3); }

.filter-search .search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(var(--ink-rgb), 0.08);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.filter-search .search-clear.visible { display: flex; }
.filter-search .search-clear:hover { background: rgba(var(--ink-rgb), 0.16); }

@media (max-width: 600px) {
    .filter-search input { width: 96px; }
    .filter-bar {
        margin: -6px -16px 20px;
        padding: 10px 16px;
    }
}

/* ---------- 空状态重试按钮 ---------- */
.empty .retry-btn {
    margin-top: 14px;
    padding: 9px 22px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.empty .retry-btn:hover { border-color: var(--accent); }
