/* ============================================
   AI虚拟试穿 — 深色科技风 Premium UI
   Inspired by Linear / Vercel / Raycast
   ============================================ */

/* --- 基础重置 & 设计 Token --- */
:root {
    --bg-base: #09090b;
    --bg-elevated: #111113;
    --bg-surface: #18181b;
    --bg-surface-hover: #1f1f23;
    --bg-overlay: rgba(0, 0, 0, 0.6);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.1);
    --border-active: rgba(139, 92, 246, 0.4);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-quaternary: #52525b;

    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-muted: rgba(139, 92, 246, 0.15);
    --accent-glow: rgba(139, 92, 246, 0.25);

    --gradient-primary: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
    --gradient-text: linear-gradient(135deg, #c084fc, #818cf8, #60a5fa);
    --gradient-surface: linear-gradient(145deg, rgba(139, 92, 246, 0.08), rgba(99, 102, 241, 0.04), transparent);

    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);

    --blur: blur(24px);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- 背景装饰：渐变光晕 --- */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.12) 0%, rgba(99, 102, 241, 0.06) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.08) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* --- 噪点纹理叠加 --- */
.noise-overlay {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* --- 顶部导航 --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 56px;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 48px);
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-brand span {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

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

.nav-user-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-points {
    background: var(--accent-muted);
    color: var(--accent-hover);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* --- 按钮系统 --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: inherit;
}

.btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    border-color: transparent;
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-tertiary);
    padding: 7px 10px;
}

.btn-ghost:hover {
    background: var(--accent-muted);
    color: var(--accent-hover);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- 主容器 --- */
.main-container {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 80px 20px 60px;
    min-height: 100vh;
}

/* --- Hero区域 --- */
.hero {
    text-align: center;
    padding: 56px 0 48px;
}

.hero h1 {
    font-size: clamp(2.2rem, 5.5vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.hero h1 span {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.0625rem;
    color: var(--text-tertiary);
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.7;
    letter-spacing: -0.01em;
}

/* --- 功能模块标签切换 --- */
.module-tabs-wrapper {
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.module-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.module-tab {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.module-tab:hover {
    color: var(--text-secondary);
    background: var(--bg-surface);
}

.module-tab.active {
    background: var(--accent-muted);
    border-color: var(--border-active);
    color: var(--accent-hover);
    font-weight: 600;
}

.module-tab-icon {
    font-size: 1rem;
    line-height: 1;
}

.module-tab-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 模块面板（默认隐藏，active 时显示） --- */
.module-panel {
    display: none;
}

.module-panel.active {
    display: block;
    animation: fadeUp 0.4s ease both;
}

/* --- 文本输入框（文生图/图生图） --- */
.prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.6;
    outline: none;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    position: relative;
    z-index: 1;
}

.prompt-textarea::placeholder {
    color: var(--text-quaternary);
}

.prompt-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
    background: var(--bg-base);
}

/* --- 选项行 --- */
.option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.option-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.size-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.size-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    font-family: inherit;
}

.size-chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.size-chip.active {
    background: var(--accent-muted);
    border-color: var(--border-active);
    color: var(--accent-hover);
}

/* --- 卡片 --- */
.glass-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-surface);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}

.glass-card:hover::before {
    opacity: 1;
}

.glass-card:hover {
    border-color: var(--border-hover);
}

/* --- 步骤区域 --- */
.steps-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
    flex-shrink: 0;
    font-family: var(--font-mono);
    transition: all var(--transition);
}

.step-number.done {
    background: var(--success-muted);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.step-title {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 1px;
    letter-spacing: -0.01em;
}

/* --- 服装类型选择器 --- */
.clothing-type-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.type-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    user-select: none;
}

.type-chip input[type="radio"] {
    display: none;
}

.type-chip:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-secondary);
}

.type-chip.active {
    background: var(--accent-muted);
    border-color: var(--border-active);
    color: var(--accent-hover);
}

/* --- 上传区域 --- */
.upload-zone {
    border: 1.5px dashed rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.01);
}

.upload-zone:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.04);
}

.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-muted);
    border-style: solid;
}

.upload-zone.has-image {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.3);
    background: var(--success-muted);
    padding: 12px;
}

.upload-zone .upload-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
    filter: grayscale(0.3);
}

.upload-zone .upload-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.upload-zone .upload-hint {
    font-size: 0.6875rem;
    color: var(--text-quaternary);
    letter-spacing: -0.01em;
}

.upload-zone input[type="file"] {
    display: none;
}

/* --- 多图上传区域 --- */
.multi-upload-area {
    margin-top: 12px;
}

.multi-upload-area input[type="file"] {
    display: none;
}

.multi-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.multi-upload-grid:empty {
    display: none;
}

.multi-upload-thumb {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    aspect-ratio: 1;
}

.multi-upload-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.multi-upload-thumb .thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 0;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.multi-upload-thumb .thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.multi-upload-thumb:hover .thumb-remove {
    opacity: 1;
}

.multi-upload-add {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.multi-upload-add:hover {
    border-color: var(--accent);
    background: rgba(147, 130, 255, 0.04);
}

.multi-upload-add.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.multi-upload-add .upload-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.multi-upload-add .upload-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.multi-upload-add .upload-hint {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.upload-preview {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.upload-preview-wrapper {
    position: relative;
    display: inline-block;
}

.upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.upload-remove:hover {
    background: var(--danger);
    border-color: transparent;
    color: #fff;
}

/* --- 生成按钮 --- */
.generate-section {
    text-align: center;
    margin: 32px 0;
}

.btn-generate {
    padding: 14px 44px;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-family: inherit;
    box-shadow: 0 0 20px var(--accent-glow), var(--shadow-sm);
}

.btn-generate::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: var(--gradient-primary);
    z-index: -1;
    filter: blur(12px);
    opacity: 0.4;
    transition: opacity var(--transition);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 40px var(--accent-glow), var(--shadow-md);
}

.btn-generate:hover::before {
    opacity: 0.6;
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-generate:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-generate:disabled::before {
    display: none;
}

.free-counter {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-quaternary);
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

/* --- 结果展示 --- */
.results-section {
    margin-top: 32px;
    animation: fadeUp 0.5s var(--transition) both;
}

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

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 720px;
    margin: 0 auto;
    margin-top: 18px;
}

.result-card {
    overflow: visible !important;
}

.result-item {
    border-radius: var(--radius-md);
    overflow: visible;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: all var(--transition);
    position: relative;
}

.result-item:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: var(--border-hover);
}

.result-item img {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-md);
}

.result-label {
    text-align: center;
    padding: 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: -0.01em;
}

/* --- 排队悬浮卡片 --- */
.queue-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.queue-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.queue-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 44px 36px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.queue-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.queue-card p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: 0;
    letter-spacing: -0.01em;
}

/* --- 加载动画 --- */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 20px 0;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- 模态框 --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.modal-tabs {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 24px;
}

.modal-tab {
    flex: 1;
    padding: 7px;
    text-align: center;
    border: none;
    background: transparent;
    border-radius: 7px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.modal-tab.active {
    background: var(--accent-muted);
    color: var(--accent-hover);
}

.modal-tab:hover:not(.active) {
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition-fast);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
}

.form-input::placeholder {
    color: var(--text-quaternary);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
    background: var(--bg-base);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 6px;
    display: none;
}

.modal-footer {
    margin-top: 20px;
}

.modal-footer .btn {
    width: 100%;
    padding: 11px;
    border-radius: var(--radius-sm);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.modal-close:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* --- Toast 消息提示 --- */
.toast-container {
    position: fixed;
    top: 68px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
    animation-fill-mode: forwards;
    max-width: 340px;
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    letter-spacing: -0.01em;
}

.toast.success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.toast.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.toast.info {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.2);
    color: var(--accent-hover);
}

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

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-8px); }
}

/* --- 记录按钮角标 --- */
.btn-history {
    position: relative;
}

.history-badge-count {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    border-radius: 9px;
    background: #ff4757;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* --- 历史记录面板 --- */
.history-overlay {
    position: fixed; inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.history-overlay.active {
    display: flex;
}

.history-panel {
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border);
}

.history-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.history-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    align-items: center;
}

.history-card:hover {
    border-color: var(--border-hover);
    background: rgba(255,255,255,0.03);
}

.history-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.history-card:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: rgba(255, 71, 87, 0.35);
}

@media (max-width: 768px) {
    .history-delete-btn {
        opacity: 0.6;
    }
}

.history-thumb {
    width: 72px; height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.history-thumb .thumb-placeholder {
    font-size: 1.5rem;
}

.thumb-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle, color-mix(in srgb, var(--load-color) 10%, transparent), transparent 70%);
}

.thumb-loading-emoji {
    font-size: 1.6rem;
    animation: emojiFloat 2s ease-in-out infinite;
    z-index: 1;
    filter: drop-shadow(0 0 6px var(--load-color));
}

@keyframes emojiFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-6px) scale(1.1) rotate(-8deg); }
    60% { transform: translateY(2px) scale(0.95) rotate(4deg); }
}

.thumb-loading-ring {
    position: absolute;
    inset: 4px;
    border: 2.5px solid transparent;
    border-top-color: var(--load-color);
    border-right-color: var(--load-color);
    border-radius: 50%;
    animation: ringRotate 1.2s linear infinite;
    opacity: 0.7;
}

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

.history-status.processing {
    color: #fbbf24;
    animation: statusBlink 1.8s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.history-info-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.history-badge.tryon { background: rgba(147,130,255,0.15); color: #b8a9ff; }
.history-badge.faceswap { background: rgba(255,149,0,0.15); color: #ffb74d; }
.history-badge.text2img { background: rgba(52,199,89,0.15); color: #66d98a; }
.history-badge.img2img { background: rgba(255,69,58,0.15); color: #ff8a80; }

.history-status {
    font-size: 0.7rem;
    font-weight: 500;
}

.history-status.processing { color: var(--accent); }
.history-status.completed { color: #66d98a; }
.history-status.failed { color: #ff6b6b; }

.history-prompt {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 0.68rem;
    color: var(--text-quaternary);
}

.history-pager {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.history-pager:empty { display: none; }

.history-pager button {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
}

.history-pager button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* --- 页脚 --- */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 32px 0;
    font-size: 0.6875rem;
    color: var(--text-quaternary);
    letter-spacing: -0.01em;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

/* --- 辅助隐藏 --- */
.hidden {
    display: none !important;
}

/* --- 页面入场动画 --- */
.hero { animation: fadeUp 0.6s ease both; }
.steps-container .glass-card:nth-child(1) { animation: fadeUp 0.6s ease 0.1s both; }
.steps-container .glass-card:nth-child(2) { animation: fadeUp 0.6s ease 0.2s both; }
.generate-section { animation: fadeUp 0.6s ease 0.3s both; }

/* --- 响应式 --- */
@media (max-width: 768px) {
    .main-container {
        padding: 72px 16px 32px;
    }

    .glass-card {
        padding: 22px;
        border-radius: var(--radius-md);
    }

    .hero {
        padding: 40px 0 32px;
    }

    .hero p {
        font-size: 0.9375rem;
    }

    .result-item img {
        max-height: 70vh;
    }

    .modal {
        padding: 24px;
        border-radius: var(--radius-lg);
    }

    .queue-card {
        padding: 32px 24px;
    }

    .navbar-brand {
        font-size: 0.875rem;
    }

    .module-tabs {
        gap: 4px;
        padding: 3px;
    }

    .module-tab {
        padding: 8px 8px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .module-tab-icon {
        font-size: 0.875rem;
    }

    .option-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .btn-generate {
        width: 100%;
        padding: 14px 24px;
    }

    .clothing-type-selector {
        gap: 4px;
    }

    .type-chip {
        padding: 5px 11px;
        font-size: 0.75rem;
    }
}
