/* ============================================================================
 * betonanything.net — components.css
 *
 * 高级组件层：chip / badge / segmented / toast / modal / sheet / tab /
 *             skeleton / spinner / progress / odd-display / market-card / ...
 *
 * 依赖：design-tokens.css + base.css
 * ========================================================================= */

/* ===================== 1. Chip / Tag ===================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 26px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--c-glass-strong);
  color: var(--c-text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-caption);
  border: 1px solid var(--c-border-subtle);
  white-space: nowrap;
}
.chip-accent { background: var(--c-accent-soft); color: var(--c-accent); border-color: transparent; }
.chip-gold { background: var(--c-gold-soft); color: var(--c-gold-text); border-color: transparent; }
.chip-success { background: var(--c-success-soft); color: var(--c-success-text); border-color: transparent; }
.chip-warning { background: var(--c-warning-soft); color: var(--c-warning-text); border-color: transparent; }
.chip-danger { background: var(--c-danger-soft); color: var(--c-danger-text); border-color: transparent; }
.chip-info { background: var(--c-info-soft); color: var(--c-info-text); border-color: transparent; }
.chip-outlined { background: transparent; border-color: var(--c-border-default); }

/* Pill 大版本 */
.chip-lg { height: 32px; font-size: var(--fs-sm); padding: 0 var(--space-4); }

/* Status dot — chip 内的小圆点 */
.chip-dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-circle);
  background: currentColor;
  display: inline-block;
}
.chip-dot.pulse {
  box-shadow: 0 0 0 0 currentColor;
  animation: chip-pulse 1.8s var(--ease-out-quart) infinite;
}
@keyframes chip-pulse {
  /* 用 currentColor 与 design-token 保持主题一致；旧硬编码 rgba(94,142,125)
     在亮主题（accent=#43705F）下颜色错位 */
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ===================== 2. Badge（数字 / 提示） ===================== */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  color: var(--c-text-inverse);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

/* ===================== 3. Segmented Control（iOS 风） ===================== */

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--c-glass-strong);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--radius-md);
  gap: 0;
}
.segmented-item {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  transition: background var(--dur-fast) var(--ease-out-quart),
              color var(--dur-fast) var(--ease-out-quart);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.segmented-item:hover { color: var(--c-text-primary); }
.segmented-item.is-active {
  background: var(--c-surface-2);
  color: var(--c-text-primary);
  box-shadow: var(--shadow-xs);
}

/* ===================== 4. Toast / Snackbar ===================== */

.toast-stack {
  position: fixed;
  bottom: calc(var(--bottom-safe-pad) + var(--space-3));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--gutter);
  width: 100%;
  max-width: var(--content-max);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--c-text-primary);
  animation: toast-in var(--dur-medium) var(--ease-out-quint) both;
}
.toast.is-success { border-color: var(--c-success); }
.toast.is-warning { border-color: var(--c-warning); }
.toast.is-danger  { border-color: var(--c-danger); }
.toast svg { color: var(--c-accent); flex: none; }
.toast.is-success svg { color: var(--c-success-text); }
.toast.is-warning svg { color: var(--c-warning-text); }
.toast.is-danger svg { color: var(--c-danger-text); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===================== 5. Modal / Dialog ===================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background: var(--c-surface-overlay);
  backdrop-filter: blur(var(--blur-sm));
  -webkit-backdrop-filter: blur(var(--blur-sm));
  animation: backdrop-in var(--dur-medium) var(--ease-out-quart) both;
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: fixed;
  z-index: var(--z-modal);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - var(--space-8));
  max-width: 440px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-xl);
  animation: modal-in var(--dur-medium) var(--ease-out-quint) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===================== 6. Bottom Sheet（移动端核心） ===================== */

.sheet {
  position: fixed;
  z-index: var(--z-sheet);
  left: 0; right: 0; bottom: 0;
  background: var(--c-surface-2);
  border-top: 1px solid var(--c-border-default);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-4) var(--gutter) var(--bottom-safe-pad);
  box-shadow: var(--shadow-xl);
  max-height: 88dvh;
  overflow-y: auto;
  animation: sheet-in var(--dur-medium) var(--ease-out-quint) both;
}
@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 40px; height: 4px;
  border-radius: var(--radius-pill);
  background: var(--c-border-strong);
  margin: 0 auto var(--space-4);
}
.sheet-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  margin-bottom: var(--space-4);
}

/* ===================== 7. Tab（顶部标签页） ===================== */

.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--c-divider);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs-item {
  position: relative;
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-secondary);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out-quart),
              border-color var(--dur-fast) var(--ease-out-quart);
}
.tabs-item:hover { color: var(--c-text-primary); }
.tabs-item.is-active {
  color: var(--c-text-primary);
  border-bottom-color: var(--c-accent);
}

/* ===================== 8. Skeleton / Spinner / Progress ===================== */

.skeleton {
  background: linear-gradient(90deg,
    var(--c-surface) 0%,
    var(--c-surface-2) 50%,
    var(--c-surface) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--c-glass-strong);
  border-top-color: var(--c-accent);
  border-radius: var(--radius-circle);
  animation: spinner-spin 0.7s linear infinite;
}
@keyframes spinner-spin { to { transform: rotate(360deg); } }

.progress {
  height: 4px;
  background: var(--c-glass-strong);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-hover));
  border-radius: inherit;
  transition: width var(--dur-medium) var(--ease-out-quart);
}

/* ===================== 9. Alert / Callout ===================== */

.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-default);
  background: var(--c-glass);
  margin-bottom: var(--space-4);
}
.alert-info { background: var(--c-info-soft); border-color: transparent; }
.alert-success { background: var(--c-success-soft); border-color: transparent; }
.alert-warning { background: var(--c-warning-soft); border-color: transparent; }
.alert-danger { background: var(--c-danger-soft); border-color: transparent; }
.alert > svg { flex: none; color: currentColor; }
.alert-info > svg { color: var(--c-info-text); }
.alert-success > svg { color: var(--c-success-text); }
.alert-warning > svg { color: var(--c-warning-text); }
.alert-danger > svg { color: var(--c-danger-text); }
.alert-title {
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-1);
  color: var(--c-text-primary);
  letter-spacing: var(--ls-heading);
}
.alert-body { color: var(--c-text-secondary); font-size: var(--fs-sm); }

/* ===================== 10. List ===================== */

.list {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--c-text-primary);
  border-bottom: 1px solid var(--c-divider);
  transition: background var(--dur-fast) var(--ease-out-quart);
  min-height: 56px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--c-glass); }
.list-item:active { background: var(--c-glass-strong); }
.list-item-leading {
  width: 36px; height: 36px;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.list-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.list-item-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: var(--c-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-subtitle {
  font-size: var(--fs-sm);
  color: var(--c-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-trailing {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--c-text-tertiary);
  flex: none;
}

/* ===================== 11. Empty State ===================== */

.empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--c-text-tertiary);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--c-text-muted);
}
.empty-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  margin-bottom: var(--space-2);
}
.empty-body {
  color: var(--c-text-tertiary);
  font-size: var(--fs-sm);
  max-width: 320px;
  margin: 0 auto var(--space-4);
}

/* ===================== 12. Market Card（首页核心） ===================== */

.market-card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur-fast) var(--ease-spring-soft),
              border-color var(--dur-fast) var(--ease-out-quart),
              box-shadow var(--dur-fast) var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}
.market-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, var(--c-accent-soft) 100%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out-quart);
  pointer-events: none;
}
.market-card:hover {
  transform: translateY(-2px);
  border-color: var(--c-border-strong);
  box-shadow: var(--shadow-md);
}
.market-card:hover::before { opacity: 1; }
.market-card:active { transform: scale(0.98); }
.market-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  position: relative;
  z-index: 1;
}
.market-card-title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-heading);
  color: var(--c-text-primary);
}
.market-card-meta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--c-text-tertiary);
  position: relative;
  z-index: 1;
}
.market-card-meta strong { color: var(--c-text-secondary); font-weight: var(--fw-medium); }

/* ===================== 13. Odds Display（赔率视觉） ===================== */

.odds {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
  color: var(--c-accent);
}
.odds-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}

/* ===================== 14. Stat / KPI ===================== */

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--c-glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-subtle);
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--c-text-tertiary);
  letter-spacing: var(--ls-caption);
  text-transform: uppercase;
  font-weight: var(--fw-medium);
}
.stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  color: var(--c-text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--ls-heading);
  line-height: var(--lh-tight);
}
.stat-delta { font-size: var(--fs-sm); }
.stat-delta-up { color: var(--c-success-text); }
.stat-delta-down { color: var(--c-danger-text); }

/* ===================== 15. Table（密集 / 美化） ===================== */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--c-surface);
  border: 1px solid var(--c-border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data th, table.data td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-divider);
}
table.data th {
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  font-weight: var(--fw-semibold);
  color: var(--c-text-tertiary);
  background: var(--c-glass);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--c-glass); }

/* ===================== 16. OTP Input（6 位独立格） ===================== */

.otp-input {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin: var(--space-4) 0;
}
.otp-input input {
  width: 44px; height: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  padding: 0;
  font-variant-numeric: tabular-nums;
}

/* ===================== 17. Hero Section ===================== */

.hero {
  padding: var(--space-8) 0 var(--space-6);
  position: relative;
}
.hero-eyebrow {
  font-size: var(--fs-micro);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
  color: var(--c-accent);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-3);
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-display-m);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  margin-bottom: var(--space-3);
}
.hero-subtitle {
  font-size: var(--fs-lg);
  color: var(--c-text-secondary);
  line-height: var(--lh-relaxed);
  max-width: 36ch;
}

/* ===================== 18. Page Header（子页面） ===================== */

.page-header {
  margin-bottom: var(--space-6);
}
.page-header-title {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-display);
  margin-bottom: var(--space-2);
}
.page-header-subtitle {
  color: var(--c-text-secondary);
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
}

/* ===================== 19. Search Bar ===================== */

.search-bar {
  position: relative;
  margin-bottom: var(--space-4);
}
.search-bar input {
  /* logical property: RTL 模式自动镜像 */
  padding-inline-start: calc(var(--space-4) + 20px + var(--space-2));
}
.search-bar svg {
  position: absolute;
  inset-inline-start: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-tertiary);
  pointer-events: none;
}

/* ===================== 20. Theme toggle 内置图标切换 ===================== */

/* 项目主题命名为 stat-light / stat-dark（非 light / dark），所以匹配前缀 */
[data-theme-toggle] .theme-icon-light { display: none; }
[data-theme-toggle] .theme-icon-dark { display: inline-flex; }
:root[data-theme$="-light"] [data-theme-toggle] .theme-icon-light { display: inline-flex; }
:root[data-theme$="-light"] [data-theme-toggle] .theme-icon-dark { display: none; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) [data-theme-toggle] .theme-icon-light { display: inline-flex; }
  :root:not([data-theme]) [data-theme-toggle] .theme-icon-dark { display: none; }
}

[data-lang-toggle] .lang-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  letter-spacing: var(--ls-micro);
}

/* ===================== 22. Language menu（多语言下拉） ===================== */
.lang-menu {
  position: relative;
}
.lang-menu > summary {
  list-style: none;
  cursor: pointer;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu .lang-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  letter-spacing: var(--ls-caption);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang-menu-list {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: lang-menu-in var(--dur-fast) var(--ease-out-quart) both;
}
@keyframes lang-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
[dir="rtl"] .lang-menu-list { right: auto; left: 0; }

.lang-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--c-text-primary);
  font-size: var(--fs-sm);
  text-align: start;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out-quart);
  gap: var(--space-3);
}
.lang-menu-item:hover { background: var(--c-glass); }
.lang-menu-item.is-active {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.lang-menu-item .lang-menu-name {
  flex: 1;
  font-weight: var(--fw-medium);
  text-align: start;
  overflow-wrap: anywhere;
}
.lang-menu-item .lang-menu-code {
  color: var(--c-text-tertiary);
  font-family: var(--font-mono);
}

/* RTL 全局调整 — 语言选 ar 时（dir="rtl"） */
/* 注意：不再对 .flex 一刀切 row-reverse — 历史一刀切导致表单 / 分页按钮顺序错乱 */
/* 仅显式标记的容器才镜像；新代码用 .flex-rtl-mirror opt-in */
[dir="rtl"] .market-card-meta,
[dir="rtl"] .flex-rtl-mirror,
[dir="rtl"] .card-header,
[dir="rtl"] .card-footer { flex-direction: row-reverse; }
[dir="rtl"] .icon-btn .ico-arrow-right,
[dir="rtl"] .ico-chevron-right { transform: scaleX(-1); }
[dir="rtl"] .ico-arrow-left { transform: scaleX(-1); }

/* ===================== 20.5. Range stepper（滑杆两端 ±1 按钮） ===================== */
/* interactions.js 运行时自动包裹 <input type="range"> */
.stepper-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}
.stepper-group input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
}
.stepper-btn {
  flex: 0 0 auto;
  width: var(--touch-target);
  height: var(--touch-target);
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: 1;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-md);
  color: var(--c-text-primary);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-out-quart),
              border-color var(--dur-fast) var(--ease-out-quart);
}
.stepper-btn:hover { background: var(--c-surface-3); border-color: var(--c-border-strong); }
.stepper-btn:active { background: var(--c-accent-soft); }
.stepper-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.stepper-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================== 20.6. Flash Toast（右上角浮动） ===================== */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + var(--space-3));
  inset-inline-end: var(--space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(420px, calc(100vw - 2 * var(--space-4)));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-default);
  border-inline-start-width: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: var(--c-text-primary);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  pointer-events: auto;
  animation: toast-slide-in 0.24s var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
  transform-origin: left;
  animation: toast-shrink var(--toast-ttl, 4s) linear forwards;
}
.toast.toast-dismissing::after { display: none; }
@keyframes toast-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.toast.toast-dismissing {
  animation: toast-slide-out 0.2s var(--ease-out-quart) forwards;
}
/* 不透明底色（--c-surface-2）+ 叠加彩色 tint：保持淡彩观感但不透明，避免底层文字透出 */
.toast-success {
  border-inline-start-color: var(--c-success); color: var(--c-success-text);
  background-color: var(--c-surface-2);
  background-image: linear-gradient(var(--c-success-soft), var(--c-success-soft));
}
.toast-error,
.toast-danger {
  border-inline-start-color: var(--c-danger); color: var(--c-danger-text);
  background-color: var(--c-surface-2);
  background-image: linear-gradient(var(--c-danger-soft), var(--c-danger-soft));
}
.toast-warning {
  border-inline-start-color: var(--c-warning); color: var(--c-warning-text);
  background-color: var(--c-surface-2);
  background-image: linear-gradient(var(--c-warning-soft), var(--c-warning-soft));
}
.toast-info {
  border-inline-start-color: var(--c-accent); color: var(--c-text-primary);
  background-color: var(--c-surface-2);
  background-image: linear-gradient(var(--c-accent-soft), var(--c-accent-soft));
}
.toast-icon { flex-shrink: 0; display: inline-flex; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; word-break: break-word; }
.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  color: currentColor;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity var(--dur-fast), background var(--dur-fast);
}
.toast-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.05); }
.toast-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
@keyframes toast-slide-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* ===================== 21. 通用 utility（components 层补充） ===================== */

.divider {
  height: 1px;
  background: var(--c-divider);
  margin: var(--space-4) 0;
  border: none;
}

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--radius-circle);
  background: currentColor;
  vertical-align: middle;
}

/* 数字大字（仪表盘） */
.number-display {
  font-family: var(--font-display);
  font-size: var(--fs-display-l);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-display);
  font-variant-numeric: tabular-nums;
  line-height: var(--lh-tight);
}
.number-display-sm { font-size: var(--fs-h1); }

/* Hash display（短哈希） */
.hash {
  font-family: var(--font-mono);
  color: var(--c-gold-text);
  font-size: var(--fs-xs);
  background: var(--c-gold-soft);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

/* ===================== Step progress indicator ===================== */
.step-progress {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: var(--space-1) 0;
}
.step-progress::-webkit-scrollbar { display: none; }
.step-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  color: var(--c-text-tertiary);
  white-space: nowrap;
  padding: 4px var(--space-2);
  border-radius: var(--radius-full);
  border: 1px solid var(--c-border-muted);
  background: var(--c-surface-2);
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-circle);
  background: var(--c-border-muted);
  color: var(--c-text-tertiary);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}
.step-sep {
  font-size: var(--fs-xs);
  color: var(--c-text-tertiary);
  padding: 0 var(--space-1);
  flex-shrink: 0;
}

/* ===================== List group label ===================== */
.list-group-label {
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  color: var(--c-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--space-3) var(--space-2) var(--space-1);
}

/* ===================== Password strength meter ===================== */
.pw-strength {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pw-strength-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--c-border-muted);
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease-out-quart), background 0.3s;
}
.pw-strength-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

/* ===================== Confirm dialog ===================== */
dialog.confirm-dialog {
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-lg);
  background: var(--c-surface-2);
  color: var(--c-text-primary);
  padding: var(--space-6);
  max-width: min(420px, calc(100vw - var(--space-8)));
  box-shadow: var(--shadow-xl);
}
dialog.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.confirm-dialog-msg {
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  margin: 0 0 var(--space-5);
}
.confirm-dialog-btns {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ===================== Rules: sticky ToC ===================== */
.rules-toc {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-2));
  z-index: 10;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.rules-toc-title {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.rules-toc-links {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
.rules-toc-link {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border-muted);
  text-decoration: none;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
  white-space: nowrap;
}
.rules-toc-link:hover {
  color: var(--c-accent);
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* ===================== DPM pool snapshot bars ===================== */
.pool-snapshot {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pool-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.pool-bar-label {
  font-size: var(--fs-xs);
  color: var(--c-text-secondary);
  min-width: 80px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.pool-bar-track {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--c-border-muted);
  overflow: hidden;
}
.pool-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--c-accent);
  transition: width 0.4s var(--ease-out-quart);
}
.pool-bar-pct {
  font-size: var(--fs-xs);
  color: var(--c-text-tertiary);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: end;
  flex-shrink: 0;
}

/* ============================================================================
 * J2 — 实时活动流 ticker（社会证明 + FOMO）
 * ========================================================================= */
.activity-ticker {
  min-height: 1.2em;
  padding-inline: var(--space-1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: opacity var(--dur-base) var(--ease-out-quart);
}
.activity-ticker:empty {
  display: none;
}
.activity-ticker.activity-pulse {
  animation: activity-pulse-kf var(--dur-slow) var(--ease-out-quint);
}
@keyframes activity-pulse-kf {
  0%   { opacity: 0; transform: translateY(-4px); color: var(--c-gold-text); }
  30%  { opacity: 1; color: var(--c-gold-text); }
  100% { opacity: 1; transform: translateY(0); color: var(--c-text-tertiary); }
}
@media (prefers-reduced-motion: reduce) {
  .activity-ticker.activity-pulse { animation: none; }
}

/* ============================================================================
 * 门头（顶栏）engagement — 余额/连签/通知/头像等级环（Duolingo/赌场原则）
 * ========================================================================= */
.topbar-engage {
  display: flex;
  align-items: center;
  gap: var(--space-1-5);
  margin-inline-start: auto;
}
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 var(--space-2-5, 10px);
  border-radius: var(--radius-pill);
  background: var(--c-gold-soft);
  color: var(--c-gold-text);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out-quart);
}
.balance-chip:hover { border-color: var(--c-gold); }
.balance-chip svg { width: 13px; height: 13px; flex: none; }
.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  color: var(--c-text-tertiary);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.streak-chip svg { width: 14px; height: 14px; flex: none; }
.streak-chip.streak-pending {
  color: var(--c-gold-text);
  background: var(--c-gold-soft);
  animation: streak-pulse 1.8s var(--ease-in-out-cubic) infinite;
}
@keyframes streak-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .streak-chip.streak-pending { animation: none; }
}

/* 通知/角标 */
.badge-wrap { position: relative; }
.nav-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--c-danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--c-bg);
}
.nav-badge-gold { background: var(--c-gold); color: var(--c-text-inverse); }
.nav-dot {
  position: absolute;
  top: 8px;
  inset-inline-end: calc(50% - 14px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 0 2px var(--c-bg);
}

/* 头像等级环（太阳=金 / 月亮=info / 无=中性） */
.avatar-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 2px;
  text-decoration: none;
  flex: none;
  background: var(--c-border-default);
}
.avatar-ring-sun  { background: linear-gradient(135deg, var(--c-gold), var(--c-warning)); }
.avatar-ring-moon { background: linear-gradient(135deg, var(--c-info), var(--c-accent)); }
.avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #f8fafc;
  font-size: 12px;
  font-weight: var(--fw-bold);
  line-height: 1;
  border: 2px solid var(--c-bg);
}

/* ============================================================================
 * 中央按钮长按快捷菜单
 * ========================================================================= */
.center-menu {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 8px);
  z-index: var(--z-tabbar);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  padding: var(--space-2);
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out-quart),
              transform var(--dur-base) var(--ease-spring);
}
.center-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.center-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: var(--c-text-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.center-menu-item:hover { background: var(--c-glass); }
@media (prefers-reduced-motion: reduce) {
  .center-menu { transition: opacity var(--dur-fast) linear; }
}

/* ============================================================================
 * #6 全站最热巨卡（门头焦点）
 * ========================================================================= */
.featured-card {
  display: block;
  padding: var(--space-4);
  border: 1px solid var(--c-border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--c-text-primary);
  margin-bottom: var(--space-4);
  transition: transform var(--dur-fast) var(--ease-spring-soft),
              box-shadow var(--dur-fast) var(--ease-out-quart);
}
.featured-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.featured-card:active { transform: scale(0.99); }
