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

: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;
}

/* ============ 标语（紧贴标题下方居中，恢复原设计） ============ */
.slogan-rotator {
    margin-top: 8px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
}
.slogan {
    display: inline-block;
    font-size: 0.82rem;
    line-height: 1.7;
}

/* ============ 压线行：右=深色按钮（2026-09-03 四改） ============ */
.slogan-row {
    position: relative;
    height: 34px;
    max-width: 488px;          /* 与下方功能卡片外沿同宽（main 16px padding 后） */
    margin: 4px auto 0;
}
.head-side { position: absolute; bottom: 3px; }   /* 距横线 3px，轻压不贴死 */
.head-right { right: 2px; }                        /* 相对卡片外沿内收 2px */

.theme-mini {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    line-height: 1;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.theme-mini:hover { color: var(--ink); border-color: var(--ink-light); }

/* ============ 头部（极简杂志式） ============ */
.header {
    background: var(--card);
    padding: 40px 16px 0;      /* 左右 16 与 main 一致，压线工具与下方卡片边界对齐 */
    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 {
    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; }

/* ============ 输入框 + 加图按钮一体（2026-09-03 图片识别） ============ */
.query-wrap { position: relative; }
.query-wrap .query-input { padding-right: 92px; }
.img-add-btn {
    position: absolute;
    right: 6px;
    bottom: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 9px;
    user-select: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.img-add-btn:hover { color: var(--ink); border-color: var(--ink-light); }
.img-add-btn i {
    font-style: normal;
    font-size: 0.66rem;
    color: var(--ink-faint);
}
.thumb-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 12px;
}
.thumb-strip:empty { display: none; }
.thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--surface);
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-orientation: from-image;
    display: block;
}
.thumb-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    line-height: 15px;
    text-align: center;
    border: none;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.thumb-del:hover { background: rgba(0, 0, 0, 0.85); }
.thumb-num {
    position: absolute;
    left: 2px;
    bottom: 2px;
    font-size: 10px;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 0 4px;
    line-height: 14px;
}

.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;
}

/* AI 看到的画面（2026-09-03 配图反馈） */
.ai-saw-tip {
    background: var(--surface);
    border-left: 2px solid var(--ink-light);
    padding: 8px 14px;
    margin-bottom: 10px;
    font-size: 0.76rem;
    color: var(--ink-light);
    line-height: 1.6;
    font-weight: 300;
}

.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;
}

/* ============ 批次历史回看导航（2026-09-04） ============ */
.batch-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 4px 2px 14px;
}
.batch-btn {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.72rem;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.batch-btn:not(:disabled):hover { color: var(--ink); border-color: var(--ink-light); }
.batch-btn:disabled { opacity: 0.35; cursor: default; }
.batch-ind {
    font-size: 0.72rem;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
    white-space: nowrap;
}

/* ============ 反馈入口（2026-09-04） ============ */
.feedback-row {
    text-align: center;
    margin: 2px 0 6px;
}
.feedback-link {
    border: none;
    background: none;
    color: var(--ink-faint);
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-family: inherit;
    padding: 6px 10px;
    transition: color 0.15s ease;
}
.feedback-link:hover { color: var(--ink); }
.feedback-ok { margin-top: 10px; padding: 16px; font-size: 0.8rem; }

/* ============ 反馈弹窗（2026-09-04） ============ */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
}
.modal-box {
    background: var(--card);
    max-width: 420px;
    width: 100%;
    padding: 24px 22px 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal-title {
    font-size: 1.02rem;
    font-weight: 600;
    margin: 0 0 12px;
    letter-spacing: 0.02em;
}
.modal-body {
    font-size: 0.8rem;
    color: var(--ink-light);
    line-height: 1.85;
    font-weight: 300;
    margin: 0 0 10px;
}
.modal-body b { color: var(--ink); font-weight: 600; }
.modal-warn {
    font-size: 0.78rem;
    color: #9c2f2f;
    line-height: 1.7;
    background: rgba(156, 47, 47, 0.06);
    border: 1px solid rgba(156, 47, 47, 0.25);
    padding: 9px 12px;
    margin: 0 0 12px;
}
.modal-warn b { font-weight: 700; }
.modal-mail a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.modal-err {
    font-size: 0.74rem;
    color: #9c2f2f;
    min-height: 1em;
    margin: 0 0 8px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}
.modal-btn {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.78rem;
    padding: 8px 18px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}
.modal-btn:hover { color: var(--ink); border-color: var(--ink-light); }
.modal-btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.modal-btn-primary:hover { opacity: 0.85; color: #fff; }
.modal-btn-primary:disabled { opacity: 0.5; cursor: default; }

/* ============ 空结果 ============ */
.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: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.example-chip {
    width: 100%;
    padding: 9px 6px;
    text-align: center;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-light);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* ============ 视图切换 ============ */
.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;
}

/* ICP 备案号 + 联系我们（备案右侧，2026-09-03 回位） */
.icp-bar {
    padding: 7px 0 9px;
    text-align: center;
    border-top: 1px solid var(--line);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--ink-faint);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.icp-sep { opacity: 0.5; }
.icp-mail { color: var(--ink-faint); text-decoration: none; }
.icp-mail:hover { color: var(--ink); }

.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);
}

/* 底部导航 + ICP 备案号预留空间 */
.app { padding-bottom: 96px; }
