/* ============================================
   朋友圈装货指南 - 移动端优先样式
   设计基调：黑白灰 · 高级极简 · 杂志感留白
   ============================================ */

:root {
    --bg: #fafafa;          /* 极浅灰背景 */
    --card: #ffffff;
    --ink: #1a1a1a;         /* 主文字（近黑） */
    --ink-light: #888888;   /* 次要文字（中灰） */
    --ink-faint: #bbbbbb;   /* 弱文字（浅灰） */
    --accent: #111111;      /* 强调（纯黑） */
    --accent-dark: #000000;
    --line: #ececec;        /* 分割线（浅灰） */
    --gold: #999999;        /* 点缀（中灰） */
    --surface: #f4f4f4;     /* 浅灰面板 */
    --footer-bg: rgba(255, 255, 255, 0.97);
}

/* 黑夜模式（2026-08-31）：切换 body.dark 覆盖全部色系变量 */
body.dark {
    --bg: #121212;
    --card: #1c1c1c;
    --ink: #e6e6e6;
    --ink-light: #9a9a9a;
    --ink-faint: #616161;
    --accent: #f0f0f0;
    --accent-dark: #ffffff;
    --line: #2e2e2e;
    --gold: #777777;
    --surface: #242424;
    --footer-bg: rgba(28, 28, 28, 0.97);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 16px; }

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ============ 黑夜模式切换按钮（header 右上角） ============ */
.theme-btn {
    position: absolute;
    right: 14px;
    top: 44px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-light);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.theme-btn:active { transform: scale(0.92); }

/* ============ 头部（极简杂志式） ============ */
.header {
    background: var(--card);
    padding: 44px 20px 30px;
    text-align: center;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    position: relative;
}

.header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--ink);
}

.header-inner { position: relative; z-index: 1; }

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    cursor: pointer;
    user-select: none;
}

.slogan {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--ink-light);
    letter-spacing: 0.08em;
    font-weight: 300;
}

/* ============ 主内容 ============ */
.main {
    padding: 20px 16px 40px;
    max-width: 520px;
    margin: 0 auto;
}

.card {
    background: var(--card);
    border-radius: 0;
    border: 1px solid var(--line);
    padding: 22px 20px;
}

/* ============ 输入区 ============ */
.query-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--ink);
    background: transparent;
    font-size: 1rem;
    line-height: 1.7;
    padding: 8px 2px 12px;
    resize: none;
    color: var(--ink);
    outline: none;
    font-family: inherit;
    font-weight: 400;
}

.query-input::placeholder { color: var(--ink-faint); font-weight: 300; }

.section-title {
    margin-top: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.12em;
}

.optional {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--ink-faint);
    margin-left: 6px;
}

/* ============ 标签胶囊 ============ */
.chip-group, .category-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.chip {
    padding: 7px 15px;
    border-radius: 0;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    letter-spacing: 0.02em;
}

.chip:active { transform: scale(0.96); }

.chip.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
    font-weight: 500;
}

/* 分类胶囊（单选）更大更醒目 */
.chip-cat {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.85rem;
    text-align: center;
    min-width: 80px;
}

.chip-cat.active {
    background: var(--ink);
    border-color: var(--ink);
}

/* ============ 生成按钮（纯黑胶囊） ============ */
.generate-btn {
    width: 100%;
    margin-top: 24px;
    padding: 14px 0;
    border: none;
    border-radius: 0;
    background: var(--ink);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.generate-btn:active { transform: scale(0.98); background: #333; }

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============ 加载 ============ */
.loading {
    text-align: center;
    padding: 40px 0 24px;
    color: var(--ink-light);
    font-size: 0.82rem;
    font-weight: 300;
}

.spinner {
    width: 26px;
    height: 26px;
    margin: 0 auto 14px;
    border: 2px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============ 结果卡片（无圆角细边框） ============ */
.results { margin-top: 20px; }

.result-card {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 22px 20px;
    margin-bottom: 14px;
    animation: fadeUp 0.4s ease both;
    position: relative;
}

.result-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--ink);
}

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

.result-text {
    font-size: 1.12rem;
    line-height: 1.8;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: 0.03em;
    flex: 1;
}

/* 文学句 + 复制按钮同行 */
.result-text-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 行内复制按钮 */
.result-text-row .copy-btn {
    flex-shrink: 0;
    padding: 4px 14px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink-light);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    border-radius: 0;
}

.result-text-row .copy-btn:active { transform: scale(0.95); }

.result-text-row .copy-btn.copied {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
    font-weight: 500;
}

.result-text-row .copy-btn.copy-error {
    background: #666;
    border-color: #666;
    color: #fff;
}

.result-source {
    margin-top: 8px;
    font-size: 0.76rem;
    color: var(--ink-light);
    letter-spacing: 0.03em;
}

.result-reason {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--ink-light);
    line-height: 1.75;
    font-weight: 300;
}

.result-meta {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: var(--ink-faint);
}

/* ============ 跨分类补充 ============ */
.supplement-tip {
    background: var(--surface);
    border-left: 2px solid var(--ink);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 0.76rem;
    color: var(--ink-light);
    line-height: 1.6;
}

.result-supplement {
    opacity: 0.9;
}

.result-supplement::before { background: var(--ink-faint); }

.supplement-badge {
    display: inline-block;
    background: var(--surface);
    color: var(--ink-light);
    font-size: 0.68rem;
    padding: 2px 10px;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

/* ============ 换一批按钮 ============ */
.reshuffle-wrap {
    text-align: center;
    margin-top: 6px;
    margin-bottom: 10px;
}

.reshuffle-btn {
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    font-size: 0.82rem;
    padding: 10px 36px;
    cursor: pointer;
    letter-spacing: 0.08em;
    transition: all 0.18s ease;
    font-family: inherit;
    border-radius: 0;
}

.reshuffle-btn:active { background: var(--ink); color: #fff; }

.reshuffle-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============ 空结果 ============ */
.empty-tip {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 36px 20px;
    text-align: center;
    color: var(--ink-light);
    font-size: 0.88rem;
    font-weight: 300;
}

/* ============ 滚动标语 ============ */
.slogan-rotator {
    margin-top: 10px;
    min-height: 1.6em;
    display: flex;
    justify-content: center;
}

.slogan {
    transition: opacity 0.4s ease;
    margin-top: 0;
}

/* ============ 示例表达 ============ */
.example-wrap {
    margin-top: 18px;
}

.example-title {
    font-size: 0.76rem;
    color: var(--ink-faint);
    letter-spacing: 0.08em;
}

.example-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.example-chip {
    padding: 7px 14px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.example-chip:active {
    background: var(--ink);
    color: #fff;
    transform: scale(0.96);
}

/* ============ 视图切换 ============ */
.hidden { display: none !important; }

.view-page {
    padding-bottom: 40px;
}

.page-banner {
    text-align: center;
    padding: 16px 10px 28px;
}

.page-slogan {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.06em;
    line-height: 1.7;
}

.page-sub {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--ink-light);
    font-weight: 300;
    letter-spacing: 0.03em;
}

/* ============ 知识库目录（笼统展示） ============ */
.lib-category {
    margin-bottom: 26px;
}

.lib-cat-head {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ink);
    margin-bottom: 14px;
}

.lib-cat-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.15em;
}

.lib-cat-meta {
    font-size: 0.72rem;
    color: var(--ink-faint);
}

/* 作品标签流 */
.lib-works {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lib-work-tag {
    padding: 7px 13px;
    border: 1px solid var(--line);
    background: var(--card);
    font-size: 0.8rem;
    color: var(--ink-light);
    letter-spacing: 0.03em;
    font-weight: 300;
}

/* ============ 关于我们 ============ */
.about-card {
    padding: 26px 22px;
}

.about-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 16px;
    letter-spacing: 0.15em;
}

.about-list {
    padding-left: 22px;
    font-size: 0.86rem;
    color: var(--ink-light);
    line-height: 2.1;
    font-weight: 300;
}

.about-list li { margin-bottom: 14px; }

.about-list li:last-child { margin-bottom: 0; }

.about-mail {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--ink);
    font-weight: 400;
}

/* ============ 底部导航（黑白极简） ============ */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--footer-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    z-index: 100;
    transition: background 0.3s ease;
}

.bottom-nav {
    display: flex;
    justify-content: space-around;
    max-width: 520px;
    margin: 0 auto;
    padding: 4px 0;
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
}

.nav-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 11px 8px;
    font-size: 0.8rem;
    color: var(--ink-faint);
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease;
    font-family: inherit;
    letter-spacing: 0.05em;
}

.nav-btn.active {
    color: var(--ink);
    font-weight: 600;
}

.nav-btn.active::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--ink);
}

/* 底部导航预留空间 */
.app { padding-bottom: 68px; }
