/*
  AI Toolset - Modern & Minimalist Design System V1

  - Author: Gemini
  - Date: 2024-11-10
  - Description: A comprehensive, variable-driven CSS framework for a clean, accessible, and responsive UI.
*/

/* ---------------------------------------------- */
/* 1. FONT DEFINITIONS
/* ---------------------------------------------- */

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/assets/fonts/inter-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------- */
/* 2. DESIGN TOKENS (CSS VARIABLES)
/* ---------------------------------------------- */

:root {
  /* 固定头部高度变量，便于内容区留白与 sticky 计算 */
  --header-height: 64px;
  /* 选项栏高度，使其与 header 贴合并固定 */
  --tabbar-height: 48px;
  
  /* a. 渐变主色调 (现代紫蓝渐变) */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary: #667eea;
  --primary-hover: #5568d3;
  --primary-focus-ring: rgba(102, 126, 234, 0.3);
  --primary-light: rgba(102, 126, 234, 0.1);

  /* b. 功能色彩（提升饱和度） */
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.1);

  /* c. 明亮主题中性色 */
  --bg-light: #f8fafc;
  --surface-light: #ffffff;
  --text-primary-light: #0f172a;
  --text-secondary-light: #64748b;
  --border-light: #e2e8f0;
  --bg-hover-light: #f1f5f9;

  /* d. 暗黑主题中性色（柔和深蓝灰） */
  --bg-dark: #0f172a; /* 深蓝黑 */
  --surface-dark: #1e293b; /* 柔和深灰蓝 */
  --text-primary-dark: #f8fafc;
  --text-secondary-dark: #94a3b8;
  --border-dark: #334155;
  --bg-hover-dark: #334155;

  /* e. 字体排版 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: clamp(1.25rem, 2vw, 1.5rem);     /* 20-24px 响应式 */
  --font-size-2xl: clamp(1.5rem, 3vw, 1.875rem);  /* 24-30px 响应式 */
  --line-height-tight: 1.3;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.8;
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;

  /* f. 间距系统（优化移动端） */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-8: 3rem;      /* 48px */
  --space-10: 4rem;     /* 64px */

  /* g. 布局与修饰 */
  --max-width: 1280px;
  --max-width-wide: 1440px;
  --border-radius-sm: 0.5rem;   /* 8px */
  --border-radius-md: 0.75rem;  /* 12px */
  --border-radius-lg: 1.25rem;  /* 20px */
  --border-radius-xl: 1.5rem;   /* 24px */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------------------------------------- */
/* 3. THEME SETUP
/* ---------------------------------------------- */

/* 明亮主题（默认） */
:root {
  --bg: var(--bg-light);
  --surface: var(--surface-light);
  --text: var(--text-primary-light);
  --text-muted: var(--text-secondary-light);
  --border: var(--border-light);
  --bg-hover: var(--bg-hover-light);

  /* 多层精致阴影（模拟真实光影） */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 
               0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
               0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 10px 20px -5px rgba(0, 0, 0, 0.1), 
               0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* 彩色阴影（用于主色调按钮和卡片） */
  --shadow-primary: 0 4px 14px 0 rgba(102, 126, 234, 0.25);
  --shadow-primary-lg: 0 10px 30px 0 rgba(102, 126, 234, 0.3);
}

/* 暗黑主题 */
html[data-theme='dark'] {
  --bg: var(--bg-dark);
  --surface: var(--surface-dark);
  --text: var(--text-primary-dark);
  --text-muted: var(--text-secondary-dark);
  --border: var(--border-dark);
  --bg-hover: var(--bg-hover-dark);

  /* 暗黑模式下的柔和阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 
               0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 
               0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 10px 20px -5px rgba(0, 0, 0, 0.4), 
               0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  
  /* 暗黑模式彩色阴影 */
  --shadow-primary: 0 4px 14px 0 rgba(102, 126, 234, 0.4);
  --shadow-primary-lg: 0 10px 30px 0 rgba(102, 126, 234, 0.5);
}

/* ---------------------------------------------- */
/* 4. GLOBAL & BASE STYLES
/* ---------------------------------------------- */

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 防止出现水平滚动条，避免视图被认为“超出屏幕” */
  overflow-x: hidden;
}

/* 全局盒模型：避免内边距/边框导致宽度溢出 */
*, *::before, *::after { box-sizing: border-box; }

/* 固定头部时给页面内容预留空间，避免被遮挡 */
body { padding-top: var(--header-height); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
}

/* 移动端优化间距 */
@media (min-width: 768px) {
  .container {
    padding: var(--space-5) var(--space-6) var(--space-8);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: var(--space-6) var(--space-6) var(--space-10);
  }
}

.container-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

@media (min-width: 768px) {
  .container-content {
    padding: 0 var(--space-6);
  }
}

/* ---------------------------------------------- */
/* 5. CORE COMPONENTS
/* ---------------------------------------------- */

/* a. Header */
.page-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--header-height);
  padding: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(1.5) blur(8px);
}

.page-header .brand {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
}

.page-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  margin: 0;
}

.env-hint {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  margin-left: var(--space-2);
  font-weight: 400;
}

/* 主导航栏按钮样式 */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: var(--transition-base);
  position: relative;
}

.nav-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

/* b. 按钮系统（增强渐变与交互） */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

/* 主按钮：渐变背景 + 彩色阴影 */
.btn.primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* 次级按钮：边框样式 */
.btn.secondary {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn.secondary:hover {
  background-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* 幽灵按钮 */
.btn.ghost {
  background-color: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn.ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text);
}

/* 轮廓按钮 */
.btn.outline {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn.outline:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* c. 卡片系统（增强深度感与微交互） */
.card, .tool-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  position: relative;
}

/* 移动端卡片优化 */
@media (min-width: 768px) {
  .card, .tool-card {
    padding: var(--space-6);
  }
}

.card:hover, .tool-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

/* 卡片内容区通用样式 */
.card .content, .tool-card .content {
  position: relative;
  z-index: 1;
}

/* d. Forms */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.field label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text);
}

input, textarea, select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-md);
  transition: var(--transition-base);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus-ring);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* e. TabBar */
.tab-bar {
  display: flex;
  position: fixed; /* 始终固定在 header 下方 */
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  align-items: center;
  z-index: 39;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.tab-bar .tab-item {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition-base);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  font-family: var(--font-sans);
}

.tab-bar .tab-item:hover {
  color: var(--primary);
  background-color: var(--bg-hover);
}

.tab-bar .tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* 兼容旧的 a 标签样式 */
.tab-bar a {
  padding: var(--space-2) var(--space-4);
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  transition: var(--transition-base);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--font-size-sm);
}

.tab-bar a:hover {
  color: var(--primary);
  background-color: var(--bg-hover);
}

.tab-bar a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* 固定选项栏后，工具列表网格向下避让，避免被遮挡 */
.tab-bar + .tool-grid {
  margin-top: var(--tabbar-height);
}

/* f. Code Blocks & Results */
pre {
  background-color: var(--bg-hover);
  padding: var(--space-4);
  border-radius: var(--border-radius-md);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.result img, .result audio {
  max-width: 100%;
  display: block;
  border-radius: var(--border-radius-md);
}

/* g. Bottom Navigation (Mobile) */
.bottom-nav {
  display: none; /* Hidden by default, shown via media query */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  justify-content: space-around;
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--space-2) 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.bottom-nav .nav-item:hover {
  color: var(--primary);
}

.bottom-nav .nav-item.active {
  color: var(--primary);
}

.bottom-nav .nav-item .label {
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
}

.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
}

/* ---------------------------------------------- */
/* 6. RESPONSIVE DESIGN
/* ---------------------------------------------- */

@media (max-width: 768px) {
  /* Show mobile navigation */
  .bottom-nav {
    display: flex;
  }

  /* Add padding to bottom of container to avoid overlap with nav */
  .container {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* Hide desktop navigation on mobile */
  .main-nav {
    display: none;
  }
}

/* ---------------------------------------------- */
/* 7. PAGE-SPECIFIC GRIDS
/* ---------------------------------------------- */

/* 首页分类卡片：移动端1列，平板2列，PC 3列 */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 分类卡片封面背景图样式 */
.card .cover {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--border-radius-md);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-base);
}

.card:hover .cover {
  transform: scale(1.02);
}

.card .content { 
  margin-top: var(--space-4); 
}

.card .content h3 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  margin: 0 0 var(--space-2) 0;
  color: var(--text);
}

.card .content p {
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
  color: var(--text-muted);
  margin: 0 0 var(--space-4) 0;
}

.card .content .actions {
  display: flex;
  gap: var(--space-3);
  margin-top: auto;
}

/* 整卡背景 + 毛玻璃覆盖层（用于分类卡片与工具卡片） */
.card.overlay, .tool-card.overlay {
  position: relative;
  aspect-ratio: 3/2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  padding: 0;
  transition: var(--transition-base);
}

.card.overlay .content, .tool-card.overlay .content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-3) var(--space-4);
  margin-top: 0;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  backdrop-filter: blur(12px) saturate(200%);
  -webkit-backdrop-filter: blur(12px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  background-clip: padding-box;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1), 
              inset 0 1px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: var(--space-2);
  box-sizing: border-box;
  transition: var(--transition-base);
}

html[data-theme='dark'] .card.overlay .content,
html[data-theme='dark'] .tool-card.overlay .content {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
  backdrop-filter: blur(12px) saturate(200%);
  -webkit-backdrop-filter: blur(12px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background-clip: padding-box;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3), 
              inset 0 1px rgba(255, 255, 255, 0.2);
}

/* 工具卡专用：容器透明，改用“仅文字背景条”玻璃效果，让背景更清晰 */
.tool-card.overlay .content {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  height: auto;
  padding: var(--space-4) var(--space-4);
}

/* 工具卡片：整卡点击 */
.tool-card.overlay {
  cursor: pointer;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.tool-card.overlay:hover {
  box-shadow: var(--shadow-2xl);
  transform: translateY(-4px) scale(1.01);
}

.tool-card.overlay .title {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-tight);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  color: white;
}

.tool-card.overlay .desc {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-base);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.95);
}

/* 暗色主题下的文字背景条（稍强不透明度） */
html[data-theme='dark'] .tool-card.overlay .title,
html[data-theme='dark'] .tool-card.overlay .desc {
  background-color: transparent;
}

/* 工具列表网格：移动端支持1列和2列，PC端固定4列 */
.tool-grid {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 0 var(--space-4);
}

/* 移动端：根据用户设置显示1列或2列（仅在移动端生效） */
@media (max-width: 767px) {
  .tool-grid.cols-1 {
    grid-template-columns: repeat(1, 1fr);
  }

  .tool-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 平板端：固定2列，忽略用户设置 */
@media (min-width: 768px) {
  .tool-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-4);
    padding: 0 var(--space-3) var(--space-5);
  }
}

/* PC端：固定4列，忽略用户设置 */
@media (min-width: 1024px) {
  .tool-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: var(--space-4);
    padding: 0 var(--space-4) var(--space-5);
  }
}

/* 防止卡片内容撑破网格导致水平溢出 */
.tool-card { 
  min-width: 0; 
}

.tool-card .content { 
  margin-top: var(--space-3); 
  overflow-wrap: anywhere; 
}

.tool-card .title { 
  font-weight: 700; 
  letter-spacing: var(--letter-spacing-tight);
}

.tool-card .desc { 
  color: var(--text-muted); 
  line-height: var(--line-height-base);
}

/* 工具缩略图：强制等比裁剪，避免原图过宽造成页面溢出 */
.tool-card .thumb {
  width: 100%;
  max-width: 100%;
  display: block;
  border-radius: var(--border-radius-md);
  aspect-ratio: 4/3;
  object-fit: cover;
  transition: var(--transition-base);
}

.tool-card:hover .thumb {
  transform: scale(1.05);
}

/* ---------------------------------------------- */
/* 8. 工具详情页专用样式
/* ---------------------------------------------- */

.tool-detail-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 1024px) {
  .tool-detail-layout {
    grid-template-columns: 1fr;
  }
}

.tool-detail-header h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.tool-detail-header .category-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.preview-panel {
  min-height: 500px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  padding: var(--space-6);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.preview-panel .loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: var(--font-size-lg);
}

.tool-usage {
  margin-top: var(--space-6);
}

.tool-usage h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 0 var(--space-3) 0;
  color: var(--text);
}

.tool-usage p {
  color: var(--text-muted);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

.control-panel {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.control-panel h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 0 var(--space-4) 0;
  color: var(--text);
}

.action-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.action-bar .spacer {
  flex: 1;
}

/* ---------------------------------------------- */
/* 9. 用户偏好页专用样式
/* ---------------------------------------------- */

.user-preferences {
  max-width: 720px;
  margin: 0 auto;
}

.user-preferences h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-tight);
  margin: 0 0 var(--space-6) 0;
  color: var(--text);
}

.preference-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
}

.preference-section h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 0 var(--space-4) 0;
  color: var(--text);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  background: var(--bg-hover);
}

.segmented .seg {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: var(--transition-base);
  border-right: 1px solid var(--border);
}

.segmented .seg:last-child {
  border-right: none;
}

.segmented .seg:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.segmented .seg.active {
  background: var(--primary-gradient);
  color: white;
  font-weight: 600;
}

.preference-note {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--bg-hover);
  border-left: 3px solid var(--primary);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: var(--line-height-relaxed);
}


