/* ── Toast 动画 ── */
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ── 变量 ── */
:root {
  --bg: #f5f7fa;
  --bg2: #fff;
  --bg3: #f0f0f0;
  --text: #0d0d1a;
  --text2: #2a2a40;
  --text3: #6a6a80;
  --border: #e5e5ea;
  --green: #0e7a4a;
  --red: #c0392b;
  --orange: #bf360c;
  --blue: #1554a0;
  --purple: #6c5ce7;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121220;
    --bg2: #1a1a2e;
    --bg3: #252540;
    --text: #e8e8f0;
    --text2: #c0c0d0;
    --text3: #8888a0;
    --border: #1a1a2e;
    --green: #2ecc71;
    --red: #e74c3c;
    --orange: #f0a500;
    --blue: #5dade2;
    --shadow: 0 1px 4px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  }
  .header { background: rgba(30,30,50,0.92) !important; border-bottom-color: transparent !important; }
  .card { background: var(--bg2) !important; }
  .mini-ball span { background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8) !important; box-shadow: none !important; }
  .draw-ball span { background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8) !important; box-shadow: none !important; }
  .stat-btn, .pagination button, .year-btn { background: var(--bg3) !important; color: var(--text2) !important; border-color: var(--border) !important; }
  .history-table th { background: var(--bg3) !important; }
}
html.dark {
  --bg: #121220;
  --bg2: #1a1a2e;
  --bg3: #252540;
  --text: #e8e8f0;
  --text2: #c0c0d0;
  --text3: #8888a0;
  --border: #2a2a40;
  --green: #2ecc71;
  --red: #e74c3c;
  --orange: #f0a500;
  --blue: #5dade2;
  --shadow: 0 1px 4px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
}
html.dark .header { background: rgba(30,30,50,0.92) !important; border-bottom-color: transparent !important; }
html.dark .top-nav { border-top-color: transparent !important; }
html.dark .card { background: var(--bg2) !important; }
html.dark .mini-ball span { background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8) !important; box-shadow: none !important; }
html.dark .draw-ball span { background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8) !important; box-shadow: none !important; }
html.dark .stat-btn, html.dark .pagination button, html.dark .year-btn { background: var(--bg3) !important; color: var(--text2) !important; border-color: var(--border) !important; }
html.dark .history-table th { background: var(--bg3) !important; }

/* ── 基础 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
html::-webkit-scrollbar { width: 0; height: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ── 布局 ── */
.header {
  padding: 8px 20px 6px;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#clock { font-weight: 700; color: var(--text); font-size: 13px; }
#date-display { font-weight: 600; color: var(--text); font-size: 11px; }
#ws-dot { width: 8px; height: 8px; border-radius: 50%; background: #888; display: inline-block; flex-shrink: 0; }
.header-top { display: flex; align-items: center; justify-content: space-between; position: relative; }
.header-title { font-size: clamp(15px,2.5vw,18px); font-weight: 700; }
.brand-accent { color: var(--red); }
.header-brand { display: flex; align-items: center; gap: 6px; }
.header-info { text-align: right; line-height: 1.3; flex-shrink: 0; }

/* 顶部导航 */
.top-nav { margin-top: 6px; }
.top-nav-inner, .top-nav { display: flex; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 32px; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--text2);
  transition: opacity 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.nav-item:active { background: transparent; }
.nav-item.active { color: var(--green); font-weight: 900; }
.nav-item span { font-size: 14px; }

.main { max-width: 1000px; margin: 0 auto; padding: 16px 20px 20px; overflow-x: hidden; }

/* ── 骨架屏 ── */
.skeleton-inner { display:flex; align-items:center; justify-content:center; gap:8px; padding:60px 20px; color:var(--text3); font-size:14px; }
.skeleton-spin { width:20px; height:20px; border:2px solid var(--border); border-top-color:var(--green); border-radius:50%; animation:spin 0.8s linear infinite; flex-shrink:0; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-ph {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── 开奖区 ── */
#live-countdown { text-align: center; padding: 10px; font-size: 18px; color: var(--text2); }
#live-countdown .countdown-num { font-size: 36px; font-weight: 900; color: var(--red); }
.live-cd { padding: 0 !important; font-size: 12px !important; line-height: 1.6; white-space: nowrap; }
.draw-card { text-align: center; padding: 10px 12px; overflow: visible; }
.draw-card .draw-period { display: block; margin-bottom: 6px; }
.draw-balls-center { justify-content: center; }
.draw-bar { display: flex; align-items: center; gap: 10px; padding: 12px 0; flex-wrap: wrap; min-height: 130px; }
.draw-period { font-size: 15px; font-weight: 700; margin: 0; line-height: 1.2; }
.draw-balls { display: flex; gap: clamp(3px, 0.5vw + 1.2px, 6px); flex-wrap: wrap; justify-content: center; align-items: flex-start; min-height: 0; }
.draw-ball.placeholder { background: linear-gradient(135deg, #ffd700, #f0a500) !important; opacity: 0.7; }
.draw-ball-wrapper { display: flex; flex-direction: column; align-items: center; gap: 4px; gap: clamp(3px, 0.25vw + 2.1px, 6px); }
.draw-ball-label { font-size: 11px; font-size: clamp(10px, 0.49vw + 8.2px, 13px); color: var(--text2); line-height: 1.2; white-space: nowrap; font-weight: 600; }
.draw-ball {
  width: 42px; width: clamp(36px, 4vw + 21.6px, 48px); height: 42px; height: clamp(36px, 4vw + 21.6px, 48px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-size: clamp(15px, 1.5vw + 9.6px, 18px); font-weight: 700; color: #fff;
  position: relative; flex-shrink: 0;
  border: none;
  background: radial-gradient(circle at 30% 25%, #ff6b6b, #e03131 45%, #c0392b); background-color: #c0392b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
  transform: translateZ(0);
}

.draw-ball span {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  width: 28px; width: clamp(23px, 2.6vw + 13.6px, 31px); height: 28px; height: clamp(23px, 2.6vw + 13.6px, 31px);
  background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8);
  border-radius: 50%;
  box-shadow: inset 0 clamp(1px, 0.1vw + 0.5px, 2px) clamp(3px, 0.2vw + 1.8px, 6px) rgba(0,0,0,0.12);
  font-weight: 900; font-size: 15px; font-size: clamp(12px, 0.75vw + 9.3px, 18px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.draw-ball.red { background: radial-gradient(circle at 30% 25%, #ff6b6b, #e03131 45%, #c0392b); background-color: #c0392b; }
.draw-ball.blue { background: radial-gradient(circle at 30% 25%, #74b9ff, #2563eb 45%, #1a5276); background-color: #1a5276; }
.draw-ball.green { background: radial-gradient(circle at 30% 25%, #2ecc71, #16a34a 45%, #145a32); background-color: #145a32; }
.draw-ball.draw-last {
  box-shadow: 0 0 8px 2px rgba(255, 215, 0, 0.5), 0 0 20px 4px rgba(255, 180, 0, 0.25);
}
.draw-ball.red span { color: #c0392b; background: radial-gradient(circle at 40% 35%, #fff, #fdf2f2); }
.draw-ball.blue span { color: #1a5276; background: radial-gradient(circle at 40% 35%, #fff, #eaf2fa); }
.draw-ball.green span { color: #145a32; background: radial-gradient(circle at 40% 35%, #fff, #eaf5ef); }
.draw-ball.placeholder span { color: #5c4200 !important; background: radial-gradient(circle at 40% 35%, #fff8e1, #ffe082) !important; }
.draw-plus { font-size: 24px; font-size: clamp(16px, 1.5vw + 10.6px, 20px); font-weight: 800; color: var(--text3); margin: 0 4px; margin: 0 clamp(3px, 0.5vw + 1.2px, 8px); height: 48px; height: clamp(32px, 2vw + 24.8px, 38px); line-height: 48px; line-height: clamp(32px, 2vw + 24.8px, 38px); align-self: flex-start; }

.card {
  background: var(--bg2);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.04);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.card-title { font-size: clamp(14px,2.2vw,17px); font-weight: 700; position: relative; padding-left: 12px; }
.card-title::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 1em; width: 4px; background: #f59e0b; border-radius: 2px; }
.card-period { font-size: 11px; color: var(--text2); }
.card-body { padding: 12px 10px; }

/* ── 走势图卡片 ── */
.trend-card { padding: 8px 12px 4px; }
.trend-attr-card { padding: 4px 8px; }
.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.history-title-row > span:first-child {
  min-width: 0;
}
.history-year-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
  text-align: right;
}

/* ── 区块标题 ── */
.section-title {
  font-size: clamp(14px,2.2vw,17px); font-weight: 800; margin: 16px 0 10px; padding-left: 12px; position: relative;
}
.section-title::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 3px; border-radius: 2px; background: #f59e0b;
}

/* ── 页面内容容器（发财资料页）── */
.page-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── 绝杀专区预测数据 ── */
.kill-zone-prediction { font-weight: 700; color: var(--text); white-space: nowrap; }
.kill-zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 6px 5px;
  white-space: normal;
}
.kill-zone-values-only {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 5px;
}
.kill-zone-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  padding: 5px 3px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--kz-color) 8%, var(--bg2));
}
.kill-zone-values-only .kill-zone-item {
  flex: 0 0 auto;
  min-width: 52px;
  min-height: 38px;
  padding: 4px 8px;
  gap: 2px;
}
.kill-zone-mini-label {
  font-size: 6px;
  line-height: 1;
  font-weight: 600;
  color: color-mix(in srgb, var(--kz-color) 62%, #777);
  white-space: nowrap;
}
.kill-zone-label {
  font-size: 10px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--kz-color);
  white-space: nowrap;
}
.kill-zone-value {
  font-size: clamp(13px, 2.6vw, 16px);
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

/* ── 模块预测内容 ── */
.module-prediction { font-size: clamp(14px,2.2vw,18px); font-weight: 700; color: var(--text); word-break: break-all; justify-content: center; }

/* ── 号码芯片 ── */
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chip-list.nowrap { flex-wrap: nowrap; }
.chip { font-size: clamp(13px,1.8vw,16px); font-weight: 700; padding: 2px 0; }
.chip + .chip::before { content: "-"; color: var(--text3); margin-right: 4px; }
.no-sep .chip + .chip::before { content: none; margin-right: 0; }
.dot-sep .chip + .chip::before { content: "."; color: var(--text3); margin-right: 1px; }
.chip-list.dot-sep { gap: 0; }
.badge-short { display: none; }
.badge-header { display: flex; }
.badge-body { display: none; }
.plan-card-header { gap: 6px !important; }
.plan-header-left { min-width: 0; }
.plan-header-right { white-space: nowrap; }
.plan-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.plan-title-row .card-period {
  white-space: nowrap;
}
.plan-header-left .badge-header {
  min-width: 0;
}
.plan-header-left .plan-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 5px;
  margin: 0 2px 0 0 !important;
  border-radius: 4px;
  line-height: 1.15;
}
@media (max-width: 767px) {
  .badge-full { display: none; }
  .badge-short { display: inline; }
  .plan-badge, .badge-body span { font-size: 8px !important; padding: 1px 3px !important; margin: 0 !important; -webkit-text-size-adjust: none; }
  .badge-header { display: none !important; }
  .badge-body { display: flex !important; gap: 1px !important; }
  .plan-title-row {
    gap: 4px;
    flex: 1;
  }
  .plan-title-row .card-period {
    font-size: 10px;
    min-width: 0;
  }
  .plan-header-right {
    margin-left: 4px;
  }
  .kill-zone-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px 4px;
  }
  .kill-zone-values-only {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 4px;
  }
  .kill-zone-item {
    min-height: 36px;
    padding: 4px 2px;
  }
  .kill-zone-values-only .kill-zone-item {
    flex: 0 0 auto;
    min-width: 46px;
    min-height: 34px;
    padding: 3px 6px;
    gap: 1px;
  }
  .kill-zone-mini-label {
    font-size: 5px;
  }
  .kill-zone-label {
    font-size: 9px;
  }
  .kill-zone-value {
    font-size: 11px;
  }
}
.chip.red  { color: var(--red); }
.chip.blue { color: var(--blue); }
.chip.green { color: var(--green); }

/* ── 方案名称 ── */
.plan-name { font-size: clamp(13px,2vw,17px); font-weight: 700; color: var(--text); text-align: center; margin-bottom: 4px; }

/* ── 统计栏 ── */
.stat-bar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 4px 10px; }
.stat-rate { font-weight: 700; color: var(--orange); font-size: 12px; }
.stat-btn {
  padding: 5px 12px; background: var(--bg2); border: 1px solid var(--border);
  color: var(--text2); border-radius: 6px; cursor: pointer; font-size: 11px;
  font-weight: 600; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  -webkit-tap-highlight-color: transparent;
}
.year-btn {
  font-size: 12px; padding: 4px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg2);
  color: var(--text2); cursor: pointer; font-weight: 600;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.year-btn:hover { background: var(--bg3); border-color: var(--text3); }
.year-btn:active { transform: scale(0.94); }
.year-btn.active {
  background: var(--red) !important; color: #fff !important; border-color: transparent !important;
  box-shadow: 0 2px 8px rgba(192,57,43,0.25);
}
.year-btn.active:active { transform: scale(0.94); }
@media (hover: hover) {
  .stat-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(9,132,227,0.2); }
}

/* ── 历史记录 ── */
.history-row {
  display: grid; grid-template-columns: 120px 120px minmax(0, 1fr);
  align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); gap: 8px;
  transition: background 0.15s;
}
.history-row:nth-child(even) { background: rgba(0,0,0,0.012); }
.history-row:hover { background: rgba(24,160,102,0.04); }
.history-row:last-child { border-bottom: none; }
.history-col-expect { font-size: 14px; color: var(--text2); white-space: nowrap; font-weight: 700; }
.history-col-time { font-size: 13px; color: var(--text3); white-space: nowrap; font-weight: 600; }
.history-col-balls { display: flex; align-items: center; flex-wrap: nowrap; justify-content: space-between; width: 100%; gap: 1px; }

.mini-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.mini-plus { color: var(--text3); font-size: 14px; margin-bottom: 10px; flex-shrink: 0; font-weight: 700; }
.mini-zodiac { font-size: 10px; color: var(--text2); text-align: center; line-height: 1.15; font-weight: 700; white-space: nowrap; }

.mini-ball {
  width: 28px; height: 28px; border-radius: 50%; font-size: 12px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0;
  border: none;
}
.mini-ball span {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; background: radial-gradient(circle at 40% 35%, #fff, #e8e8e8);
  border-radius: 50%; box-shadow: inset 0 1px 2px rgba(0,0,0,0.15);
  font-weight: 900; font-size: 12px;
}
.mini-ball.red { background: radial-gradient(circle at 30% 25%, #ff6b6b, #e03131 45%, #c0392b); background-color: #c0392b; }
.mini-ball.blue { background: radial-gradient(circle at 30% 25%, #74b9ff, #2563eb 45%, #1a5276); background-color: #1a5276; }
.mini-ball.green { background: radial-gradient(circle at 30% 25%, #2ecc71, #16a34a 45%, #145a32); background-color: #145a32; }
.mini-ball.mini-last {
  box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.45), 0 0 14px 3px rgba(255, 180, 0, 0.2);
}
.mini-ball.red span { color: #c0392b; background: radial-gradient(circle at 40% 35%, #fff, #fdf2f2); }
.mini-ball.blue span { color: #1a5276; background: radial-gradient(circle at 40% 35%, #fff, #eaf2fa); }
.mini-ball.green span { color: #145a32; background: radial-gradient(circle at 40% 35%, #fff, #eaf5ef); }

/* ── 历史面板 ── */
.history-ball { font-size: clamp(11px,1.5vw,13px); font-weight: 700; }
.history-zodiac { font-size: clamp(11px,1.5vw,13px); color: var(--text2); font-weight: 700; }
.history-panel { display: none; max-height: 300px; overflow-y: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: 100%; box-sizing: border-box; }
.history-panel::-webkit-scrollbar { display: none; }
.history-panel.open { display: block; }
.history-table { width: 100%; border-collapse: collapse; font-size: 10px; table-layout: fixed; }
.history-table th {
  position: sticky; top: 0; z-index: 1; background: var(--bg3);
  padding: 4px 2px; text-align: center; font-weight: 700; font-size: 9px;
  border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis;
}
.history-table td {
  padding: 4px 2px; text-align: center; font-size: 9px;
  border-bottom: 1px solid rgba(0,0,0,0.04); overflow: hidden; text-overflow: ellipsis;
}
.history-table .pred-cell { font-size: 8px; word-break: keep-all; line-height: 1.2; }
.history-table td:first-child,
.history-table th:first-child { width: 60px; line-height: 1.3; overflow: visible; text-overflow: clip; white-space: nowrap; }
.history-table td:first-child span { display: block; }
.history-table .hit  { color: var(--green); font-weight: 700; }
.history-table .miss { color: var(--red); font-weight: 700; }

/* ── 盈亏 ── */
.profit-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.profit-plan {
  padding: 8px 12px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(24,160,102,0.02), rgba(0,0,0,0.01));
  margin-bottom: 4px; border: 1px solid rgba(0,0,0,0.03);
}
.profit-plan-name { font-weight: 700; font-size: 14px; }
.profit-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 10px; }
.profit-label { color: var(--text2); font-weight: 600; min-width: 80px; }
.profit-amount { font-weight: 700; font-size: 13px; }
.profit-amount.pos { color: var(--green); }
.profit-amount.neg { color: var(--red); }
.profit-total { text-align: center; font-weight: 700; font-size: 14px; padding: 4px 0 2px; }

/* ── 综合命中率 ── */
.hit-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 10px 12px;
}
.hit-row:nth-child(odd) { background: rgba(0,0,0,0.012); }
.hit-row + .hit-row { border-top: 1px solid var(--border); }
.hit-name { font-size: 12px; font-weight: 700; }
.hit-line {
  display: grid;
  grid-template-columns: 78px 12px minmax(108px, 1fr) 12px 52px;
  align-items: baseline;
  gap: 6px;
  width: 100%;
}
.hit-col { min-width: 0; }
.hit-col-name { white-space: nowrap; }
.hit-col-pred {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hit-col-actual {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.hit-arrow { color: var(--text3); flex-shrink: 0; }
.hit-name.hit  { color: var(--green); }
.hit-name.miss { color: var(--red); }
.hit-badge {
  flex: 0 0 18px;
  width: 18px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

/* ── 十全十美回测表格美化 ── */
.hit-table { border-collapse: separate; border-spacing: 0; }
.hit-table thead th {
  background: linear-gradient(180deg, var(--bg3), var(--bg));
  font-size: 9px; padding: 5px 3px; white-space: nowrap;
  border-bottom: 2px solid var(--border); letter-spacing: 0.3px;
}
.hit-table tbody td {
  font-size: 10px; padding: 4px 2px;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: background 0.1s;
}
.hit-table tbody tr:hover td { background: rgba(24,160,102,0.04); }
.hit-table td:first-child { font-size: 9px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.hit-table .hit  { color: var(--green); font-weight: 700; }
.hit-table .miss { color: var(--red); font-weight: 700; }
.hit-table .no-data { color: var(--text3); opacity: 0.5; }
.hit-table .ball-sm { width: 22px; height: 22px; font-size: 10px; }
.hit-table .ball-sm span { width: 15px; height: 15px; font-size: 9px; }
.hit-table .draw-ball-label { font-size: 8px; }
.history-ball { font-size: clamp(11px,1.5vw,13px); font-weight: 700; }
.history-zodiac { font-size: clamp(11px,1.5vw,13px); color: var(--text2); font-weight: 700; }

/* ── 响应式 ── */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
  html, body { height: 100%; height: 100dvh; overflow: hidden; }
  body { display: flex; flex-direction: column; }
  .header { padding: 8px 6px; max-width: 100%; position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .header-top { flex-wrap: wrap; gap: 4px; }
  .header-title { font-size: 15px; }
  .main { flex: 1; padding: 63px 6px 56px; max-width: 100%; margin: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .main::-webkit-scrollbar { display: none; }
  .main .card { margin-left: 0 !important; margin-right: 0 !important; }
  .main .draw-card { padding-left: 12px !important; padding-right: 12px !important; }
  .card-header { padding: 7px 8px; }
  .card-title { font-size: 15px; }
  .card-period { font-size: 10px; }
  .card-body { padding: 8px 8px; }
  .history-title-row {
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 6px;
  }
  .history-title-row > span:first-child {
    width: auto;
    flex: 1;
  }
  .history-year-btns {
    display: flex;
    flex-basis: auto;
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    margin-left: 0;
    align-self: center;
  }

  /* 触摸优化：按钮最小尺寸 */
  button, .year-btn, .stat-btn, .pagination button, .file-tab { min-height: 36px; touch-action: manipulation; }
  .year-btn, .pagination button { padding: 5px 12px; font-size: 13px; }
  .stat-btn, #historyYearBtns button { min-height: 24px; padding: 2px 8px; font-size: 12px; }
  .top-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 0 0 env(safe-area-inset-bottom); margin: 0; height: calc(48px + env(safe-area-inset-bottom));
    display: flex;
  }
  .nav-item { padding: 0; font-size: 13px; flex: 1; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 0; gap: 6px; }
  .main { padding-bottom: calc(56px + env(safe-area-inset-bottom)) !important; }

  /* 直播球缩小 */
  .draw-period { font-size: 16px; }

  /* 历史记录 */
  .history-row { grid-template-columns: 82px minmax(0, 1fr); grid-template-rows: auto auto; padding: 8px 10px; gap: 6px; }
  .history-col-expect { grid-column: 1; grid-row: 1; align-self: end; text-align: center; font-size: 11px; line-height: 1.2; }
  .history-col-time { grid-column: 1; grid-row: 2; align-self: start; text-align: center; font-size: 10px; line-height: 1.2; }
  .history-col-balls { grid-column: 2; grid-row: 1 / span 2; gap: 0; }
  .mini-wrap { gap: 1px; }
  .mini-ball { width: 8vw; height: 8vw; font-size: 3.3vw; max-width: 31px; max-height: 31px; }
  .mini-ball span { width: 5.4vw; height: 5.4vw; font-size: 2.9vw; max-width: 20px; max-height: 20px; }
  .mini-zodiac { font-size: 2.15vw; }
  .mini-plus { font-size: 3.4vw; margin-bottom: 3vw; }

  /* 预测模块 */
  .chip { font-size: 15px; }
  .module-prediction { font-size: 15px; }
  .profit-grid { gap: 4px; }
  .profit-plan-name { font-size: 13px; }
  .profit-row { font-size: 11px; padding: 2px 8px; }
  .profit-amount { font-size: 12px; }
  .profit-label { min-width: 60px; }
  .profit-total { font-size: 12px; }
  .stat-bar { flex-wrap: wrap; gap: 4px; padding: 4px 8px; }
  .plan-stat-bar { flex-wrap: wrap; gap: 3px; justify-content: space-between; }
  .stat-rate { font-size: 11px; }
  .stat-btn { font-size: 11px; padding: 3px 6px; }

  /* 命中率 */
  .hit-row { padding: 6px 0; gap: 8px; }
  .hit-name { font-size: 11px; }
  .hit-line {
    grid-template-columns: 60px 10px minmax(0, 1fr) 10px 40px;
    gap: 4px;
  }
  .hit-col-pred {
    font-size: 10px;
    letter-spacing: 0;
  }
  .hit-badge { flex-basis: 16px; width: 16px; font-size: 11px; }

  /* 分页 */
  .pagination { gap: 3px; font-size: 10px; }
  .pagination button { min-width: 36px; padding: 6px 10px; font-size: 13px; }

  /* 历史面板 */
  .history-panel { max-height: 50vh; }

  /* 方案卡片 */
  .section-title { font-size: 15px; margin: 12px 0 8px; }
}

/* 超小屏防溢出 */
@media (max-width: 380px) {
  .draw-balls { gap: 2px; }
  .draw-ball { width: 32px; height: 32px; font-size: 14px; }
  .draw-ball span { width: 20px; height: 20px; font-size: 11px; }
  .draw-plus { font-size: 14px; margin: 0 2px; height: 28px; line-height: 28px; }
  .draw-bar { gap: 2px; min-height: 120px; }
  .draw-ball-label { font-size: 9px; }
}

/* 超小屏 */
@media (max-width: 480px) {
  .history-row { grid-template-columns: 74px minmax(0, 1fr); grid-template-rows: auto auto; padding: 6px 8px; gap: 6px; }
  .history-col-expect { font-size: 10px; }
  .history-col-time { font-size: 9px; text-align: center; }
  .history-col-balls { grid-column: auto; margin-top: 0; gap: 0; }
  .history-table td:first-child,
  .history-table th:first-child { width: 54px; }
  .mini-ball { width: 7.8vw; height: 7.8vw; font-size: 3.2vw; max-width: 28px; max-height: 28px; }
  .mini-ball span { width: 5.2vw; height: 5.2vw; font-size: 2.8vw; max-width: 18px; max-height: 18px; }
  .mini-zodiac { font-size: 2.35vw; }
  .mini-plus { font-size: 3.8vw; margin-bottom: 3vw; }
  .history-table .ball-sm { width: 22px; height: 22px; font-size: 10px; }
  .history-table .ball-sm span { width: 15px; height: 15px; font-size: 9px; }
  .history-table .draw-ball-label { font-size: 8px; }
  .history-ball { font-size: clamp(11px,1.5vw,13px); }
  .history-zodiac { font-size: clamp(11px,1.5vw,13px); }
  .hit-table .history-ball { font-size: 9px !important; width: 20px; height: 20px; line-height: 20px; }
  .hit-table .history-zodiac { font-size: 9px !important; }
  .hit-table .chip { font-size: 9px !important; padding: 1px 2px !important; }
  .hit-table td:first-child span { font-size: 8px !important; }
  .hit-table { table-layout: auto !important; }
  .hit-table th { font-size: 8px !important; padding: 2px 1px !important; white-space: nowrap; }
  .hit-table td { font-size: 8px !important; padding: 3px 1px !important; }
  .hit-rate-table th { font-size: 7px !important; padding: 2px 0 !important; }
  .hit-rate-table td { font-size: 7px !important; padding: 3px 0 !important; }
  .hit-rate-table .history-ball { width: 18px; height: 18px; line-height: 18px; font-size: 8px !important; }
  .hit-rate-table .history-zodiac { font-size: 8px !important; }
  .hit-rate-table td:first-child,
  .hit-rate-table th:first-child { width: 50px; }
  .hit-rate-table td:first-child span { font-size: 7px !important; }
  .nav-item { padding: 6px 18px; font-size: 12px; }
  .file-tab { padding: 4px 10px; font-size: 11px; }
}

/* ══════════════════════════════════
   桌面端美化 (≥768px)
   ══════════════════════════════════ */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  /* ── 背景 ── */
  body {
    background: linear-gradient(135deg, #f5f7fa 0%, #eef1f5 100%);
  }

  /* ── Header ── */
  .header {
    padding: 12px 32px 8px;
    max-width: 1000px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  }
  .header-title { font-size: 28px; }
  #clock { font-size: 15px; letter-spacing: 1px; }
  #date-display { font-size: 14px; }

  /* ── 导航 ── */
  .top-nav { margin-top: 8px; justify-content: center; }
  .nav-item {
    padding: 8px 32px;
    font-size: 15px;
    border-radius: 8px;
    position: relative;
    transition: all 0.25s;
  }
  .nav-item:hover {
    background: rgba(24,160,102,0.06);
    transform: translateY(-1px);
  }
  .nav-item.active {
    color: var(--green);
    background: rgba(24,160,102,0.08);
  }
  .nav-item span { font-size: 16px; }

  /* ── 主体 ── */
  .main {
    max-width: 1200px;
    padding: 24px 32px 40px;
  }

  /* ── 区块标题 ── */
  .section-title {
    font-size: 18px;
    margin: 24px 0 14px;
    padding-left: 14px;
  }
  .section-title::before {
    top: 4px;
    bottom: 4px;
    width: 4px;
    border-radius: 3px;
  }

  /* ── 卡片 ── */
  .card {
    border-radius: 12px;
    margin-bottom: 16px;
    transition: transform 0.2s, box-shadow 0.25s;
  }
  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
  }

  /* ── 走势图卡片桌面端 ── */
  .trend-card { padding: 16px 24px 8px; }
  .trend-attr-card { padding: 8px 16px; }
  .trend-attr-card svg,
  #trend-container svg { max-width: 100%; display: block; }
  #trend-container { max-width: 100%; }

  /* ── 号码热力图柱形图 ── */
  .heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0 4px;
    font-size: 11px;
    color: #888;
  }
  .legend-block {
    width: 28px;
    height: 12px;
    border-radius: 2px;
  }

  .card-header {
    padding: 16px 24px;
  }
  .plan-card-header {
    gap: 8px !important;
  }
  .plan-header-left {
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }
  .plan-header-left .badge-header {
    flex-wrap: nowrap !important;
    overflow: hidden;
  }
  .plan-title-row {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .plan-header-left .plan-badge {
    font-size: 9px;
    padding: 1px 4px;
    margin-right: 2px !important;
  }
  .plan-header-right .card-period {
    font-size: 11px;
  }
  .card-title { font-size: 18px; }
  .card-body { padding: 16px 20px; }

  /* ── 开奖区 ── */
  .draw-bar { gap: 14px; padding: 16px 0; }
  .draw-period { font-size: 18px; }

  /* ── 历史记录 ── */
  .history-row {
    grid-template-columns: 160px 140px minmax(0, 1fr);
    padding: 14px 24px;
    gap: 12px;
    cursor: pointer;
  }
  .history-row:hover {
    background: rgba(24,160,102,0.06);
  }
  .history-col-expect { font-size: 15px; }
  .history-col-time { font-size: 14px; }

  .mini-ball {
    width: 34px; height: 34px;
    font-size: 14px;
  }
  .mini-ball span {
    width: 22px; height: 22px;
    font-size: 13px;
  }
  .mini-plus { font-size: 18px; margin-bottom: 16px; }
  .mini-zodiac { font-size: 12px; }
  .mini-wrap { gap: 4px; }

  /* ── 号码芯片 ── */
  .chip { font-size: 16px; }
  .chip-list { gap: 6px; }
  .history-ball { font-size: clamp(12px,1.5vw,14px); }
  .history-zodiac { font-size: clamp(12px,1.5vw,14px); }

  /* ── 统计栏 ── */
  .stat-bar { padding: 6px 16px; }
  .stat-rate { font-size: 13px; }
  .stat-btn {
    padding: 6px 16px;
    font-size: 12px;
  }

  /* ── 预测模块 ── */
  .module-prediction { font-size: 20px; }

  /* ── 方案 ── */
  .plan-name { font-size: 17px; margin-bottom: 8px; }
  .profit-plan { padding: 12px 20px; }
  .profit-plan-name { font-size: 16px; }
  .profit-row { font-size: 14px; padding: 4px 16px; }
  .profit-amount { font-size: 15px; }
  .profit-label { min-width: 100px; }
  .profit-total { font-size: 16px; padding: 8px 0 4px; }

  /* ── 命中率 ── */
  .hit-row { padding: 12px 20px; }
  .hit-name { font-size: 14px; }
  .hit-badge { font-size: 14px; }

  /* ── 历史面板 ── */
  .history-panel { max-height: 400px; }
  .history-table th { font-size: 11px; padding: 6px 4px; }
  .history-table td { font-size: 11px; padding: 6px 4px; }

  /* ── 分页 ── */
  .pagination { gap: 8px; padding: 8px 16px 12px; font-size: 13px; }
  .pagination button {
    min-width: 38px;
    padding: 6px 14px;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.15s;
  }
