/* ============================================
   TokenShop - Design System
   Clean, Modern SaaS Style
   ============================================ */

/* --- Design Tokens --- */
:root {
  /* Primary Colors - Tech Violet */
  --color-primary: #7c3aed;
  --color-primary-hover: #6d28d9;
  --color-primary-light: #f5f3ff;
  --color-primary-dark: #5b21b6;

  /* Accent - Electric Blue */
  --color-accent: #3b82f6;
  --color-accent-light: #eff6ff;

  /* Success / Warning / Danger */
  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;

  /* Neutral - Gray Scale */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  /* Background */
  --bg-body: #ffffff;
  --bg-muted: #f9fafb;
  --bg-card: #ffffff;

  /* Text */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  /* Border */
  --border-color: #e5e7eb;
  --border-color-light: #f3f4f6;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Cascadia Code",
    Consolas, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 1200px;
  --header-height: 64px;
}

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

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

body {
  padding-top: var(--header-height);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 公告栏固定：贴在导航栏正下方 */
#announcement-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 99;
}

/* 有公告时，页面内容再往下让出公告栏的高度 */
body.has-announcement {
  padding-top: calc(var(--header-height) + 40px);
}

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

a:hover {
  color: var(--color-primary-hover);
}

ul,
ol {
  list-style: none;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* --- Layout Utilities --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-20) 0;
}

.section-muted {
  background-color: var(--bg-muted);
}

.text-center {
  text-align: center;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: var(--font-mono); }

/* --- Header (固定顶部，像Excel冻结窗格) --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

/* 头部固定后，所有页面内容下移，避免被遮挡 */
body {
  padding-top: var(--header-height);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
}

/* LOGO / 标题文字光扫特效：每隔 2 秒有一道光从左扫到右
   - 在 span[data-brand] 上挂光带层（覆盖在文字之上）
   - 通过 background-size + background-position 动画扫过
   - color: transparent + -webkit-background-clip: text 让文字变成彩色渐变窗
   - 中间一段高亮白带就是那道闪光
*/
[data-brand] {
  position: relative;
  display: inline-block;
  color: var(--text-primary);
  background: linear-gradient(
    90deg,
    var(--text-primary) 0%,
    var(--text-primary) 35%,
    #ffffff 50%,
    var(--text-primary) 65%,
    var(--text-primary) 100%
  );
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: logo-shine 2s linear infinite;
  /* 给文字留出光带的层空间（防止光带溢出文字范围） */
  padding: 0 2px;
}

@keyframes logo-shine {
  0%   { background-position: 100% 0; }   /* 光带在文字右侧外 */
  60%  { background-position: -50% 0; }   /* 光带扫到文字左侧外 */
  100% { background-position: -50% 0; }   /* 停留至下一周期 */
}

.logo:hover {
  color: var(--text-primary);
}
/* 悬停时让光扫停留为亮色，更显眼 */
.logo:hover > span[data-brand] {
  animation-duration: 1.2s;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-lg);
}
.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-credits {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

/* --- User dropdown menu --- */
.user-menu {
  position: relative;
}

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.75rem;
}

.user-menu-caret {
  font-size: 10px;
  opacity: 0.7;
  transition: transform var(--transition-fast);
}

.user-menu.open .user-menu-caret {
  transform: rotate(180deg);
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 170px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 200;
}

.user-menu.open .user-dropdown {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  box-sizing: border-box;
}

.dropdown-item:hover {
  background-color: var(--color-gray-50);
  color: var(--color-primary);
}

.dropdown-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  color: var(--text-inverse);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background-color: var(--color-gray-50);
  border-color: var(--color-gray-300);
}

.btn-ghost {
  color: var(--text-secondary);
  padding: 0.5rem 0.875rem;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background-color: var(--color-gray-100);
}

.btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: var(--text-base);
}

.btn-block {
  width: 100%;
}

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

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--color-gray-300);
}

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

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

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

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

/* 自适应宽度的下拉框：用于工具栏（如「数据概览」的周期筛选）。
   .form-select 默认 width:100%，放进 flex 工具栏里会被压扁到只剩几十像素，
   选项文字就被截断。加这个类后宽度按最长选项自动撑开，多语言都不会被切。

   ⚠️ 这里必须用 appearance:none 自绘箭头，不能用浏览器原生箭头。
   原生 <select> 的箭头由内核绘制，各家（Chrome / Edge / 国产套壳浏览器 / 不同
   内核版本）"预留多少像素给箭头"的算法不一致：有的把箭头画在 padding 之上，
   有的则在 padding 之外再吃掉一段文字区，导致最后一个字被硬生生切掉半截
   （2026-09-15 用户在 Edge 之外的环境上实测到该问题）。
   自绘后：箭头占用的空间由下面的 padding-right 完全决定，跨浏览器表现一致。
   min-width 是兜底：即使某些内核把 width:auto 算错，也保证文字区够宽。 */
.form-select.form-select-auto {
  width: auto;
  min-width: 8.5em; /* 兜底宽度，em 随字号缩放。取值算法（14px 字号时 =119px）：
                       最长选项 4 个汉字(56px) + 左内边距(14px) + 右内边距(36px) + 边框(2px)
                       = 108px，再留约 11px 余量 → 119px。
                       实测：文字区 67px，最长选项「全部类型」56px，余量 11px。*/
  /* ⚠️ 高度 / 上下内边距 / line-height 三者必须匹配，否则字形下缘会被裁掉。
     2026-09-15 实测（用户报「本周两个字的最下边没显示完整」）：
     原来这里是 height:36px，而 .form-select 带上下 padding 10px，border-box 下
     内容区只剩 36-2-20 = 14px，但本字体栈的行盒要 19px。溢出部分不会居中摊开，
     而是**整体向下裁掉** → 「本」底部那一小竖、「周」外框的底边直接消失。
     现在：上下 padding 归零，用 line-height = 高度 - 边框 精确撑满内容区，
     字形自带上下留白，跨浏览器 / 跨字体都不会再被裁。 */
  height: 36px;
  padding: 0 2.25rem 0 0.875rem; /* 右 = 右侧间距 12px + 箭头 12px + 文字与箭头间余量 12px */
  line-height: 34px; /* = 36px（高度）- 2px（上下边框）→ 行盒正好填满内容区 */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.75rem;
  flex: 0 0 auto;
}

/* 工具栏里包着这类下拉框的 .form-group 同样不能被压缩，否则外层被压扁，
   里层的下拉框还是会被连带挤压 */
.form-group.form-group-auto {
  flex: 0 0 auto;
  margin: 0;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap; /* 列窄时禁止徽章内部换行（「热门」曾被挤成圆形竖排），空间不足时整体换行 */
}

.badge-primary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.badge-warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.badge-gray {
  background-color: var(--color-gray-100);
  color: var(--color-gray-600);
}

/* 「热门」徽章：实底红色 + 定期扫光（一闪而过），参照 tokease 款式（2026-11-02 用户反馈） */
.badge-hot {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f43f5e, #ef4444);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.28);
}
.badge-hot::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: badge-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes badge-shine {
  0%   { left: -70%; }
  45%  { left: 135%; }
  100% { left: 135%; }
}
@media (prefers-reduced-motion: reduce) {
  .badge-hot::after { animation: none; }
}

/* --- Tables --- */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color-light);
}

/* 管理后台表格：列间距更大，避免拥挤 */
.admin-panel .table th,
.admin-panel .table td,
.admin-panel .table-wrap > table th,
.admin-panel .table-wrap > table td {
  padding: var(--space-4) var(--space-6);
  white-space: nowrap;
}
.admin-panel .table-wrap {
  overflow-x: auto;
  width: 100%;
}
.admin-panel .table-wrap > table {
  width: 100%;
  table-layout: auto;
}
.admin-panel .table-wrap > table th:nth-child(1),
.admin-panel .table-wrap > table td:nth-child(1) { padding-left: var(--space-8); }
.admin-panel .table-wrap > table th:last-child,
.admin-panel .table-wrap > table td:last-child { padding-right: var(--space-8); }

.table tbody tr:hover {
  background-color: var(--color-gray-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform var(--transition-base);
}

/* 模型编辑弹窗：档位表列多，需要更宽 */
.modal.modal-wide,
.modal-wide .modal {
  max-width: 960px;
  width: 95%;
}

.modal-wide .form-row {
  gap: var(--space-5);
}

.modal-wide .form-input,
.modal-wide .form-select {
  min-height: 40px;
  padding: 0.625rem 0.875rem;
}

.modal-wide table {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.modal-wide th,
.modal-wide td {
  padding: 8px 10px;
}

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

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.toast {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  animation: toastSlide 0.3s ease;
  max-width: 360px;
}

.toast-success { background-color: var(--color-success); }
.toast-error { background-color: var(--color-danger); }
.toast-info { background-color: var(--color-primary); }

@keyframes toastSlide {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Footer --- */
.site-footer {
  background-color: var(--color-gray-900);
  color: var(--color-gray-400);
  padding: var(--space-16) 0;
  margin-top: var(--space-20);
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.footer-links {
  display: flex;
  gap: var(--space-8);
}

.footer-links a {
  color: var(--color-gray-400);
  font-size: var(--text-sm);
}

.footer-links a:hover {
  color: white;
}

.footer-copy {
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}

/* --- ICP 备案号（工信部要求：底部展示并链接至 beian.miit.gov.cn） --- */
.footer-icp {
  font-size: var(--text-xs);
  line-height: 1.6;
}

.footer-icp a {
  color: var(--color-gray-500);
  text-decoration: none;
}

.footer-icp a:hover {
  color: white;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }

  .nav-links {
    display: none;
  }

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

  .nav-credits {
    display: none;
  }

  .user-menu-toggle {
    padding: 0.4rem 0.6rem;
  }

  .section {
    padding: var(--space-12) 0;
  }

  .container {
    padding: 0 var(--space-4);
  }
}

/* ============================================
   Animations - Scroll Reveal & Hover Effects
   ============================================ */

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* --- Staggered children --- */
.stagger > .reveal-child { opacity: 0; transform: translateY(24px); transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.stagger.revealed > .reveal-child { opacity: 1; transform: translateY(0); }
.stagger.revealed > .reveal-child:nth-child(1) { transition-delay: 0.05s; }
.stagger.revealed > .reveal-child:nth-child(2) { transition-delay: 0.1s; }
.stagger.revealed > .reveal-child:nth-child(3) { transition-delay: 0.15s; }
.stagger.revealed > .reveal-child:nth-child(4) { transition-delay: 0.2s; }
.stagger.revealed > .reveal-child:nth-child(5) { transition-delay: 0.25s; }
.stagger.revealed > .reveal-child:nth-child(6) { transition-delay: 0.3s; }
.stagger.revealed > .reveal-child:nth-child(7) { transition-delay: 0.35s; }
.stagger.revealed > .reveal-child:nth-child(8) { transition-delay: 0.4s; }
.stagger.revealed > .reveal-child:nth-child(9) { transition-delay: 0.45s; }
.stagger.revealed > .reveal-child:nth-child(10) { transition-delay: 0.5s; }
.stagger.revealed > .reveal-child:nth-child(11) { transition-delay: 0.55s; }
.stagger.revealed > .reveal-child:nth-child(12) { transition-delay: 0.6s; }

/* --- Shimmer/Glow Button --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.btn-glow {
  position: relative; overflow: hidden;
}
.btn-glow::after {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}
.btn-glow:hover::after { left: 100%; }

/* --- Gradient Text Animation --- */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-animated {
  background: linear-gradient(135deg, var(--color-primary) 0%, #8b5cf6 25%, var(--color-accent) 50%, #8b5cf6 75%, var(--color-primary) 100%);
  background-size: 400% 400%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: gradientShift 4s ease-in-out infinite;
}

/* 联系我们区块 */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}
.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.contact-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}
.contact-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary, #f3f4f6);
  border-radius: var(--radius-md, 8px);
}
.contact-info {
  flex: 1;
  min-width: 0;
}
.contact-label {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin-bottom: 4px;
}
.contact-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  word-break: break-all;
}

/* --- Gradient Border Pulse (for cards) --- */
@keyframes borderPulse {
  0%, 100% { border-color: var(--color-primary); box-shadow: 0 0 0 0 rgba(124,58,237,0.2); }
  50% { border-color: var(--color-accent); box-shadow: 0 0 0 6px rgba(124,58,237,0); }
}
.popular-card-animated {
  animation: borderPulse 2s ease-in-out infinite;
}

/* --- Icon Hover Bounce --- */
@keyframes iconBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
.icon-bounce:hover { animation: iconBounce 0.3s ease; }

/* --- Model Row Stagger --- */
.model-table tbody tr { opacity: 0; transform: translateX(-10px); transition: all 0.3s ease; }
.model-table tbody tr.visible { opacity: 1; transform: translateX(0); }
.model-table tbody tr.visible:nth-child(1) { transition-delay: 0.02s; }
.model-table tbody tr.visible:nth-child(2) { transition-delay: 0.04s; }
.model-table tbody tr.visible:nth-child(3) { transition-delay: 0.06s; }
.model-table tbody tr.visible:nth-child(4) { transition-delay: 0.08s; }
.model-table tbody tr.visible:nth-child(5) { transition-delay: 0.10s; }
.model-table tbody tr.visible:nth-child(6) { transition-delay: 0.12s; }
.model-table tbody tr.visible:nth-child(7) { transition-delay: 0.14s; }
.model-table tbody tr.visible:nth-child(8) { transition-delay: 0.16s; }
.model-table tbody tr.visible:nth-child(9) { transition-delay: 0.18s; }
.model-table tbody tr.visible:nth-child(10) { transition-delay: 0.20s; }
.model-table tbody tr.visible:nth-child(11) { transition-delay: 0.22s; }
.model-table tbody tr.visible:nth-child(12) { transition-delay: 0.24s; }
.model-table tbody tr.visible:nth-child(13) { transition-delay: 0.26s; }
.model-table tbody tr.visible:nth-child(14) { transition-delay: 0.28s; }
.model-table tbody tr.visible:nth-child(15) { transition-delay: 0.30s; }

/* --- Faq Item Entry --- */
.faq-item { opacity: 0; transform: translateY(20px); transition: all 0.5s ease; }
.faq-item.visible { opacity: 1; transform: translateY(0); }
.faq-item.visible:nth-child(1) { transition-delay: 0.05s; }
.faq-item.visible:nth-child(2) { transition-delay: 0.1s; }
.faq-item.visible:nth-child(3) { transition-delay: 0.15s; }
.faq-item.visible:nth-child(4) { transition-delay: 0.2s; }
.faq-item.visible:nth-child(5) { transition-delay: 0.25s; }
.faq-item.visible:nth-child(6) { transition-delay: 0.3s; }
.faq-item.visible:nth-child(7) { transition-delay: 0.35s; }
.faq-item.visible:nth-child(8) { transition-delay: 0.4s; }
.faq-item.visible:nth-child(9) { transition-delay: 0.45s; }
.faq-item.visible:nth-child(10) { transition-delay: 0.5s; }

/* --- Recharge Card Glow Hover --- */
.recharge-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.recharge-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px -8px rgba(79,70,229,0.15), 0 8px 16px -4px rgba(79,70,229,0.08);
}

/* --- Code Block Glow --- */
.code-block { transition: box-shadow 0.3s ease; }
.code-block:hover { box-shadow: 0 0 0 2px rgba(79,70,229,0.2), 0 20px 40px -10px rgba(0,0,0,0.3); }

/* --- CTA Section Pulse --- */
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.2); }
  50% { box-shadow: 0 0 0 20px rgba(79,70,229,0); }
}
.cta { animation: ctaPulse 3s ease-in-out infinite; }

/* --- Plan Card Select Bounce --- */
@keyframes selectBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.plan-card.selected { animation: selectBounce 0.35s cubic-bezier(0.16, 1, 0.3, 1); }

/* --- Plan Card Hover Enhance --- */
.plan-card {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -4px rgba(79,70,229,0.1);
}

/* --- Success Celebration --- */
@keyframes celebrateIn {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.success-icon { animation: celebrateIn 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes confettiFall {
  0% { transform: translateY(-100%); opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* --- Form Input Focus Glow --- */
.form-input {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
  outline: none;
}

/* ==================== 模型单价 / 档位详情（首页模型列表） ==================== */
/* 「输入」列在图像/视频行改放真实单位价：低至 $0.09/秒 */
.price-cell { white-space: nowrap; }
.price-cell .price-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: 1px;
}
.price-cell .price-from {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-right: 3px;
}

.detail-cell { white-space: nowrap; }

.model-detail-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: color var(--transition-fast);
}
.model-detail-btn:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* 档位详情弹窗宽度。2026-09-20 由 760 → 1040（用户：「可以拉宽一点吗」）。
   实测数据（_pw/width-compare2.js，vidu2.0 / 16 行）：

     弹窗宽 | 内容区 | 卡宽 | 右侧留白
      760  |  681  | 219 |   0px   ← 旧值：卡片偏窄，价格行挤
     1040  |  961  | 312 |   1px   ← 现值：三列正好铺满
     1180  | 1101  | 340 |  57px   ← 再宽就没收益了，卡片封顶后只剩留白

   ⚠️ 这个值和 .tier-card 的 max-width 是**一对**，必须一起看：
      弹窗 760 ↔ 卡片上限 280（旧组合）
      弹窗 1040 ↔ 卡片上限 340（现组合）
   只拉弹窗不改卡片上限，卡片会卡在 280px 不再变宽，
   多出来的 97px 全变成右侧留白（实测方案 B，明显左倾）。
   特异度需 ≥ (0,2,0) 才能压过上方 .modal.modal-wide 的 960px。 */
.modal.modal-wide.model-detail-modal {
  /* 2026-09-22：1040 → 920 → 880（用户「间隔再缩小一点点」）。卡片由网格 1fr 撑满，
     唯一不引入右侧留白/列不对齐的收法就是弹窗整体收窄。
     880 时内容区 801px，3 列各 ~259px。 */
  max-width: 880px;
  /* 标题 + 基础单价固定，只有档位表滚动。
     seedance 这类 24 行表格内容高达 1379px，滚到底时「基础单价」行会被整行推出
     视野（实测 baseY=-437），客户看不到「低至 X/秒」，会误以为没有价格。 */
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
}
.model-detail-modal .model-detail-head { flex: 0 0 auto; }
.model-detail-modal #model-detail-base { flex: 0 0 auto; }
/* 无基础单价（如按 Token 计费的模型）时不占位 */
.model-detail-modal #model-detail-base:empty { display: none; }
.model-detail-modal #model-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  /* 始终预留滚动条槽位，避免有/无滚动条时表格宽度跳动 */
  scrollbar-gutter: stable;
}

.model-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.model-detail-head .modal-title { margin-bottom: 2px; }
.model-detail-heading { min-width: 0; }

/* 类型 / 计费方式做成标签，比一行点分小字干净 */
.model-detail-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.md-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: var(--color-gray-100);
  color: var(--color-gray-600);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
/* 标签配色：一种颜色对应一类语义，不是随手涂 —— 品类=紫 / 计费=蓝 / 时长=橙。
   紫与蓝取「淡底 + 深字」（100 级底 / 700 级字），饱和度压住。
   ⚠️ 橙色是例外：2026-09-20 用户拿参考图要求「要这种橙色」，
   淡底浅字的橙被判定为「土」，所以橙一律用**满饱和实底 + 白字**，
   与清晰度徽章（.tier-card-res）保持同一个值，两处橙色必须一致。 */
.md-tag-kind { background: #ede9fe; color: #6d28d9; }
.md-tag-bill { background: #dbeafe; color: #1d4ed8; }
.md-tag-dur { background: #f97316; color: #fff; font-weight: 700; }
/* 上游渠道徽标（提供商）：2026-09-22 按用户给的参考图（「聚合平台 ·sy」胶囊）1:1 复刻。
   特征 = 极浅的绿→蓝底 + **渐变文字**（绿 #6b9437 → 蓝 #2e84b1，从参考图 canvas 取样，
   平均值略偏灰，落地时向饱和方向收了一点）。
   实现：两层 background 分别 clip —— 第一层（文字渐变）clip 到 text，第二层（胶囊底）clip 到 padding-box。 */
.md-tag-provider {
  background-image:
    linear-gradient(90deg, #5f9a2e 0%, #2e84b1 100%),
    linear-gradient(120deg, #e0f2c4 0%, #d8ecf6 100%);
  -webkit-background-clip: text, padding-box;
  background-clip: text, padding-box;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

.model-detail-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  padding: 4px 7px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.model-detail-close:hover {
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

/* ---- 详情弹窗「API 文档」：折叠开关 + 两步接入面板 ----
   设计原则与全站一致：克制、少色相（主色只用在徽标/按钮上，
   其余全部灰阶），复制行做成一条浅底圆角条，不堆卡片边框。 */

/* 标题行右侧的「API 文档」开关（默认实底主色，保证一眼可见；展开后变描边「返回价格」） */
.md-api-toggle {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  margin-right: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(124, 58, 237, 0.28);
  transition: color var(--transition-fast), border-color var(--transition-fast),
    background var(--transition-fast), box-shadow var(--transition-fast);
}
.md-api-toggle:hover {
  filter: brightness(0.93);
}
.md-api-toggle.is-open {
  background: #fff;
  color: var(--color-primary);
  box-shadow: none;
}

/* 展开文档时只显示 API 文档，隐藏下方价格区（点「返回价格」回到价格页）
   注意：api-open 由 JS 加在 #model-detail-modal（外层容器）上，这里必须用 ID 匹配 */
#model-detail-modal.api-open #model-detail-body { display: none; }

/* 面板本体：夹在「基础单价」和档位表之间，展开时档位区自然收窄滚动 */
.model-detail-modal #model-detail-api { flex: 0 0 auto; }
.model-detail-modal #model-detail-api:empty { display: none; }

.api-doc-panel {
  margin: 0 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-lg, 14px);
  background: var(--color-gray-50, #f9fafb);
  display: grid;
  gap: var(--space-4);
}

.api-step { display: grid; gap: 10px; }

.api-step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.api-step-badge {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.api-step-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary, var(--color-gray-900));
  line-height: 1.4;
}
.api-step-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 1px;
}

/* 端点条目：标签行（圆点 + 名称 + 方法徽标） + 可复制值行 */
.api-endpoint { display: grid; gap: 5px; }
.api-endpoint-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-gray-600);
}
.api-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.55;
}
.api-method {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}
.api-method[data-method="POST"] { background: #dbeafe; color: #1d4ed8; }
.api-method[data-method="GET"] { background: #dcfce7; color: #15803d; }

/* 可复制值行：浅底长条 + 右侧复制按钮 */
.api-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  background: #fff;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--radius-md, 10px);
}
.api-copy-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-xs);
  color: var(--text-primary, var(--color-gray-900));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.api-copy-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-md, 8px);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.api-copy-btn svg { width: 15px; height: 15px; }
.api-copy-btn:hover {
  background: var(--color-gray-100);
  color: var(--color-primary);
}

.api-note {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---- 档位价格弹窗 ---- */

/* 基础单价：整条汇总行，标签在左、价格在右 */
.tier-base {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  /* 曾经的紫→蓝→粉三段渐变是「第二组颜色」，跟卡片的色阶互相打架，改回单一淡紫 */
  background: #f7f5ff;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.tier-base-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-gray-500);
  letter-spacing: 0.02em;
}
.tier-base-price {
  /* 2026-11-30 用户反馈「这个字体很难看」。
     根因：2026-11-12 已把档位卡价格从等宽字体换成系统正文字体，但这一行漏改，
     仍是「等宽（打字机感）+ 18px/700」，在同一弹窗里跟下方档位价格像两套字体。
     现与 .tier-card-price 统一：系统正文字体；字号 1rem 比档位卡（0.9375rem）
     略大一级保留「汇总价」层级，但不再用 700 粗黑。
     tabular-nums 必须保留：六位小数（如 14.000096）逐位对齐、刷新时不抖动。 */
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tier-base-unit { font-size: var(--text-sm); }
.tier-hint {
  margin-right: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-gray-500);
}

/* 档位卡片：按任务类型分组，组内是「清晰度」卡片网格。
   相比原来的长表格，同一清晰度下的有声/无声并排对比一目了然，
   也不用把「文生视频」这种重复文字抄 24 遍。 */
.tier-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* 分组头：图标 + 任务类型名，悬停出该类型的说明 */
.tier-group-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  cursor: default;
}
/* 图标块统一品牌紫：任务类型靠图标形状 + 文字区分，不能再各占一个色相 */
.tier-group-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex: 0 0 auto;
}
.tier-group-ico svg { width: 15px; height: 15px; }
.tier-group-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 分组名右侧牵一条向左淡出的细线，把「组」的边界交代清楚（中性灰，不参与配色） */
.tier-group-head::after {
  content: '';
  flex: 1 1 auto;
  min-width: var(--space-4);
  height: 1px;
  margin-left: var(--space-2);
  background: linear-gradient(90deg, var(--border-color), transparent);
}

.tier-grid {
  display: grid;
  /* 2026-09-22：auto-fit → auto-fill。auto-fit 会让「只有 2 张卡的行」轨道塌缩成 2 列、
     每张卡被拉到 max-width，和上面 3 张卡的行对不齐（用户实测反馈）。
     auto-fill 保留空轨道 ⇒ 2 卡行与 3 卡行严格同宽对齐。
     min 250px 的来由：内容区 801px（弹窗 880）时 (801+12)/(250+12)=3.1 ⇒ 正好 3 轨；
     ⚠️ 调弹窗宽度必须回算这个 min：min > (内容宽+gap)/列数-gap 就会塌列（实测 880+min260 塌成 2 列）。 */
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-3);
}

/* 一张卡 = 一个清晰度，卡内逐行列出该清晰度下的每个 (时长 × 有声/无声) 价格。
   ⚠️ 配色纪律（2026-09-20 重做，上一版「青→蓝→紫→玫红」被用户打回「好难看」）：
   整屏**只允许一个色相**（品牌紫），档位高低靠明度递进表达，绝不换色相。
   原来的做法一屏会出现 4 个色相 × 4 个任务类型 = 8 种颜色，是「廉价」的主因。
   颜色只出现在两处小面积：顶部 3px 色条、分组头图标块；标题文字保持深色。 */
/* 清晰度徽章统一用同一个橙色（2026-09-20 用户要求：「改成统一的底色，不要渐变，可以改橙色吧」，
   紧接着又给了参考图：「要这种橙色，你现在这种橙色太土了」）。

   ⚠️ 第一版是「淡橙底 + 深橙字」（#fed7aa / #9a3412），被判定为土。
   参考图那种橙是**满饱和实底 + 白字**（#f97316）—— 差别不在色相而在「量」：
   淡底浅字是怯的，实底白字才是精神的。想调深浅只动这两个值。

   橙色在这里有语义：它和顶部的「时长」标签同色系 = 都属于「视频规格」，
   而品类是紫、计费是蓝 —— 一屏仍然只有 3 个色相。

   ⚠️ 四档曾用「同一紫色的明度递进」（low #ede9fe → ultra #a78bfa），
   但一排卡片看过去就是一条渐变，用户要的是「统一」。
   如需恢复递进，把下面这行换回四条 `.tier-card[data-tier="…"]` 规则即可，
   JS 侧 `resolutionTierLevel()` 与 `data-tier` 属性都还在，不用改代码。 */
.tier-card {
  --tier-color: #fff;
  /* 2026-09-22 用户要求：清晰度徽章改「橙粉渐变胶囊」（此前为纯橙 #f97316 圆角块） */
  /* 2026-09-22 用户从 6 个候选里选定的渐变（橙粉 → 淡橙粉 → 珊瑚玫瑰）：
     珊瑚玫瑰 coral→rose，白字对比最好，与粉紫「无声」相邻但不打架。
     候选对照见 _pw/gradient-candidates.js + shots/badge-g-*.png。 */
  --tier-bg: linear-gradient(120deg, #fb7185 0%, #e11d48 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* 卡片宽度上限。2026-09-22：弹窗 1040 → 920 后，桌面端 3 轨各 272px，
     340 上限在桌面不再生效，只兜底「窄屏单/双轨」场景（防单行卡被拉满）。
     ⚠️ 改弹窗宽度必须回看这里，反之亦然（见 .model-detail-modal）。 */
  max-width: 340px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    transform var(--transition-fast);
}
/* 四档统一底色后，`.tier-card[data-tier="…"]` 的配色规则已移除，
   这里只保留一句说明：档位信息由徽章里的文字（360p / 720p / 1080p / 4k）承载，
   不再靠颜色深浅暗示高低 —— 颜色回归「装饰与分区」，不做信息载体。 */

/* 顶部色条已移除（2026-09-20）：12 张卡各一条 = 「条纹图案」，是廉价感的来源。
   颜色的载体改成清晰度徽章，面积更小更集中。 */
/* 同一行的卡片被 grid 拉成等高（vidu 的 360p 只有 2 档、720p 有 4 档），
   价格行垂直居中，避免档位少的卡片底下空一大块 */
.tier-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* hover 统一用品牌紫（不再跟着卡片变色，4K 卡浮起是粉光晕会让整屏更花） */
.tier-card:hover {
  border-color: rgba(124, 58, 237, 0.32);
  box-shadow: 0 8px 20px -12px rgba(124, 58, 237, 0.45);
  transform: translateY(-2px);
}

.tier-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  /* 与行分隔线同色同粗细：线不可见时卡片头部和第一条价格会糊在一起（见下方注释） */
  border-bottom: 1px solid var(--color-gray-300);
}
/* 清晰度做成徽章：颜色集中在这一小块上，比「顶部通栏色条」精致，
   也是 Linear / Stripe 那类界面表达「版本标签」的常用做法。
   四档同色（见上方 .tier-card 的 --tier-bg），文字才是档位的载体。
   白字压在满饱和橙上，字重要给到 700 —— 600 在实底上会显得发虚。 */
.tier-card-res {
  display: inline-block;
  /* 2026-09-22 用户反馈「p 没和数字齐平、胶囊偏大」⇒ 压行高 + 减上下 padding，做扁 */
  padding: 0 10px 1px;
  border-radius: var(--radius-full);
  /* 2026-11-12 用户反馈「字体小一点、换成正常官方字体」：14px/700 → 12px/600，
     避免白字实底上过重、像营销贴纸 */
  font-size: var(--text-xs);
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0;
  background: var(--tier-bg);
  color: var(--tier-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tier-card-unit {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* 卡内的价格行：音频图标 + 标签 + 价格（价格右对齐，多行成列）
   2026-11-06 用户反馈卡片「空洞」：行距 4px 太挤、信息密度低 ⇒ 行距放宽，
   配合 token 模式的 6 位精度价格 + ≈/秒 折算行，让每张卡的内容饱满起来 */
.tier-variant {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  /* 允许换行：token 模式的「≈¥X/秒」折算要独占第二行（2026-11-09 用户反馈：
     胶囊 + 6 位价格 + 折算挤一行，≈ 被卡片右缘截断看不清） */
  flex-wrap: wrap;
}
/* 每一行之间都画一条分隔线（2026-09-20 用户要求：「你每一行划个横线」）。
   原来是「只在时长变化处画虚线」，同一时长下的有声/无声挤在一起没有分界，
   多档模型看起来疏密不均。统一成实线后像一张规整的价目表。

   ⚠️ 第一版用了 --border-color-light（#f3f4f6）：与卡片白底只差 12/255，
   在真实屏幕上「有线等于没线」，用户直接问「线在哪呢」。
   ⚠️ 这条也等于「无声」胶囊的底色（--color-gray-100 同值），线挨着胶囊时更是糊在一起。
   ⚠️ 第二版换 --border-color（#e5e7eb，纸面差 26）仍偏弱 —— 用 canvas 扫真实像素发现：
   1px 的线落在小数 Y 坐标上会被抗锯齿摊到相邻像素，**实测只剩 20/255**；
   若系统缩放是 125%（Windows 常见），线被摊成两个半亮的像素，只剩 11~15/255，肉眼几乎看不出。
   ⇒ 用 --color-gray-300（#d1d5db，纸面差 42，实测渲染后 ~34）：这才是「一眼能看出是张表」的档位。
   实测脚本：_pw/pixel-line.js（扫渲染像素，不看 CSS 值）。 */
.tier-variant + .tier-variant {
  border-top: 1px solid var(--color-gray-300);
}
/* 时长变化处：线不变，只把上间距放宽一点，「4 秒 / 8 秒」两组仍能一眼分开。
   （JS 里 dur-start 这个类名保留着，方便以后想恢复分组样式。） */
.tier-variant.dur-start:not(:first-child) {
  padding-top: 7px;
}
/* 参考视频子分组（2026-09-20）：一个清晰度下同时配了「有参考视频 / 无参考视频」时才出现，
   用来把两类价格分开 —— 之前这一维度没进分组键，后台配两行前台只显示一条（静默吞行）。
   做成小胶囊而不是行内标签：行内会挤爆 219px 的卡片宽度（有声胶囊 + 时长 + 价格已占满）。 */
.tier-vref {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  margin: var(--space-2) 0 1px;
  padding: 1px 7px 2px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
/* 卡内第一块参考视频分组不需要额外上边距（上面就是卡片头部） */
.tier-card-body > .tier-vref:first-child {
  margin-top: 0;
}
/* 紧跟在参考视频胶囊后面的第一行，「时长分组」的额外上边距不再叠加（胶囊已经做了分隔） */
.tier-vref + .tier-variant.dur-start {
  padding-top: 4px;
}
/* 声音状态胶囊：有声=绿 / 无声=粉紫（2026-09-22 用户要求：与顶部「视频」标签 .md-tag-kind 同底色）。
   颜色只落在这个小胶囊上，卡片其余部分保持中性 —— 有活力但不花。 */
.tier-snd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px 2px;
  border-radius: var(--radius-full);
  background: #ede9fe;
  color: #6d28d9;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tier-snd svg { width: 12px; height: 12px; flex: 0 0 auto; }
.tier-snd.is-on { background: #dcfce7; color: #15803d; }
/* 时长（只有按次打包的模型才有，如 vidu 的 4 秒 / 8 秒）—— 比「有声/无声」重一点 */
.tier-variant-dur {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.tier-variant-price {
  margin-left: auto;
  /* 2026-11-12 用户反馈「字体换成正常的、官方的」：等宽字体（打字机感）→ 系统正文字体；
     14px → 13px（比正文略收，价格不抢视线），tabular-nums 保留以保证多行数字右对齐 */
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  white-space: nowrap;
}
/* 视频按百万Token计费时，在每个价格后附一行「≈¥X/秒」折算预览，方便核对是否填错量级。
   flex:0 0 100% 强制独占一行（父级已 flex-wrap:wrap），右对齐到价格正下方；
   顶部留 2px、右侧留 1px 微调，让两行数字视觉上成一列。 */
.tier-variant-persec {
  flex: 0 0 100%;
  text-align: right;
  padding-right: 1px;
  margin-top: 2px;
  /* 2026-11-30 与价格字体统一：等宽 → 系统正文字体（原本 11px 等宽在中文界面里像代码） */
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}
/* 价格一律用同一个深色：同价的「有声 / 无声」若一黑一紫，会被读成价格不同。
   声音的区分交给胶囊底色（见 .tier-snd），绝不碰价格颜色。 */

/* 整表只有一种音频配置时，卡内只留一个价格 —— 没有对比就没有必要标「无声」
   2026-11-06 用户反馈：价格改成蓝色、字号调小（参考 tokease 价目表的蓝色价格）。
   蓝色用主题里的 Electric Blue accent（#3b82f6），不另起炉灶引入新色。 */
.tier-card-price {
  padding-top: var(--space-1);
  /* 2026-11-12 用户反馈「字体小一点、换成正常官方字体」：
     等宽（打字机感）→ 系统正文字体；18px/700 → 15px/600，蓝底强调保留，但不再像粗黑报价单 */
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
}

/* 注意：admin 后台的档位表「有声」复选框也复用了 .tier-audio 这个类名（见 admin.js），
   前台详情弹窗已不再使用它，这里保留原有外观以免影响后台。 */
.tier-audio {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  line-height: 1.6;
  background: var(--color-gray-100);
  color: var(--color-gray-500);
  white-space: nowrap;
  vertical-align: 1px;
}
.tier-audio.is-on {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

/* 悬停提示：挂在 body 上（position:fixed），避免被弹窗的 overflow 裁切 */
.tier-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 3000;
  max-width: 260px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  font-size: var(--text-xs);
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast);
}
.tier-tip.is-visible { opacity: 1; visibility: visible; }

.tier-empty {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: var(--space-5) 0;
  text-align: center;
}
.tier-empty.tier-error { color: var(--color-danger); }

/* --- Modal Enter Animation --- */
@keyframes modalIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Toast Slide In --- */
@keyframes toastIn {
  0% { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Smooth Page Transitions --- */
.recharge-page, .login-page, .dashboard-page {
  animation: fadeSlideIn 0.4s ease;
}
@keyframes fadeSlideIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Nav Link Hover Indicator --- */
.nav-links a {
  position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: 2px; transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }

/* --- Mobile: Hide floating tags on small screens --- */
@media (max-width: 768px) {
  .hero-float-showcase { display: none !important; }
  .hero { padding: var(--space-16) 0 var(--space-12); }
  .reveal { transform: translateY(20px); transition-duration: 0.5s; }
}

/* --- 模型品牌官方 logo（2026-09-23）---
   图片自托管在 img/brand/（来源 LobeHub Icons · MIT），不依赖外网 CDN。
   容器 .model-icon 本身是浅色底（admin 40px / 前台 36px），logo 外面套一层白底
   圆角衬底 + 极细描边，避免品牌色和容器底色互相打架、白 logo 糊在浅底上。 */
.model-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--color-gray-200, #e5e7eb);
}
.model-logo { width: 26px; height: 26px; object-fit: contain; display: block; }

/* 模型详情弹窗标题旁的品牌 LOGO（2026-09-24）。
   标题带 LOGO 时整个 .modal-title 转 flex 垂直居中，
   不再用 vertical-align 硬凑基线（32px 方块对 20px 文字必偏低）。 */
.modal-title.has-logo {
  display: flex;
  align-items: center;
}
.md-title-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--color-gray-200, #e5e7eb);
}
.md-title-logo .model-logo { width: 24px; height: 24px; }

/* 后台「图标」下拉框旁的选择预览 */
.icon-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
