/*
Theme Name: 家电故障码查询主题
Theme URI: https://example.com/appliance-fault-theme
Author: WordPress Developer
Author URI: https://example.com
Description: 专为家电故障码查询系统定制的移动端优先响应式主题，支持故障码智能查询、AI对话式搜索、个人中心管理等功能。
Version: 3.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: appliance-fault
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, mobile-first, responsive-layout

This theme is designed for appliance fault code query system with mobile-first responsive design.
*/

/* ============================================
   Design Tokens / CSS Custom Properties
   ============================================ */
:root {
    /* Color Palette - Primary */
    --color-primary: #6366f1;
    --color-primary-light: #818cf8;
    --color-primary-dark: #4f46e5;
    --color-primary-subtle: rgba(99, 102, 241, 0.08);
    --color-primary-hover: #4f46e5;

    /* Color Palette - Accent */
    --color-accent: #8b5cf6;
    --color-accent-light: #a78bfa;
    --color-accent-dark: #7c3aed;

    /* Gradient System */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-primary-hover: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
    --gradient-hero: linear-gradient(160deg, #4f46e5 0%, #6366f1 25%, #8b5cf6 50%, #a855f7 75%, #c084fc 100%);
    --gradient-hero-mesh: radial-gradient(ellipse at 20% 80%, rgba(99, 102, 241, 0.4) 0%, transparent 50%),
                          radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.3) 0%, transparent 50%),
                          radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.2) 0%, transparent 60%),
                          linear-gradient(160deg, #4f46e5 0%, #6366f1 25%, #8b5cf6 50%, #a855f7 75%, #c084fc 100%);
    --gradient-card-shine: linear-gradient(135deg, rgba(99, 102, 241, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);

    /* Neutral Colors */
    --color-bg: #f1f5f9;
    --color-bg-elevated: #ffffff;
    --color-bg-muted: #f8fafc;
    --color-bg-overlay: rgba(15, 23, 42, 0.55);

    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-tertiary: #94a3b8;
    --color-text-inverse: #ffffff;

    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-border-focus: #6366f1;

    /* Semantic Colors */
    --color-success: #22c55e;
    --color-success-light: #dcfce7;
    --color-success-dark: #16a34a;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-dark: #d97706;
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-danger-dark: #dc2626;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;

    /* Typography Scale */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Cascadia Code", "JetBrains Mono", "Courier New", monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 0.9375rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.375rem;
    --text-3xl: 1.75rem;

    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.6;
    --leading-relaxed: 1.75;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-primary: 0 4px 14px rgba(99, 102, 241, 0.35);
    --shadow-primary-lg: 0 8px 24px rgba(99, 102, 241, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 8px 24px rgba(99,102,241,0.12), 0 2px 8px rgba(0,0,0,0.06);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Z-Index Scale */
    --z-dropdown: 50;
    --z-sticky: 100;
    --z-fixed: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* Layout */
    --header-height: 56px;
    --tab-nav-height: 64px;
    --container-max: 1200px;
    --mobile-max: 500px;
}

/* ============================================
   CSS Reset & Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    height: 100%;
    /* 防止移动端弹性滚动导致背景色露出 */
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    /* 使用 calc + safe-area 确保真实手机底部不被遮挡 */
    padding-bottom: calc(var(--tab-nav-height) + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#wpadminbar { display: none !important; visibility: hidden !important; }
html { margin-top: 0 !important; }
html.admin-bar { margin-top: 0 !important; }
body.admin-bar { padding-top: 0 !important; }

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover, a:focus { color: var(--color-primary-dark); outline: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
input, button, textarea, select { font-family: inherit; font-size: inherit; outline: none; border: none; background: none; }
button { cursor: pointer; }

/* ============================================
   Layout Container
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.page-wrapper {
    width: 100%;
    min-height: calc(100vh - var(--tab-nav-height));
    min-height: calc(100dvh - var(--tab-nav-height));
    /* 防止子元素溢出导致横向滚动 */
    overflow-x: hidden;
}

/* ============================================
   Header — Glassmorphism
   ============================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base), box-shadow var(--transition-base);
}

.site-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
    border-bottom-color: rgba(226, 232, 240, 0.8);
}

.site-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
    letter-spacing: -0.02em;
}

.site-title a { -webkit-text-fill-color: transparent; }

/* 桌面端导航默认隐藏（移动端不显示） */
.desktop-nav {
    display: none;
}

/* 个人中心侧边栏在移动端为普通流式布局 */
.uc-sidebar,
.uc-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ============================================
   Hero Section — Immersive Gradient
   ============================================ */
.hero-section {
    margin-top: var(--header-height);
    position: relative;
    padding: var(--space-12) var(--space-6) var(--space-10);
    background: var(--gradient-hero-mesh);
    color: var(--color-text-inverse);
    text-align: center;
    overflow: hidden;
}

.hero-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    /* GPU加速：防止移动端动画卡顿 */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.hero-orb-1 {
    width: 180px;
    height: 180px;
    top: -40px;
    right: -30px;
    animation: heroOrbFloat 8s ease-in-out infinite;
}

.hero-orb-2 {
    width: 120px;
    height: 120px;
    bottom: -20px;
    left: -20px;
    animation: heroOrbFloat 6s ease-in-out infinite reverse;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, transparent 70%);
}

@keyframes heroOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-8px, 12px) scale(1.05); }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.hero-desc {
    font-size: var(--text-md);
    opacity: 0.88;
    font-weight: var(--font-medium);
    letter-spacing: 0.05em;
}

/* Carousel within Hero */
.carousel-slides-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    /* 
     * 不在此容器上加 translateZ(0) !
     * 原因：内部 carousel-track 已有 GPU 加速，
     * 外层再加会造成复合变换，移动端出现闪烁/跳帧
     */
}

/*
 * 无JS降级：当JS未执行时，slides直接在wrapper内（无carousel-track），
 * 只显示第一个slide，隐藏其余
 */
.carousel-slides-wrapper > .carousel-slide:not(:first-child) {
    display: none;
}
.carousel-slides-wrapper > .carousel-slide:first-child {
    width: 100%;
}
/* JS执行后，carousel-track包裹slides，恢复显示 */
.carousel-track .carousel-slide {
    display: block !important;
    /* 
     * flex-shrink:0防止slide被flex压缩
     * flex-basis:auto配合JS动态设置inline width
     * max-width:100vw作为终极安全网，防止slide超出视口
     */
    flex: 0 0 auto;
    max-width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/*
 * carousel-track：JS创建的flex水平容器
 * 默认不可见（opacity:0 + visibility:hidden双重保险）
 * JS完成布局后添加 .carousel-ready 类变为可见
 * opacity用于动画过渡，visibility防止布局未就绪时交互
 */
.carousel-track {
    display: flex;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.carousel-track.carousel-ready {
    opacity: 1;
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease;
}

/* 有图片轮播时，隐藏hero默认渐变背景和装饰 */
.carousel-has-images ~ .hero-decor,
.hero-content > .carousel-has-images ~ .hero-decor {
    /* handled via JS class on hero-section */
}
.hero-section.hero-has-carousel-img {
    background: transparent;
    padding: var(--space-4) var(--space-4) var(--space-2);
}
.hero-section.hero-has-carousel-img .hero-decor {
    display: none;
}

/* 有图片的轮播：全幅图片背景 */
.carousel-slide-img {
    position: relative;
    width: 100%;
    min-height: 160px;
    /* 
     * 宽高比约束：确保图片轮播项在所有设备上有正确的宽高比
     * 16:9 是标准轮播比例，移动端最安全
     * 如需自定义可覆盖此值
     */
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.carousel-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.carousel-slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: var(--space-8) var(--space-5) var(--space-5);
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.carousel-slide-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.carousel-slide .hero-title {
    margin-bottom: var(--space-3);
}

.carousel-slide-img .hero-title {
    text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}

.carousel-slide-img .hero-desc {
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    opacity: 0.92;
}

/* 公告栏 */
.announcement-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-2) var(--space-4) 0;
    padding: var(--space-2) var(--space-3);
    background: var(--color-primary-subtle);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--color-primary);
    overflow: hidden;
}

.announcement-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--color-primary);
}

.announcement-scroll {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 24px;
    /* 防止移动端文字渲染溢出 */
    line-height: 24px;
}

.announcement-track {
    display: flex;
    flex-direction: column;
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    /* 
     * 仅用 will-change 提升合成层，不用 translateZ(0)
     * translateZ(0) 在文字元素上会导致移动端文字模糊
     */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.announcement-item {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 24px;
    height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-base);
    /* 确保不换行，移动端字体缩放安全 */
    flex-shrink: 0;
}

.announcement-item:hover {
    color: var(--color-primary);
}

/* 公告详情弹窗 */
.announcement-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.announcement-modal-overlay.show {
    display: flex;
}

.announcement-modal {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    width: 90%;
    max-width: 420px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    animation: announcementModalIn 0.25s ease;
}

@keyframes announcementModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.announcement-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5) var(--space-2);
}

.announcement-modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin: 0;
    flex: 1;
    padding-right: var(--space-2);
}

.announcement-modal-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--color-bg-muted);
    border-radius: var(--radius-full);
    font-size: 18px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.announcement-modal-close:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.announcement-modal-body {
    padding: 0 var(--space-5) var(--space-5);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.7;
    max-height: 60vh;
    overflow-y: auto;
    word-break: break-word;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: var(--space-5);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: rgba(153, 153, 153, 0.5);
    /* 只过渡宽度和背景色，不过渡所有属性，防止移动端卡顿 */
    transition: width 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease;
    cursor: pointer;
}

.dot.active {
    width: 28px;
    border-radius: 4px;
    background: var(--color-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* ============================================
   Search Panel — Floating Glass Card
   ============================================ */
.search-panel {
    position: relative;
    z-index: 10;
    margin: var(--space-2) var(--space-4) 0;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

/* Mode Switch — Segmented Control */
.mode-switch {
    display: flex;
    gap: 4px;
    background: var(--color-bg-muted);
    padding: 4px;
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-5);
}

.mode-btn {
    flex: 1;
    height: 42px;
    border-radius: calc(var(--radius-xl) - 2px);
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all var(--transition-base);
    border: none;
    position: relative;
}

.mode-btn.active {
    background: var(--color-bg-elevated);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    font-weight: var(--font-semibold);
}

.mode-btn:not(.active):hover {
    color: var(--color-text-secondary);
}

.mode-btn:active {
    transform: scale(0.97);
}

/* Cascade Selects */
.cascade-selects {
    margin-bottom: var(--space-4);
}

.select-row {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    /* 允许小屏换行，避免溢出 */
    flex-wrap: nowrap;
    min-width: 0;
}

.select-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.select-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-primary);
    letter-spacing: 0.04em;
    padding-left: 2px;
}

/* "可选" tag for optional fields */
.select-label .optional-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: var(--font-medium);
    color: var(--color-text-tertiary);
    background: var(--color-bg-muted);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0;
}

/* Hidden native select — keeps search.js compatibility */
.select-input-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}

/* Custom select trigger button */
.custom-select {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 42px;
    padding: 0 32px 0 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #fafbff 0%, var(--color-bg-muted) 100%);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.8);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

.custom-select-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: var(--font-medium);
}

/* Has selected value */
.custom-select.selected {
    color: var(--color-text-primary);
    border-color: rgba(99, 102, 241, 0.25);
    background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
}

.custom-select.selected .custom-select-text {
    color: var(--color-primary-dark);
    font-weight: var(--font-semibold);
}

.custom-select-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary-light);
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

/* Hover */
.custom-select:hover:not(.disabled) {
    border-color: var(--color-primary-light);
    background: linear-gradient(180deg, #ffffff 0%, #f0f1ff 100%);
}

/* Active / pressed */
.custom-select:active:not(.disabled) {
    transform: scale(0.98);
    box-shadow: var(--shadow-xs);
}

/* Focus (keyboard) */
.custom-select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Open state */
.custom-select.open {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle), var(--shadow-sm);
}

.custom-select.open .custom-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* Disabled state */
.custom-select.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--color-bg-muted);
    box-shadow: none;
}

.custom-select.disabled .custom-select-arrow {
    color: var(--color-text-tertiary);
}

/* Connector Arrow between selects */
.select-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    margin-bottom: 12px;
    color: var(--color-border);
    transition: color var(--transition-base);
    flex-shrink: 0;
}

.select-connector.active {
    color: var(--color-primary-light);
}

/* ============================================
   Center Modal Picker（居中弹窗式选择器）
   ============================================ */
.picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.picker-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.picker-sheet {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: var(--z-modal);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-slow), opacity var(--transition-base);
    max-height: 70vh;
    min-height: 200px;
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;   /* 关闭时不拦截点击 */
    visibility: hidden;     /* 双重保障：不拦截也不渲染 */
}

.picker-sheet.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.picker-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.picker-cancel,
.picker-confirm {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    border: none;
    background: none;
    cursor: pointer;
    padding: var(--space-2) var(--space-1);
    -webkit-tap-highlight-color: transparent;
}

.picker-cancel {
    color: var(--color-text-tertiary);
}

.picker-confirm {
    color: var(--color-primary);
}

.picker-confirm:active {
    opacity: 0.7;
}

.picker-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-2) 0;
    overscroll-behavior: contain;
    max-height: calc(70vh - 56px); /* 减去 header 高度，确保整体不超过 70vh */
    scroll-behavior: smooth;
}

/* Picker option items */
.picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-md);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.picker-option:active {
    background: var(--color-primary-subtle);
}

.picker-option.active {
    color: var(--color-primary);
    font-weight: var(--font-semibold);
    background: var(--color-primary-subtle);
}

.picker-option.active::after {
    content: '';
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 13l4 4L19 7' stroke='%236366f1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* Safe area at bottom for phones with home indicator */
.picker-body::after {
    content: '';
    display: block;
    height: env(safe-area-inset-bottom, 0);
}

/* Scroll fade indicator at top */
.picker-body-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
}
.picker-body-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(to bottom, var(--color-bg-elevated), transparent);
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}
.picker-body-wrapper.is-scrollable::before {
    opacity: 1;
}

/* Keyword Row */
.keyword-row {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.keyword-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.keyword-icon {
    position: absolute;
    left: var(--space-3);
    color: var(--color-text-tertiary);
    pointer-events: none;
    transition: color var(--transition-base);
}

.keyword-input {
    width: 100%;
    height: 46px;
    padding: 0 var(--space-4) 0 42px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, #fafbff 0%, var(--color-bg-muted) 100%);
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,0.8);
}

.keyword-input:focus {
    border-color: var(--color-primary);
    background-color: var(--color-bg-elevated);
    box-shadow: 0 0 0 3px var(--color-primary-subtle), var(--shadow-sm);
}

.keyword-input:focus + .keyword-icon,
.keyword-input:focus ~ .keyword-icon {
    color: var(--color-primary);
}

.keyword-input-wrap:focus-within .keyword-icon {
    color: var(--color-primary);
}

/* Search Button */
.search-btn {
    height: 46px;
    padding: 0 var(--space-6);
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-primary);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: 0.02em;
}

.search-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-primary-lg);
    transform: translateY(-1px);
}

.search-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Page Title Section
   ============================================ */
.page-title-section {
    text-align: center;
    padding: var(--space-6) var(--space-4) var(--space-2);
}

.page-main-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
    letter-spacing: -0.02em;
}

.page-sub-title {
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
    font-weight: var(--font-medium);
}

/* ============================================
   Hot Faults Section
   ============================================ */
.hot-faults-section {
    padding: var(--space-4) var(--space-4) 0;
}

.hot-faults-title {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.hot-faults-title svg {
    color: var(--color-warning);
}

.hot-faults-scroll {
    display: flex;
    gap: var(--space-3);
    overflow-x: auto;
    padding-bottom: var(--space-3);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* 隐藏滚动条但保留功能 */
}

.hot-faults-scroll::-webkit-scrollbar {
    display: none;
}

.hot-fault-item {
    flex-shrink: 0;
    min-width: 80px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--color-border-light);
    position: relative;
    overflow: hidden;
}

.hot-fault-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.hot-fault-item:hover {
    background: var(--color-primary-subtle);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(99, 102, 241, 0.15);
}

.hot-fault-item:hover::before {
    opacity: 1;
}

.hot-fault-item:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.hot-fault-code {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    margin-bottom: 2px;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.hot-fault-name {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    line-height: var(--leading-snug);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   Results Section
   ============================================ */
.results-section {
    padding: var(--space-5) var(--space-4) var(--space-4);
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.results-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.results-count {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    font-weight: var(--font-normal);
}

/* Results List */
.results-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ============================================
   Results Placeholder Card
   ============================================ */
.results-placeholder {
    padding: var(--space-4) var(--space-4) var(--space-6);
}

.placeholder-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-card);
    padding: var(--space-10) var(--space-6);
    text-align: center;
    border: 1px solid var(--color-border-light);
}

.placeholder-icon {
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.placeholder-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.placeholder-desc {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    line-height: var(--leading-relaxed);
}

/* ============================================
   Fault Card — Premium Component
   ============================================ */
.fault-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.fault-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.fault-card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.fault-card:hover::before {
    opacity: 1;
}

/* Simple card variant (code + button) */
.fault-card-simple {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
}

.fault-code-main {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-primary);
    letter-spacing: 1.5px;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

/* Level Tags */
.level-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    flex-shrink: 0;
}

.level-tag.level-critical {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.level-tag.level-warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.level-tag.level-info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Detail View Button */
.btn-detail-view {
    margin-left: auto;
    padding: var(--space-2) var(--space-5);
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    box-shadow: var(--shadow-primary);
    transition: all var(--transition-base);
}

.btn-detail-view:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-primary-lg);
}

.btn-detail-view:active:not(:disabled) {
    transform: translateY(0);
}

.btn-detail-view.btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(135deg, #94a3b8, #64748b);
    box-shadow: none;
}

.btn-detail-view.btn-viewed {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    cursor: default;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.btn-detail-view .btn-icon {
    font-size: var(--text-lg);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
}

.empty-visual {
    margin-bottom: var(--space-4);
}

.empty-text {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.empty-hint {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.empty-icon {
    margin-bottom: var(--space-3);
}

/* ============================================
   Pagination & Load More
   ============================================ */
.pagination-wrapper {
    margin-top: var(--space-4);
}

.load-more-btn {
    display: block;
    width: 100%;
    padding: var(--space-3);
    background: var(--color-bg-elevated);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xl);
    color: var(--color-primary);
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-base);
}

.load-more-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-subtle);
}

.load-more-btn:active {
    transform: scale(0.98);
}

/* ============================================
   Modal — Modern Dialog
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--color-bg-overlay);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease;
}

.modal-content {
    position: relative;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    position: sticky;
    top: 0;
    background: var(--color-bg-elevated);
    z-index: 2;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-bg-muted);
    border-radius: 50%;
    font-size: 20px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-4) var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border-light);
    position: sticky;
    bottom: 0;
    background: var(--color-bg-elevated);
}

/* ============================================
   Fault Detail Modal
   ============================================ */
.fault-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.fault-code-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) var(--space-4);
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    border-radius: var(--radius-lg);
    letter-spacing: 1px;
    font-family: var(--font-mono);
    box-shadow: var(--shadow-primary);
}

.fault-detail-body {
    padding: var(--space-5);
}

.detail-section {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
}

.detail-section:last-of-type {
    margin-bottom: var(--space-4);
    padding-bottom: 0;
    border-bottom: none;
}

.detail-level {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fef2f2 0%, var(--color-bg-elevated) 100%);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--color-danger);
}

.detail-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.detail-value {
    font-size: var(--text-md);
    line-height: var(--leading-relaxed);
    color: var(--color-text-primary);
    margin: 0;
    word-break: break-word;
}

.solution-text {
    background: linear-gradient(135deg, #f0fdf4 0%, var(--color-bg-elevated) 100%);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--color-success);
    line-height: var(--leading-relaxed);
    white-space: pre-wrap;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
}

.level-critical {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.level-warning {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    color: #d97706;
    border: 1px solid #fde68a;
}

.level-info {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.detail-meta {
    background: var(--color-bg-muted);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    display: flex;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.meta-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.meta-value {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
}

.detail-loading {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-tertiary);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin: 0 auto var(--space-3);
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   Chat Interface (AI Search Page)
   v4.0 — 类ChatGPT侧栏布局
   ============================================ */

/* 根容器 */
.chat-app {
    background: var(--color-bg);
    overflow: hidden;
}

/* 未登录状态 */
.chat-app-guest {
    margin-top: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--header-height) - var(--tab-nav-height));
    background: var(--color-bg);
}

.chat-guest {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-6);
    text-align: center;
}

/* 主布局容器 */
.chat-app-layout {
    position: relative;
    display: flex;
    margin-top: var(--header-height);
    height: calc(100dvh - var(--header-height) - var(--tab-nav-height));
    height: calc(100vh - var(--header-height) - var(--tab-nav-height));
    background: var(--color-bg);
    overflow: hidden;
}

/* ---- 侧栏遮罩 ---- */
.chat-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chat-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---- 左侧边栏 ---- */
.chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: #1e1e2e;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 91;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-sidebar.open {
    transform: translateX(0);
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-new-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.sidebar-new-chat:active {
    opacity: 0.85;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: rgba(226, 232, 240, 0.5);
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

/* 对话历史列表 */
.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) 0;
    -webkit-overflow-scrolling: touch;
}

.sidebar-history::-webkit-scrollbar {
    width: 4px;
}

.sidebar-history::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-history::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* 日期分组标签 */
.sidebar-date-group {
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: 11px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 单个对话项 */
.sidebar-conv-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    margin: 1px var(--space-2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    color: rgba(226, 232, 240, 0.7);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.sidebar-conv-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-conv-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-conv-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-conv-delete {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: rgba(226, 232, 240, 0.4);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-conv-delete:active {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* 底部区域 */
.sidebar-bottom {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-clear-all {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-lg);
    color: rgba(226, 232, 240, 0.4);
    font-size: var(--text-xs);
    cursor: pointer;
    width: 100%;
}

.sidebar-clear-all:active {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ---- 主聊天区域 ---- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: var(--color-bg);
}

/* 顶部栏 */
.chat-topbar {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    background: var(--color-bg-elevated);
    gap: var(--space-3);
    position: relative;
}

.chat-sidebar-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.chat-sidebar-toggle:active {
    background: var(--color-bg-muted);
}

/* 模型选择器 */
.chat-model-selector {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.chat-model-selector:active {
    background: var(--color-primary-subtle);
}

.model-arrow {
    color: var(--color-text-tertiary);
    transition: transform var(--transition-base);
}

.chat-model-selector.open .model-arrow {
    transform: rotate(180deg);
}

/* 模型下拉菜单 */
.model-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: var(--space-4);
    right: var(--space-4);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-base);
    z-index: 100;
}

.model-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    cursor: pointer;
}

.model-option:active {
    background: var(--color-bg-muted);
}

.model-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-option-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.model-option-desc {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.model-option-check {
    color: var(--color-primary);
    opacity: 0;
    flex-shrink: 0;
}

.model-option.active .model-option-check {
    opacity: 1;
}

/* 聊天主体 */
.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.guest-visual {
    margin-bottom: var(--space-6);
}

.guest-icon {
    width: 96px;
    height: 96px;
    border-radius: var(--radius-3xl);
    background: var(--color-primary-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.15); }
    50% { box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); }
}

.guest-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.guest-desc {
    font-size: var(--text-md);
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-6);
}

.guest-login-btn {
    min-width: 160px;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-4);
    padding-bottom: var(--space-6);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Welcome Section */
.chat-welcome {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--gradient-card-shine);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-5);
}

.welcome-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
}

.welcome-content {
    flex: 1;
}

.welcome-greeting {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.welcome-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--leading-normal);
}

/* Quick Prompts */
.quick-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.quick-prompt {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}

.quick-prompt:hover {
    border-color: var(--color-primary-light);
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.quick-prompt:active {
    transform: translateY(0);
}

.prompt-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Chat Bubbles */
.chat-msg {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    animation: msgSlideIn 0.3s ease both;
}

@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
}

.chat-msg-ai .chat-msg-avatar {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.chat-msg-user .chat-msg-avatar {
    background: var(--color-bg-muted);
    color: var(--color-text-tertiary);
    border: 1px solid var(--color-border);
}

.chat-msg-bubble {
    max-width: 80%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-xl);
    font-size: var(--text-md);
    line-height: var(--leading-relaxed);
    word-break: break-word;
}

.chat-msg-ai .chat-msg-bubble {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
    border-top-left-radius: var(--radius-sm);
}

.chat-msg-user .chat-msg-bubble {
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    border-top-right-radius: var(--radius-sm);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-2xl);
    border-bottom-left-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-tertiary);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================
   Message Bubbles
   ============================================ */
.message-item {
    display: flex;
    margin-bottom: var(--space-4);
    animation: fadeInUp 0.3s ease both;
}

.message-item.user {
    justify-content: flex-end;
}

.message-item.ai {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 85%;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-2xl);
    font-size: var(--text-md);
    line-height: var(--leading-relaxed);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-item.user .message-bubble {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.message-item.ai .message-bubble {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
    border-bottom-left-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Message Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0 var(--space-2);
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-item.user .message-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    order: 1;  /* 用户头像在右侧 */
}

.message-item.ai .message-avatar,
.avatar-ai {
    background: var(--gradient-primary);
    color: white;
    order: 0;  /* AI头像在左侧 */
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Custom Modal Dialog (安全替代confirm/alert) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(-20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: 28px;
}

.modal-icon.warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.modal-icon.danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-3);
    color: var(--color-text-primary);
}

.modal-message {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    text-align: center;
    margin-bottom: var(--space-5);
    white-space: pre-line;  /* 支持换行符 */
}

.modal-buttons {
    display: flex;
    gap: var(--space-3);
}

.modal-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.modal-btn-primary {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.modal-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

.modal-btn-secondary {
    background: var(--color-bg-muted);
    color: var(--color-text-secondary);
}

.modal-btn-secondary:hover {
    background: var(--color-border-light);
    color: var(--color-text-primary);
}

/* Chat Input Area */
.chat-input-area {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-4);
    padding-bottom: var(--space-3);
    background: var(--color-bg-elevated);
    border-top: 1px solid var(--color-border-light);
}

.input-wrapper {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.chat-input {
    flex: 1;
    height: 44px;
    padding: 0 var(--space-4);
    background: var(--color-bg-muted);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-xl);
    font-size: var(--text-md);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
}

.chat-input:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-elevated);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-primary-lg);
    transform: scale(1.05);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.send-btn.is-stop {
    background: #666;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.send-btn.is-stop:hover {
    background: #e74c3c;
    box-shadow: 0 4px 12px rgba(231,76,60,0.3);
    transform: scale(1.05);
}

.send-btn.is-stop:active {
    transform: scale(0.95);
}

.clear-history-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg-muted);
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.clear-history-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    transform: scale(1.05);
}

.clear-history-btn:active {
    transform: scale(0.95);
}

.input-hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-align: center;
    margin-top: var(--space-2);
}

/* ============================================
   User Center
   ============================================ */
.user-center {
    margin-top: var(--header-height);
    padding: 0 var(--space-4);
    padding-bottom: calc(var(--space-4) + var(--tab-nav-height) + env(safe-area-inset-bottom, 0px));
    background: var(--color-bg);
}

/* ============================================
   User Center — Header
   ============================================ */
.uc-header {
    position: relative;
    padding: var(--space-8) var(--space-5) var(--space-6);
    margin: 0 calc(var(--space-4) * -1);
    margin-bottom: 0;
    overflow: hidden;
}

.uc-header-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero-mesh);
    z-index: 0;
}

.uc-header-bg::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.uc-header-bg::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -15%;
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
}

.uc-header-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--color-text-inverse);
}

/* Avatar */
.uc-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: var(--space-3);
}

.uc-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.uc-avatar-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.uc-avatar-edit {
    position: absolute;
    bottom: 0;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-bg-elevated);
    border: 2px solid rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--color-primary);
    padding: 0;
}

.uc-avatar-edit svg {
    width: 14px;
    height: 14px;
}

.uc-avatar-edit:hover {
    transform: scale(1.1);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

.uc-avatar-remove {
    display: none;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.7);
    background: none;
    border: none;
    cursor: pointer;
    margin-top: var(--space-1);
    text-decoration: underline;
}

.uc-nickname {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-1);
    letter-spacing: -0.01em;
}

.uc-phone {
    font-size: var(--text-sm);
    opacity: 0.85;
    margin-bottom: var(--space-3);
}

/* Badge Row */
.uc-badge-row {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.uc-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.uc-badge-vip {
    background: rgba(250, 204, 21, 0.25);
    border-color: rgba(250, 204, 21, 0.3);
}

.uc-badge-icon {
    display: inline-flex;
    color: #facc15;
}

.uc-badge-icon svg {
    width: 14px;
    height: 14px;
}

.uc-badge-default {
    background: rgba(255, 255, 255, 0.12);
}

.uc-badge-info {
    background: rgba(96, 165, 250, 0.25);
    border-color: rgba(96, 165, 250, 0.3);
}

/* ============================================
   User Center — Quick Grid
   ============================================ */
.uc-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-4);
    margin: calc(var(--space-4) * -1) var(--space-4) var(--space-4);
    margin-top: calc(-1 * var(--space-4));
    position: relative;
    z-index: 2;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
}

.uc-quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    text-decoration: none;
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.uc-quick-item:active {
    transform: scale(0.95);
    background: var(--color-primary-subtle);
}

.uc-quick-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-1);
}

.uc-quick-icon svg {
    width: 22px;
    height: 22px;
}

.uc-qi-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.uc-qi-green {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.uc-qi-purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.uc-qi-orange {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.uc-quick-value {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    line-height: var(--leading-tight);
}

.uc-quick-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-align: center;
    white-space: nowrap;
}

/* ============================================
   User Center — Activate Card
   ============================================ */
.uc-activate-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
    animation: fadeInUp 0.25s ease both;
}

.uc-activate-row {
    display: flex;
    gap: var(--space-3);
}

.uc-activate-input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
    transition: all var(--transition-base);
}

.uc-activate-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
    outline: none;
    background: var(--color-bg-elevated);
}

.uc-activate-btn {
    padding: var(--space-3) var(--space-6);
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-primary);
}

.uc-activate-btn:hover {
    box-shadow: var(--shadow-primary-lg);
    transform: translateY(-1px);
}

.uc-activate-btn:active {
    transform: translateY(0);
}

.uc-activate-hint {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    text-align: center;
    margin-top: var(--space-2);
}

/* ============================================
   User Center — Card (Accordion)
   ============================================ */
.uc-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl);
    padding: 0;
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
    overflow: hidden;
}

.uc-card-centered {
    text-align: center;
    padding: var(--space-8) var(--space-6);
}

.uc-card-header {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    transition: background var(--transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.uc-card-header:hover {
    background: var(--color-bg-muted);
}

.uc-card-header:active {
    background: var(--color-primary-subtle);
}

.uc-card-icon {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
    margin-right: var(--space-3);
    flex-shrink: 0;
}

.uc-card-icon svg {
    width: 20px;
    height: 20px;
}

.uc-card-title {
    flex: 1;
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.uc-card-arrow {
    color: var(--color-text-tertiary);
    transition: transform var(--transition-base);
    flex-shrink: 0;
}

.uc-card-arrow svg {
    width: 16px;
    height: 16px;
}

.uc-card-header-open .uc-card-arrow {
    transform: rotate(90deg);
}

.uc-card-body {
    padding: 0 var(--space-5) var(--space-5);
    animation: fadeInUp 0.2s ease both;
}

/* ============================================
   User Center — Forms
   ============================================ */
.uc-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.uc-form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.uc-form-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.uc-required {
    color: var(--color-danger);
    font-size: var(--text-base);
}

.uc-optional {
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
    font-weight: var(--font-normal);
}

.uc-form-input {
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    transition: all var(--transition-base);
    background: var(--color-bg-muted);
    color: var(--color-text-primary);
}

.uc-form-input:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-elevated);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
    outline: none;
}

.uc-form-input.error {
    border-color: var(--color-danger);
    background: var(--color-danger-light);
}

.uc-form-textarea {
    resize: vertical;
    min-height: 72px;
    line-height: var(--leading-normal);
}

.uc-form-counter {
    text-align: right;
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

/* ============================================
   User Center — Buttons
   ============================================ */
.uc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-md);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-base);
    line-height: var(--leading-snug);
}

.uc-btn-primary {
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-primary);
}

.uc-btn-primary:hover {
    box-shadow: var(--shadow-primary-lg);
    transform: translateY(-1px);
}

.uc-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.uc-btn-text {
    background: transparent;
    color: var(--color-primary);
    padding: var(--space-2) var(--space-4);
}

.uc-btn-text:hover {
    background: var(--color-primary-subtle);
}

.uc-btn-block {
    width: 100%;
}

.uc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   User Center — History List
   ============================================ */
.uc-history-list {
    min-height: 60px;
}

.uc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6) var(--space-4);
    color: var(--color-text-tertiary);
}

.uc-empty p {
    font-size: var(--text-sm);
}

.uc-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-2);
    background: var(--color-bg-muted);
    transition: all var(--transition-fast);
}

.uc-history-item:hover {
    background: var(--color-primary-subtle);
}

.uc-history-item:last-child {
    margin-bottom: 0;
}

.uc-history-info {
    flex: 1;
    min-width: 0;
}

.uc-history-query {
    font-size: var(--text-md);
    color: var(--color-text-primary);
    font-weight: var(--font-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.uc-history-time {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.uc-history-link {
    font-size: var(--text-sm);
    color: var(--color-primary);
    flex-shrink: 0;
    margin-left: var(--space-3);
}

/* ============================================
   User Center — Menu
   ============================================ */
.uc-menu {
    display: flex;
    flex-direction: column;
}

.uc-menu-item {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    color: var(--color-text-primary);
    text-decoration: none;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--color-border-light);
    -webkit-tap-highlight-color: transparent;
}

.uc-menu-item:last-child {
    border-bottom: none;
}

.uc-menu-item:hover {
    background: var(--color-bg-muted);
}

.uc-menu-item:active {
    background: var(--color-primary-subtle);
}

.uc-menu-icon {
    width: 20px;
    height: 20px;
    margin-right: var(--space-3);
    color: var(--color-primary);
    flex-shrink: 0;
}

.uc-menu-icon svg {
    width: 20px;
    height: 20px;
}

.uc-menu-text {
    flex: 1;
    font-size: var(--text-md);
}

.uc-menu-arrow {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.uc-menu-arrow svg {
    width: 16px;
    height: 16px;
}

.uc-menu-item-danger {
    color: var(--color-danger);
}

.uc-menu-item-danger .uc-menu-icon {
    color: var(--color-danger);
}

.uc-menu-item-danger:hover {
    background: var(--color-danger-light);
}

/* Auth Switch */
.uc-auth-switch {
    margin-top: var(--space-4);
    font-size: var(--text-base);
    color: var(--color-text-tertiary);
}

.uc-link-primary {
    color: var(--color-primary);
    font-weight: var(--font-medium);
}

.uc-link-primary:hover {
    color: var(--color-primary-dark);
}

/* ============================================
   User Center — Modal
   ============================================ */
.uc-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.uc-modal.show {
    pointer-events: auto;
    opacity: 1;
}

.uc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--color-bg-overlay);
}

.uc-modal-content {
    position: relative;
    width: 100%;
    max-width: var(--mobile-max);
    background: var(--color-bg-elevated);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
    max-height: 85vh;
    overflow-y: auto;
}

.uc-modal.show .uc-modal-content {
    transform: translateY(0);
}

.uc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
}

.uc-modal-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.uc-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-muted);
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.uc-modal-close:hover {
    background: var(--color-border);
}

.uc-modal-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ============================================
   Bottom Tab Navigation
   ============================================ */
.bottom-tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--tab-nav-height);
    /* 安全区域由 body padding-bottom 处理，此处只加安全距离撑高 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;
    /* 防止内部元素溢出 */
    overflow: hidden;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
    transition: all var(--transition-base);
    text-decoration: none;
    min-height: 44px;
    position: relative;
}

.tab-icon {
    font-size: 22px;
    line-height: 1;
    transition: all var(--transition-base);
}

.tab-label {
    font-weight: var(--font-medium);
    transition: all var(--transition-base);
}

.tab-item.active {
    color: var(--color-primary);
}

.tab-item.active .tab-icon {
    transform: scale(1.15);
}

.tab-item.active::after {
    content: '';
    position: absolute;
    top: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-primary);
}

.tab-item:active {
    transform: scale(0.92);
}

/* ============================================
   User Profile Card (Legacy class support)
   ============================================ */
.user-profile-card {
    background: var(--gradient-hero-mesh);
    border-radius: var(--radius-2xl);
    padding: var(--space-6) var(--space-5);
    color: var(--color-text-inverse);
    text-align: center;
    margin-bottom: var(--space-4);
    position: relative;
    overflow: hidden;
}

.user-profile-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.user-nickname {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.user-expire {
    font-size: var(--text-sm);
    opacity: 0.9;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(10px);
    color: var(--color-text-inverse);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-xl);
    font-size: var(--text-base);
    z-index: var(--z-toast);
    animation: toastFade 2s ease-in-out forwards;
    max-width: 80%;
    text-align: center;
}

@keyframes toastFade {
    0%, 100% { opacity: 0; visibility: hidden; }
    10%, 90% { opacity: 1; visibility: visible; }
}

/* ============================================
   Utility & Animation Classes
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: var(--space-3); }
.mt-15 { margin-top: var(--space-4); }
.mt-20 { margin-top: var(--space-5); }
.mb-10 { margin-bottom: var(--space-3); }
.mb-15 { margin-bottom: var(--space-4); }
.mb-20 { margin-bottom: var(--space-5); }

.hidden { display: none !important; }
.visible { display: block !important; }

.fade-in { animation: fadeInUp 0.3s ease both; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Login Page
   ============================================ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-color: #0f0f23;
    position: relative;
    padding: var(--space-6) var(--space-4);
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(15, 15, 35, 0.3) 0%,
        rgba(15, 15, 35, 0.6) 50%,
        rgba(15, 15, 35, 0.9) 100%
    );
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 2;
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-4);
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.login-logo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-2xl);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.login-title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--space-2);
}

.login-subtitle {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
}

/* Login Form */
.login-form {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: var(--space-6) var(--space-5);
    margin-bottom: var(--space-5);
}

.login-error {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.login-field {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

.login-field:focus-within {
    border-color: var(--accent-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.login-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: var(--space-4);
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.login-field-icon svg {
    width: 18px;
    height: 18px;
}

.login-input {
    flex: 1;
    background: none;
    border: none;
    padding: var(--space-4) var(--space-3);
    color: #fff;
    font-size: var(--text-base);
    outline: none;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.login-toggle-pwd {
    background: none;
    border: none;
    padding: var(--space-3) var(--space-4);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.login-toggle-pwd:hover {
    color: rgba(255, 255, 255, 0.7);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.login-remember {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--text-sm);
    cursor: pointer;
}

.login-remember input[type="checkbox"] {
    accent-color: var(--accent-color, #6366f1);
    width: 16px;
    height: 16px;
}

.login-forgot {
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.login-forgot:hover {
    color: var(--accent-color, #6366f1);
}

.login-btn {
    width: 100%;
    padding: var(--space-4);
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-color, #6366f1), #8b5cf6);
    color: #fff;
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.login-btn:active {
    transform: translateY(0);
}

/* Social Login */
.login-divider {
    display: flex;
    align-items: center;
    margin: var(--space-5) 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.login-divider span {
    padding: 0 var(--space-3);
    color: rgba(255, 255, 255, 0.35);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.login-social {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.login-social-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    backdrop-filter: blur(8px);
}

.login-social-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--social-color, rgba(255, 255, 255, 0.3));
    color: #fff;
}

.login-social-btn svg {
    width: 20px;
    height: 20px;
}

.login-social-qq {
    --social-color: #12B7F5;
}

.login-social-qq svg {
    color: #12B7F5;
}

.login-social-wechat {
    --social-color: #07C160;
}

.login-social-wechat svg {
    color: #07C160;
}

.login-social-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: var(--space-6);
    color: rgba(255, 255, 255, 0.45);
    font-size: var(--text-sm);
}

.login-register-link {
    color: var(--accent-color, #6366f1);
    text-decoration: none;
    font-weight: 500;
    margin-left: var(--space-1);
    transition: color var(--transition-fast);
}

.login-register-link:hover {
    color: #818cf8;
}

/* 密码强度指示器（注册页） */
.reg-password-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 0 4px;
}
.reg-strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}
.reg-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}
.reg-strength-text {
    font-size: 12px;
    font-weight: 500;
    min-width: 32px;
    text-align: right;
}

/* ============================================
   Responsive — Tablet & Mobile Centering (501-1024px)
   1025px+ 的桌面端布局见 css/desktop.css
   ============================================ */
@media (min-width: 501px) and (max-width: 1024px) {
    .site-main {
        max-width: var(--mobile-max);
        margin: 0 auto;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
        position: relative;
    }

    /* AI搜索页不受500px限制 */
    .chat-app.site-main,
    body.page-template-ai-search-php .site-main {
        max-width: none !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .site-header .container {
        max-width: var(--mobile-max);
    }

    .bottom-tab-nav {
        max-width: var(--mobile-max);
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    }

    .search-panel {
        margin-left: var(--space-4);
        margin-right: var(--space-4);
    }
}

/* ============================================
   手机端 APP 打开提示浮层（全局）
   homepage.php 和 fault-query.php 共用
   ============================================ */
.mobile-app-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 10px 16px;
}

.app-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.app-banner-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6366f1;
}

.app-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-banner-text strong {
    font-size: 14px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-banner-text span {
    font-size: 12px;
    color: #64748b;
}

.app-banner-open {
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.app-banner-open:hover {
    opacity: 0.9;
}

.app-banner-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.app-banner-close:hover {
    color: #64748b;
}

/* 有浮层时内容区下移 */
body.has-mobile-banner .site-header,
body.has-mobile-banner .hero-section {
    margin-top: 52px;
}

/* PC端也居中浮层 */
@media screen and (min-width: 1025px) {
    .mobile-app-banner {
        display: none !important;
    }
}


/* ============================================
   法律文档页面
   ============================================ */
.legal-page-main {
    min-height: 100vh;
    background: #f8fafc;
    padding: 0;
}

.legal-page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

.legal-article {
    background: #fff;
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.legal-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.legal-page-content {
    font-size: 15px;
    line-height: 1.8;
    color: #475569;
}

.legal-page-content h2,
.legal-page-content h3 {
    color: #1e293b;
    margin-top: 24px;
    margin-bottom: 12px;
}

.legal-page-content h2 {
    font-size: 18px;
    font-weight: 600;
}

.legal-page-content h3 {
    font-size: 16px;
    font-weight: 600;
}

.legal-page-content p {
    margin: 0 0 12px;
}

.legal-page-content ul,
.legal-page-content ol {
    padding-left: 20px;
    margin: 0 0 12px;
}

.legal-page-content li {
    margin-bottom: 6px;
}

.legal-page-content a {
    color: #6366f1;
    text-decoration: none;
}

.legal-page-content a:hover {
    text-decoration: underline;
}

@media screen and (max-width: 600px) {
    .legal-page-container {
        padding: 20px 16px 80px;
    }
    .legal-article {
        padding: 24px 20px;
        border-radius: 0;
    }
    .legal-page-title {
        font-size: 20px;
    }
}
