/*!
 * assets/theme.css — 设计系统：浅色/深色主题、布局、走势表、图表与组件
 */

:root {
  --bg: #f3f5fa;
  --bg-deep: #e9edf6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --text: #1d2433;
  --text-2: #55607a;
  --muted: #8992a7;
  --border: #e4e9f2;
  --border-strong: #d3dae7;
  --accent: #d64541;
  --accent-strong: #b5322f;
  --accent-soft: #fdecea;
  --blue: #2f80c9;
  --blue-strong: #2467a5;
  --blue-soft: #eaf3fb;
  --green: #1f9d63;
  --green-soft: #e9f7ef;
  --amber: #d99422;
  --amber-soft: #fdf4e3;
  --purple: #8061c9;
  --danger: #d64541;

  --front-rgb: 214, 69, 65;
  --back-rgb: 47, 128, 201;
  --heat: 0.028;

  --chart-1: #d64541;
  --chart-2: #2f80c9;
  --chart-3: #d99422;
  --chart-4: #1f9d63;
  --chart-5: #8061c9;
  --chart-6: #158e8e;
  --chart-grid: rgba(120, 134, 160, 0.16);
  --chart-axis: rgba(120, 134, 160, 0.35);
  --chart-text: #7c869b;
  --chart-surface: rgba(120, 134, 160, 0.08);

  --focus-bg: rgba(217, 148, 34, 0.18);
  --focus-border: rgba(217, 148, 34, 0.65);
  --focus-text: #8a5b00;
  --repeat-ring: rgba(241, 196, 15, 0.95);

  --shadow-sm: 0 1px 2px rgba(20, 28, 45, 0.04);
  --shadow: 0 1px 2px rgba(20, 28, 45, 0.04), 0 10px 26px rgba(20, 28, 45, 0.06);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.16);
  --radius: 14px;
  --radius-sm: 9px;
  --header-height: 58px;
  --tabbar-height: 50px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1118;
  --bg-deep: #0a0d13;
  --surface: #151b26;
  --surface-2: #1a2130;
  --surface-3: #202838;
  --text: #e8edf7;
  --text-2: #aab4c8;
  --muted: #7c879d;
  --border: #242c3c;
  --border-strong: #313b4f;
  --accent: #ff6f66;
  --accent-strong: #ff8d86;
  --accent-soft: rgba(255, 111, 102, 0.14);
  --blue: #5aa9ef;
  --blue-strong: #83c2fb;
  --blue-soft: rgba(90, 169, 239, 0.14);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.14);
  --amber: #f0b64b;
  --amber-soft: rgba(240, 182, 75, 0.14);
  --purple: #a58bff;
  --danger: #ff6f66;

  --front-rgb: 255, 111, 102;
  --back-rgb: 90, 169, 239;
  --heat: 0.042;

  --chart-1: #ff6f66;
  --chart-2: #5aa9ef;
  --chart-3: #f0b64b;
  --chart-4: #3ecf8e;
  --chart-5: #a58bff;
  --chart-6: #35c2c2;
  --chart-grid: rgba(150, 165, 195, 0.16);
  --chart-axis: rgba(150, 165, 195, 0.32);
  --chart-text: #93a0b8;
  --chart-surface: rgba(150, 165, 195, 0.08);

  --focus-bg: rgba(240, 182, 75, 0.18);
  --focus-border: rgba(240, 182, 75, 0.5);
  --focus-text: #ffd88a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 12% -8%, rgba(var(--front-rgb), 0.08), transparent 60%),
    radial-gradient(900px 420px at 92% -12%, rgba(var(--back-rgb), 0.09), transparent 62%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; line-height: 1.25; }
p { margin: 0; }
button { font-family: inherit; }
a { color: var(--blue); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.danger-text { color: var(--danger) !important; }

/* ================= 顶部 ================= */

.site-header {
  position: relative;
  background: linear-gradient(135deg, rgba(var(--front-rgb), 0.95), rgba(163, 32, 32, 0.92) 55%, rgba(122, 24, 45, 0.94));
  color: #fff;
  box-shadow: 0 8px 26px rgba(90, 20, 20, 0.22);
}
[data-theme="dark"] .site-header {
  background: linear-gradient(135deg, rgba(120, 34, 34, 0.9), rgba(74, 22, 40, 0.94) 60%, rgba(30, 22, 44, 0.96));
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.site-header::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
.header-inner {
  position: relative; z-index: 1;
  max-width: 1480px; margin: 0 auto;
  padding: 14px 20px 10px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: grid; place-items: center;
  backdrop-filter: blur(6px);
  flex: none;
}
.brand-logo svg { display: block; }
.brand-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-title h1 { font-size: 20px; letter-spacing: 0.06em; }
.brand-title p { font-size: 12px; opacity: 0.82; letter-spacing: 0.02em; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.game-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  background: rgba(0, 0, 0, 0.18); border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.game-switch a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none; font-size: 12.5px; padding: 6px 15px; border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.game-switch a:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.game-switch a.active { background: #fff; color: var(--accent-strong); font-weight: 650; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: #fff; display: grid; place-items: center;
  cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.2); }
.icon-btn:active { transform: scale(0.94); }

.header-meta {
  position: relative; z-index: 1;
  max-width: 1480px; margin: 0 auto;
  padding: 0 20px 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: rgba(255, 255, 255, 0.78);
}
.meta-sep { opacity: 0.4; }
.meta-item b { color: #fff; font-weight: 650; }
.meta-item.badge-local {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 9px; border-radius: 999px; color: #fff;
}

/* ================= 标签栏 ================= */

.tabbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; gap: 2px;
  padding: 0 max(12px, calc((100vw - 1480px) / 2 + 20px));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.3);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbtn {
  position: relative;
  border: 0; background: transparent; color: var(--text-2);
  font-size: 14px; padding: 0 18px; height: var(--tabbar-height);
  cursor: pointer; white-space: nowrap; font-weight: 550;
  display: inline-flex; align-items: center; gap: 7px;
  transition: color 0.15s;
}
.tabbtn:hover { color: var(--text); }
.tabbtn.active { color: var(--accent); font-weight: 700; }
.tabbtn.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2.5px;
  border-radius: 2px 2px 0 0; background: var(--accent);
}
.tabbtn .tab-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.35;
}
.tabbtn.active .tab-dot { opacity: 1; }

/* ================= 布局 ================= */

main {
  max-width: 1480px; margin: 0 auto;
  padding: 18px 20px 40px;
}
.panel { display: none; }
.panel.active { display: block; animation: panel-in 0.22s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h2 { font-size: 20px; letter-spacing: 0.01em; }
.panel-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 720px; }
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.site-footer {
  max-width: 1480px; margin: 0 auto; padding: 18px 20px 40px;
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.site-footer .dot-sep { margin: 0 8px; opacity: 0.5; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.card-head h3 { font-size: 15px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-note { color: var(--muted); font-size: 12px; margin-top: 10px; }
.card-note.warn-note { color: var(--amber); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 14px;
}

/* ================= 表单控件 ================= */

.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  line-height: 1.2;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.green:hover { filter: brightness(1.06); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn.xs { padding: 5px 9px; font-size: 11.5px; border-radius: 7px; }
.btn.file-btn { position: relative; overflow: hidden; }

.input {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--front-rgb), 0.13); }
.input::placeholder { color: var(--muted); }
.select { cursor: pointer; padding-right: 26px; }
.num-input { width: 74px; text-align: center; font-family: var(--mono); }
.textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.9;
  outline: none;
}
.textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--front-rgb), 0.12); }

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.seg-btn {
  border: 0; background: transparent; color: var(--text-2);
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input {
  appearance: none; width: 32px; height: 18px; border-radius: 999px;
  background: var(--border-strong); position: relative; cursor: pointer;
  transition: background 0.16s; margin: 0;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: transform 0.16s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2);
  font-size: 12px; font-weight: 550;
  white-space: nowrap;
}
.pill .pill-k { color: var(--muted); font-weight: 500; }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--accent-soft); color: var(--accent); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  padding: 5px 11px; border-radius: 999px;
  font-size: 12px; cursor: default;
}
.chip-period { cursor: pointer; font-family: var(--mono); }
.chip-period:hover { border-color: var(--accent); color: var(--accent); }
.chip-period small { color: var(--muted); font-family: var(--font); }
.chip-pair { cursor: pointer; }
.chip-pair:hover { border-color: var(--accent); color: var(--accent); }
.chip-pair b { color: var(--accent); }

.num-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  min-width: 42px; justify-content: center;
  padding: 5px 8px; border-radius: 9px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: all 0.13s;
}
.num-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.num-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.num-chip-count { font-style: normal; font-size: 9.5px; font-weight: 500; opacity: 0.65; font-family: var(--font); }
.num-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.num-chip.active .chip-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95); }
.chip-scroll { display: flex; gap: 5px; flex-wrap: wrap; max-width: 100%; }

/* ================= 号码球 ================= */

.ball-set { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ball {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  flex: none;
}
.ball.sm { width: 27px; height: 27px; font-size: 11.5px; }
.ball.lg { width: 46px; height: 46px; font-size: 19px; }
.ball.red { background: linear-gradient(150deg, #ef6f68, #b5322f); box-shadow: 0 2px 8px rgba(var(--front-rgb), 0.32); }
.ball.blue { background: linear-gradient(150deg, #5aa9ef, #2467a5); box-shadow: 0 2px 8px rgba(var(--back-rgb), 0.32); }
[data-theme="dark"] .ball.red { background: linear-gradient(150deg, #dd645d, #992d29); }
[data-theme="dark"] .ball.blue { background: linear-gradient(150deg, #4a9be0, #1c5487); }
.ball.match { outline: 2px solid #f5c542; outline-offset: 1px; }
.ball-sep { color: var(--muted); font-weight: 700; margin: 0 1px; }

/* ================= 顶部 hero ================= */

.hero {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 18px 20px; margin-bottom: 14px;
  background:
    linear-gradient(120deg, var(--surface), color-mix(in srgb, var(--accent-soft) 55%, var(--surface)));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-main { display: flex; flex-direction: column; gap: 10px; }
.hero-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); font-weight: 600; flex-wrap: wrap; }
.hero-label .pill { background: var(--accent); color: #fff; font-weight: 650; }
.hero-balls .ball { animation: ball-pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.hero-balls .ball:nth-child(2) { animation-delay: 0.03s; }
.hero-balls .ball:nth-child(3) { animation-delay: 0.06s; }
.hero-balls .ball:nth-child(4) { animation-delay: 0.09s; }
.hero-balls .ball:nth-child(5) { animation-delay: 0.12s; }
@keyframes ball-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.hero-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.mini-stat {
  min-width: 64px; padding: 7px 10px; border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  text-align: center;
}
.mini-stat span { display: block; font-size: 10.5px; color: var(--muted); }
.mini-stat b { font-size: 15px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ================= 统计卡 ================= */

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11.5px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 750; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }

/* ================= 走势图 ================= */

.filter-card { margin-bottom: 12px; padding: 13px 16px; }
.filter-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.filter-row + .filter-row { margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--border); }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-group.grow { flex: 1; min-width: 200px; }
.filter-group.grow .input { flex: 1; }
.filter-label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.filter-group.actions { margin-left: auto; }
.filter-group.toggles { gap: 16px; }

.focus-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 14px; margin-bottom: 10px;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 38%, transparent);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  animation: panel-in 0.18s ease;
}
.focus-title { font-weight: 650; }
.focus-meta { color: var(--text-2); }
.focus-meta b { font-family: var(--mono); color: var(--text); font-size: 13px; }
.focus-spacer { flex: 1; }

.trend-card { padding: 0; overflow: hidden; }
.trend-scroll {
  overflow: auto;
  max-height: min(70vh, 760px);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.trend-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 11px;
  table-layout: fixed;
}
.trend-table col.col-seq { width: 38px; }
.trend-table col.col-period { width: 66px; }
.trend-table col.col-num { width: 23px; }
.trend-table col.col-sum { width: 52px; }

.trend-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 650;
  border-bottom: 1px solid var(--border);
  z-index: 5;
  font-size: 10.5px;
  padding: 0;
  height: 30px;
}
.trend-table thead tr:first-child th { top: 0; height: 30px; }
.trend-table thead tr:nth-child(2) th { top: 30px; height: 26px; }
.trend-table thead th.zone-head { font-size: 11px; letter-spacing: 0.08em; color: var(--text-2); }
.trend-table thead th.zone-front { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface-2)); color: var(--accent); }
.trend-table thead th.zone-back { background: color-mix(in srgb, var(--blue-soft) 55%, var(--surface-2)); color: var(--blue); }
.trend-table th.num-head {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
.trend-table th.num-head:hover { background: var(--surface-3); color: var(--accent); }
.trend-table th.num-back:hover { color: var(--blue); }
.trend-table th.sum-head { font-size: 10.5px; color: var(--muted); font-weight: 600; }

.trend-table .sticky-seq { position: sticky; left: 0; z-index: 4; background: var(--surface); }
.trend-table .sticky-period { position: sticky; left: 38px; z-index: 4; background: var(--surface); }
.trend-table thead .sticky-seq,
.trend-table thead .sticky-period { z-index: 8; background: var(--surface-2); }
.trend-table .sticky-seq { border-right: 1px solid var(--border); }
.trend-table .sticky-period { border-right: 1px solid var(--border-strong); }

.trend-table tbody td {
  height: 26px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 62%, transparent);
  text-align: center;
  padding: 0;
}
.trend-table tbody tr:nth-child(even) .cell { background-color: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.trend-table tbody tr:hover td { background-color: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.trend-table tbody tr.is-latest td { background-color: color-mix(in srgb, var(--accent-soft) 70%, transparent); }

.seq-cell { color: var(--muted); font-size: 10px; font-family: var(--mono); }
.period-cell {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.period-cell:hover { color: var(--accent); }
.latest-tag { font-style: normal; font-size: 9px; background: var(--accent); color: #fff; border-radius: 3px; padding: 1px 3px; margin-left: 2px; }

.trend-table td.cell { position: relative; }
.trend-table .hitball {
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; border-radius: 50%;
  color: #fff; font-size: 9.5px; font-weight: 700;
  font-family: var(--mono);
  cursor: pointer;
  transition: transform 0.1s;
}
.trend-table .hitball:hover { transform: scale(1.18); }
.trend-table .hitball.red { background: linear-gradient(150deg, #ef6f68, #b5322f); }
.trend-table .hitball.blue { background: linear-gradient(150deg, #5aa9ef, #2467a5); }
[data-theme="dark"] .trend-table .hitball.red { background: linear-gradient(150deg, #dd645d, #992d29); }
[data-theme="dark"] .trend-table .hitball.blue { background: linear-gradient(150deg, #4a9be0, #1c5487); }
.trend-table .hitball.repeat { box-shadow: 0 0 0 2px var(--repeat-ring); }
.trend-table .miss-val { font-size: 9px; color: var(--muted); font-family: var(--mono); }

.miss-cell { --lv: 1; }
.miss-cell.h1 { --lv: 1; } .miss-cell.h2 { --lv: 2; } .miss-cell.h3 { --lv: 3; }
.miss-cell.h4 { --lv: 4; } .miss-cell.h5 { --lv: 5; } .miss-cell.h6 { --lv: 6; }
.miss-cell.h7 { --lv: 7; } .miss-cell.h8 { --lv: 8; } .miss-cell.h9 { --lv: 9; }
.trend-table td.miss-cell.front { background-color: rgba(var(--front-rgb), calc(var(--heat) * var(--lv))); }
.trend-table td.miss-cell.back { background-color: rgba(var(--back-rgb), calc(var(--heat) * var(--lv))); }
.trend-table td.miss-cell .miss-val { color: color-mix(in srgb, var(--text) 60%, var(--muted)); }
.trend-table.hide-miss .miss-val { display: none; }
.trend-table.hide-heat td.miss-cell { background-color: transparent; }

.trend-table .sum-cell { font-size: 10.5px; font-family: var(--mono); color: var(--text-2); }
.trend-table .sum-cell b { color: var(--text); }
.trend-table .sum-cell.zones { color: var(--muted); font-size: 10px; }

.trend-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 14px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11.5px; flex-wrap: wrap;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--accent); }
.dot-blue { background: var(--blue); }
.dot-heat { background: linear-gradient(90deg, rgba(var(--front-rgb), 0.1), rgba(var(--front-rgb), 0.85)); }
.dot-repeat { background: var(--repeat-ring); }

.trend-card:fullscreen { background: var(--bg); border-radius: 0; display: flex; flex-direction: column; }
.trend-card:fullscreen .trend-scroll { max-height: none; flex: 1; }

/* ================= 图表 ================= */

.chart-card { margin-bottom: 0; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-frame { width: 100%; height: 100%; }
.chart-error { padding: 20px; color: var(--danger); font-size: 13px; }

.chart-tip {
  position: fixed; top: 0; left: 0; z-index: 300;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 8px 11px;
  font-size: 12px;
  min-width: 96px;
  opacity: 0;
  transition: opacity 0.1s;
}
.chart-tip.show { opacity: 1; }
.tip-title { font-weight: 700; margin-bottom: 4px; font-size: 12px; }
.tip-row { display: flex; align-items: center; gap: 6px; line-height: 1.65; }
.tip-row b { margin-left: auto; font-family: var(--mono); }
.tip-name { color: var(--muted); }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.pairs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pairs-title { font-size: 11.5px; color: var(--muted); }

/* ================= 详情弹窗内容 ================= */

.detail-hero {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.detail-title { font-size: 16px; font-weight: 700; }
.detail-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.detail-hero-balls { margin-left: auto; }
.detail-hero-right { margin-left: auto; }
.detail-hero-card .detail-hero { border-bottom: 0; padding-bottom: 0; margin-bottom: 6px; }
.detail-block { margin-top: 16px; }
.detail-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.detail-block-head h4 { font-size: 13px; }
.detail-block-head .muted { font-size: 11.5px; }

.strip { display: flex; gap: 4px; flex-wrap: wrap; }
.strip-cell {
  width: 40px; padding: 4px 0 3px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: transform 0.1s, border-color 0.12s;
}
.strip-cell:hover { transform: translateY(-2px); border-color: var(--accent); }
.strip-miss { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.strip-period { font-size: 8.5px; color: var(--muted); opacity: 0.8; }
.strip-cell.hit.red { background: var(--accent); border-color: var(--accent); }
.strip-cell.hit.blue { background: var(--blue); border-color: var(--blue); }
.strip-cell.hit .strip-miss, .strip-cell.hit .strip-period { color: #fff; }

.link-btn { border: 0; background: transparent; color: var(--blue); cursor: pointer; padding: 0; font-family: var(--mono); font-size: 12px; }
.link-btn:hover { text-decoration: underline; }

/* ================= 选号器 ================= */

.picker-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.85fr); gap: 14px; align-items: start; }
.picker-card { padding: 18px; }
.num-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 7px; max-width: 740px; }
.num-grid.grid-back { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.pick-ball {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.14s, color 0.14s, border-color 0.14s;
}
.pick-ball:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.pick-ball.selected.red { background: linear-gradient(150deg, #ef6f68, #b5322f); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(var(--front-rgb), 0.35); }
.pick-ball.selected.blue { background: linear-gradient(150deg, #5aa9ef, #2467a5); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(var(--back-rgb), 0.35); }
[data-theme="dark"] .pick-ball.selected.red { background: linear-gradient(150deg, #dd645d, #992d29); }
[data-theme="dark"] .pick-ball.selected.blue { background: linear-gradient(150deg, #4a9be0, #1c5487); }
.picker-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.picker-stats { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.picker-balls { margin-bottom: 10px; min-height: 30px; display: flex; align-items: center; }
.picker-side { display: grid; gap: 14px; }
.best-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.picker-summary { margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.picker-summary b { color: var(--accent); font-family: var(--mono); }
.hit-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 5px; }
.hit-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.hit-list .muted { font-family: var(--mono); }
.hotcold { display: grid; gap: 12px; }
.hotcold h5 { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.ticket-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ticket-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.ticket-actions { display: flex; gap: 5px; }

/* ================= 核对 ================= */

.check-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.draw-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
}
.banner-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; flex-wrap: wrap; }
.check-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.check-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px;
  padding: 12px; margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #fff;
}
.summary-item { text-align: center; }
.summary-item span { display: block; font-size: 10.5px; opacity: 0.82; }
.summary-item b { font-size: 18px; font-family: var(--mono); }
.summary-item.best b { font-size: 14px; }
.ticket-results { display: grid; gap: 8px; }
.ticket-result {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 12px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.ticket-result.won { border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: color-mix(in srgb, var(--amber-soft) 55%, var(--surface-2)); }
.ticket-result.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--accent-soft); flex-direction: column; align-items: flex-start; }
.ticket-line { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.ticket-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.ticket-amount { color: var(--accent); font-family: var(--mono); }
.ticket-error { color: var(--danger); font-size: 12px; }
.tier-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--muted);
  white-space: nowrap;
}
.tier-badge.none { background: var(--surface-3); color: var(--muted); }
.tier-badge.t1 { background: linear-gradient(120deg, #e8a33d, #d2691e); }
.tier-badge.t2 { background: linear-gradient(120deg, #9b6ecf, #7a4fb5); }
.tier-badge.t3 { background: linear-gradient(120deg, #e05c54, #b5322f); }
.tier-badge.t4 { background: linear-gradient(120deg, #e08a3c, #bf6a1e); }
.tier-badge.t5 { background: linear-gradient(120deg, #33b57a, #1f8f5e); }
.tier-badge.t6 { background: linear-gradient(120deg, #2f9e9e, #1b7a7a); }
.tier-badge.t7 { background: linear-gradient(120deg, #4f95d2, #2f70a8); }
.tier-badge.t8, .tier-badge.t9 { background: linear-gradient(120deg, #8b96a8, #6a7488); }

/* ================= 表格 ================= */

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.table th {
  text-align: left; font-weight: 650; font-size: 11.5px; color: var(--muted);
  padding: 8px 10px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
  white-space: nowrap;
}
.table td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table.compact td { padding: 6px 10px; }
.table .clickable { cursor: pointer; }
.table .clickable:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.table-scroll { overflow: auto; border-radius: 10px; border: 1px solid var(--border); }
.table-more { text-align: center; padding-top: 12px; }
.balls-cell .ball { margin-right: 2px; }
.history-table td.balls-cell { min-width: 250px; }
.row-actions { white-space: nowrap; }

/* ================= 数据管理 ================= */

.admin-grid { align-items: start; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); }
.field.grow { flex: 1; }
.field > .input { width: 100%; }
.ball-input-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ball-input-row .input { width: 62px; text-align: center; font-family: var(--mono); padding: 8px 6px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.data-source { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--muted); display: grid; gap: 4px; }
.data-source code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.src-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; font-weight: 650; }
.src-badge.add { background: var(--green-soft); color: var(--green); }
.src-badge.edit { background: var(--amber-soft); color: var(--amber); }
.inline-msg { font-size: 12px; }
.inline-msg.success { color: var(--green); }
.inline-msg.error { color: var(--danger); }
.inline-msg.warn { color: var(--amber); }
.inline-msg.loading { color: var(--blue); }
.inline-msg.info { color: var(--text-2); }
.inline-msg:not(:empty) { padding: 6px 0; }

/* ================= 弹窗 / 提示 ================= */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(10, 14, 22, 0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fade-in 0.16s ease;
}
.modal-backdrop.closing { animation: fade-out 0.16s ease forwards; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.modal.wide { width: min(940px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-close {
  border: 0; background: var(--surface-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 13px; line-height: 1;
}
.modal-close:hover { background: var(--accent-soft); color: var(--accent); }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 16px 16px;
  flex-wrap: wrap;
}
.confirm-text { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.help-grid h4 { font-size: 13px; margin-bottom: 4px; }
.help-grid p { font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 5px; background: var(--surface-2);
}

#toastRoot { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 600; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--text);
  color: var(--surface);
  padding: 9px 16px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--amber); color: #fff; }
.toast.leaving { animation: toast-out 0.4s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ================= 空态 / 错误 ================= */

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 12px; color: var(--muted); text-align: center; }
.empty-icon { font-size: 24px; opacity: 0.8; }
.empty-text { font-size: 12.5px; }
.fatal-card { max-width: 640px; margin: 60px auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; text-align: center; box-shadow: var(--shadow); }
.fatal-icon { font-size: 34px; color: var(--danger); }
.fatal-card h2 { font-size: 18px; margin: 10px 0; }
.fatal-card p { color: var(--text-2); font-size: 13px; line-height: 1.8; margin-bottom: 8px; }
.fatal { position: fixed; inset: 0; background: var(--bg); color: var(--danger); display: grid; place-items: center; font-size: 14px; z-index: 999; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= 响应式 ================= */

@media (max-width: 1200px) {
  .picker-layout { grid-template-columns: 1fr; }
  .picker-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .grid2, .check-layout { grid-template-columns: 1fr; }
  .hero-stats { margin-left: 0; }
  .detail-hero-balls { margin-left: 0; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .header-inner { padding: 12px 14px 8px; gap: 10px; }
  .brand-title h1 { font-size: 17px; }
  .brand-title p { font-size: 11px; }
  .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
  .header-meta { padding: 0 14px 10px; font-size: 11px; }
  .header-actions { gap: 6px; }
  .game-switch a { padding: 5px 11px; font-size: 11.5px; }
  .icon-btn { width: 32px; height: 32px; }
  main { padding: 14px 12px 32px; }
  .panel-head h2 { font-size: 17px; }
  .tabbtn { padding: 0 12px; font-size: 13px; }
  .card { padding: 13px; border-radius: 12px; }
  .hero { padding: 14px; gap: 14px; }
  .ball.lg { width: 38px; height: 38px; font-size: 16px; }
  .filter-group.actions { margin-left: 0; }
  .filter-row { gap: 10px; }
  .picker-side { grid-template-columns: 1fr; }
  .num-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); max-width: none; }
  .num-grid.grid-back { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
  .trend-scroll { max-height: 66vh; }
  .strip-cell { width: 34px; }
  .stat-value { font-size: 17px; }
  .modal { max-height: 92vh; }
  .modal-backdrop { padding: 10px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .brand-title p { display: none; }
  .header-actions { margin-left: auto; }
  .panel-tools { width: 100%; }
  .seg { overflow-x: auto; max-width: 100%; }
  .num-grid, .num-grid.grid-back { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 5px; }
  .pick-ball { font-size: 11.5px; }
  .hero-stats { gap: 6px; width: 100%; }
  .mini-stat { min-width: 56px; padding: 6px 5px; }
  .mini-stat b { font-size: 14px; }
  .check-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
