/* ============================================================
   洛小智 · 一站式数智学伴 - Apple Design System Inspired Stylesheet
   基于 DESIGN.md Apple 设计规范
   主色调：蓝白为主，浅灰辅助，教育场景适配
   ============================================================ */

/* --- CSS Variables --- */
:root {
    /* Apple-inspired colors adapted for education (blue-white theme) */
    --color-primary: #0071e3;
    --color-primary-hover: #0077ED;
    --color-primary-active: #006edb;
    --color-link: #0066cc;
    --color-link-dark: #2997ff;

    --color-bg-light: #f5f5f7;
    --color-bg-white: #ffffff;
    --color-bg-dark: #1d1d1f;

    --color-text-primary: #1d1d1f;
    --color-text-secondary: rgba(0, 0, 0, 0.8);
    --color-text-tertiary: rgba(0, 0, 0, 0.48);
    --color-text-white: #ffffff;

    --color-surface: #ffffff;
    --color-surface-alt: #f5f5f7;
    --color-border: rgba(0, 0, 0, 0.06);

    --color-success: #34c759;
    --color-warning: #ff9500;
    --color-error: #ff3b30;

    /* Card shadow - Apple spec */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 4px 24px rgba(0, 0, 0, 0.12);
    --shadow-elevated: rgba(0, 0, 0, 0.22) 3px 5px 30px 0px;

    /* Border radius - Apple scale */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 980px;

    /* Typography */
    --font-display: -apple-system, 'SF Pro Display', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-text: -apple-system, 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Consolas', 'Courier New', monospace;

    /* Spacing base: 8px */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Nav height */
    --nav-height: 48px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-normal: 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-slow: 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-text);
    font-size: 17px;
    line-height: 1.47;
    letter-spacing: -0.374px;
    color: var(--color-text-primary);
    background: var(--color-bg-white);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--color-link); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

/* --- Scrollbar (subtle Apple-style) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ============================================================
   Navigation - Apple Glass Style
   ============================================================ */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    z-index: 1000;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-normal);
}

.nav-inner {
    max-width: 1080px;            /* 略加宽，给 Logo 更多呼吸空间 */
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-5);
    gap: var(--space-4);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;             /* 加粗，让 Logo 视觉权重更高 */
    color: var(--color-text-primary);
    letter-spacing: -0.374px;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
    padding-right: var(--space-5); /* 右侧留白 */
    margin-right: var(--space-3);  /* 与下一个元素拉开距离 */
    border-right: 1px solid var(--color-border); /* 细分隔线，让 Logo 独立成块 */
}

.nav-brand:hover { opacity: 0.75; transform: translateY(-1px); }

.nav-brand i {
    font-size: 22px;
    color: var(--color-primary);
    /* 图标加上柔和的圆角背景，强化品牌识别 */
    background: linear-gradient(135deg, rgba(0,113,227,.10), rgba(52,170,220,.10));
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 移动端：分隔线去除，间距适当收紧 */
@media (max-width: 834px) {
    .nav-brand {
        border-right: none;
        padding-right: 0;
        margin-right: 0;
    }
    .nav-brand i {
        font-size: 18px;
        width: 28px;
        height: 28px;
    }
}

.nav-links {
    display: flex;
    gap: var(--space-5);
}

.nav-links a {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-secondary);
    letter-spacing: -0.12px;
    line-height: var(--nav-height);
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--color-text-primary);
    text-decoration: none;
}

.nav-actions {
    display: flex;
    gap: var(--space-2);
}

.nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text-primary);
}

.mobile-menu-btn { display: none; }

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    gap: var(--space-1);
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    color: var(--color-text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mobile-menu a:hover {
    background: var(--color-bg-light);
    text-decoration: none;
}

/* ============================================================
   Main Content
   ============================================================ */
#app-main {
    padding-top: var(--nav-height);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* 确保页面容器不会横向溢出 */
.page {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Page transitions */
.page {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.page.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    min-height: auto;
    overflow-y: visible;
    overflow-x: hidden;
}

.page.entering {
    display: block;
    opacity: 0;
    transform: translateY(8px);
}

/* ============================================================
   Home Page - Hero Section
   ============================================================ */
.hero-section {
    background: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);
    padding: 80px var(--space-5) var(--space-6);
    text-align: center;
    flex-shrink: 0;
}

.hero-content {
    max-width: 680px;
    margin: 0 auto;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.28px;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.hero-subtitle {
    font-size: 17px;
    font-weight: 400;
    line-height: 1.19;
    letter-spacing: 0.231px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
}

.hero-badge {
    display: inline-block;
    padding: 4px 16px;
    background: linear-gradient(135deg, var(--color-primary), #5ac8fa);
    color: var(--color-text-white);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: var(--radius-pill);
    margin-bottom: var(--space-4);
}

/* Avatar */
.avatar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

/* 视频+Canvas共用包裹层 — 正方形保证全身显示 */
.avatar-media-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    background: transparent;
}

#avatar-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 0;
}

/* 视频叠加层（由 avatar-video.js 动态注入） */
.avatar-video-overlay {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0; /* inset shorthand不兼容iOS<14.5 */
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 正方形视频在任意容器内全身可见 */
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.3s ease;
    background: transparent;
}

/* 迷你头像区域 — 固定正方形，与720×720视频比例完美匹配 */
.mini-avatar-area {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto var(--space-3);
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-surface-alt);
    display: block;          /* 不被后续 flex 定义覆盖 */
}

/* 迷你视频：绝对覆盖整个正方形区域，cover模式无需裁切 */
.mini-avatar-video {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0; /* inset shorthand不兼容iOS<14.5 */
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* canvas 退到视频背后（视频加载失败时仍可显示） */
.mini-avatar-area canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.avatar-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.avatar-switch {
    width: 36px;
    height: 36px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-white);
    border-radius: var(--radius-pill);
    cursor: pointer;
    color: var(--color-text-tertiary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.avatar-switch:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(0, 113, 227, 0.04);
}

.avatar-speech-bubble {
    max-width: 420px;
    margin: 0 auto;
    padding: var(--space-2) var(--space-5);
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    position: relative;
    animation: fadeInUp 0.6s ease;
}

.avatar-speech-bubble::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--color-bg-white);
    border-radius: 2px;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0,0,0,0.04);
}

.avatar-speech-bubble p {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Features Grid */
.features-grid {
    max-width: 980px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-5) var(--space-4);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    flex: 1;
    overflow-y: auto;
    align-content: start;
}

.feature-card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    opacity: 0;
    background: linear-gradient(135deg, rgba(0,113,227,0.04), rgba(0,113,227,0.01));
    transition: opacity var(--transition-normal);
}

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

.feature-card:hover::after { opacity: 1; }

.feature-card:active {
    transform: translateY(-2px) scale(0.98);
}

.feature-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto var(--space-2);
    background: linear-gradient(135deg, #e8f0fe, #dbeafe);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-primary);
    transition: transform var(--transition-normal);
}

.feature-card:hover .feature-icon {
    transform: scale(1.08);
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.231px;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.feature-card p {
    font-size: 14px;
    line-height: 1.43;
    letter-spacing: -0.224px;
    color: var(--color-text-tertiary);
}

/* ============================================================
   Page Header (all function pages)
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5);
    max-width: 980px;
    margin: 0 auto;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.196px;
    color: var(--color-text-primary);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.back-btn:hover {
    background: rgba(0, 113, 227, 0.06);
}

/* ============================================================
   Page Body - Two Column Layout
   ============================================================ */
.page-body {
    max-width: 980px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-5) var(--space-3);
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    align-items: stretch;
    height: 100%;
}

.input-panel {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-card);
    overflow-y: auto;
    min-height: 0;
}

.result-panel {
    background: var(--color-surface-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    overflow-y: auto;
    min-height: 0;
}

/* mini-avatar-area 已在上方 avatar 区块完整定义，此处不重复 */

.result-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-secondary);
    overflow-y: auto;
    max-height: 600px;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--color-text-tertiary);
    text-align: center;
    gap: var(--space-3);
}

.result-placeholder i {
    font-size: 36px;
    opacity: 0.3;
}

.result-placeholder p {
    font-size: 14px;
}

/* Result content styling (rendered markdown) */
.result-content h1, .result-content h2, .result-content h3, .result-content h4 {
    font-family: var(--font-display);
    color: var(--color-text-primary);
    margin: var(--space-5) 0 var(--space-3);
}

.result-content h1 { font-size: 24px; font-weight: 600; }
.result-content h2 { font-size: 21px; font-weight: 600; }
.result-content h3 { font-size: 17px; font-weight: 600; }
.result-content h4 { font-size: 15px; font-weight: 600; }

.result-content p { margin-bottom: var(--space-3); }

.result-content ul, .result-content ol {
    margin-bottom: var(--space-3);
    padding-left: var(--space-6);
}

.result-content li { margin-bottom: var(--space-1); }

.result-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 14px;
}

.result-content pre {
    background: var(--color-bg-dark);
    color: var(--color-text-white);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin-bottom: var(--space-4);
}

.result-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.result-content strong {
    font-weight: 600;
    color: var(--color-text-primary);
}

.result-content blockquote {
    border-left: 3px solid var(--color-primary);
    padding-left: var(--space-4);
    color: var(--color-text-tertiary);
    margin: var(--space-3) 0;
}

.result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    font-size: 14px;
}

.result-content table th,
.result-content table td {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.result-content table th {
    font-weight: 600;
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.02);
}

/* ============================================================
   Form Elements
   ============================================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.29;
    letter-spacing: -0.224px;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.required { color: var(--color-error); }

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-text);
    font-size: 15px;
    line-height: 1.47;
    letter-spacing: -0.374px;
    color: var(--color-text-primary);
    background: var(--color-bg-light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    background: var(--color-bg-white);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-group.half {
    flex: 1;
}

/* Checkbox group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
}

.checkbox-item {
    display: flex !important;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px !important;
    font-weight: 400 !important;
    color: var(--color-text-secondary) !important;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* File upload area */
.file-upload {
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.file-upload:hover {
    border-color: var(--color-primary);
    background: rgba(0, 113, 227, 0.02);
}

.file-upload i {
    font-size: 28px;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-2);
}

.file-upload p {
    font-size: 13px;
    color: var(--color-text-tertiary);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload.has-file {
    border-color: var(--color-success);
    background: rgba(52, 199, 89, 0.04);
}

/* Image Upload Area */
.image-upload-area {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.image-upload-btn {
    flex: 1;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.image-upload-btn:hover {
    border-color: var(--color-primary);
    background: rgba(0, 113, 227, 0.02);
}

.image-upload-btn i {
    font-size: 18px;
    color: var(--color-text-tertiary);
}

.image-upload-btn span {
    font-size: 13px;
    color: var(--color-text-tertiary);
}

.image-upload-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-preview {
    position: relative;
    flex-shrink: 0;
}

.image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.image-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border: none;
    background: var(--color-error);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.image-remove-btn:hover {
    background: #e0342a;
}

/* Vision not supported notice */
.vision-notice {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(255, 149, 0, 0.08);
    border: 1px solid rgba(255, 149, 0, 0.2);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: #8a6d3b;
    margin-top: var(--space-2);
}

.vision-notice i {
    color: var(--color-warning);
    font-size: 16px;
    flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    background: var(--color-primary);
    color: var(--color-text-white);
    font-family: var(--font-text);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: normal;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--color-primary-active);
    transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
    font-family: var(--font-text);
    font-size: 15px;
    font-weight: 400;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: #ededf2;
}

/* ============================================================
   Sub Tabs (Research & Extend)
   ============================================================ */
.sub-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-1);
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.sub-tabs::-webkit-scrollbar {
    display: none;
}

.sub-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sub-tab:hover {
    color: var(--color-text-secondary);
}

.sub-tab.active {
    background: var(--color-bg-white);
    color: var(--color-text-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sub-page {
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sub-page.active {
    display: block;
    opacity: 1;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ============================================================
   Modal (Settings)
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-elevated);
    animation: modalIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.231px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-bg-light);
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-tertiary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: #e5e5ea;
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
}

.settings-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.settings-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-4);
    line-height: 1.33;
    letter-spacing: -0.12px;
}

.settings-presets {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.preset-btns {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.preset-btn {
    padding: var(--space-1) var(--space-3);
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(0, 113, 227, 0.04);
}

/* ============================================================
   Connection Status Indicator (Nav)
   ============================================================ */
.conn-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-bg-light);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 11px;
    letter-spacing: -0.12px;
    color: var(--color-text-tertiary);
    user-select: none;
}

.conn-status:hover { background: #ededf2; }

.conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aaa;
    transition: background 0.3s;
    flex-shrink: 0;
}

.conn-status.ok .conn-dot { background: var(--color-success); box-shadow: 0 0 6px rgba(52,199,89,0.5); }
.conn-status.error .conn-dot { background: var(--color-error); }
.conn-status.checking .conn-dot { background: var(--color-warning); animation: pulse-dot 1s infinite; }
.conn-status.ok .conn-text { color: var(--color-success); }
.conn-status.error .conn-text { color: var(--color-error); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ============================================================
   Stream Status Bar (replaces spinner)
   ============================================================ */
.stream-status-bar {
    position: fixed;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    transition: bottom 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
}

.stream-status-bar.active {
    bottom: 24px;
    pointer-events: auto;
}

.stream-status-inner {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-elevated);
    padding: 14px 28px;
    min-width: 460px;
    max-width: 90vw;
}

.stream-stages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 8px;
}

.stream-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.3;
    transition: all 0.35s ease;
}

.stream-stage.active {
    opacity: 1;
}

.stream-stage.done {
    opacity: 0.6;
}

.stage-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--color-text-tertiary);
    transition: all 0.35s ease;
}

.stream-stage.active .stage-icon {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 113, 227, 0.35);
    animation: stage-pulse 1.5s ease infinite;
}

.stream-stage.done .stage-icon {
    background: var(--color-success);
    color: white;
}

.stream-stage.error .stage-icon {
    background: var(--color-error);
    color: white;
}

@keyframes stage-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(0, 113, 227, 0.35); }
    50% { box-shadow: 0 2px 18px rgba(0, 113, 227, 0.55); }
}

.stream-stage span {
    font-size: 10px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    letter-spacing: -0.08px;
}

.stream-stage.active span {
    color: var(--color-primary);
    font-weight: 600;
}

.stream-stage-line {
    width: 32px;
    height: 2px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0 4px;
    margin-bottom: 18px;
    border-radius: 1px;
    transition: background 0.35s;
}

.stream-stage-line.passed {
    background: var(--color-success);
}

.stream-detail {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-3);
    font-size: 12px;
    color: var(--color-text-tertiary);
    letter-spacing: -0.12px;
}

.stream-tokens {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-primary);
    font-weight: 600;
}

/* ============================================================
   Voice Input & TTS Buttons
   ============================================================ */
.input-with-voice {
    position: relative;
}

.input-with-voice textarea {
    width: 100%;
    padding-right: 44px;
}

.voice-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-bg-light);
    color: var(--color-text-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 2;
}

.voice-btn:hover {
    background: rgba(0, 113, 227, 0.08);
    color: var(--color-primary);
}

.voice-btn.recording {
    background: var(--color-error);
    color: white;
    animation: recording-pulse 1s ease infinite;
}

/* Whisper 录音中：橙色区分（表示"录完再停"交互模式） */
.voice-btn.whisper-recording {
    background: #ff8c00;
    color: white;
    animation: recording-pulse 1s ease infinite;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
}

.btn-row {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}

.btn-row .btn-primary {
    flex: 1;
}

.btn-voice-play {
    width: 44px;
    height: auto;
    border: none;
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-voice-play:hover {
    background: rgba(0, 113, 227, 0.08);
    color: var(--color-primary);
}

.btn-voice-play.speaking {
    background: var(--color-primary);
    color: white;
    animation: speak-pulse 1.2s ease infinite;
}

@keyframes speak-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================================
   AI回复风格选择栏
   ============================================================ */
.style-bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-6);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: var(--nav-height);
    z-index: 90;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.style-bar-label {
    font-size: 13px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    font-weight: 500;
}

.style-chip {
    padding: 5px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: var(--font-text);
}

.style-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(0, 113, 227, 0.04);
}

.style-chip.active {
    background: var(--color-primary);
    color: var(--color-text-white);
    border-color: var(--color-primary);
}

/* ============================================================
   3D头像容器
   ============================================================ */
.avatar-3d-container {
    width: 280px;
    height: 320px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.avatar-3d-container canvas {
    display: block;
}

/* ============================================================
   TTS工具栏（通用-所有结果面板）
   ============================================================ */
.tts-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    animation: fadeIn 0.3s ease;
}

.tts-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--color-primary);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-text);
}

.tts-toolbar-btn:hover {
    background: var(--color-primary);
    color: white;
}

.tts-stop-btn {
    border-color: var(--color-error);
    color: var(--color-error);
}

.tts-stop-btn:hover {
    background: var(--color-error);
    color: white;
}

.tts-speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.tts-speed-control label {
    font-weight: 500;
}

.tts-speed-slider {
    width: 80px;
    height: 4px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.tts-speed-value {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 32px;
    text-align: center;
}

/* ============================================================
   浮动语音助手面板
   ============================================================ */
.voice-assistant-panel {
    position: fixed;
    top: var(--nav-height);
    right: -380px;
    width: 360px;
    height: calc(100vh - var(--nav-height));
    background: var(--color-surface);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 500;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.voice-assistant-panel.open {
    right: 0;
}

.va-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

.va-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.va-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.va-close:hover {
    background: var(--color-bg-light);
    color: var(--color-text-primary);
}

.va-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-5);
}

.va-section {
    margin-bottom: var(--space-6);
}

.va-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.va-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
}

.va-textarea {
    width: 100%;
    padding: var(--space-3);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-text);
    resize: vertical;
    transition: border-color 0.2s;
    background: var(--color-surface);
    box-sizing: border-box;
}

.va-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.va-stt-controls {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.va-record-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 24px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-text);
}

.va-record-btn:hover {
    background: var(--color-primary);
    color: white;
}

.va-record-btn.recording {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
    animation: record-pulse 1.5s ease infinite;
}

@keyframes record-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
}

.va-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.va-action-btn {
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-text);
}

.va-action-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.va-tts-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.va-play-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 20px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-text);
}

.va-play-btn:hover {
    background: var(--color-primary-hover);
}

.va-play-btn.playing {
    background: var(--color-error);
    border-color: var(--color-error);
}

.va-speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.va-speed-control label {
    font-weight: 500;
}

.va-speed-control input[type="range"] {
    width: 70px;
    accent-color: var(--color-primary);
}

/* ============================================================
   Streaming text cursor in result area
   ============================================================ */
.stream-cursor::after {
    content: '|';
    font-weight: 300;
    color: var(--color-primary);
    animation: blink 0.6s step-end infinite;
    margin-left: 1px;
}

/* 等待首 token 的"思考中"三点动画 */
.thinking-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
}
.thinking-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.3;
    animation: thinking-bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.3; }
    40%           { transform: scale(1.2); opacity: 1;   }
}

/* 流式期间的纯文本预览区 */
pre.stream-pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.7;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: inherit;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    top: calc(var(--nav-height) + var(--space-4));
    right: var(--space-5);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    background: var(--color-bg-dark);
    color: var(--color-text-white);
    border-radius: var(--radius-md);
    font-size: 14px;
    letter-spacing: -0.224px;
    box-shadow: var(--shadow-elevated);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }
.toast.warning { background: var(--color-warning); }

.toast.hiding {
    animation: toastOut 0.3s ease forwards;
}

/* ============================================================
   Emotion Chat History
   ============================================================ */
.emotion-chat-history {
    margin-top: var(--space-4);
    max-height: 200px;
    overflow-y: auto;
}

.chat-msg {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.chat-msg.user {
    background: rgba(0, 113, 227, 0.08);
    color: var(--color-text-primary);
    text-align: right;
}

.chat-msg.ai {
    background: var(--color-bg-light);
    color: var(--color-text-secondary);
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* Typing animation for results */
.typing-cursor::after {
    content: '▊';
    animation: blink 0.8s infinite;
    color: var(--color-primary);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ============================================================
   TTS Toolbar (dynamic, injected into result panels)
   ============================================================ */
.tts-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 8px 12px;
    margin-bottom: var(--space-2);
    background: rgba(0, 113, 227, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 113, 227, 0.10);
    flex-wrap: wrap;
}

.tts-left-group,
.tts-right-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tts-maximize-btn {
    background: transparent !important;
    border: 1.5px solid rgba(0,113,227,.3) !important;
    color: var(--color-primary) !important;
}
.tts-maximize-btn:hover {
    background: rgba(0,113,227,.08) !important;
    transform: scale(1.03);
}

.tts-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: white;
    font-size: 13px;
    font-family: var(--font-text);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tts-toolbar-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.03);
}

.tts-stop-btn {
    background: var(--color-error);
}

.tts-stop-btn:hover {
    background: #e0342b;
}

/* 复制按钮：outline 风格 */
.tts-toolbar .tts-right-group .tts-toolbar-btn:first-child {
    background: transparent;
    border: 1.5px solid rgba(0,113,227,.3);
    color: var(--color-primary);
}
.tts-toolbar .tts-right-group .tts-toolbar-btn:first-child:hover {
    background: rgba(0,113,227,.08);
    transform: scale(1.03);
}

.tts-speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.tts-speed-control label {
    white-space: nowrap;
}

.tts-speed-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 113, 227, 0.2);
    border-radius: 2px;
    outline: none;
}

.tts-speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

.tts-speed-value {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 32px;
}

/* ============================================================
   Floating Voice Assistant Panel
   ============================================================ */
.voice-assistant-panel {
    position: fixed;
    right: -420px;
    top: var(--nav-height);
    width: 400px;
    height: calc(100vh - var(--nav-height));
    background: var(--color-bg-white);
    border-left: 1px solid var(--color-border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 2500;
    transition: right 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.voice-assistant-panel.open {
    right: 0;
}

.va-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, var(--color-primary), #0077ED);
    color: white;
}

.va-header h3 {
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-display);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.va-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.va-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.va-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.va-section {
    background: var(--color-surface-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.va-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.va-section-title i {
    color: var(--color-primary);
}

.va-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.va-textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-family: var(--font-text);
    font-size: 14px;
    resize: vertical;
    background: white;
    color: var(--color-text-primary);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.va-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.va-stt-controls {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-3);
}

.va-record-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 28px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-family: var(--font-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.va-record-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.03);
}

.va-record-btn.recording {
    background: var(--color-error);
    animation: rec-pulse 1.5s ease infinite;
}

@keyframes rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
}

.va-tts-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.va-play-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: var(--font-text);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.va-play-btn:hover {
    background: var(--color-primary-hover);
    transform: scale(1.03);
}

.va-play-btn.playing {
    background: var(--color-error);
}

.va-speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.va-speed-control label {
    white-space: nowrap;
}

#va-tts-speed {
    width: 70px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(0, 113, 227, 0.2);
    border-radius: 2px;
    outline: none;
}

#va-tts-speed::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
}

#va-tts-speed-val {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 32px;
}

.va-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.va-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-family: var(--font-text);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.va-action-btn:hover {
    background: var(--color-bg-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ============================================================
   Responsive - Tablet & Mobile
   ============================================================ */
@media (max-width: 834px) {
    .hero-title { font-size: 28px; }
    .hero-subtitle { font-size: 15px; }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    /* 功能页整体允许垂直滚动 */
    .page.active {
        min-height: auto;
        height: auto;
        overflow-y: visible;
        overflow-x: hidden;
    }

    /* page-body 不裁切内容，交由 #app-main 滚动 */
    .page-body {
        overflow: visible;
        min-height: unset;
        padding-bottom: var(--space-8);
        width: 100%;
        box-sizing: border-box;
    }

    .two-column {
        grid-template-columns: 1fr;
        height: auto;
        width: 100%;
    }

    /* sub-page 不裁切（桌面端 overflow:hidden 专为固定高布局设计，移动端不适用）*/
    .sub-page.active {
        overflow: visible;
        flex: none;
        min-height: unset;
        width: 100%;
        box-sizing: border-box;
    }

    /* 单列时 input/result 面板不限高 */
    .input-panel,
    .result-panel {
        overflow: visible;
        min-height: unset;
        width: 100%;
        box-sizing: border-box;
    }

    /* 结果区移动端允许自然高度展开 */
    .result-content {
        max-height: none;
        overflow-y: visible;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .nav-links { display: none; }
    .mobile-menu-btn { display: flex; }
    .conn-text { display: none; }
    .nav-user-badge { display: none; } /* 移动端在汉堡菜单里展示用户信息 */
    .stream-status-inner { min-width: auto; padding: 12px 18px; }

    .voice-assistant-panel {
        width: 320px;
        right: -340px;
    }

    .tts-toolbar { flex-wrap: wrap; }

    .tts-speed-control {
        margin-left: 0;
        width: 100%;
        margin-top: var(--space-1);
    }

    /* 科研助手和智能陪伴页面的子标签页在移动端可横向滚动 */
    .sub-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sub-tabs::-webkit-scrollbar {
        display: none;
    }
}

/* ============================================================
   Responsive - Mobile Only
   ============================================================ */
@media (max-width: 480px) {
    .hero-title { font-size: 26px; }
    .hero-subtitle { font-size: 15px; }
    .hero-section { padding: 100px var(--space-4) var(--space-6); }

    .features-grid {
        grid-template-columns: 1fr;
        padding: var(--space-6) var(--space-4);
    }

    .feature-card {
        padding: var(--space-6) var(--space-4);
    }

    .page-header {
        padding: var(--space-4);
        width: 100%;
        box-sizing: border-box;
    }

    .page-header h2 {
        font-size: 21px;
    }

    .page-body {
        padding: var(--space-4) var(--space-3) var(--space-12);
        overflow: visible;
        min-height: unset;
        width: 100%;
        box-sizing: border-box;
    }

    .input-panel, .result-panel {
        padding: var(--space-4);
        overflow: visible;
        min-height: unset;
        width: 100%;
        box-sizing: border-box;
    }

    /* 小屏迷你头像缩小，节省纵向空间 */
    .mini-avatar-area {
        width: 100px;
        height: 100px;
    }

    .sub-tabs {
        gap: var(--space-1);
        padding: var(--space-2);
    }

    .sub-tab {
        padding: var(--space-2) var(--space-3);
        font-size: 13px;
        flex-shrink: 0;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .voice-assistant-panel {
        width: 100%;
        right: -100%;
    }

    .va-body {
        padding: var(--space-3) var(--space-4);
    }

    /* 确保表单元素在小屏幕不溢出 */
    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group input[type="password"],
    .form-group select,
    .form-group textarea {
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }

    /* 确保子页面容器不会横向溢出，但不裁剪子标签滚动条 */
    #page-research,
    #page-extend {
        width: 100%;
        /* overflow-x:hidden 会阻断 .sub-tabs 横向滚动，改为 clip 或不设置 */
    }

    /* 修复科研助手和智能陪伴页面的子内容区域 */
    #page-research .page-body,
    #page-extend .page-body {
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
    }
}

/* ============================================================
   Nav User Badge & Admin Badge
   ============================================================ */
.nav-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 4px 10px 4px 8px;
    white-space: nowrap;
    user-select: none;
}

.nav-user-badge i {
    font-size: 14px;
    color: var(--color-primary);
}

.admin-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff9500, #ff6b00);
    border-radius: 8px;
    padding: 1px 5px;
    letter-spacing: .3px;
    vertical-align: middle;
    margin-left: 2px;
}

/* ============================================================
   Settings Badge (自动切换 chip)
   ============================================================ */
.settings-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(0,113,227,.1);
    border: 1px solid rgba(0,113,227,.2);
    border-radius: 10px;
    padding: 1px 7px;
    vertical-align: middle;
    margin-left: 6px;
    letter-spacing: .2px;
}

/* ============================================================
   Sub-tabs mobile: wrap to 2×2 grid so all tabs are visible
   without relying on parent overflow-x behaviour
   ============================================================ */
@media (max-width: 480px) {
    .sub-tabs {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .sub-tab {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        justify-content: center;
        padding: 7px 4px;
        font-size: 12px;
        gap: 3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ============================================================
   代码块（配合 highlight.js）
   ============================================================ */
.code-block-wrap {
    border-radius: 10px;
    overflow: hidden;
    margin: 12px 0;
    border: 1px solid rgba(0,0,0,.08);
    background: #f6f8fa;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(0,0,0,.04);
    border-bottom: 1px solid rgba(0,0,0,.06);
}

.code-lang {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.copy-btn {
    font-size: 11px;
    padding: 3px 8px;
    background: transparent;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 6px;
    cursor: pointer;
    color: #86868b;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all .15s;
}
.copy-btn:hover { background: #fff; color: var(--color-primary); }

.code-block-wrap pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    background: #f6f8fa;
}

.code-block-wrap pre code { background: none; padding: 0; border-radius: 0; }

code.inline-code {
    background: rgba(0,113,227,.08);
    color: #0055cc;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .88em;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

/* 表格滚动包裹 */
.md-table-wrap { overflow-x: auto; margin: 12px 0; }

/* ============================================================
   Token 用量悬浮组件
   ============================================================ */
.token-widget {
    position: fixed;
    bottom: 88px;
    right: 20px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #1d1d1f;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
    transition: transform .15s, box-shadow .15s;
    user-select: none;
}
.token-widget i { color: #34c759; font-size: 11px; }
.token-widget:hover { transform: scale(1.05); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.token-widget.token-warning i { color: #ff9500; }
.token-widget.token-danger  i { color: #ff3b30; }
.token-widget.token-warning  { border-color: rgba(255,149,0,.3); }
.token-widget.token-danger   { border-color: rgba(255,59,48,.3); }

.token-panel {
    position: fixed;
    bottom: 135px;
    right: 20px;
    z-index: 900;
    width: 280px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    padding: 16px;
    transform: translateY(10px) scale(.95);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
}
.token-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.token-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
}
.token-panel-close {
    background: none; border: none; cursor: pointer;
    color: #86868b; font-size: 14px; padding: 2px;
}

.token-bar-wrap { margin-bottom: 10px; }
.token-bar-bg {
    height: 6px;
    background: rgba(0,0,0,.08);
    border-radius: 3px;
    overflow: hidden;
}
.token-bar-fill {
    height: 100%;
    background: #34c759;
    border-radius: 3px;
    transition: width .4s ease, background .3s;
    width: 0%;
}

.token-detail {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #3a3a3c;
    margin-bottom: 8px;
    gap: 4px;
}
.token-detail strong { color: #1d1d1f; }

.token-hint {
    font-size: 10.5px;
    color: #86868b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   系统使用说明 FAB + 弹窗
   ============================================================ */
.guide-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 900;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,113,227,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, box-shadow .15s;
}
.guide-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,113,227,.45);
}

.guide-modal-content {
    max-width: 640px;
    max-height: 85vh;
    overflow: hidden;   /* body 自身滚动，不要双滚动条 */
    display: flex;
    flex-direction: column;
}

.guide-body {
    overflow-y: auto;
    padding: 0 24px 8px;
    flex: 1;
}

.guide-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.guide-section:last-child { border-bottom: none; }
.guide-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.guide-section ul {
    margin: 0;
    padding-left: 18px;
}
.guide-section ul li {
    font-size: 13px;
    color: #3a3a3c;
    margin-bottom: 5px;
    line-height: 1.6;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.guide-table th {
    background: var(--color-bg-light);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    color: #3a3a3c;
    border-bottom: 1px solid rgba(0,0,0,.08);
}
.guide-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(0,0,0,.04);
    color: #3a3a3c;
}
.guide-table tr:last-child td { border-bottom: none; }

kbd {
    display: inline-block;
    padding: 1px 6px;
    font-size: 11px;
    background: #f5f5f7;
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 4px;
    font-family: monospace;
    color: #3a3a3c;
}

@media (max-width: 834px) {
    .token-widget { bottom: 76px; right: 12px; }
    .token-panel  { right: 12px; width: calc(100vw - 24px); max-width: 320px; }
    .guide-fab    { bottom: 16px; right: 12px; width: 44px; height: 44px; font-size: 16px; }
    .guide-modal-content { max-height: 90vh; }
}

/* ============================================================
   结果面板最大化覆层
   ============================================================ */
.result-maximize-overlay {
    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: stretch;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.result-maximize-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.result-maximize-panel {
    background: #fff;
    width: min(900px, 96vw);
    max-height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
    transform: translateY(20px) scale(.97);
    transition: transform .25s cubic-bezier(.25,.1,.25,1);
    border-radius: 0;
}

.result-maximize-overlay.open .result-maximize-panel {
    transform: translateY(0) scale(1);
}

/* ── Header ── */
.result-maximize-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(0,0,0,.08);
    background: rgba(0,113,227,.03);
    flex-shrink: 0;
}

.result-maximize-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
}

.result-maximize-title i { color: var(--color-primary); }

.result-maximize-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rmax-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    border: 1.5px solid rgba(0,0,0,.12);
    background: transparent;
    color: #3a3a3c;
    white-space: nowrap;
}
.rmax-btn:hover { background: rgba(0,0,0,.05); }

.rmax-close-btn {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.rmax-close-btn:hover { background: var(--color-primary-hover); }

/* ── Body ── */
.result-maximize-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px;
    font-size: 15px;
    line-height: 1.75;
    color: #1d1d1f;
    -webkit-overflow-scrolling: touch;
}

/* 继承 result-content 的 markdown 排版 */
.result-maximize-body h1, .result-maximize-body h2,
.result-maximize-body h3, .result-maximize-body h4 {
    color: #1d1d1f;
    margin: 20px 0 10px;
    font-weight: 600;
    line-height: 1.3;
}
.result-maximize-body h1 { font-size: 26px; }
.result-maximize-body h2 { font-size: 21px; border-bottom: 1px solid rgba(0,0,0,.08); padding-bottom: 6px; }
.result-maximize-body h3 { font-size: 17px; }
.result-maximize-body h4 { font-size: 15px; }
.result-maximize-body p  { margin-bottom: 12px; }
.result-maximize-body ul, .result-maximize-body ol { padding-left: 24px; margin-bottom: 12px; }
.result-maximize-body li { margin-bottom: 4px; }
.result-maximize-body blockquote {
    border-left: 3px solid var(--color-primary);
    margin: 12px 0;
    padding: 8px 16px;
    background: rgba(0,113,227,.04);
    border-radius: 0 8px 8px 0;
    color: #555;
}
.result-maximize-body hr {
    border: none;
    border-top: 1px solid rgba(0,0,0,.1);
    margin: 20px 0;
}
.result-maximize-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}
.result-maximize-body th {
    background: rgba(0,113,227,.06);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(0,113,227,.15);
}
.result-maximize-body td {
    padding: 7px 12px;
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.result-maximize-body tr:last-child td { border-bottom: none; }
.result-maximize-body tr:hover td { background: rgba(0,0,0,.02); }

/* ── Footer ── */
.result-maximize-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-top: 1px solid rgba(0,0,0,.06);
    font-size: 12px;
    color: #86868b;
    background: #fafafa;
    flex-shrink: 0;
}

.result-maximize-footer kbd {
    padding: 1px 5px;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 11px;
}

/* 移动端：全屏 */
@media (max-width: 834px) {
    .result-maximize-panel {
        width: 100vw;
        border-radius: 0;
    }
    .result-maximize-body { padding: 16px 16px 24px; }
    .rmax-btn span { display: none; }
    .result-maximize-footer { display: none; }
}

/* ============================================================
   管理员：用户额度管理表格
   ============================================================ */
.quota-table-wrap {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
    max-height: 360px;
    overflow-y: auto;
}
.quota-loading {
    padding: 24px;
    text-align: center;
    color: #86868b;
    font-size: 13px;
}
.quota-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.quota-table th {
    background: var(--color-bg-light);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #3a3a3c;
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.quota-table td {
    padding: 8px 10px;
    border-top: 1px solid rgba(0,0,0,.04);
    color: #3a3a3c;
    vertical-align: middle;
}
.quota-table code {
    font-size: 12px;
    color: var(--color-primary);
    background: rgba(0,113,227,.06);
    padding: 1px 5px;
    border-radius: 4px;
}
.role-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}
.role-tag.admin {
    background: linear-gradient(135deg, #ff9500, #ff6b00);
    color: #fff;
}
.role-tag.user {
    background: rgba(0,113,227,.1);
    color: var(--color-primary);
}
.mini-bar {
    display: inline-block;
    width: 80px;
    height: 5px;
    background: rgba(0,0,0,.08);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 6px;
}
.mini-bar-fill {
    height: 100%;
    background: #34c759;
    transition: width .3s;
}
.mini-bar-fill.warning { background: #ff9500; }
.mini-bar-fill.danger  { background: #ff3b30; }
.quota-actions { display: flex; gap: 4px; }
.quota-btn {
    padding: 3px 8px;
    border: 1px solid rgba(0,0,0,.12);
    background: #fff;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    color: #3a3a3c;
    transition: all .15s;
}
.quota-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.quota-btn.quota-btn-warn:hover { background: #ff3b30; border-color: #ff3b30; }

/* ============================================================
   我的画像页面
   ============================================================ */
.profile-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.profile-controls label { font-size: 13px; color: #3a3a3c; }
.profile-controls select {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}

.profile-summary-card {
    background: linear-gradient(135deg, rgba(0,113,227,.06), rgba(52,170,220,.04));
    border: 1px solid rgba(0,113,227,.1);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 20px;
}
.profile-summary-text {
    font-size: 14px;
    color: #1d1d1f;
    line-height: 1.7;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.profile-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
.profile-card-wide { grid-column: 1 / -1; }
.profile-card h4 {
    font-size: 13px;
    font-weight: 600;
    color: #3a3a3c;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.profile-card h4 i { color: var(--color-primary); }

.profile-stats .stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: #3a3a3c;
    border-bottom: 1px dashed rgba(0,0,0,.05);
}
.profile-stats .stat-row:last-child { border-bottom: none; }
.profile-stats .stat-row strong {
    color: var(--color-primary);
    font-size: 18px;
    margin-right: 4px;
}

.dist-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12.5px;
}
.dist-label {
    flex: 0 0 80px;
    color: #1d1d1f;
}
.dist-bar {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,.06);
    border-radius: 3px;
    overflow: hidden;
}
.dist-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width .4s ease;
}
.dist-num {
    flex: 0 0 32px;
    text-align: right;
    color: #86868b;
    font-size: 11px;
}

.empty-tip {
    color: #86868b;
    font-size: 12px;
    margin: 0;
    padding: 16px 0;
    text-align: center;
    line-height: 1.5;
}

/* 24 小时柱状图 */
.hour-chart {
    display: flex;
    align-items: flex-end;
    height: 100px;
    gap: 2px;
}
.hour-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.hour-bar {
    width: 100%;
    min-height: 2px;
    background: linear-gradient(180deg, var(--color-primary), #34aadc);
    border-radius: 2px 2px 0 0;
    transition: height .4s ease;
}
.hour-label {
    font-size: 9px;
    color: #86868b;
    margin-top: 3px;
}

/* 14 天柱状图 */
.daily-chart {
    display: flex;
    align-items: flex-end;
    height: 110px;
    gap: 4px;
}
.day-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.day-bar {
    width: 100%;
    min-height: 3px;
    background: linear-gradient(180deg, #34c759, #5ac8fa);
    border-radius: 3px 3px 0 0;
    transition: height .4s ease;
}
.day-label {
    font-size: 10px;
    color: #86868b;
    margin-top: 4px;
    transform: rotate(-25deg);
    transform-origin: left center;
}

.rec-list {
    margin: 0;
    padding-left: 18px;
}
.rec-list li {
    font-size: 13px;
    color: #3a3a3c;
    margin-bottom: 6px;
    line-height: 1.6;
}

.ai-rec-content {
    font-size: 14px;
    line-height: 1.7;
    color: #1d1d1f;
}
.ai-rec-content h2,
.ai-rec-content h3 {
    margin: 14px 0 8px;
    font-size: 15px;
    color: var(--color-primary);
}

@media (max-width: 834px) {
    .profile-grid { grid-template-columns: 1fr; }
    .quota-table { font-size: 11px; }
    .quota-table td, .quota-table th { padding: 6px 6px; }
    .mini-bar { width: 50px; }
}

/* ============================================================
   思考模式选择栏（替换原 style-bar，融合 mode + style）
   ============================================================ */
.mode-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    margin: 12px 24px 0;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.mode-bar-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-right: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mode-chip {
    padding: 5px 12px;
    border: 1.5px solid var(--color-border);
    background: #fff;
    border-radius: 16px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
    white-space: nowrap;
}

.mode-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

/* 不同模式的激活态使用不同主色 */
.mode-chip[data-mode="express"].active {
    background: linear-gradient(135deg, #ff9500, #ffcc00);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(255, 149, 0, .3);
}

.mode-chip[data-mode="thinking"].active {
    background: linear-gradient(135deg, #0071e3, #34aadc);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 113, 227, .3);
}

.mode-chip[data-mode="deep"].active {
    background: linear-gradient(135deg, #7c3aed, #c026d3);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(124, 58, 237, .3);
}

.mode-divider {
    width: 1px;
    height: 18px;
    background: var(--color-border);
    margin: 0 8px;
}

/* 深度思考模式：流式状态条主色变紫，强化视觉反馈 */
body.mode-deep .stream-status-inner {
    background: linear-gradient(135deg, rgba(124, 58, 237, .04), rgba(192, 38, 211, .04));
    border-color: rgba(124, 58, 237, .2);
}
body.mode-express .stream-status-inner {
    background: linear-gradient(135deg, rgba(255, 149, 0, .04), rgba(255, 204, 0, .04));
    border-color: rgba(255, 149, 0, .2);
}

/* 移动端：模式栏紧凑 */
@media (max-width: 834px) {
    .mode-bar {
        margin: 8px 12px 0;
        padding: 8px 10px;
        gap: 4px;
        font-size: 11.5px;
    }
    .mode-chip { padding: 4px 8px; font-size: 11px; }
    .mode-bar-label { font-size: 11px; }
    .mode-divider { display: none; }
}

/* 隐藏旧的 style-bar（已被 mode-bar 替代） */
.style-bar { display: none !important; }

/* ============================================================
   项目顶部声明条
   ============================================================ */
.project-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: linear-gradient(135deg, #ff9500, #ff6b00);
    color: #fff;
    padding: 6px 18px;
    font-size: 12px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    line-height: 1.4;
}
.project-banner .banner-tag {
    background: rgba(0,0,0,.22);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    flex-shrink: 0;
}
.project-banner .banner-text { flex: 0 1 auto; }
.project-banner .banner-text strong { font-weight: 700; }
.project-banner .banner-close {
    background: transparent;
    border: 1px solid rgba(255,255,255,.4);
    color: #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 6px;
    transition: all .15s;
}
.project-banner .banner-close:hover {
    background: rgba(0,0,0,.2);
    border-color: rgba(255,255,255,.7);
}

/* 当顶部声明条存在时，导航栏整体下移 */
body:has(#project-banner) #main-nav { top: 32px; }
body:has(#project-banner) main#app-main { padding-top: calc(var(--nav-height) + 32px); }

@media (max-width: 480px) {
    .project-banner { font-size: 11px; padding: 5px 8px; gap: 6px; }
    .project-banner .banner-tag { font-size: 10px; padding: 1px 6px; }
    .project-banner .banner-text { font-size: 10.5px; }
    body:has(#project-banner) #main-nav { top: 36px; }
}

/* ============================================================
   模式 chip 上的小时间徽章
   ============================================================ */
.mode-chip .mode-tag {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    background: rgba(0,0,0,.08);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    opacity: .7;
}
.mode-chip.active .mode-tag {
    background: rgba(255,255,255,.25);
    opacity: 1;
}

/* 模式帮助按钮 */
.mode-help-btn {
    background: transparent;
    border: 1px dashed var(--color-border);
    color: var(--color-text-tertiary);
    border-radius: 50%;
    width: 26px; height: 26px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
    margin-left: 2px;
}
.mode-help-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    border-style: solid;
}

/* 当前模式描述提示 */
.mode-current-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 24px 8px;
    padding: 6px 14px;
    background: rgba(0,113,227,.05);
    border-left: 3px solid var(--color-primary);
    border-radius: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
}
.mode-current-hint i { color: var(--color-primary); }

@media (max-width: 834px) {
    .mode-current-hint { margin: 4px 12px 8px; font-size: 11px; padding: 5px 10px; }
}

/* ============================================================
   模式选择指南弹窗
   ============================================================ */
.mode-help-content {
    max-width: 920px;
    max-height: 88vh;
    overflow-y: auto;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.mode-card {
    border: 1.5px solid var(--color-border);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
    transition: all .2s;
    position: relative;
}
.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.mode-card-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 8px;
}
.mode-card h4 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mode-card .default-badge {
    font-size: 10px;
    background: var(--color-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 600;
}
.mode-card-time {
    display: inline-block;
    background: rgba(0,0,0,.06);
    color: #3a3a3c;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}
.mode-card-desc {
    color: #3a3a3c;
    font-size: 12.5px;
    margin: 0 0 12px;
    line-height: 1.5;
}
.mode-card-section {
    margin-bottom: 10px;
    font-size: 12px;
}
.mode-card-section strong {
    display: block;
    color: #1d1d1f;
    margin-bottom: 4px;
    font-weight: 600;
}
.mode-card-section ul {
    margin: 0;
    padding-left: 16px;
    color: #3a3a3c;
}
.mode-card-section li {
    margin-bottom: 2px;
    line-height: 1.5;
}
.mode-card-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(0,0,0,.08);
    font-size: 11px;
    color: #86868b;
}

.mode-card-express { border-color: rgba(255,149,0,.3); }
.mode-card-express:hover { border-color: #ff9500; }
.mode-card-thinking { border-color: rgba(0,113,227,.3); background: rgba(0,113,227,.02); }
.mode-card-thinking:hover { border-color: #0071e3; }
.mode-card-deep { border-color: rgba(124,58,237,.3); }
.mode-card-deep:hover { border-color: #7c3aed; }

.mode-decision-tree {
    background: rgba(0,113,227,.05);
    border-left: 3px solid var(--color-primary);
    padding: 12px 18px;
    border-radius: 6px;
    margin-top: 8px;
}
.mode-decision-tree h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--color-primary);
}
.mode-decision-tree ol {
    margin: 0;
    padding-left: 22px;
    color: #3a3a3c;
    font-size: 13px;
}
.mode-decision-tree li {
    margin-bottom: 4px;
    line-height: 1.6;
}

@media (max-width: 834px) {
    .mode-cards { grid-template-columns: 1fr; }
    .mode-help-content { max-width: 100%; }
}

/* ============================================================
   反馈悬浮按钮 + 弹窗
   ============================================================ */
.feedback-fab {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 900;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b9d, #ff8c69);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255,107,157,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, box-shadow .15s;
}
.feedback-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(255,107,157,.45);
}

.feedback-modal-content {
    max-width: 540px;
}

.feedback-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.feedback-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: 18px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text-secondary);
    transition: all .15s;
    user-select: none;
    background: #fff;
}
.feedback-type-chip input { display: none; }
.feedback-type-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.feedback-type-chip:has(input:checked) {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(0,113,227,.25);
}

.feedback-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}
.feedback-rating .rate-star {
    cursor: pointer;
    font-size: 22px;
    color: #d2d2d7;
    transition: all .12s;
    user-select: none;
}
.feedback-rating .rate-star:hover { transform: scale(1.15); }
.feedback-rating .rate-star.on {
    color: #ff9500;
    text-shadow: 0 1px 2px rgba(255,149,0,.3);
}

@media (max-width: 834px) {
    .feedback-fab { bottom: 16px; left: 12px; width: 44px; height: 44px; font-size: 16px; }
    .feedback-modal-content { max-width: 100%; max-height: 90vh; }
}

/* ============================================================
   v4.0.1 UX 改进：停止按钮 / 重试 / 错误状态 / 自定义对话框
   ============================================================ */

/* 流式停止按钮 */
.stream-stop-btn {
    background: rgba(255, 59, 48, .1);
    color: #ff3b30;
    border: 1px solid rgba(255, 59, 48, .3);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 12px;
    display: none;
    align-items: center;
    gap: 4px;
    transition: all .15s;
}
.stream-status-bar.active .stream-stop-btn { display: inline-flex; }
.stream-stop-btn:hover {
    background: #ff3b30;
    color: #fff;
}
.stream-stop-btn i { font-size: 11px; }

/* 错误结果占位 + 重试按钮 */
.result-placeholder.result-error {
    background: rgba(255, 59, 48, .04);
    border: 1px dashed rgba(255, 59, 48, .2);
    border-radius: 12px;
    padding: 24px 16px;
}
.result-placeholder.result-error i {
    color: #ff3b30;
    font-size: 32px;
}
.result-placeholder.result-error p {
    color: #3a3a3c;
    font-size: 14px;
    margin: 8px 0;
}
.btn-retry {
    margin-top: 12px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 18px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}
.btn-retry:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* 自定义 prompt/confirm 弹窗 */
.custom-prompt-content {
    max-width: 420px !important;
}
.custom-prompt-content .modal-header h3 {
    font-size: 16px;
    margin: 0;
}
.custom-prompt-content #cp-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #ff3b30;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.btn-danger:hover { background: #d70015; transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0); }

/* 个人画像新用户 CTA */
.profile-empty-cta {
    text-align: center;
    padding: 32px 20px;
}
.profile-empty-cta h3 {
    color: #1d1d1f;
}
.profile-empty-cta button {
    font-size: 13px;
    padding: 7px 14px;
}

/* 表单控件统一焦点态（提升 a11y） */
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================================
   移动端 UX 强化（触摸目标 ≥ 44px / 模式栏布局优化）
   ============================================================ */
@media (max-width: 480px) {
    /* 模式栏：拆成两行 + 垂直分组 */
    .mode-bar {
        gap: 5px;
        padding: 8px 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .mode-bar > .mode-bar-label,
    .mode-bar > .style-bar-label {
        margin-top: 2px;
    }
    .mode-bar .mode-divider { display: none; }
    .mode-chip {
        padding: 7px 10px;
        font-size: 12px;
        min-height: 32px;
        flex: 1 1 auto;
    }
    .mode-chip .mode-tag { font-size: 9px; padding: 0 4px; }
    .mode-help-btn {
        width: 32px; height: 32px;
        font-size: 14px;
    }
    .style-chip {
        padding: 6px 10px;
        font-size: 11.5px;
        min-height: 30px;
    }

    /* 子标签页：优先省略文字，但放大点击区域 */
    .sub-tab {
        padding: 10px 4px;
        font-size: 12px;
        min-height: 40px;
    }

    /* 导航按钮：增大触摸目标 */
    .nav-btn {
        width: 40px;
        height: 40px;
    }

    /* 浮动按钮：保持 44px 标准 */
    .feedback-fab,
    .guide-fab {
        width: 44px;
        height: 44px;
    }
    .token-widget {
        min-height: 32px;
        padding: 7px 14px;
    }
}

/* ============================================================
   可访问性：reduce-motion 用户偏好
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   v4.0.2 Token 显示：管理员 ∞ + 学生百分比 + 管理面板增强
   ============================================================ */

/* 管理员 Token 微件（无限制） */
.token-widget.token-admin {
    background: linear-gradient(135deg, rgba(255,149,0,.12), rgba(124,58,237,.12));
    border-color: rgba(255,149,0,.35);
    color: #ff6b00;
}
.token-widget.token-admin i { color: #ff9500; }
.token-widget.token-admin #token-pct {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

/* 管理员 Token 面板：换成卡片视图 */
.admin-token-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255,149,0,.08), rgba(124,58,237,.08));
    border-radius: 10px;
    margin-bottom: 10px;
}
.admin-token-card .admin-icon {
    font-size: 28px;
    line-height: 1;
}
.admin-token-card .admin-text strong {
    display: block;
    font-size: 13px;
    color: #1d1d1f;
}
.admin-token-card .admin-text span {
    font-size: 11px;
    color: #86868b;
}
.admin-token-stats {
    font-size: 11.5px;
    color: #3a3a3c;
    padding: 6px 0;
    border-top: 1px solid rgba(0,0,0,.05);
    margin-bottom: 10px;
}
.admin-token-stats strong { color: #1d1d1f; }
.btn-admin-quota {
    width: 100%;
    padding: 8px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .15s;
}
.btn-admin-quota:hover { background: var(--color-primary-hover); transform: translateY(-1px); }

/* ============================================================
   管理员 Token 配额管理面板增强
   ============================================================ */

/* 顶部 4 张摘要卡片 */
.quota-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.qs-card {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
    transition: all .15s;
}
.qs-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.qs-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}
.qs-label {
    font-size: 11px;
    color: #3a3a3c;
    font-weight: 600;
    margin-top: 4px;
}
.qs-sub {
    font-size: 10px;
    color: #86868b;
    margin-top: 2px;
}

/* 工具栏：搜索 + 排序 + 批量 */
.quota-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}
.quota-search {
    flex: 1 1 160px;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 12.5px;
    background: #fff;
}
.quota-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0,113,227,.1);
}
.quota-sort {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
}
.quota-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: #3a3a3c;
    cursor: pointer;
    user-select: none;
}
.quota-bulk-btn {
    padding: 6px 11px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #3a3a3c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all .15s;
}
.quota-bulk-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.quota-bulk-btn.quota-bulk-warn:hover {
    background: #ff3b30;
    border-color: #ff3b30;
}

/* 表格视觉优化 */
.quota-table-scroll {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}
.quota-row.quota-row-warning td {
    background: rgba(255,149,0,.04);
}
.quota-row.quota-row-danger td {
    background: rgba(255,59,48,.06);
}
.quota-usage strong {
    font-size: 13px;
    color: #1d1d1f;
}
.quota-usage .quota-divider {
    color: #c7c7cc;
    margin: 0 3px;
}
.quota-usage .quota-total {
    color: #86868b;
    font-size: 12px;
}
.quota-bar-cell {
    white-space: nowrap;
}
.quota-pct {
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}
.quota-pct.warning { color: #ff9500; }
.quota-pct.danger  { color: #ff3b30; }
.quota-pct.ok      { color: #34c759; }

.quota-empty {
    padding: 32px 16px;
    text-align: center;
    color: #86868b;
}
.quota-empty p {
    font-size: 13px;
    margin: 12px 0 0;
}

/* 移动端适配 */
@media (max-width: 834px) {
    .quota-summary { grid-template-columns: repeat(2, 1fr); }
    .qs-num { font-size: 18px; }
    .quota-toolbar { gap: 6px; }
    .quota-toolbar .quota-search { flex: 1 1 100%; }
    .quota-bulk-btn span { display: none; }
}

/* ============================================================
   个人档案表单 — Apple-style 极简
   ============================================================ */
.me-profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 4px;
}

/* ── 分组（极简：仅小标题 + 细分隔，无卡片、无色条）── */
.mep-group {
    border: none;
    background: transparent;
    padding: 0;
}
.mep-group + .mep-group {
    padding-top: 22px;
    border-top: 1px solid rgba(0,0,0,.06);
}

.mep-group-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: .8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mep-group-title i {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.mep-group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.mep-col-full { grid-column: 1 / -1; }

/* ── 单个表单项 ── */
.me-profile-form .form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.me-profile-form label {
    font-size: 13px;
    color: var(--color-text-primary);
    margin-bottom: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
/* 极简：标签前不显示图标（保持纯净） */
.me-profile-form label i { display: none; }

.mep-hint {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    margin: -2px 0 8px;
    line-height: 1.45;
    font-weight: 400;
}

.me-profile-form input,
.me-profile-form select,
.me-profile-form textarea {
    width: 100%;
    padding: 0 12px;
    border: 1px solid rgba(60,60,67,.18);
    border-radius: 8px;
    font-size: 14px;
    color: var(--color-text-primary);
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
    line-height: 1.4;
    height: 34px;
    -webkit-font-smoothing: antialiased;
}
.me-profile-form textarea {
    height: auto;
    padding: 9px 12px;
    resize: vertical;
    min-height: 72px;
    max-height: 160px;
    line-height: 1.55;
}
.me-profile-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23999' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 28px;
    cursor: pointer;
}

.me-profile-form input::placeholder,
.me-profile-form textarea::placeholder {
    color: rgba(60,60,67,.32);
    font-weight: 400;
}

.me-profile-form input:hover,
.me-profile-form select:hover,
.me-profile-form textarea:hover {
    border-color: rgba(60,60,67,.32);
}
.me-profile-form input:focus,
.me-profile-form select:focus,
.me-profile-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0,113,227,.12);
}

/* ── 多选 chips（Apple iOS 风格 pill）── */
.ms-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0 0;
}
.ms-chip {
    background: rgba(60,60,67,.06);
    border: none;
    color: var(--color-text-primary);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    cursor: pointer;
    transition: background .15s, color .15s;
    user-select: none;
    line-height: 1.4;
    font-weight: 400;
}
.ms-chip:hover {
    background: rgba(60,60,67,.12);
}
.ms-chip.on {
    background: var(--color-primary);
    color: #fff;
    font-weight: 500;
}
.ms-chip.on:hover {
    background: var(--color-primary-hover);
}

.ms-counter {
    font-size: 11.5px;
    color: var(--color-text-tertiary);
    margin-top: 8px;
    text-align: right;
    font-weight: 400;
}
.ms-counter span {
    color: var(--color-text-primary);
    font-weight: 500;
}

/* ── 移动端 ── */
@media (max-width: 700px) {
    .me-profile-form { gap: 20px; }
    .mep-group + .mep-group { padding-top: 18px; }
    .mep-group-grid { grid-template-columns: 1fr; gap: 12px; }
    .ms-chip { padding: 5px 11px; font-size: 12px; }
}

/* ============================================================
   B1 · 虚拟实验室
   ============================================================ */
.lab-intro {
    background: rgba(0,113,227,.05);
    border: 1px solid rgba(0,113,227,.15);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 18px;
    display: flex; gap: 8px; align-items: flex-start;
}
.lab-intro i { color: var(--color-primary); margin-top: 2px; }

.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.lab-card {
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 14px;
    padding: 18px 16px;
    cursor: pointer;
    transition: all .18s ease;
    display: flex; flex-direction: column; gap: 8px;
}
.lab-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    border-color: rgba(0,113,227,.4);
}
.lab-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.lab-card h4 { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--color-text-primary); }
.lab-card p { margin: 0; font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.5; }
.lab-tag {
    display: inline-block;
    background: var(--color-bg-light);
    color: var(--color-text-tertiary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    align-self: flex-start;
}

.lab-iframe-wrap {
    margin-top: 22px;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}
.lab-iframe-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: var(--color-bg-light);
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.lab-iframe-header h3 { margin: 0; font-size: 14px; flex: 1; }
.lab-extlink {
    font-size: 12px; color: var(--color-primary);
    text-decoration: none; padding: 4px 10px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
}
.lab-extlink:hover { background: var(--color-primary); color: #fff; }
#lab-iframe { width: 100%; height: 600px; border: none; display: block; }

/* 在新标签页打开的卡片：标题旁显示小箭头图标 */
.lab-extbadge {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-left: 4px;
    vertical-align: middle;
    opacity: .7;
}
.lab-card[data-embed="0"]:hover .lab-extbadge {
    color: var(--color-primary);
    opacity: 1;
}

/* iframe 失败回退框 */
.lab-iframe-fallback {
    padding: 40px 24px;
    text-align: center;
    color: var(--color-text-secondary);
    background: linear-gradient(180deg, #fafbfc 0%, #f5f6f8 100%);
    min-height: 300px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px;
}
.lab-iframe-fallback i {
    font-size: 36px; color: var(--color-text-tertiary);
}
.lab-iframe-fallback h4 {
    margin: 0; font-size: 16px; font-weight: 600;
    color: var(--color-text-primary);
}
.lab-iframe-fallback p {
    margin: 0; line-height: 1.6; max-width: 500px;
    color: var(--color-text-secondary);
}
.lab-iframe-fallback a.btn-primary {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--color-primary); color: #fff;
    padding: 10px 20px; border-radius: 8px;
    text-decoration: none; font-weight: 500;
    transition: background .15s;
}
.lab-iframe-fallback a.btn-primary:hover { background: var(--color-primary-hover); }

@media (max-width: 600px) {
    .lab-grid { grid-template-columns: 1fr; }
    #lab-iframe { height: 480px; }
}

/* ============================================================
   A4 · 心理援助 modal
   ============================================================ */
.crisis-modal-content {
    max-width: 480px;
    border-top: 4px solid #5856d6;
}
.crisis-modal-header h3 {
    color: #5856d6;
    font-size: 19px;
}
.crisis-subtitle {
    font-size: 13.5px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0 0 14px;
}
.crisis-hotlines {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    display: flex; flex-direction: column; gap: 8px;
}
.crisis-hotlines li {
    background: rgba(88,86,214,.05);
    border: 1px solid rgba(88,86,214,.15);
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    font-size: 13px;
}
.crisis-hotlines li strong {
    grid-column: 1 / 2;
    color: var(--color-text-primary);
    font-weight: 500;
}
.crisis-call {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    align-self: center;
    background: #5856d6; color: #fff;
    padding: 6px 14px;
    border-radius: 18px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.crisis-call:hover { background: #3e3da8; }
.crisis-avail {
    grid-column: 1 / 2;
    font-size: 11.5px;
    color: var(--color-text-tertiary);
}
.crisis-campus, .crisis-tip {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin: 8px 0;
    line-height: 1.55;
}

/* ============================================================
   A6 · 学习成果反馈条
   ============================================================ */
.usefulness-bar {
    margin-top: 14px;
    padding: 8px 14px;
    background: var(--color-bg-light);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: var(--color-text-secondary);
}
.usefulness-bar .useful-btn {
    background: #fff;
    border: 1px solid rgba(0,0,0,.1);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all .15s;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.usefulness-bar .useful-btn:hover {
    background: var(--color-primary); color: #fff;
    border-color: var(--color-primary);
    transform: scale(1.08);
}
.usefulness-thanks { color: var(--color-primary); font-weight: 500; }

/* ============================================================
   B3 · 知识掌握度地图 + streak 行
   ============================================================ */
.stat-row-streak {
    flex-wrap: wrap;
}
.stat-row .stat-sub {
    flex-basis: 100%;
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.knowledge-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.km-item {
    background: var(--color-bg-light);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
}
.km-item.km-good { border-color: rgba(52,199,89,.25); background: rgba(52,199,89,.04); }
.km-item.km-medium { border-color: rgba(255,149,0,.25); background: rgba(255,149,0,.04); }
.km-item.km-weak { border-color: rgba(255,59,48,.25); background: rgba(255,59,48,.04); }

.km-head { display: flex; justify-content: space-between; font-size: 13px; }
.km-name { font-weight: 500; color: var(--color-text-primary); }
.km-mastery { color: var(--color-text-tertiary); font-size: 12px; }
.km-bar {
    height: 5px; background: rgba(0,0,0,.06);
    border-radius: 3px; overflow: hidden; margin: 6px 0 4px;
}
.km-fill { height: 100%; background: linear-gradient(90deg,#ff3b30,#ff9500,#34c759); border-radius: 3px; transition: width .4s; }
.km-good .km-fill { background: #34c759; }
.km-medium .km-fill { background: #ff9500; }
.km-weak .km-fill { background: #ff3b30; }
.km-meta { font-size: 11px; color: var(--color-text-tertiary); }

/* ============================================================
   B4 · 数据隐私按钮
   ============================================================ */
.privacy-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
    margin-top: 8px;
}
.privacy-actions .btn-danger {
    background: #fff;
    color: #ff3b30;
    border: 1px solid rgba(255,59,48,.3);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.privacy-actions .btn-danger:hover {
    background: #ff3b30; color: #fff; border-color: #ff3b30;
}

/* ============================================================
   AI 绘图 / 思维导图
   ============================================================ */
.mindmap-toolbar {
    display: flex; gap: 8px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.mermaid-render {
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 12px;
    padding: 18px;
    overflow: auto;
    min-height: 300px;
    display: flex; align-items: center; justify-content: center;
}
.mermaid-render svg {
    max-width: 100%; height: auto;
}

.ai-image-meta {
    display: flex; gap: 14px; flex-wrap: wrap;
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--color-bg-light);
    border-radius: 8px;
}
.ai-image-meta code {
    background: rgba(0,0,0,.04);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.ai-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.ai-image-item {
    background: var(--color-bg-light);
    border-radius: 12px;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.ai-image-item img {
    width: 100%; height: auto;
    display: block;
    background: #f0f0f0;
}
.ai-image-actions {
    padding: 10px 12px;
    display: flex; gap: 8px; justify-content: flex-end;
}
.ai-image-actions a {
    text-decoration: none;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 6px;
}

/* ════════════════════════════════════════════════════════════
   ◉ APPLE POLISH · v4.4 全站统一视觉重构
   原则：单一系统蓝、克制的边框、零彩色渐变、扁平化、留白
   优先级覆盖前文样式（声明顺序保证最低风险，无 !important 滥用）
   ════════════════════════════════════════════════════════════ */

/* ── ① 取消所有装饰性多色渐变，统一为单色系统蓝/白 ───────── */
.lab-icon,
.feature-icon,
.km-good .km-fill,
.km-medium .km-fill,
.km-weak .km-fill,
.km-fill {
    background: rgba(0, 113, 227, 0.08) !important;
}
.lab-icon i,
.feature-icon i {
    color: var(--color-primary) !important;
    background: transparent !important;
    -webkit-text-fill-color: var(--color-primary);
}
.lab-icon {
    box-shadow: none !important;
    border-radius: 12px !important;
}
.feature-icon {
    box-shadow: none !important;
}

/* km-fill 改为内联根据等级显色（保留 mastery 进度但去渐变） */
.km-fill { background: var(--color-primary) !important; }
.km-good .km-fill   { background: #34c759 !important; }
.km-medium .km-fill { background: #ff9500 !important; }
.km-weak .km-fill   { background: #ff3b30 !important; }

/* ── ② 知识掌握地图：去除彩色卡背景 + 用色点替代 emoji ──── */
.km-item,
.km-item.km-good,
.km-item.km-medium,
.km-item.km-weak {
    background: var(--color-bg-light) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
.km-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.km-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #c7c7cc;
}
.km-good .km-dot   { background: #34c759; }
.km-medium .km-dot { background: #ff9500; }
.km-weak .km-dot   { background: #ff3b30; }
.km-mastery {
    font-variant-numeric: tabular-nums;
    color: var(--color-text-primary);
    font-weight: 500;
    font-size: 13px;
}
.km-mastery-total {
    color: var(--color-text-tertiary);
    font-weight: 400;
    margin-left: 1px;
}

/* ── ③ 反馈条：去 emoji 的彩色背景，回到极简胶囊 ────────── */
.usefulness-bar {
    background: transparent !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0 !important;
    padding: 10px 0 0 !important;
    margin-top: 16px !important;
    color: var(--color-text-tertiary) !important;
    font-size: 12px !important;
}
.usefulness-bar .useful-btn {
    background: transparent !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    width: 28px !important; height: 28px !important;
}
.usefulness-bar .useful-btn:hover {
    background: var(--color-bg-light) !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    transform: none !important;
}
.usefulness-thanks {
    color: var(--color-primary) !important;
    font-weight: 500;
}

/* ── ④ 按钮统一：扁平、不强调阴影 ─────────────────────────── */
.btn-primary {
    background: var(--color-primary) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: none !important;
    font-weight: 500;
    transition: background 0.15s ease;
}
.btn-primary:hover {
    background: var(--color-primary-hover) !important;
    transform: none !important;
    box-shadow: none !important;
}
.btn-secondary {
    background: var(--color-bg-light) !important;
    color: var(--color-text-primary) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
}
.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}

/* ── ⑤ 卡片悬停：去除上浮 + 大阴影 ───────────────────────── */
.lab-card:hover,
.feature-card:hover {
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 113, 227, 0.18) !important;
}

/* ── ⑥ Token widget / 头像 / 等装饰组件去强阴影 ─────────── */
.token-widget {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
    color: var(--color-text-primary) !important;
}
.token-widget:hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
}
.token-widget.admin-widget,
.token-widget[data-admin="true"] {
    background: #fff !important;
    color: var(--color-primary) !important;
    border-color: rgba(0, 113, 227, 0.2) !important;
}

/* ── ⑦ 心理援助 modal：紫色顶边换为系统蓝 ────────────────── */
.crisis-modal-content { border-top-color: var(--color-primary) !important; }
.crisis-modal-header h3 { color: var(--color-primary) !important; }
.crisis-hotlines li {
    background: var(--color-bg-light) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
.crisis-call {
    background: var(--color-primary) !important;
}
.crisis-call:hover { background: var(--color-primary-hover) !important; }

/* ── ⑧ 模式 chip / 标签 hover 取消上浮 ────────────────────── */
.mode-chip:hover,
.ms-chip:hover,
.lab-tag:hover {
    transform: none !important;
}

/* ── ⑨ 流式状态条降饱和度 ────────────────────────────────── */
.stream-bar {
    background: rgba(0, 113, 227, 0.04) !important;
    border-color: rgba(0, 113, 227, 0.12) !important;
}

/* ── ⑩ 反馈/评分等粉红渐变按钮回归系统蓝 ────────────────── */
[class*="thumbs"],
[class*="praise"],
.fb-rating-btn-active,
.btn-fb {
    background: var(--color-primary) !important;
    color: #fff !important;
    box-shadow: none !important;
}

/* ── ⑪ 概览/数据卡片：取消彩色背景 + 浅色 hover ──────────── */
.profile-card,
.summary-card,
.stat-card {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: none !important;
}

/* ── ⑫ 滚动条统一为系统灰 ────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }
::-webkit-scrollbar-track { background: transparent; }

/* ── ⑬ 输入框聚焦统一蓝色细外环 ──────────────────────────── */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12) !important;
}

/* ── ⑭ 移动端微调 ───────────────────────────────────────── */
@media (max-width: 600px) {
    .lab-icon, .feature-icon {
        width: 40px !important; height: 40px !important;
        font-size: 18px !important;
    }
}

/* ════════════════════════════════════════════════════════════
   ◉ APPLE POLISH 第二轮 · 思考模式 / 帮助卡 / 反馈 · v4.4.1
   ════════════════════════════════════════════════════════════ */

/* ── ⓐ 思考模式 chip 改为 iOS 分段控件（segmented control）── */
.mode-chip-group {
    display: inline-flex;
    background: rgba(118, 118, 128, 0.12);
    border-radius: 9px;
    padding: 2px;
    gap: 0;
}
.mode-chip-group .mode-chip,
.mode-chip-group .style-chip {
    padding: 5px 12px !important;
    border: none !important;
    border-radius: 7px !important;
    background: transparent !important;
    color: var(--color-text-primary) !important;
    font-size: 12.5px !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
    box-shadow: none !important;
    transform: none !important;
}
.mode-chip-group .mode-chip:hover,
.mode-chip-group .style-chip:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--color-text-primary) !important;
    transform: none !important;
}
/* 回复风格 chip：保持极简的白底激活态（次要控件）*/
.mode-chip-group .style-chip.active {
    background: #fff !important;
    color: var(--color-text-primary) !important;
    border-color: transparent !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04) !important;
}

/* 思考模式 chip：iOS Filled 变体（主要控件，更醒目）── */
/* 整组容器在思考模式标签后视觉权重略高 */
.mode-bar > .mode-chip-group:first-of-type {
    padding: 3px;
    background: rgba(118, 118, 128, 0.16);
}
.mode-chip-group .mode-chip {
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
}
/* chip 内的 FA 图标：未激活=系统蓝，激活=继承白色 */
.mode-chip-icon {
    color: var(--color-primary);
    font-size: 12px;
    transition: color .15s ease;
}
.mode-chip.active .mode-chip-icon {
    color: #fff;
}
/* 激活态：实色系统蓝 + 白字（Apple "Tinted Segmented Control"）*/
.mode-chip-group .mode-chip.active,
.mode-chip-group .mode-chip[data-mode="express"].active,
.mode-chip-group .mode-chip[data-mode="thinking"].active,
.mode-chip-group .mode-chip[data-mode="deep"].active {
    background: var(--color-primary) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 1px 2px rgba(0, 113, 227, 0.18), 0 2px 8px rgba(0, 113, 227, 0.16) !important;
    font-weight: 600 !important;
}
.mode-chip-group .mode-chip .mode-tag {
    color: var(--color-text-tertiary) !important;
    font-weight: 400 !important;
    margin-left: 5px;
    font-size: 11px;
    transition: color .15s ease;
}
.mode-chip-group .mode-chip.active .mode-tag {
    color: rgba(255, 255, 255, 0.78) !important;
}
.mode-chip-group .mode-chip:hover:not(.active) {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--color-primary) !important;
}

/* "思考模式" 标签轻微加重，与右侧 segmented control 形成视觉锚点 */
.mode-bar-label {
    font-weight: 600 !important;
    color: var(--color-text-primary) !important;
    font-size: 12px !important;
    margin-right: 2px;
}
/* "回复风格" 标签保持次要（更弱的灰）*/
.style-bar-label {
    color: var(--color-text-tertiary) !important;
    font-weight: 500 !important;
    font-size: 11.5px !important;
}

/* ── ⓚ PC 端 mode-bar 居中 + 两组 segmented control 等大 ── */
@media (min-width: 835px) {
    .mode-bar {
        justify-content: center !important;
        gap: 12px !important;
        padding: 12px 20px !important;
    }
    /* 思考模式 + 回复风格容器统一规格 */
    .mode-bar > .mode-chip-group:first-of-type,
    .mode-bar > .mode-chip-group:nth-of-type(2) {
        padding: 3px !important;
        background: rgba(118, 118, 128, 0.16) !important;
    }
    /* 两组里的所有 chip 统一尺寸（思考模式 chip + 风格 chip 同高同字号）*/
    .mode-bar .mode-chip-group .mode-chip,
    .mode-bar .mode-chip-group .style-chip {
        padding: 6px 14px !important;
        font-size: 13px !important;
        min-width: 56px;
        text-align: center;
        justify-content: center;
    }
    /* 标签 + 容器组成的「字段单元」整体居中对齐 */
    .mode-bar-label,
    .style-bar-label {
        font-size: 12px !important;
    }
    .mode-divider { margin: 0 4px !important; }
}

/* 移动端：保持原 wrap 布局，左对齐紧凑 */
@media (max-width: 834px) {
    .mode-bar { justify-content: flex-start !important; }
    .mode-bar .mode-chip-group .mode-chip,
    .mode-bar .mode-chip-group .style-chip {
        padding: 5px 11px !important;
        font-size: 12px !important;
    }
}

/* ── ⓑ 模式选择栏外框中性化 ────────────────────────────── */
.mode-bar {
    background: var(--color-bg-light) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
.mode-bar-label,
.style-bar-label {
    color: var(--color-text-tertiary) !important;
    font-size: 11px !important;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500 !important;
}

/* ── ⓒ 模式卡片：去掉橙/紫边框 + 彩色 hover ─────────────── */
.mode-card,
.mode-card-express,
.mode-card-thinking,
.mode-card-deep {
    background: #fff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
}
.mode-card:hover,
.mode-card-express:hover,
.mode-card-thinking:hover,
.mode-card-deep:hover {
    border-color: rgba(0, 113, 227, 0.25) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    transform: none !important;
}
.mode-card-icon {
    color: var(--color-primary) !important;
    background: rgba(0, 113, 227, 0.08) !important;
    width: 44px; height: 44px;
    border-radius: 10px;
    display: inline-flex !important; align-items: center; justify-content: center;
    font-size: 18px !important;
    margin-bottom: 10px;
}
.mode-card .default-badge {
    background: rgba(0, 113, 227, 0.1) !important;
    color: var(--color-primary) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 2px 8px !important;
    font-size: 10.5px !important;
    border-radius: 4px;
    font-weight: 500;
}
.mode-card-time {
    color: var(--color-text-tertiary) !important;
    font-size: 11px !important;
    font-weight: 400;
}
.mode-card-meta {
    border-top: 1px solid rgba(0, 0, 0, 0.04) !important;
    padding-top: 10px;
    margin-top: 12px;
}
.mode-card-meta span {
    color: var(--color-text-tertiary) !important;
    font-size: 11.5px !important;
    background: transparent !important;
    padding: 0 !important;
}

/* ── ⓓ stream-bar 体内深度/急速彩色提示 → 全部蓝色低饱和 ── */
body.mode-deep .stream-status-inner,
body.mode-express .stream-status-inner {
    background: rgba(0, 113, 227, 0.04) !important;
    border-color: rgba(0, 113, 227, 0.12) !important;
}

/* ── ⓔ 反馈 FAB 粉橙渐变 → 系统蓝实色 ───────────────────── */
.feedback-fab {
    background: var(--color-primary) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 113, 227, 0.18) !important;
}
.feedback-fab:hover {
    background: var(--color-primary-hover) !important;
    transform: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 6px 16px rgba(0, 113, 227, 0.25) !important;
}

/* ── ⓕ 评分星：橙色发光 → 中性灰 / 系统蓝（更克制）────── */
.feedback-rating .rate-star {
    color: rgba(0, 0, 0, 0.18) !important;
    text-shadow: none !important;
    transition: color .12s ease !important;
}
.feedback-rating .rate-star:hover {
    transform: none !important;
    color: var(--color-text-secondary) !important;
}
.feedback-rating .rate-star.on {
    color: var(--color-primary) !important;
    text-shadow: none !important;
}

/* ── ⓖ 反馈类型 chip：取消 hover transform 上浮 ────────── */
.feedback-type-chip {
    border-color: rgba(0, 0, 0, 0.08) !important;
}
.feedback-type-chip:has(input:checked) {
    box-shadow: none !important;
}

/* ── ⓗ 模式当前提示条 ──────────────────────────────────── */
.mode-current-hint {
    background: var(--color-bg-light) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    color: var(--color-text-secondary) !important;
}
.mode-current-hint i { color: var(--color-text-tertiary) !important; }

/* ── ⓘ 使用说明 modal：所有 section 图标统一系统蓝 ──────── */
.guide-section h4 {
    color: var(--color-text-primary) !important;
    display: flex; align-items: center; gap: 8px;
    font-size: 14px;
    font-weight: 600;
}
.guide-section h4 i {
    color: var(--color-primary) !important;
    width: 16px; text-align: center;
    font-size: 14px;
}
/* 模块表格行图标 + 列表内联图标统一规格 */
.guide-row-icon {
    color: var(--color-primary) !important;
    width: 16px; text-align: center;
    margin-right: 6px;
    font-size: 13px;
    opacity: .9;
}
.guide-table tr td:first-child {
    white-space: nowrap;
}
/* 嵌套子列表（思考模式 / 回复风格）层级缩进 */
.guide-section ul ul {
    margin-top: 6px;
    padding-left: 18px;
}
.guide-section ul ul li {
    list-style: circle;
    margin: 3px 0;
}
.guide-section li code {
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
    color: var(--color-primary);
}

/* ── ⓙ 反馈类型 chip 图标统一为单色（被选中时白色）─────── */
.feedback-type-chip span {
    display: inline-flex; align-items: center; gap: 5px;
}
.feedback-type-chip span i {
    color: var(--color-primary);
    font-size: 12px;
    width: 14px; text-align: center;
    transition: color .15s ease;
}
.feedback-type-chip:hover span i {
    color: var(--color-primary);
}
.feedback-type-chip:has(input:checked) span,
.feedback-type-chip:has(input:checked) span i {
    color: #fff !important;
}

/* ============================================================
   站点页脚（ICP 备案）· Apple 风格极简
   ============================================================ */
.site-footer {
    margin-top: 40px;
    padding: 18px 24px 24px;
    text-align: center;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: transparent;
}
.site-footer-inner {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-tertiary);
    line-height: 1.6;
}
.site-footer .footer-brand {
    font-weight: 500;
    color: var(--color-text-secondary);
}
.site-footer .footer-divider {
    color: rgba(0, 0, 0, 0.15);
    margin: 0 2px;
    user-select: none;
}
.site-footer .footer-icp {
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: color .15s ease;
}
.site-footer .footer-icp:hover,
.site-footer .footer-icp:focus-visible {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.site-footer .footer-copy {
    color: var(--color-text-tertiary);
}

/* 移动端：堆叠 + 缩小 */
@media (max-width: 600px) {
    .site-footer { padding: 16px 16px 20px; margin-top: 28px; }
    .site-footer-inner { font-size: 11px; gap: 4px 6px; }
    .site-footer .footer-divider { display: none; }
}

/* ── 登录页：固定在屏幕底部居中（无主内容滚动）── */
.site-footer-fixed {
    position: fixed;
    bottom: 14px;
    left: 0; right: 0;
    text-align: center;
    z-index: 50;
    pointer-events: none;
}
.site-footer-fixed a {
    pointer-events: auto;
    font-size: 12px;
    color: rgba(60, 60, 67, 0.55);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: color .15s ease;
}
.site-footer-fixed a:hover {
    color: var(--color-primary);
}
@media (max-width: 480px) {
    .site-footer-fixed a { font-size: 11px; padding: 3px 10px; }
}
