/* ============================================================
   少年视界梦想号小火车 · 统一设计系统 v2.0
   DreamTrain Design System - 移动端优先 · 三标签导航
   ============================================================ */

/* ==================== CSS 自定义属性（设计令牌） ==================== */
:root {
  /* 品牌色系 */
  --dt-primary: #FF9800;
  --dt-primary-dark: #F57C00;
  --dt-primary-light: #FFB74D;
  --dt-secondary: #7C4DFF;
  --dt-secondary-dark: #536DFE;
  --dt-accent: #FFD700;
  --dt-success: #4CAF50;
  --dt-error: #EF5350;
  --dt-warning: #FFA726;
  --dt-info: #42A5F5;

  /* 品牌渐变 */
  --dt-gradient-primary: linear-gradient(135deg, #FF9800, #F57C00);
  --dt-gradient-secondary: linear-gradient(135deg, #7C4DFF, #536DFE);
  --dt-gradient-accent: linear-gradient(135deg, #FFD700, #FFA000);
  --dt-gradient-success: linear-gradient(135deg, #66BB6A, #43A047);
  --dt-gradient-dark: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);

  /* 中性色 */
  --dt-bg: #f5f5f5;
  --dt-bg-card: #ffffff;
  --dt-bg-dark: #1a1a2e;
  --dt-text: #333333;
  --dt-text-secondary: #666666;
  --dt-text-muted: #999999;
  --dt-border: #e0e0e0;
  --dt-border-light: #f0f0f0;

  /* 字体 */
  --dt-font: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --dt-font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  /* 圆角 */
  --dt-radius-xs: 6px;
  --dt-radius-sm: 10px;
  --dt-radius: 14px;
  --dt-radius-lg: 20px;
  --dt-radius-xl: 28px;
  --dt-radius-full: 9999px;

  /* 阴影 */
  --dt-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --dt-shadow: 0 4px 16px rgba(0,0,0,0.12);
  --dt-shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --dt-shadow-glow: 0 0 20px rgba(255,152,0,0.3);

  /* 间距 */
  --dt-space-xs: 4px;
  --dt-space-sm: 8px;
  --dt-space: 16px;
  --dt-space-lg: 24px;
  --dt-space-xl: 32px;
  --dt-space-2xl: 48px;

  /* 动画 */
  --dt-transition-fast: 0.15s ease;
  --dt-transition: 0.3s ease;
  --dt-transition-slow: 0.5s ease;

  /* 导航栏高度 */
  --dt-nav-height: 56px;
  --dt-bottom-nav-height: 64px;
  --dt-top-bar-height: 48px;
}

/* ==================== 全局重置 & 基础样式 ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--dt-font);
  color: var(--dt-text);
  background: var(--dt-bg);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.dt-dark {
  --dt-bg: #121212;
  --dt-bg-card: #1e1e2e;
  --dt-text: #e0e0e0;
  --dt-text-secondary: #aaaaaa;
  --dt-text-muted: #777777;
  --dt-border: #333333;
  --dt-border-light: #2a2a2a;
  background: var(--dt-bg);
  color: var(--dt-text);
}

a {
  color: var(--dt-primary);
  text-decoration: none;
  transition: color var(--dt-transition-fast);
}
a:hover { color: var(--dt-primary-dark); }

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

button {
  font-family: var(--dt-font);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--dt-transition-fast);
}
button:active { transform: scale(0.96); }

input, textarea, select {
  font-family: var(--dt-font);
  font-size: 14px;
  outline: none;
}

/* ==================== 布局系统 ==================== */
.dt-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--dt-bottom-nav-height) + env(safe-area-inset-bottom));
}

.dt-page--no-nav {
  padding-bottom: 0;
}

.dt-main {
  flex: 1;
  padding: var(--dt-space);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.dt-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--dt-space);
}

/* ==================== 顶部导航栏（极简 · 移动端优先） ==================== */
.dt-topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--dt-bg-card);
  border-bottom: 1px solid var(--dt-border-light);
  box-shadow: var(--dt-shadow-sm);
  height: var(--dt-top-bar-height);
  display: flex;
  align-items: center;
  padding: 0 var(--dt-space);
  padding-top: env(safe-area-inset-top);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dt-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
  font-size: 16px;
  font-weight: 800;
  color: var(--dt-text);
  text-decoration: none;
  white-space: nowrap;
}

.dt-topbar__brand .logo {
  font-size: 22px;
  animation: dt-train-bounce 2s infinite;
}

@keyframes dt-train-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.dt-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
  margin-left: auto;
}

.dt-topbar__icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--dt-radius-full);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--dt-text-secondary);
  transition: all var(--dt-transition-fast);
  position: relative;
  /* 触摸优化：最小 44pt 点击区域 */
  min-width: 44px;
  min-height: 44px;
}

.dt-topbar__icon-btn:hover {
  background: var(--dt-border-light);
  color: var(--dt-text);
}

.dt-topbar__avatar {
  min-width: 32px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--dt-gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.dt-topbar__avatar:hover {
  transform: scale(1.1);
  box-shadow: var(--dt-shadow-glow);
}

/* 移动端顶部栏适配 */
@media (max-width: 768px) {
  .dt-topbar { padding: 0 var(--dt-space-sm); padding-top: env(safe-area-inset-top); }
  .dt-topbar__brand { font-size: 15px; }
  .dt-topbar__brand .logo { font-size: 20px; }
  .dt-topbar__brand .brand-text { display: inline; }
  .dt-page { padding-bottom: calc(var(--dt-bottom-nav-height) + env(safe-area-inset-bottom)); }
  .dt-main { padding: var(--dt-space-sm); }
}

/* ==================== 底部三标签导航栏（移动端核心） ==================== */
.dt-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--dt-bg-card);
  border-top: 1px solid var(--dt-border-light);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  height: var(--dt-bottom-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--dt-space-lg);
  padding-bottom: env(safe-area-inset-bottom);
}

.dt-bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--dt-radius-sm);
  color: var(--dt-text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  transition: all var(--dt-transition-fast);
  min-width: 64px;
  min-height: 48px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  /* 触摸优化 */
  touch-action: manipulation;
}

.dt-bottom-nav__item .icon {
  font-size: 24px;
  transition: transform var(--dt-transition-fast);
  line-height: 1;
}

.dt-bottom-nav__item .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.dt-bottom-nav__item.active {
  color: var(--dt-primary);
}

.dt-bottom-nav__item.active .icon {
  transform: scale(1.2);
}

.dt-bottom-nav__item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--dt-gradient-primary);
  border-radius: 0 0 var(--dt-radius-full) var(--dt-radius-full);
}

.dt-bottom-nav__item .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--dt-radius-full);
  background: var(--dt-error);
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 0 4px;
}

/* 桌面端隐藏底部导航，显示顶部导航 */
@media (min-width: 769px) {
  .dt-bottom-nav { display: none; }
  .dt-fab-group { display: none; }
}

/* ==================== FAB 浮动操作按钮组 ==================== */
.dt-fab-group {
  position: fixed;
  bottom: calc(var(--dt-bottom-nav-height) + 8px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.dt-fab {
  width: 52px;
  height: 52px;
  border-radius: var(--dt-radius-full);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: all var(--dt-transition);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dt-fab:active {
  transform: scale(0.92);
}

.dt-fab--ai {
  background: linear-gradient(135deg, #7C4DFF, #536DFE);
  box-shadow: 0 4px 18px rgba(124,77,255,0.4);
  animation: dt-fab-pulse 3s infinite;
}

.dt-fab--ar {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  box-shadow: 0 4px 18px rgba(255,152,0,0.4);
}

@keyframes dt-fab-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(124,77,255,0.4); }
  50% { box-shadow: 0 4px 28px rgba(124,77,255,0.6); }
}

/* ==================== 卡片组件 ==================== */
.dt-card {
  background: var(--dt-bg-card);
  border-radius: var(--dt-radius);
  padding: var(--dt-space);
  box-shadow: var(--dt-shadow-sm);
  border: 1px solid var(--dt-border-light);
  transition: all var(--dt-transition);
}

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

.dt-card--clickable {
  cursor: pointer;
}

.dt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--dt-space-sm);
}

.dt-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dt-text);
}

.dt-card__subtitle {
  font-size: 12px;
  color: var(--dt-text-muted);
}

.dt-card__body {
  color: var(--dt-text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.dt-card__footer {
  margin-top: var(--dt-space-sm);
  padding-top: var(--dt-space-sm);
  border-top: 1px solid var(--dt-border-light);
}

/* 统计卡片 */
.dt-stat-card {
  background: var(--dt-bg-card);
  border-radius: var(--dt-radius);
  padding: var(--dt-space);
  text-align: center;
  box-shadow: var(--dt-shadow-sm);
  border: 1px solid var(--dt-border-light);
}

.dt-stat-card__value {
  font-size: 28px;
  font-weight: 800;
  background: var(--dt-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.dt-stat-card__label {
  font-size: 12px;
  color: var(--dt-text-muted);
  margin-top: 4px;
}

/* 网格布局 */
.dt-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--dt-space-sm); }
.dt-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--dt-space-sm); }
.dt-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--dt-space-sm); }

@media (max-width: 768px) {
  .dt-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dt-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== 按钮组件 ==================== */
.dt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--dt-space-xs);
  padding: 10px 20px;
  border-radius: var(--dt-radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  /* 触摸优化 */
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dt-btn:active { transform: scale(0.96); }

/* 按钮涟漪效果 */
.dt-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  top: 0; right: 0; bottom: 0; left: 0; /* iOS < 14.1 WebView 不支持 inset 简写，兜底 */
  background: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: all 0.5s;
}

.dt-btn:active::after {
  opacity: 1;
  background-size: 200%;
  transition: 0s;
}

.dt-btn--primary {
  background: var(--dt-gradient-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,152,0,0.35);
}

.dt-btn--primary:hover {
  box-shadow: 0 6px 20px rgba(255,152,0,0.45);
  transform: translateY(-1px);
}

.dt-btn--secondary {
  background: var(--dt-gradient-secondary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,77,255,0.35);
}

.dt-btn--outline {
  background: transparent;
  color: var(--dt-primary);
  border: 2px solid var(--dt-primary);
}

.dt-btn--outline:hover {
  background: rgba(255,152,0,0.08);
}

.dt-btn--ghost {
  background: transparent;
  color: var(--dt-text-secondary);
}

.dt-btn--ghost:hover {
  background: var(--dt-border-light);
  color: var(--dt-text);
}

.dt-btn--sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: var(--dt-radius-xs);
  min-height: 36px;
}

.dt-btn--lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--dt-radius);
}

.dt-btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--dt-radius-full);
}

.dt-btn--block {
  width: 100%;
}

/* ==================== 头像组件 ==================== */
.dt-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--dt-radius-full);
  background: var(--dt-gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.dt-avatar--sm { width: 32px; height: 32px; font-size: 14px; }
.dt-avatar--lg { width: 72px; height: 72px; font-size: 32px; }
.dt-avatar--xl { width: 96px; height: 96px; font-size: 40px; }

/* ==================== 徽章组件 ==================== */
.dt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--dt-radius-full);
  font-size: 11px;
  font-weight: 600;
}

.dt-badge--primary { background: rgba(255,152,0,0.15); color: var(--dt-primary); }
.dt-badge--success { background: rgba(76,175,80,0.15); color: var(--dt-success); }
.dt-badge--error { background: rgba(239,83,80,0.15); color: var(--dt-error); }
.dt-badge--warning { background: rgba(255,167,38,0.15); color: var(--dt-warning); }
.dt-badge--info { background: rgba(66,165,245,0.15); color: var(--dt-info); }

/* ==================== 进度条 ==================== */
.dt-progress {
  height: 8px;
  background: var(--dt-border-light);
  border-radius: var(--dt-radius-full);
  overflow: hidden;
}

.dt-progress__bar {
  height: 100%;
  background: var(--dt-gradient-primary);
  border-radius: var(--dt-radius-full);
  transition: width var(--dt-transition);
}

/* ==================== 加载骨架屏 ==================== */
.dt-skeleton {
  background: linear-gradient(90deg, var(--dt-border-light) 25%, var(--dt-border) 50%, var(--dt-border-light) 75%);
  background-size: 200% 100%;
  animation: dt-skeleton-shimmer 1.5s infinite;
  border-radius: var(--dt-radius-xs);
}

@keyframes dt-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.dt-skeleton--text { height: 14px; width: 100%; margin-bottom: 8px; }
.dt-skeleton--title { height: 20px; width: 60%; margin-bottom: 12px; }
.dt-skeleton--avatar { width: 48px; height: 48px; border-radius: var(--dt-radius-full); }
.dt-skeleton--card { height: 120px; width: 100%; border-radius: var(--dt-radius); }

/* ==================== Toast 通知 ==================== */
.dt-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 12px 24px;
  border-radius: var(--dt-radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--dt-shadow-lg);
  animation: dt-toast-in 0.3s ease-out;
  pointer-events: none;
  white-space: nowrap;
}

.dt-toast--success { background: var(--dt-gradient-success); }
.dt-toast--error { background: linear-gradient(135deg, #EF5350, #E53935); }
.dt-toast--warning { background: linear-gradient(135deg, #FFA726, #FB8C00); }
.dt-toast--info { background: linear-gradient(135deg, #42A5F5, #1E88E5); }

@keyframes dt-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== 模态框 ==================== */
.dt-overlay {
  position: fixed;
  inset: 0;
  top: 0; right: 0; bottom: 0; left: 0; /* iOS < 14.1 WebView 不支持 inset 简写，兜底 */
  z-index: 10000;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dt-fade-in 0.2s ease;
}

.dt-modal {
  background: var(--dt-bg-card);
  border-radius: var(--dt-radius-lg);
  padding: var(--dt-space-lg);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--dt-shadow-lg);
  animation: dt-modal-in 0.3s ease;
}

.dt-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--dt-space);
}

.dt-modal__header h3 {
  font-size: 18px;
  font-weight: 700;
}

.dt-modal__close {
  width: 32px;
  height: 32px;
  border-radius: var(--dt-radius-full);
  background: var(--dt-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--dt-text-secondary);
  cursor: pointer;
}

@keyframes dt-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dt-modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ==================== 页面过渡动画 ==================== */
.dt-page-transition {
  animation: dt-page-in 0.3s ease;
}

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

/* ==================== 成就/徽章墙 ==================== */
.dt-achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--dt-space-sm);
}

.dt-achievement-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--dt-space-sm);
  border-radius: var(--dt-radius);
  background: var(--dt-bg-card);
  border: 2px solid var(--dt-border-light);
  text-align: center;
  transition: all var(--dt-transition);
}

.dt-achievement-item--earned {
  border-color: var(--dt-accent);
  background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(255,152,0,0.04));
}

.dt-achievement-item--locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.dt-achievement-item .icon {
  font-size: 32px;
}

.dt-achievement-item .name {
  font-size: 11px;
  font-weight: 600;
  color: var(--dt-text-secondary);
}

/* ==================== 快捷入口网格 ==================== */
.dt-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--dt-space-sm);
}

@media (min-width: 769px) {
  .dt-shortcut-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.dt-shortcut-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--dt-space);
  border-radius: var(--dt-radius);
  background: var(--dt-bg-card);
  border: 1px solid var(--dt-border-light);
  text-decoration: none;
  color: var(--dt-text);
  transition: all var(--dt-transition);
  cursor: pointer;
  min-height: 80px;
  justify-content: center;
}

.dt-shortcut-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--dt-shadow);
  border-color: var(--dt-primary);
}

.dt-shortcut-item .icon {
  font-size: 28px;
}

.dt-shortcut-item .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--dt-text-secondary);
}

/* ==================== 内容卡片（移动端优化） ==================== */
.dt-content-card {
  background: var(--dt-bg-card);
  border-radius: var(--dt-radius);
  overflow: hidden;
  box-shadow: var(--dt-shadow-sm);
  border: 1px solid var(--dt-border-light);
  transition: all var(--dt-transition);
}

.dt-content-card:active {
  transform: scale(0.98);
}

.dt-content-card__image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--dt-gradient-dark);
}

.dt-content-card__body {
  padding: var(--dt-space);
}

.dt-content-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--dt-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dt-content-card__meta {
  font-size: 12px;
  color: var(--dt-text-muted);
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
}

/* ==================== 分段/标签切换 ==================== */
.dt-segment {
  display: flex;
  background: var(--dt-border-light);
  border-radius: var(--dt-radius-sm);
  padding: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.dt-segment::-webkit-scrollbar { display: none; }

.dt-segment__item {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: var(--dt-radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--dt-text-secondary);
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  white-space: nowrap;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.dt-segment__item.active {
  background: var(--dt-bg-card);
  color: var(--dt-primary);
  box-shadow: var(--dt-shadow-sm);
}

/* ==================== 工具类 ==================== */
.dt-text-center { text-align: center; }
.dt-text-right { text-align: right; }
.dt-text-muted { color: var(--dt-text-muted); }
.dt-text-primary { color: var(--dt-primary); }
.dt-text-success { color: var(--dt-success); }
.dt-text-error { color: var(--dt-error); }
.dt-font-bold { font-weight: 700; }
.dt-mt { margin-top: var(--dt-space); }
.dt-mt-lg { margin-top: var(--dt-space-lg); }
.dt-mb { margin-bottom: var(--dt-space); }
.dt-mb-lg { margin-bottom: var(--dt-space-lg); }
.dt-flex { display: flex; }
.dt-flex-center { display: flex; align-items: center; justify-content: center; }
.dt-flex-between { display: flex; align-items: center; justify-content: space-between; }
.dt-gap { gap: var(--dt-space); }
.dt-gap-sm { gap: var(--dt-space-sm); }
.dt-hidden-mobile { display: none; }
.dt-hidden-desktop { display: block; }

@media (min-width: 769px) {
  .dt-hidden-mobile { display: block; }
  .dt-hidden-desktop { display: none; }
}

/* ==================== 页面滚动条 ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dt-border); border-radius: var(--dt-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--dt-text-muted); }

/* ==================== 移动端安全区域适配 ==================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .dt-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dt-page {
    padding-bottom: calc(var(--dt-bottom-nav-height) + env(safe-area-inset-bottom));
  }
  .dt-fab-group {
    bottom: calc(var(--dt-bottom-nav-height) + 8px + env(safe-area-inset-bottom));
  }
}

/* ==================== flex gap iOS < 14.1 WebView 兜底 ==================== */
/* 现代浏览器优先使用 gap；对不识别 gap 的古老 WebView，用兄弟元素 margin 模拟间距。
   注：Safari 10.3–14.0 会解析 gap 但不作用于 flex，@supports 无法精确探测，
   此处兜底主要覆盖完全不支持 gap 的浏览器，且不会影响已支持的现代浏览器。 */
@supports not (gap: 1px) {
  .dt-badge > * + * { margin-left: 4px; }
  .dt-achievement-item > * + * { margin-top: 4px; }
  .dt-shortcut-item > * + * { margin-top: 6px; }
  .dt-gap > * + * { margin: var(--dt-space) 0 0 var(--dt-space); }
  .dt-gap-sm > * + * { margin: var(--dt-space-sm) 0 0 var(--dt-space-sm); }
}

/* ==================== 学习中心 · 顶部标签切换（阅读/语法/AI/单词/闪卡共用） ==================== */
.learning-hub {
  margin: 0 0 14px;
  padding: 0 2px;
}
.learning-hub__tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.learning-hub__tabs::-webkit-scrollbar { display: none; }
.learning-hub__tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dt-text-secondary, #aaa);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.25s var(--dt-transition, ease);
}
.learning-hub__tab .icon { font-size: 15px; }
.learning-hub__tab:hover {
  background: rgba(255, 152, 0, 0.10);
  color: var(--dt-primary, #FF9800);
}
.learning-hub__tab.active {
  background: linear-gradient(135deg, var(--dt-primary, #FF9800), var(--dt-primary-dark, #F57C00));
  color: #1a1206;
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.32);
}
