/* ===== 体彩大乐透智能选号器 · 主题与组件样式 =====
   配色取自中国体育彩票品牌（红/橙主色，前区红球、后区蓝球），暗/亮双主题。 */

:root {
  /* 基础（暗色：深炭灰 + 红橙 + 琥珀） */
  --dlt-background: linear-gradient(180deg, #15171c 0%, #0d0f13 100%);
  --dlt-foreground: #f5f7fa;
  --dlt-primary: #ff5a1f;          /* 体彩橙红 */
  --dlt-primary-2: #ff2d55;        /* 玫红 */
  --dlt-accent: #ffb020;           /* 琥珀金 */
  --dlt-border: rgba(255, 255, 255, 0.10);
  --dlt-border-strong: rgba(255, 255, 255, 0.18);
  --dlt-border-faint: rgba(255, 255, 255, 0.06);
  --dlt-muted: #9aa3b2;
  --dlt-text-secondary: #cdd3dc;
  --dlt-text-tertiary: #6b7280;
  --dlt-card: rgba(255, 255, 255, 0.05);
  --dlt-card-solid: #181b21;
  --dlt-surface: rgba(255, 255, 255, 0.08);
  --dlt-overlay: rgba(0, 0, 0, 0.45);
  --dlt-overlay-strong: rgba(0, 0, 0, 0.30);
  --dlt-header-bg: rgba(13, 15, 19, 0.82);
  --dlt-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --dlt-glow: 0 0 40px rgba(255, 90, 31, 0.22);
  --dlt-radius-sm: 8px;
  --dlt-radius-md: 16px;
  --dlt-radius-lg: 24px;
  /* 语义状态色 */
  --dlt-success: #4ade80;
  --dlt-success-bg: rgba(34, 197, 94, 0.15);
  --dlt-danger: #f87171;
  --dlt-danger-bg: rgba(239, 68, 68, 0.15);
  --dlt-warning: #facc15;
  --dlt-warning-bg: rgba(250, 204, 21, 0.15);
  --dlt-info: #f9a8d4;
  --dlt-info-bg: rgba(244, 114, 182, 0.18);
  --dlt-cold: #3b82f6;
  --dlt-hot: #ef4444;
  --dlt-warm: #facc15;
  --dlt-muted-bg: rgba(148, 163, 184, 0.15);
  /* 号码球 */
  --dlt-ball-front: linear-gradient(180deg, #ff5a1f 0%, #e60012 100%);  /* 前区红球 */
  --dlt-ball-back: linear-gradient(180deg, #2f9bff 0%, #1565c0 100%);   /* 后区蓝球 */
  --dlt-ball-front-text: #ffffff;
  --dlt-ball-back-text: #ffffff;
  --dlt-ball-empty-bg: rgba(255, 255, 255, 0.06);
  --dlt-ball-empty-border: rgba(255, 255, 255, 0.14);
  /* 功能按钮渐变 */
  --dlt-btn-primary: linear-gradient(180deg, #ff5a1f 0%, #e63a0b 100%);
  --dlt-btn-red: linear-gradient(180deg, #ff2d55 0%, #e11d48 100%);
  --dlt-btn-blue: linear-gradient(180deg, #2f9bff 0%, #1565c0 100%);
  --dlt-btn-ghost: rgba(255, 255, 255, 0.06);
  /* 设计升级：背景光晕 / 标签 / 卡片品牌光（暗色） */
  --dlt-aura-1: rgba(255, 90, 31, 0.20);
  --dlt-aura-2: rgba(255, 176, 32, 0.10);
  --dlt-tag-bg: rgba(255, 90, 31, 0.18);
  --dlt-tag-text: #ffc7a8;
  --dlt-card-glow: 0 0 0 1px rgba(255, 90, 31, 0.28), 0 10px 34px rgba(255, 90, 31, 0.12);
}

/* ===== 亮色主题（日间） ===== */
[data-theme="light"] {
  --dlt-background: linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%);
  --dlt-foreground: #0f172a;
  --dlt-primary: #e63a0b;
  --dlt-primary-2: #e11d48;
  --dlt-accent: #c2740a;
  --dlt-border: rgba(15, 23, 42, 0.12);
  --dlt-border-strong: rgba(15, 23, 42, 0.20);
  --dlt-border-faint: rgba(15, 23, 42, 0.08);
  --dlt-muted: #475569;
  --dlt-text-secondary: #334155;
  --dlt-text-tertiary: #64748b;
  --dlt-card: rgba(15, 23, 42, 0.04);
  --dlt-card-solid: #ffffff;
  --dlt-surface: rgba(15, 23, 42, 0.05);
  --dlt-overlay: rgba(15, 23, 42, 0.06);
  --dlt-overlay-strong: rgba(15, 23, 42, 0.10);
  --dlt-header-bg: rgba(255, 255, 255, 0.88);
  --dlt-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --dlt-glow: 0 0 40px rgba(230, 58, 11, 0.16);
  --dlt-success: #16a34a;
  --dlt-success-bg: rgba(34, 197, 94, 0.12);
  --dlt-danger: #dc2626;
  --dlt-danger-bg: rgba(239, 68, 68, 0.12);
  --dlt-warning: #d97706;
  --dlt-warning-bg: rgba(250, 204, 21, 0.18);
  --dlt-info: #db2777;
  --dlt-info-bg: rgba(244, 114, 182, 0.18);
  --dlt-cold: #2563eb;
  --dlt-hot: #dc2626;
  --dlt-warm: #d97706;
  --dlt-muted-bg: rgba(15, 23, 42, 0.06);
  --dlt-ball-front: linear-gradient(180deg, #ff6a2b 0%, #e60012 100%);
  --dlt-ball-back: linear-gradient(180deg, #3aa0ff 0%, #1565c0 100%);
  --dlt-ball-front-text: #ffffff;
  --dlt-ball-back-text: #ffffff;
  --dlt-ball-empty-bg: rgba(15, 23, 42, 0.04);
  --dlt-ball-empty-border: rgba(15, 23, 42, 0.16);
  --dlt-btn-primary: linear-gradient(180deg, #ff6a2b 0%, #e63a0b 100%);
  --dlt-btn-red: linear-gradient(180deg, #ff2d55 0%, #e11d48 100%);
  --dlt-btn-blue: linear-gradient(180deg, #3aa0ff 0%, #1565c0 100%);
  --dlt-btn-ghost: rgba(15, 23, 42, 0.05);
  --dlt-aura-1: rgba(230, 58, 11, 0.10);
  --dlt-aura-2: rgba(194, 116, 10, 0.08);
  --dlt-tag-bg: rgba(230, 58, 11, 0.12);
  --dlt-tag-text: #b8410a;
  --dlt-card-glow: 0 0 0 1px rgba(230, 58, 11, 0.22), 0 10px 34px rgba(230, 58, 11, 0.10);
}

* { box-sizing: border-box; }

/* 触摸端基础：去掉点击高亮闪烁、限制 iOS 横屏字号放大、避免误触发双击缩放 */
* { -webkit-tap-highlight-color: transparent; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--dlt-foreground);
  background: var(--dlt-background);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
  /* 兜底：极端窄屏下不让横向滚动扩散（clip 不会创建滚动容器，不影响 sticky 头部） */
  overflow-x: clip;
}

/* 键盘可达性（PC） */
:focus-visible { outline: 2px solid var(--dlt-primary); outline-offset: 2px; }

/* 消除移动端 300ms 点击延迟 */
.btn, .chip, .seg button, .theme-toggle, a.link, select, input, label {
  touch-action: manipulation;
}

/* 背景光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px 400px at 80% -5%, var(--dlt-aura-1), transparent 60%),
    radial-gradient(500px 360px at 0% 10%, var(--dlt-aura-2), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px 56px;
  /* 刘海屏/圆角屏安全区（Android 手势条、iPhone 底部横条） */
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

/* PC：更宽的容器 + 更舒展的留白 */
@media (min-width: 1024px) {
  .app-container {
    padding: 0 28px 72px;
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
}
@media (min-width: 1600px) {
  .app-container { max-width: 1440px; }
}

/* ===== 头部 ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 4px;
  padding-top: max(16px, env(safe-area-inset-top));
  margin-bottom: 8px;
  background: var(--dlt-header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--dlt-border-faint);
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.header-left > div:last-child { min-width: 0; }
.header-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* ===== 表单（登录页等通用）===== */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; font-size: 13px; color: var(--dlt-text-secondary); margin-bottom: 6px; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--dlt-btn-primary);
  color: #fff; font-weight: 800; font-size: 13px; line-height: 1.05; text-align: center;
  box-shadow: var(--dlt-glow);
}
.page-title {
  font-size: 20px; font-weight: 800; margin: 0; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-title .title-accent { color: var(--dlt-primary); }
.subtitle { font-size: 12px; color: var(--dlt-muted); margin-top: 2px; }

.theme-toggle {
  flex: none; width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--dlt-border); background: var(--dlt-surface); color: var(--dlt-foreground);
  display: grid; place-items: center; font-size: 18px; transition: .2s;
}
.theme-toggle:hover { border-color: var(--dlt-border-strong); transform: translateY(-1px); }

/* ===== 卡片 / 区块 ===== */
.section { margin-top: 20px; }
.card {
  background: var(--dlt-card);
  border: 1px solid var(--dlt-border);
  border-radius: var(--dlt-radius-md);
  padding: 18px;
  box-shadow: var(--dlt-shadow);
  backdrop-filter: blur(6px);
}
.card-title {
  font-size: 16px; font-weight: 700; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 4px;
  background: var(--dlt-btn-primary);
}
.card-body { font-size: 13px; color: var(--dlt-text-secondary); line-height: 1.7; }

/* ===== 数据概览 stat ===== */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px;
}
.stat {
  background: var(--dlt-surface); border: 1px solid var(--dlt-border-faint);
  border-radius: var(--dlt-radius-sm); padding: 12px 14px;
}
.stat .stat-label { font-size: 12px; color: var(--dlt-muted); }
.stat .stat-value { font-size: 20px; font-weight: 800; margin-top: 4px; color: var(--dlt-foreground); }
.stat .stat-value.accent { color: var(--dlt-primary); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--dlt-tag-bg); color: var(--dlt-tag-text); border: 1px solid var(--dlt-border-faint);
  /* 内嵌号码球同样需要 flex 才能换行（否则窄屏会撑破卡片） */
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px;
}
.pill .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot-hot { background: var(--dlt-hot); }
.dot-warm { background: var(--dlt-warm); }
.dot-cold { background: var(--dlt-cold); }

/* ===== 号码球 ===== */
.ball {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 15px; font-weight: 700; user-select: none;
  background: var(--dlt-ball-empty-bg);
  border: 1.5px solid var(--dlt-ball-empty-border);
  color: var(--dlt-foreground);
  transition: transform .12s ease, box-shadow .15s ease;
}
.ball.front { background: var(--dlt-ball-front); color: var(--dlt-ball-front-text); border-color: transparent; }
.ball.back { background: var(--dlt-ball-back); color: var(--dlt-ball-back-text); border-color: transparent; }
.ball.lg { width: 46px; height: 46px; font-size: 17px; }
.ball.sm { width: 30px; height: 30px; font-size: 13px; }

/* 号码行：球与球之间无空白，必须靠 flex 才能在窄屏正常换行 */
.ball-row { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
/* 单区号码组（前区 5 个 / 后区 2 个）：内部不拆行，整组一起换行 */
.ball-run { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.plus { color: var(--dlt-primary); font-weight: 800; margin: 0 2px; flex: none; }

/* ===== 按钮 ===== */
.btn {
  appearance: none; border: 1px solid var(--dlt-border); cursor: pointer;
  padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700;
  background: var(--dlt-btn-ghost); color: var(--dlt-foreground); transition: .18s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--dlt-border-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--dlt-btn-primary); border-color: transparent; color: #fff; }
.btn-red { background: var(--dlt-btn-red); border-color: transparent; color: #fff; }
.btn-blue { background: var(--dlt-btn-blue); border-color: transparent; color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ===== 策略 chips ===== */
.group-block { margin-top: 14px; }
.group-title { font-size: 13px; font-weight: 700; color: var(--dlt-text-secondary); margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--dlt-surface); border: 1px solid var(--dlt-border-faint); color: var(--dlt-text-secondary);
  transition: .15s; margin: 0 8px 8px 0;
}
.chip:hover { border-color: var(--dlt-border-strong); }
.chip.active { background: var(--dlt-tag-bg); color: var(--dlt-tag-text); border-color: var(--dlt-primary); }
.chip .desc { font-size: 11px; color: var(--dlt-muted); font-weight: 500; }

.seg { display: inline-flex; border: 1px solid var(--dlt-border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--dlt-text-secondary); padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }
.seg button.active { background: var(--dlt-btn-primary); color: #fff; }

/* ===== 生成结果 ===== */
.result-card {
  background: var(--dlt-card-solid); border: 1px solid var(--dlt-border); border-radius: var(--dlt-radius-md);
  padding: 18px; box-shadow: var(--dlt-card-glow);
}
.result-balls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; }
.result-balls .plus { font-size: 22px; font-weight: 800; color: var(--dlt-primary); margin: 0 4px; }
.result-meta { font-size: 12px; color: var(--dlt-muted); margin-top: 8px; line-height: 1.7; }
.ticket {
  border: 1px dashed var(--dlt-border-strong); border-radius: 12px; padding: 12px; margin-top: 10px;
  background: var(--dlt-surface);
}
.ticket .ticket-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; margin-top: 8px; }
table.dlt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dlt-table th, table.dlt-table td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--dlt-border-faint); white-space: nowrap; }
table.dlt-table th { color: var(--dlt-muted); font-weight: 600; position: sticky; top: 0; background: var(--dlt-card-solid); }
table.dlt-table td.num-cell { font-variant-numeric: tabular-nums; }
.hit { color: var(--dlt-success); font-weight: 700; }

/* ===== 提示 / 免责 ===== */
.disclaimer {
  margin-top: 18px; font-size: 12px; color: var(--dlt-muted); line-height: 1.8;
  border-top: 1px dashed var(--dlt-border); padding-top: 14px;
}
.note-line { font-size: 12px; color: var(--dlt-muted); margin-top: 6px; }
.message { margin-top: 10px; font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.message.error { background: var(--dlt-danger-bg); color: var(--dlt-danger); }
.message.success { background: var(--dlt-success-bg); color: var(--dlt-success); }
.message.info { background: var(--dlt-info-bg); color: var(--dlt-info); }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--dlt-muted); }
.accent-text { color: var(--dlt-primary); font-weight: 700; }
.divider { height: 1px; background: var(--dlt-border-faint); margin: 14px 0; }

a.link { color: var(--dlt-primary); text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }

/* ===== 玩法选择（单式 / 复试 / 胆拖） ===== */
.play-panel { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--dlt-border); }
.fushi-panel { margin-top: 12px; }
.fushi-inputs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.fushi-field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--dlt-text-secondary);
  flex: 1 1 130px; min-width: 120px;
}
.fushi-field input {
  width: 100%; padding: 10px 12px; font-size: 16px; font-weight: 800; text-align: center;
  color: var(--dlt-foreground); background: var(--dlt-surface);
  border: 1px solid var(--dlt-border-strong); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.fushi-field input::-webkit-outer-spin-button,
.fushi-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fushi-field input:focus { border-color: var(--dlt-primary); box-shadow: var(--dlt-card-glow); }
.fushi-cost {
  margin-top: 12px; font-size: 14px; line-height: 1.6; padding: 10px 12px; border-radius: 10px;
  background: var(--dlt-surface); border: 1px solid var(--dlt-border-faint);
}
.fushi-cost .accent-text { font-size: 16px; }
.fushi-cost-bad { color: var(--dlt-danger); font-weight: 600; }
.fushi-cost-warn { color: var(--dlt-warning); margin-top: 6px; font-size: 12px; }

/* 号码球：胆 / 拖 标记（胆拖玩法） */
.ball.drag { box-shadow: 0 0 0 3px var(--dlt-accent), var(--dlt-card-glow); }
.ball.tail { box-shadow: 0 0 0 3px var(--dlt-warning), var(--dlt-card-glow); }
.mark-badge {
  position: absolute; top: -9px; right: -9px; transform: none;
  font-size: 10px; font-weight: 800; line-height: 14px; color: #fff;
  background: var(--dlt-primary); border: 2px solid var(--dlt-card-solid);
  border-radius: 6px; padding: 0 4px;
}
.mark-badge.tail { background: var(--dlt-warning); color: #1a1a1a; }

/* ===== 选号记录 / 历史记录 ===== */
.record-card {
  border: 1px solid var(--dlt-border); border-radius: 14px; padding: 14px;
  margin-top: 12px; background: var(--dlt-surface);
}
.record-card-win { border-color: rgba(74, 222, 128, 0.45); box-shadow: var(--dlt-card-glow); }
.record-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.record-period { font-size: 15px; font-weight: 800; color: var(--dlt-foreground); }
.record-bets { font-size: 12.5px; color: var(--dlt-text-secondary); }
.record-time { margin-left: auto; font-size: 12px; color: var(--dlt-muted); }
.record-strategy { font-size: 12px; color: var(--dlt-muted); margin-top: 6px; }
.record-body { margin-top: 10px; }

/* ===== 记录号码折叠/展开 ===== */
.record-body.rec-collapsible:not(.rec-expanded) {
  max-height: 108px; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.rec-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 8px; padding: 7px 0; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--dlt-primary);
  background: transparent; border: 1px dashed var(--dlt-border); border-radius: 9px;
  transition: background .18s ease, border-color .18s ease;
}
.rec-toggle:hover { background: var(--dlt-tag-bg); border-color: var(--dlt-primary); }
.rec-toggle .rec-caret { display: inline-block; transition: transform .2s ease; font-size: 11px; }
.rec-toggle.is-open .rec-caret { transform: rotate(180deg); }

.record-body .ticket-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 5px 0; }
.rec-pool { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 5px 0; }
.rec-pool-label { font-size: 12px; color: var(--dlt-muted); font-weight: 600; }
.record-draw {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--dlt-border);
}
.record-foot { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--dlt-border); }
.record-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.btn.rec-del { color: var(--dlt-danger); border-color: rgba(248, 113, 113, 0.35); }
.rec-tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  background: var(--dlt-tag-bg); color: var(--dlt-tag-text);
}
.rec-tag-fushi { background: rgba(255, 176, 32, 0.18); color: var(--dlt-accent); }
.rec-tag-drag { background: rgba(47, 155, 255, 0.18); color: var(--dlt-cold); }
.rec-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.rec-badge-pending { background: var(--dlt-muted-bg); color: var(--dlt-text-secondary); }
.rec-badge-win { background: var(--dlt-success-bg); color: var(--dlt-success); }
.rec-badge-lose { background: var(--dlt-danger-bg); color: var(--dlt-danger); }
.rec-note { font-size: 12px; color: var(--dlt-muted); }
.rec-prize { display: flex; flex-direction: column; gap: 6px; }
.rec-prize-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.rec-prize-row b { color: var(--dlt-success); }
.rec-amount { color: var(--dlt-primary); font-weight: 700; }
.rec-pending-amount { color: var(--dlt-warning); font-weight: 700; }
.rec-prize-sum { font-size: 13px; margin-top: 4px; color: var(--dlt-text-secondary); }
.record-filter { font-size: 13px; color: var(--dlt-text-secondary); }
.record-filter select {
  padding: 6px 10px; border-radius: 8px; font-size: 13px; margin: 0 4px;
  color: var(--dlt-foreground); background: var(--dlt-surface); border: 1px solid var(--dlt-border-strong);
}
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; margin-top: 14px; }

/* ============================================================
   页面级作用域（body 上的语义类，用于按页面微调布局）
   ============================================================ */

/* 历史开奖页：热力区与历史表之间的节奏 */
body.page-history .section { margin-top: 16px; }

/* 历史记录页：记录列表容器允许收缩（PC 并排规则见 PC 段） */
body.page-records #record-list { min-width: 0; }

/* ===== 频率 / 遗漏热力网格（历史开奖页）
   用 grid + auto-fill 自适应列数：手机 7 列、PC 更宽时自动增多列，避免右侧留白 ===== */
.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}
.heat-cell {
  min-height: 46px;
  border-radius: 8px;
  padding: 6px 2px;
  display: grid;
  place-items: center;
  align-content: center;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.heat-num { display: block; }
.heat-meta { display: block; margin-top: 1px; font-size: 10px; font-weight: 600; opacity: .92; }
.heat-cell.hot  { background: linear-gradient(180deg, #ff5a1f 0%, #e60012 100%); }
.heat-cell.warm { background: linear-gradient(180deg, #ffb020 0%, #f59e0b 100%); }
.heat-cell.cold { background: linear-gradient(180deg, #2f9bff 0%, #1565c0 100%); }

/* ============================================================
   双端适配（PC / 平板 / 手机）
   断点：≥1024 PC ｜ 721–1023 平板 ｜ ≤720 手机 ｜ ≤380 小屏手机
   ============================================================ */

/* ---------- 指针设备区分：仅真正支持悬停的设备启用 hover 位移 ---------- */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); border-color: var(--dlt-border-strong); }
  .chip:hover { border-color: var(--dlt-border-strong); }
  .theme-toggle:hover { border-color: var(--dlt-border-strong); transform: translateY(-1px); }
}
@media (hover: none) {
  /* 触摸端：避免 hover 样式被"粘住"，改用按下反馈 */
  .btn:hover, .chip:hover, .theme-toggle:hover { transform: none; }
}
.btn:active, .chip:active, .seg button:active { transform: scale(.97); }

/* ============================================================
   PC（≥1024px）
   ============================================================ */
@media (min-width: 1024px) {
  /* 主区双栏：左「智能选号 + 形态分析」、右「生成结果 + 选号记录」
     用两个列容器分别纵向堆叠，避免 CSS Grid 跨行造成的大块空白 */
  .main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 20px;
  }
  .col-main, .col-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  .main-grid .section { margin-top: 0; }

  /* PC 端号码球略微放大 */
  .ball { width: 40px; height: 40px; font-size: 15px; }

  /* PC 端热力格子更大 */
  .heat-cell { min-height: 52px; font-size: 13px; }
  .heat-meta { font-size: 10.5px; }

  /* 数据概览：4 项固定 4 列 */
  .section-overview .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* 历史记录页：记录卡片两栏 */
  body.page-records #record-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
  }
  body.page-records #record-list .record-card { margin-top: 0; }

  /* 历史记录页顶部：汇总 + 筛选同排 */
  body.page-records .records-head {
    display: grid;
    grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 20px;
  }
  body.page-records .records-head > .section { margin-top: 0; }

  /* 历史开奖页：热力网格更宽 */
  .heat-grid { max-width: 800px; }
}

@media (min-width: 1600px) {
  body.page-records #record-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============================================================
   平板 / 手机（≤1023px）：单栏堆叠
   ============================================================ */
@media (max-width: 1023px) {
  /* 断点收窄：统计期数 + 融合方式改为上下排列，避免挤在一行 */
  .filter-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .filter-row > div { width: 100%; min-width: 0; }
  /* 统计卡在平板宽度下 4 列会过窄导致文案换行，收为 2 列 */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================
   手机（≤720px）
   ============================================================ */
@media (max-width: 720px) {
  /* ---- 头部 ---- */
  .app-header { padding-top: max(12px, env(safe-area-inset-top)); padding-bottom: 12px; }
  .brand-badge { width: 38px; height: 38px; font-size: 11px; border-radius: 10px; }
  .page-title { font-size: 17px; }
  .subtitle { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .theme-toggle { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; }
  .header-right { gap: 6px; }
  .header-right .btn-sm { padding: 6px 10px; }

  /* ---- 卡片 ---- */
  .card { padding: 14px; border-radius: 14px; }
  .card-title { font-size: 15px; }
  .section { margin-top: 14px; }
  .result-card { padding: 14px; }

  /* ---- 分段控件：允许换行，按钮均分整行 ---- */
  .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .seg button { flex: 1 1 auto; min-width: 0; padding: 9px 10px; white-space: nowrap; }

  /* ---- 数据概览 ---- */
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .stat-label { font-size: 11px; }
  .stat .stat-value { font-size: 16px; margin-top: 2px; }
  .section-overview .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pill { font-size: 11.5px; padding: 5px 9px; }
  .ball.sm { width: 28px; height: 28px; font-size: 12px; }

  /* ---- 号码球：36px 球径（拇指友好） ---- */
  .ball { width: 36px; height: 36px; font-size: 14px; }
  .ball.lg { width: 40px; height: 40px; font-size: 15px; }
  /* 号码组间距收紧，保证「前区 5 + 后区 2」一行放得下 */
  .ball-row { gap: 5px; }
  .ball-run { gap: 5px; }
  .plus { margin: 0 1px; }

  /* ---- 按钮：主按钮整行，其余两个一行（等宽，形成 2 列网格感） ---- */
  .toolbar { gap: 8px; }
  .toolbar .btn { padding: 11px 12px; min-height: 44px; flex: 1 1 calc(50% - 4px); justify-content: center; }
  .toolbar .btn-primary { flex: 1 1 100%; }
  /* 生成类工具栏里的「清空」也占半行，避免最后一个按钮被拉伸得宽窄不一 */
  #toolbar-single .btn-sm, #toolbar-fushi .btn-sm, #toolbar-drag .btn-sm {
    flex: 1 1 calc(50% - 4px); min-height: 44px; padding: 11px 12px; justify-content: center;
  }
  /* 卡片标题右侧的小工具按钮（刷新 / 清空本期）保持紧凑 */
  .toolbar .btn-sm { min-height: 36px; padding: 8px 12px; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }

  /* ---- 表单：16px 起，避免 iOS 聚焦自动放大页面 ---- */
  .fushi-field { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .fushi-field input { font-size: 16px; padding: 11px 10px; }
  .login-input { font-size: 16px; }
  .record-filter select { font-size: 16px; padding: 8px 10px; }

  /* ---- 选号记录 ---- */
  .record-card { padding: 12px; margin-top: 10px; }
  .record-head { gap: 6px; }
  .record-period { font-size: 14px; }
  .record-bets { font-size: 12px; }
  .record-time { margin-left: 0; width: 100%; font-size: 11px; }
  .record-actions { justify-content: stretch; }
  .record-actions .btn { width: 100%; }
  .pager { flex-wrap: wrap; }

  /* ---- 表格：手机端转为卡片式（避免横向溢出、后区列被裁掉） ---- */
  table.dlt-table.responsive-table,
  table.dlt-table.responsive-table tbody,
  table.dlt-table.responsive-table tr,
  table.dlt-table.responsive-table td { display: block; width: 100%; }
  table.dlt-table.responsive-table thead { display: none; }
  table.dlt-table.responsive-table tr {
    border: 1px solid var(--dlt-border);
    border-radius: 12px;
    background: var(--dlt-surface);
    padding: 10px 12px;
    margin-bottom: 8px;
  }
  table.dlt-table.responsive-table tr:last-child { margin-bottom: 0; }
  table.dlt-table.responsive-table td {
    border: 0; padding: 3px 0; text-align: left; white-space: normal;
    display: flex; align-items: center; gap: 10px;
  }
  table.dlt-table.responsive-table td::before {
    content: attr(data-label);
    flex: 0 0 72px;
    color: var(--dlt-muted);
    font-size: 12px;
    font-weight: 600;
  }
  table.dlt-table.responsive-table td:first-child {
    font-size: 15px; font-weight: 800; padding-bottom: 6px;
    border-bottom: 1px dashed var(--dlt-border-faint); margin-bottom: 4px;
  }
  table.dlt-table.responsive-table td:first-child::before { display: none; }
  table.dlt-table.responsive-table .ball { width: 30px; height: 30px; font-size: 12.5px; }

  /* ---- 热力网格：每行 7 个（与开奖球号视觉一致） ---- */
  .heat-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; max-width: none; }
  .heat-cell { font-size: 11.5px; padding: 6px 1px; }
  .heat-meta { font-size: 9.5px; }

  /* ---- 免责 / 说明 ---- */
  .disclaimer { font-size: 11.5px; }
}

/* ============================================================
   小屏手机（≤380px）
   ============================================================ */
@media (max-width: 380px) {
  .app-container { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .card { padding: 12px; }
  #dlt-user-info { display: none; }
  .ball { width: 33px; height: 33px; font-size: 13px; }
  .stat-grid, .section-overview .stat-grid { grid-template-columns: 1fr; }
  .fushi-field { flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 100%; }
  .heat-grid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
}

/* ============================================================
   可访问性：尊重"减少动态效果"系统设置
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}
