/* ==========================================================================
   AI 创造平台 - 设计系统与全局样式 (style.css)
   深空暗黑科技风 (Deep Space Dark & Neon Cyan / Purple Cyberpunk)
   ========================================================================== */

:root {
  --bg-space: #0a0e1a;
  --bg-surface: #0f172a;
  --bg-card: rgba(16, 24, 48, 0.75);
  --bg-card-hover: rgba(26, 38, 74, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-bright: rgba(255, 255, 255, 0.18);
  --border-neon: rgba(34, 211, 238, 0.4);
  
  --neon-cyan: #22d3ee;
  --neon-purple: #a78bfa;
  --neon-gold: #fbbf24;
  --neon-green: #10b981;
  --neon-yellow: #f59e0b;
  --neon-red: #ef4444;
  --neon-gray: #6b7280;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --glow-cyan: 0 0 20px rgba(34, 211, 238, 0.25);
  --glow-purple: 0 0 20px rgba(167, 139, 250, 0.25);
  --glow-gold: 0 0 15px rgba(251, 191, 36, 0.3);
  
  --sidebar-w: 24rem; /* 384px = w-96 */
}

/* 基础重置与全局字体 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-image: 
    radial-gradient(ellipse at top, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(167, 139, 250, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
}

#app {
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 14, 26, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 211, 238, 0.4);
}

.no-scrollbar::-webkit-scrollbar {
  display: none !important;
}
.no-scrollbar {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

/* 玻璃拟态卡片 */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 1rem;
  transition: all 0.25s ease;
}
.glass-card:hover {
  border-color: var(--border-glass-bright);
}
.glass-card-glow:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

/* 霓虹渐变按钮 */
.btn-primary {
  background: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
  filter: brightness(1.1);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--border-glass);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-glass-bright);
}

.btn-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #111827;
  font-weight: 700;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(251, 191, 36, 0.4);
  box-shadow: var(--glow-gold);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-gold:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* 顶部导航与 Tab */
.tab-btn {
  position: relative;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}
.tab-btn.active {
  color: #ffffff;
  background: rgba(34, 211, 238, 0.12);
  font-weight: 600;
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 15%;
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  border-radius: 9999px;
  box-shadow: 0 0 8px #22d3ee;
}

/* VIP 迷你小角标 */
.vip-mini-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f172a;
  font-weight: 800;
  line-height: 1;
  text-shadow: none;
}

/* 算力红绿灯 */
#pool-light {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
}
.light-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
#pool-light.light-green .light-dot, .light-green {
  background-color: var(--neon-green);
  box-shadow: 0 0 8px var(--neon-green);
}
#pool-light.light-yellow .light-dot, .light-yellow {
  background-color: var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow);
}
#pool-light.light-gray .light-dot, .light-gray {
  background-color: var(--neon-gray);
  box-shadow: 0 0 4px var(--neon-gray);
}

/* 体验额度胶囊 */
#trial-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--neon-cyan);
}

/* 免费极速徽章 */
.badge-free {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

/* 表单输入与控件美化 */
.input-glass {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 0.75rem;
  color: var(--text-main);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  transition: all 0.2s ease;
  outline: none;
}
.input-glass:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.2);
}
.input-glass::placeholder {
  color: var(--text-dim);
}

/* 拖拽上传区 */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.25s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--neon-cyan);
  background: rgba(34, 211, 238, 0.05);
}

/* 任务卡片与列表 */
.task-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  border-radius: 0.875rem;
  padding: 0.875rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}
.task-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(20, 30, 55, 0.95);
}
.task-progress {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}
.task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #a78bfa);
  border-radius: 9999px;
  transition: width 0.3s ease;
}
.task-progress-fill.indeterminate {
  width: 40%;
  animation: indeterminate 1.5s infinite linear;
}
@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

.task-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0.5rem;
  padding: 0.5rem;
  color: #94a3b8;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 弹窗遮罩与弹窗框 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal-mask.hidden {
  display: none !important;
}
.modal-box {
  background: #0f172a;
  border: 1px solid var(--border-glass-bright);
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--glow-cyan);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

/* 步骤指示器 (Stepper) */
.stepper-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.875rem;
}
.stepper-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.stepper-item.active {
  color: var(--neon-cyan);
}
.stepper-item.active .stepper-circle {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}
.stepper-item.completed {
  color: var(--neon-purple);
}
.stepper-item.completed .stepper-circle {
  background: rgba(167, 139, 250, 0.2);
  border-color: var(--neon-purple);
  color: #ffffff;
}

/* 瀑布流画廊 */
.gallery-grid-masonry {
  column-count: 4;
  column-gap: 1rem;
}
.gallery-grid-masonry > .g-item {
  break-inside: avoid;
  margin-bottom: 1rem;
}
@media (max-width: 1280px) {
  .gallery-grid-masonry { column-count: 3; }
}
@media (max-width: 900px) {
  .gallery-grid-masonry { column-count: 2; }
}
@media (max-width: 540px) {
  .gallery-grid-masonry { column-count: 1; }
}

/* 悬浮 FAB 按钮 (移动端专用) */
#task-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(6, 182, 212, 0.4);
  z-index: 80;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease;
}
#task-fab:hover {
  transform: scale(1.05);
}

/* 响应式适配 (<1024px 平板与手机端) */
@media (max-width: 1023.98px) {
  html, body {
    width: 100vw !important;
    max-width: 100vw !important;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* 防止 iOS 聚焦输入框时触发浏览器自动缩放 */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* 顶栏与移动端Tab栏置顶 */
  #topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    z-index: 99 !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.35rem !important;
    background: rgba(10, 14, 26, 0.98) !important;
    backdrop-filter: blur(25px) !important;
    -webkit-backdrop-filter: blur(25px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.7) !important;
  }

  .mobile-nav-tabs {
    position: relative !important;
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x !important;
    padding-top: 0.35rem !important;
    padding-bottom: 0.25rem !important;
  }
  }

  .mobile-nav-tabs .tab-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8125rem !important;
  }

  #trial-pill {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.7rem !important;
  }
  #vip-badge {
    padding: 0.15rem 0.45rem !important;
    font-size: 0.7rem !important;
  }
  #user-header-pill {
    display: flex !important;
  }
  #vip-center-btn {
    padding: 0.25rem 0.55rem !important;
    font-size: 0.75rem !important;
  }

  /* 移动端吸底操作栏 (Sticky Bottom Action Bar) - 杜绝横向溢出 */
  .mobile-bottom-bar {
    position: sticky !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    background: rgba(10, 14, 26, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    padding: 0.75rem 0 calc(env(safe-area-inset-bottom, 0px) + 0.5rem) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
    z-index: 35 !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.7) !important;
  }

  /* 保证移动端所有卡片和容器绝不超出屏幕宽度 */
  .glass-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  main {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* 移动端核心按钮触控区域加大 */
  .btn-primary, .btn-secondary, .btn-gold {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation;
  }

  /* 移动端弹窗自适应 */
  .modal-box {
    margin: 0.5rem !important;
    max-height: 92vh !important;
    border-radius: 1.25rem !important;
  }

  .modal-close {
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 0.5rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
  }
}

/* ==========================================================================
   右侧滑出式任务抽屉与贴边按钮 (全端统一最高层级，杜绝任何遮挡)
   ========================================================================== */

#floating-task-btn {
  box-shadow: -4px 0 20px rgba(6, 182, 212, 0.25), 0 8px 32px rgba(0, 0, 0, 0.6);
  user-select: none;
  touch-action: manipulation;
  z-index: 98 !important;
}

#floating-task-btn:hover {
  box-shadow: -6px 0 28px rgba(6, 182, 212, 0.4), 0 10px 40px rgba(0, 0, 0, 0.8);
  border-color: rgba(34, 211, 238, 0.7);
}

#task-drawer {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  right: 0 !important;
  z-index: 1000 !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(34, 211, 238, 0.2);
}

/* 抽屉打开状态 */
#task-drawer.drawer-open,
#task-drawer.open {
  transform: translateX(0) !important;
}

#task-drawer-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 998 !important;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#task-drawer-backdrop.backdrop-open {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* 移动端任务抽屉宽度全屏自适应与底部安全边距 */
@media (max-width: 640px) {
  #task-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

