/* ============================================================
   AI Tools 设计系统 2.0 —— 纸墨工坊 (Paper & Ink Atelier)
   设计理念源自 DesignPhilosophy.md，完整复用并增强
   ------------------------------------------------------------
   核心理念：
   · Editorial First —— 杂志式排版，层级清晰，留白克制
   · Tactile Material —— 纸色背景 + 噪点纹理 + 暖色边框
   · Category as Color —— 分类即色彩，每个分类独立色彩人格
   · 动效是节奏，不是表演
   ============================================================ */

/* -----------------------------------------------------------
   1. Design Tokens
   ----------------------------------------------------------- */
:root {
    /* —— 纸墨基础色 —— */
    --paper:         #F5F1EA;
    --paper-dark:    #EDE7DC;
    --paper-deeper:  #E4DCCB;
    --ink:           #1C1814;
    --ink-soft:      #4A4339;
    --ink-muted:     #7A6F5F;
    --border-warm:   #D4CCBC;

    /* —— 双强调色 —— */
    --accent:        #C8553D;   /* 赤陶 · 行动之色 */
    --accent-hover:  #B04A35;
    --accent-soft:   rgba(200, 85, 61, 0.10);
    --gold:          #C9A961;   /* 成就金 · 回报之色 */
    --gold-hover:    #B8982F;
    --gold-soft:     rgba(201, 169, 97, 0.14);

    /* —— 分类色彩人格（Category as Color）—— */
    --cat-doc:       #2C5F7C;   /* 文档 · 牛津蓝 */
    --cat-doc-soft:  rgba(44, 95, 124, 0.10);
    --cat-image:     #3A7D5C;   /* 图片 · 翠玉 */
    --cat-image-soft: rgba(58, 125, 92, 0.10);
    --cat-video:     #8A5A44;   /* 视频 · 赭石 */
    --cat-video-soft: rgba(138, 90, 68, 0.10);
    --cat-query:     #6B5B95;   /* 查询 · 紫藤 */
    --cat-query-soft: rgba(107, 91, 149, 0.10);
    --cat-ai:        #C8553D;   /* AI · 赤陶 */
    --cat-ai-soft:   rgba(200, 85, 61, 0.10);
    --cat-util:      #7A6F5F;   /* 实用 · 灰墨 */
    --cat-util-soft: rgba(122, 111, 95, 0.10);

    /* —— 功能色 —— */
    --success:       #4A8C5C;
    --success-soft:  rgba(74, 140, 92, 0.12);
    --danger:        #C8553D;
    --warning:       #C9A961;
    --info:          #2C5F7C;

    /* —— 字体 —— */
    --font-display:  'Fraunces', 'Georgia', 'Noto Serif SC', serif;
    --font-body:     'Plus Jakarta Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* —— 字号（流式响应）—— */
    --text-xs:       0.75rem;
    --text-sm:       0.875rem;
    --text-base:     1rem;
    --text-lg:       1.125rem;
    --text-xl:       1.25rem;
    --text-2xl:      1.5rem;
    --text-3xl:      clamp(1.75rem, 3.5vw, 2.25rem);
    --text-4xl:      clamp(2rem, 5vw, 3rem);
    --text-display:  clamp(2.75rem, 8vw, 5.5rem);

    /* —— 圆角（拒绝果冻感）—— */
    --radius-sm:     0.375rem;
    --radius-md:     0.5rem;
    --radius-lg:     0.875rem;
    --radius-xl:     1.25rem;

    /* —— 三层阴影 + 辉光 —— */
    --shadow-soft:   0 2px 8px -2px rgba(28, 24, 20, 0.08);
    --shadow-card:   0 4px 24px -8px rgba(28, 24, 20, 0.12);
    --shadow-lift:   0 12px 40px -12px rgba(28, 24, 20, 0.18);
    --shadow-glow:   0 0 32px -4px rgba(201, 169, 97, 0.45);

    /* —— 间距 —— */
    --space-xs:      0.25rem;
    --space-sm:      0.5rem;
    --space-md:      1rem;
    --space-lg:      1.5rem;
    --space-xl:      2rem;
    --space-2xl:     3rem;
    --space-3xl:     4.5rem;

    /* —— 动效 —— */
    --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
    --duration-fast: 0.15s;
    --duration-base: 0.3s;
    --duration-slow: 0.6s;

    /* —— 布局 —— */
    --max-width:     1280px;
    --nav-height:    60px;
    --tabbar-height: 64px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--paper);
    /* 径向渐变氛围光：左上赤陶微光 + 右下牛津蓝微光 */
    background-image:
        radial-gradient(circle at 15% 20%, rgba(200, 85, 61, 0.045) 0%, transparent 45%),
        radial-gradient(circle at 85% 75%, rgba(44, 95, 124, 0.045) 0%, transparent 45%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

::selection {
    background: rgba(200, 85, 61, 0.22);
    color: var(--ink);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; display: block; }

button { font-family: inherit; }

/* 滚动条：暖灰轨道 + 圆角拇指 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--paper-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-warm); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* -----------------------------------------------------------
   3. Typography —— 杂志式排版
   ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-optical-sizing: auto;
}

h1 { font-size: var(--text-display); font-weight: 700; }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

.text-display  { font-family: var(--font-display); }
.text-mono     { font-family: var(--font-mono); }
.text-muted    { color: var(--ink-muted); }
.text-soft     { color: var(--ink-soft); }
.text-accent   { color: var(--accent); }
.text-gold     { color: var(--gold); }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.text-lg       { font-size: var(--text-lg); }
.text-center   { text-align: center; }

/* 杂志眉标（kicker）：栏目标题上方的小标签 */
.kicker {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

/* 装饰分隔线：左右线条 + 中间文字 */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--ink-muted);
    font-size: var(--text-sm);
    margin: var(--space-xl) 0;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-warm);
}
.divider-ornament {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-muted);
}

/* -----------------------------------------------------------
   4. Layout
   ----------------------------------------------------------- */
.container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .container { max-width: 720px; padding: 0 24px; }
}
@media (min-width: 1024px) {
    .container { max-width: var(--max-width); padding: 0 48px; }
}

.main-content {
    padding-top: var(--nav-height);
    min-height: calc(100vh - var(--nav-height));
}
@media (max-width: 767px) {
    .main-content { padding-bottom: calc(var(--tabbar-height) + 24px); }
}
@media (min-width: 768px) {
    .main-content { padding-bottom: var(--space-3xl); }
}

/* -----------------------------------------------------------
   5. 桌面导航 —— 顶部毛玻璃 + 墨色 Logo
   ----------------------------------------------------------- */
.nav-desktop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(245, 241, 234, 0.88);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid var(--border-warm);
    z-index: 100;
}

.nav-desktop .nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 48px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Logo：衬线字标 + 装饰点 */
.nav-desktop .nav-logo {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}
.nav-desktop .nav-logo:hover { color: var(--ink); }
.nav-logo-mark {
    width: 32px;
    height: 32px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    transition: transform var(--duration-base) var(--ease-out), background var(--duration-base);
}
.nav-desktop .nav-logo:hover .nav-logo-mark {
    transform: rotate(-8deg);
    background: var(--accent);
}

.nav-desktop .nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}
.nav-desktop .nav-links a {
    color: var(--ink-soft);
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    position: relative;
    transition: all var(--duration-fast) var(--ease-out);
}
.nav-desktop .nav-links a:hover {
    color: var(--ink);
    background: var(--paper-dark);
}
.nav-desktop .nav-links a.active {
    color: var(--accent);
    font-weight: 600;
}
.nav-desktop .nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}
.nav-links .nav-vip-link {
    color: var(--gold);
    font-weight: 600;
}
.nav-links .nav-vip-link:hover { color: var(--gold-hover); background: var(--gold-soft); }

.nav-desktop .nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .nav-desktop { display: block; }
}

/* -----------------------------------------------------------
   6. 移动端 Tab Bar —— 底部导航
   ----------------------------------------------------------- */
.tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--tabbar-height);
    background: rgba(245, 241, 234, 0.95);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-top: 1px solid var(--border-warm);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--ink-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.tabbar-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
    transition: transform var(--duration-base) var(--ease-out);
}
.tabbar-item.active { color: var(--accent); }
.tabbar-item.active svg { transform: translateY(-2px); }
.tabbar-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2.5px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}
.tabbar-item:active svg { transform: scale(0.88); }

@media (min-width: 768px) {
    .tabbar { display: none; }
}

/* -----------------------------------------------------------
   7. Buttons —— 四变体 + 统一微交互
   ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 18px; height: 18px; stroke-width: 1.5; }

/* 主按钮 · 深墨 */
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover {
    background: var(--ink-soft);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-lift);
    color: var(--paper);
}

/* 行动按钮 · 赤陶 */
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-lift);
    color: #fff;
}

/* 幽灵按钮 · 边框 */
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--border-warm);
}
.btn-ghost:hover {
    background: var(--paper-dark);
    border-color: var(--ink-muted);
    color: var(--ink);
    transform: translateY(-1px);
}

/* 金色按钮 · 荣誉 */
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover {
    background: var(--gold-hover);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-glow);
    color: var(--ink);
}

/* Focus 焦点环 */
.btn:focus-visible,
.input:focus-visible,
.chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent);
}

.btn-lg { padding: 14px 32px; font-size: var(--text-base); border-radius: var(--radius-xl); }
.btn-sm { padding: 6px 14px; font-size: var(--text-xs); }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* -----------------------------------------------------------
   8. Cards —— 半透明纸质卡片
   ----------------------------------------------------------- */
.card {
    background: rgba(237, 231, 220, 0.55);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
    transition: all var(--duration-base) var(--ease-out);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: var(--ink-muted);
}

.card-flat {
    background: var(--paper-dark);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
}

/* 纸张噪点纹理层 */
.paper-grain { position: relative; overflow: hidden; }
.paper-grain::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    mix-blend-mode: multiply;
    border-radius: inherit;
    z-index: 0;
}
.paper-grain > * { position: relative; z-index: 1; }

/* -----------------------------------------------------------
   9. Tool Grid & Cards —— 核心组件
   ----------------------------------------------------------- */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 768px) {
    .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (min-width: 1024px) {
    .tool-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

/* 工具卡片：图标容器 + 信息 + 徽章 */
.tool-card {
    background: rgba(245, 241, 234, 0.75);
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-xl);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--ink);
    transition: all var(--duration-base) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
/* hover 时左侧出现分类色条 */
.tool-card::before {
    content: '';
    position: absolute;
    left: 0; top: 20%;
    width: 3px; height: 60%;
    background: var(--card-accent, var(--accent));
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transition: all var(--duration-base) var(--ease-out);
}
.tool-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-warm);
    background: var(--paper);
    color: var(--ink);
}
.tool-card:hover::before { opacity: 1; }
.tool-card:active { transform: scale(0.98); }

/* 工具图标容器：分类色浅底 + 深色图标 */
.tool-card .tool-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    background: var(--card-bg, var(--paper-deeper));
    border: 1px solid var(--border-warm);
    transition: transform var(--duration-base) var(--ease-out);
}
.tool-card:hover .tool-icon { transform: scale(1.06) rotate(-3deg); }

.tool-card .tool-info { flex: 1; min-width: 0; }
.tool-card .tool-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--ink);
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.tool-card .tool-desc {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* 分类色工具卡片（通过 .cat-N 类应用） */
.cat-1 { --card-accent: var(--cat-doc);    --card-bg: var(--cat-doc-soft); }
.cat-2 { --card-accent: var(--cat-image);  --card-bg: var(--cat-image-soft); }
.cat-3 { --card-accent: var(--cat-video);  --card-bg: var(--cat-video-soft); }
.cat-4 { --card-accent: var(--cat-query);  --card-bg: var(--cat-query-soft); }
.cat-5 { --card-accent: var(--cat-ai);     --card-bg: var(--cat-ai-soft); }
.cat-6 { --card-accent: var(--cat-util);   --card-bg: var(--cat-util-soft); }

/* -----------------------------------------------------------
   10. Chips —— 分类筛选标签
   ----------------------------------------------------------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    font-size: var(--text-xs);
    font-weight: 600;
    border: 1.5px solid var(--border-warm);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.chip:hover {
    background: var(--paper-dark);
    border-color: var(--ink-muted);
    transform: translateY(-1px);
}
.chip.active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.chip-gold {
    background: var(--gold-soft);
    border-color: var(--gold);
    color: var(--gold-hover);
}

.chip-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

/* -----------------------------------------------------------
   11. Form Elements
   ----------------------------------------------------------- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.input-group label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-soft);
}

.input {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--ink);
    background: var(--paper);
    border: 1.5px solid var(--border-warm);
    border-radius: var(--radius-lg);
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}
.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--ink-muted); }

textarea.input { resize: vertical; min-height: 100px; }

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A6F5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 42px;
}

/* -----------------------------------------------------------
   12. Badges
   ----------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}
.badge-vip {
    background: linear-gradient(135deg, var(--gold), #E8D5A0);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(201, 169, 97, 0.35);
}
.badge-accent { background: var(--accent); color: #fff; }
.badge-ghost  { background: var(--paper-deeper); color: var(--ink-muted); }
.badge-gold   { background: var(--gold-soft); color: var(--gold-hover); }

/* -----------------------------------------------------------
   12.5 SVG 图标系统 —— lucide 线条风格适配
   ----------------------------------------------------------- */
/* 通用 SVG 对齐 */
.btn svg { vertical-align: -3px; }

/* 上传区图标：44px 线条图标 */
.upload-icon {
    color: var(--ink-muted);
    margin-bottom: var(--space-md);
    transition: transform var(--duration-base) var(--ease-out), color var(--duration-base);
}
.upload-icon svg { width: 44px; height: 44px; }
.upload-area:hover .upload-icon { transform: scale(1.08); color: var(--accent); }

/* 工具卡片图标：分类色 */
.tool-card .tool-icon {
    color: var(--card-accent, var(--ink-soft));
    display: flex;
    align-items: center;
    justify-content: center;
}
.tool-card .tool-icon svg { width: 22px; height: 22px; }

/* 栏目分类图标 */
.cat-icon { display: inline-flex; align-items: center; }
.cat-icon svg { width: 24px; height: 24px; color: var(--card-accent, var(--ink-soft)); }
.cat-icon-lg svg { width: 32px; height: 32px; }

/* chip 内图标 */
.chip svg.chip-icon,
.chip .chip-icon {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

/* chip 内色点（背景色选择） */
.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-warm);
    box-shadow: inset 0 0 0 1.5px var(--paper);
    vertical-align: -2px;
}

/* 开发中卡片大图标 */
.dev-icon {
    color: var(--ink-muted);
    margin-bottom: 16px;
    opacity: 0.7;
}
.dev-icon svg { width: 48px; height: 48px; }

/* 空状态图标 */
.empty-icon {
    color: var(--ink-muted);
    margin-bottom: var(--space-md);
    opacity: 0.45;
}
.empty-icon svg { width: 44px; height: 44px; }

/* 文件信息卡图标 */
.file-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--paper-deeper);
    color: var(--ink-soft);
    flex-shrink: 0;
}

/* 支付品牌圆形标识 */
.pay-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    flex-shrink: 0;
}
.pay-brand svg { width: 20px; height: 20px; }

/* VIP 权益图标 */
.benefit-icon {
    color: var(--gold);
    margin-bottom: 4px;
}
.benefit-icon svg { width: 24px; height: 24px; }

/* Logo 方块内图标 */
.nav-logo-mark svg { width: 18px; height: 18px; }

/* hero-kicker 内图标 */
.hero-kicker { display: inline-flex; align-items: center; gap: 6px; }
.hero-kicker svg { width: 14px; height: 14px; }

/* 搜索图标 */
.search-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    pointer-events: none;
}

/* -----------------------------------------------------------
   13. Upload Area —— 上传区域
   ----------------------------------------------------------- */
.upload-area {
    border: 2px dashed var(--border-warm);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    background: rgba(237, 231, 220, 0.35);
    -webkit-tap-highlight-color: transparent;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-2px);
}
.upload-area .upload-icon {
    opacity: 0.75;
}
.upload-area .upload-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: var(--space-xs);
}
.upload-area .upload-hint {
    font-size: var(--text-sm);
    color: var(--ink-muted);
}

/* -----------------------------------------------------------
   14. Progress & Loading
   ----------------------------------------------------------- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--paper-deeper);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 4px;
    transition: width 0.5s var(--ease-out);
    position: relative;
}
/* 进度条流动微光 */
.progress-bar .progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: shimmer 2s infinite;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 241, 234, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: var(--space-md);
    animation: fadeIn var(--duration-fast) var(--ease-out);
}
.loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid var(--border-warm);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -----------------------------------------------------------
   15. Modal —— 底部抽屉（移动）/ 居中弹窗（桌面）
   ----------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 24, 20, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn var(--duration-fast) var(--ease-out);
}
@media (min-width: 768px) {
    .modal-overlay { align-items: center; padding: 24px; }
}
.modal {
    background: var(--paper);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: var(--space-xl);
    animation: slideUp var(--duration-base) var(--ease-out);
    box-shadow: var(--shadow-lift);
}
@media (min-width: 768px) {
    .modal {
        border-radius: var(--radius-xl);
        animation: fadeUp var(--duration-base) var(--ease-out);
    }
}
/* 移动端抽屉顶部把手 */
.modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-warm);
    border-radius: 2px;
    margin: -8px auto 16px;
}
@media (min-width: 768px) {
    .modal::before { display: none; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}
.modal-header h3 { font-size: var(--text-xl); }
.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--paper-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    font-size: 1rem;
    transition: all var(--duration-fast) var(--ease-out);
}
.modal-close:hover { background: var(--paper-deeper); color: var(--ink); }

/* -----------------------------------------------------------
   16. Toast
   ----------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 400px;
}
.toast {
    background: var(--ink);
    color: var(--paper);
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    box-shadow: var(--shadow-lift);
    animation: toastIn 0.35s var(--ease-out);
    pointer-events: auto;
    text-align: center;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--gold); color: var(--ink); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* -----------------------------------------------------------
   17. Hero —— 首页杂志式头部
   ----------------------------------------------------------- */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-2xl);
    position: relative;
}
/* Hero 背后装饰性大字 */
.hero::before {
    content: 'TOOLS';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: clamp(5rem, 18vw, 13rem);
    font-weight: 800;
    color: transparent;
    -webkit-text-stroke: 1px rgba(212, 204, 188, 0.55);
    letter-spacing: 0.05em;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

.hero .hero-kicker {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1.5px solid rgba(200, 85, 61, 0.3);
    border-radius: 999px;
    padding: 4px 14px;
    margin-bottom: var(--space-md);
    background: var(--accent-soft);
}

.hero h1 {
    margin-bottom: var(--space-sm);
    font-weight: 800;
}
/* 主标题渐变墨色 */
.hero h1 .hero-title-accent {
    color: var(--accent);
    font-style: italic;
}

.hero .hero-subtitle {
    font-size: var(--text-lg);
    color: var(--ink-soft);
    max-width: 480px;
    margin: 0 auto var(--space-xl);
    line-height: 1.6;
}

/* 搜索框：圆角胶囊 */
.search-box {
    max-width: 480px;
    margin: 0 auto var(--space-lg);
    position: relative;
}
.search-box .input {
    padding-left: 46px;
    padding-right: 16px;
    height: 52px;
    border-radius: 999px;
    background: var(--paper-dark);
    border-width: 1.5px;
    font-size: var(--text-base);
}
.search-box .input:focus {
    background: var(--paper);
    box-shadow: var(--shadow-card);
}
.search-box .search-icon {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    pointer-events: none;
}

/* -----------------------------------------------------------
   18. Category Section —— 杂志栏目
   ----------------------------------------------------------- */
.category-section {
    margin-bottom: var(--space-2xl);
}

/* 栏目标题：眉标 + 衬线标题 + 计数 */
.category-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--ink);
    position: relative;
}
.category-header .cat-icon {
    font-size: 1.3rem;
    align-self: center;
}
.category-header h2 {
    font-size: var(--text-2xl);
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.category-header .cat-count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--ink-muted);
    margin-left: auto;
    letter-spacing: 0.05em;
}
/* 栏目下分类色点 */
.category-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 48px;
    height: 2px;
    background: var(--card-accent, var(--accent));
}

/* -----------------------------------------------------------
   19. Tool Page —— 工具页布局
   ----------------------------------------------------------- */
.tool-header {
    padding: var(--space-lg) 0;
    border-bottom: 2px solid var(--ink);
    margin-bottom: var(--space-xl);
    position: relative;
}
.tool-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 64px;
    height: 2px;
    background: var(--accent);
}
.tool-header h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-xs);
}
.tool-header .tool-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: var(--text-sm);
    color: var(--ink-muted);
    flex-wrap: wrap;
}

/* 底部固定操作栏（移动端） */
.tool-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(245, 241, 234, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-warm);
    z-index: 50;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    margin-top: var(--space-xl);
}
@media (max-width: 767px) {
    .tool-actions { bottom: var(--tabbar-height); }
}
@media (min-width: 768px) {
    .tool-actions {
        position: static;
        background: none;
        backdrop-filter: none;
        border: none;
        padding: 0;
        margin-top: var(--space-xl);
    }
}

/* 格式选择网格 */
.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (min-width: 768px) {
    .format-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
}
.format-option {
    padding: 12px 8px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 1.5px solid var(--border-warm);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    background: transparent;
    color: var(--ink-soft);
    -webkit-tap-highlight-color: transparent;
}
.format-option:hover {
    border-color: var(--ink-muted);
    background: var(--paper-dark);
    transform: translateY(-1px);
}
.format-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

/* -----------------------------------------------------------
   20. User Center
   ----------------------------------------------------------- */
.user-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl) 0 var(--space-lg);
}
.user-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--paper-deeper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-family: var(--font-display);
    font-weight: 700;
    flex-shrink: 0;
    border: 2.5px solid var(--ink);
    color: var(--ink);
}
.user-info h3 {
    font-size: var(--text-xl);
    font-family: var(--font-body);
    font-weight: 700;
}

.menu-list { list-style: none; display: flex; flex-direction: column; }
.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 4px;
    border-bottom: 1px solid rgba(212, 204, 188, 0.6);
    text-decoration: none;
    color: var(--ink);
    transition: all var(--duration-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--paper-dark); }
.menu-item .menu-left { display: flex; align-items: center; gap: 12px; }
.menu-item .menu-icon { width: 20px; color: var(--ink-soft); }
.menu-item .menu-label { font-weight: 500; }
.menu-item .menu-arrow { color: var(--ink-muted); transition: transform var(--duration-fast); }
.menu-item:hover .menu-arrow { transform: translateX(3px); }

/* -----------------------------------------------------------
   21. VIP Banner & Plans
   ----------------------------------------------------------- */
.vip-banner {
    background: linear-gradient(135deg, var(--ink) 0%, #2C241E 55%, #3A2E24 100%);
    color: var(--paper);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.vip-banner::before {
    content: '✦';
    position: absolute;
    top: 12px;
    right: 20px;
    font-size: 3.5rem;
    color: var(--gold);
    opacity: 0.18;
    pointer-events: none;
}
.vip-banner::after {
    content: '';
    position: absolute;
    bottom: -40%;
    right: -20%;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.22) 0%, transparent 70%);
    pointer-events: none;
}
.vip-banner > * { position: relative; z-index: 1; }
.vip-banner h2 {
    color: var(--gold);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-sm);
}

.plan-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
}
.plan-cards::-webkit-scrollbar { display: none; }
.plan-card {
    min-width: 145px;
    padding: 18px 14px;
    text-align: center;
    border: 2px solid var(--border-warm);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
    background: var(--paper);
    scroll-snap-align: start;
    position: relative;
}
.plan-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
}
.plan-card.recommended { border-color: var(--gold); }
.plan-card .plan-name {
    font-weight: 600;
    font-size: var(--text-base);
    margin-bottom: 6px;
    color: var(--ink-soft);
}
.plan-card.selected .plan-name { color: var(--accent); }
.plan-card .plan-price {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--ink);
}
.plan-card.selected .plan-price { color: var(--accent); }
.plan-card .plan-original {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    text-decoration: line-through;
}
.plan-card .plan-duration {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    margin-top: 6px;
}

/* -----------------------------------------------------------
   22. Footer
   ----------------------------------------------------------- */
.site-footer {
    padding: var(--space-2xl) 0;
    border-top: 1px solid var(--border-warm);
    text-align: center;
    color: var(--ink-muted);
    font-size: var(--text-sm);
    margin-top: var(--space-3xl);
}
.site-footer .footer-brand {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: var(--space-sm);
}
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--accent); }
@media (max-width: 767px) {
    .site-footer { padding-bottom: calc(var(--tabbar-height) + var(--space-xl)); }
}

/* -----------------------------------------------------------
   23. Animations —— 克制的动效
   ----------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes floatSlow {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.animate-fade-in { animation: fadeIn var(--duration-slow) var(--ease-out) both; }
.animate-fade-up { animation: fadeUp var(--duration-slow) var(--ease-out) both; }
.animate-delay-1 { animation-delay: 0.08s; }
.animate-delay-2 { animation-delay: 0.16s; }
.animate-delay-3 { animation-delay: 0.24s; }
.animate-delay-4 { animation-delay: 0.32s; }
.animate-float   { animation: floatSlow 6s ease-in-out infinite; }

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--paper-dark) 25%, var(--paper-deeper) 50%, var(--paper-dark) 75%);
    background-size: 200% 100%;
    animation: shimmer 2.5s infinite;
    border-radius: var(--radius-md);
}

/* -----------------------------------------------------------
   24. Empty State —— 空状态
   ----------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.45;
}
.empty-state .empty-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: var(--space-xs);
}
.empty-state .empty-desc {
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

/* -----------------------------------------------------------
   25. Utilities
   ----------------------------------------------------------- */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-sm  { margin-top: var(--space-sm); }
.mt-md  { margin-top: var(--space-md); }
.mt-lg  { margin-top: var(--space-lg); }
.mt-xl  { margin-top: var(--space-xl); }
.mb-sm  { margin-bottom: var(--space-sm); }
.mb-md  { margin-bottom: var(--space-md); }
.mb-lg  { margin-bottom: var(--space-lg); }
.mb-xl  { margin-bottom: var(--space-xl); }
.p-md   { padding: var(--space-md); }
.p-lg   { padding: var(--space-lg); }
.w-full { width: 100%; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only  { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.mobile-only  { display: block; }
.desktop-only { display: none; }
@media (min-width: 768px) {
    .mobile-only  { display: none; }
    .desktop-only { display: block; }
}

/* -----------------------------------------------------------
   26. 结果预览区
   ----------------------------------------------------------- */
.result-area {
    border: 1.5px solid var(--border-warm);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    background: rgba(237, 231, 220, 0.4);
    text-align: center;
}
.result-area img,
.result-area video {
    max-width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin: 0 auto var(--space-md);
}
.result-area audio {
    width: 100%;
    margin-bottom: var(--space-md);
}
.result-filename {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--ink-muted);
    margin-bottom: var(--space-md);
    word-break: break-all;
}
