.analysis-width { width: min(1000px, calc(100% - 32px)); }
#analysis { padding-top: clamp(18px, 3vh, 28px); }

/* 「彩种 / 统计范围」吸顶：
   这一页从上到下有趋势、奖池、落点、冷热、结构、规律、体检、奖级八张卡，
   手机一路滑到「落点」想看别的窗口时，这行早就滚出屏幕，只能滑回顶部再滑
   下来，来回三四屏。所以让它吸在视口顶上。
   ① 没滚动时它就是页面里普通的一行，不悬浮、不挡标题；
   ② 滚过它自己之后贴住顶部，换彩种／窗口不用再找；
   ③ 吸住时补一层页面底色与分隔线，卡片从下面穿过时不会和按钮文字叠在一起。
   只吸这一条，不吸奖级（一/二/三等奖）：奖级只影响趋势卡，滚到「落点」
   再切也看不到图变化，吸着反而让人以为能就地看到新图。
   用 sticky 而不是 fixed：sticky 在文档流里占位，不会像固定条那样从一开局
   就压住内容，滚到页面最底也会自动让位（上一轮摇号页的吸底条就踩过
   fixed 的坑——父容器没进视口时它先挡住半屏）。 */
.filters-sentinel { height: 1px; margin-top: -1px; }
.analysis-filters {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  /* 左右各撑出 10px：吸住时条子比卡片略宽，卡片从上／下穿过不会在两侧
     留下一道白边，看着像卡片从条子底下漏出来 */
  margin: 18px -10px 0;
  padding: 8px 10px;
  /* 底色常驻而不是只在吸住时加：它和页面同色，静止时看不出来；一旦有卡片
     从下面穿过就是一层实底。这样即使脚本没跑到（旧浏览器、被拦、滚动事件
     没派发），文字也不会和卡片叠在一起，功能不依赖 JS。 */
  background: var(--page);
  transition: box-shadow .18s;
}
/* 吸住时补一条分隔线：卡片边缘从条子底下露出来时，没有这道线会分不清
   哪条是筛选、哪条是卡片标题 */
.analysis-filters.is-stuck {
  box-shadow: 0 1px 0 var(--line), 0 12px 18px -18px #10182066;
}
/* 换窗口时页面不再塌成空白，而是在条子底边跑一条流光当进度：
   用户正看着「落点」时，上方的「正在读取」文案已经不在视野里 */
.analysis-filters::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 1px;
  left: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--primary) 45%, transparent);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity .15s;
}
.analysis-filters[data-loading="true"]::after {
  opacity: .85;
  animation: filters-fetch 1.1s ease-in-out infinite alternate;
}
/* 两端都留在元素内：0% 时亮块贴左、100% 时贴右，来回推移。写成
   -50% → 150% 的话起点和终点都在框外，刚点下去的那一瞬是空白的，
   看起来像「没反应」 */
@keyframes filters-fetch {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .analysis-filters[data-loading="true"]::after { animation: none; opacity: .55; background-position: 50% 0; }
}
/* 换窗口时旧内容淡一档但不消失：整块 hidden 会让页面高度瞬间塌回顶部，
   用户点一下「近半年」就被弹回页首，等于白吸 */
#analysis-results { transition: opacity .18s; }
#analysis-results[aria-busy="true"] { opacity: .45; }
.analysis-filters .switcher { margin: 0; }
/* 页内分区跳转：八张卡、手机近十屏，滚到「落点」想回「趋势」只能一路滑回去。
   它挂在同一个吸顶壳里当第二行（不是第二条 sticky），页面只多 44px；
   芯片横排可滚，8 个在 390 宽下正好一屏多一点点。 */
.section-nav {
  flex: 1 0 100%;
  display: flex;
  gap: 6px;
  /* 跟着吸顶壳一起左右出血，横向滚到头时芯片贴屏幕边而不是卡里 */
  margin: 0 -10px;
  padding: 0 10px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
}
/* 当前分区：底纹 + 主色字，不靠加粗（中文加粗会变宽，芯片跟着跳） */
.section-nav a[aria-current="true"] {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  background: color-mix(in srgb, var(--primary) 9%, var(--paper));
  color: var(--primary);
}
@media (hover: hover) {
  .section-nav a:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); color: var(--primary); }
}
/* 跳转落点要避开吸顶壳：高度由脚本写进 --sticky-h（换彩种时筛选条可能换行，
   写死一个数在窄屏上会让卡片标题被条子盖住）。 */
.analysis-card { scroll-margin-top: calc(var(--sticky-h, 112px) + 12px); }
#analysis-status { color: var(--ink-muted); margin: 18px 0; font-size: 13px; font-variant-numeric: tabular-nums; }

.analysis-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(16px, 3vw, 26px);
  margin: 16px 0;
  box-shadow: 0 1px 2px #10182008, 0 18px 36px -30px #10182040;
}
.analysis-card h2 { margin: 0 0 4px; color: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.analysis-caption { margin: 0 0 16px; color: var(--ink-muted); font-size: 13px; line-height: 1.6; }

.trend-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 12px; }
.trend-fields .switcher { margin: 0; }
.trend-fields label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-soft); font-size: 13px; }
.trend-fields input { accent-color: var(--primary); }
.trend-hint { margin: 10px 0 0; color: var(--ink-muted); font-size: 12px; line-height: 1.6; }
.trend-extra {
  margin: 8px 0 0;
  padding: 7px 10px;
  border-left: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--primary) 4%, transparent);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.trend-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.trend-stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.trend-stats[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.trend-stats div {
  position: relative;
  padding: 10px 12px 10px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.trend-stats div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
  opacity: .5;
}
.trend-stats dt { color: var(--ink-muted); font-size: 12px; }
.trend-stats dd { margin: 4px 0 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-stats small { display: block; margin-top: 3px; color: var(--ink-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

.trend-facts { display: grid; gap: 5px; margin: 12px 0 0; padding: 0; list-style: none; }
.trend-facts li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 5px; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.trend-facts li::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  opacity: .45;
  align-self: center;
}
.trend-facts b { flex: none; color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.trend-facts b::after { content: "："; }

.trend-plots { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 900px) {
  .trend-plots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
#trend-plots.single { grid-template-columns: minmax(0, 1fr); }
.trend-plot {
  margin: 0;
  padding: 12px 12px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.trend-plot h3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.trend-plot h3 span { color: var(--primary); font-variant-numeric: tabular-nums; }
.plot-avg { margin-right: auto; color: var(--ink-muted); font-size: 11px; font-style: normal; font-weight: 500; font-variant-numeric: tabular-nums; }
.trend-chart { display: block; width: 100%; height: 150px; cursor: crosshair; }
.trend-chart[hidden] { display: none; }
@media (min-width: 900px) { .trend-chart { height: 190px; } }
.trend-fixed {
  display: grid;
  place-content: center;
  gap: 5px;
  min-height: 128px;
  margin: 0;
  padding: 10px;
  color: var(--ink-muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}
.trend-fixed strong { color: var(--primary); font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.trend-fixed[hidden] { display: none; }
@media (min-width: 900px) { .trend-fixed { min-height: 190px; } }

/* 奖池走势卡：单张全宽折线图，视觉与上面两张走势图一致 */
.pool-plot { margin-top: 14px; }
/* 奖池图对着指针实时跟随，不需要先点一下；触摸屏点按选中、点同一处取消 */
.pool-plot .trend-chart { cursor: crosshair; }
.pool-plot .trend-chart:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
/* 选中某期时胶囊变成 chip：默认是「最新一期」，点了之后是「你选的那一期」 */
#pool-current.is-selected {
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

/* 一等奖落点排名：省份 + 横条 + 注数；整行是按钮，点开看这一省的逐期明细 */
.place-ranking { display: grid; gap: 0; margin: 10px 0 0; padding: 0; list-style: none; }
.place-item { border-bottom: 1px dashed var(--line-soft); }
.place-item:last-child { border-bottom: 0; }
.place-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto 8px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background .15s ease;
}
@media (hover: hover) { .place-row:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); } }
.place-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.place-row[aria-expanded="true"] { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.place-name { color: var(--ink-soft); font-size: 13px; font-weight: 600; white-space: nowrap; }
.place-bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--primary) 10%, transparent); overflow: hidden; }
.place-bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.place-count { color: var(--ink); font-size: 13px; font-weight: 650; white-space: nowrap; }
.place-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--ink-muted);
  border-bottom: 1.5px solid var(--ink-muted);
  transform: rotate(45deg);
  transition: transform .18s ease;
  justify-self: center;
}
.place-row[aria-expanded="true"] .place-caret { transform: rotate(225deg); }
.place-ranking .is-top .place-name,
.place-ranking .is-top .place-count { color: var(--primary); }

.place-detail { padding: 2px 4px 12px; }
.place-detail-head,
.place-detail-best { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.place-detail-best { color: var(--ink-muted); }
.place-issues {
  display: grid;
  gap: 0;
  max-height: 320px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  overscroll-behavior: contain;
}
.place-issues li {
  display: grid;
  /* 一行放不下号码：上面是「期号 / 日期 / 追加 / 注数」四列，号码单独占
     下面一行小字，既不用横向挤，也不至于让每行高得像卡片 */
  gap: 3px;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.place-issue-top {
  display: grid;
  /* 期号吃掉剩余宽度，日期／追加／注数各占定宽列：追加位数不同也不会
     让日期和注数左右跳，整块像一张对齐的表。最后一列是小三角 */
  grid-template-columns: minmax(0, 1fr) 76px 58px 44px 10px;
  gap: 10px;
  align-items: center;
  /* 整行是按钮：把原生按钮的边框、底色、内边距全部去掉，让它看起来
     还是那行文字，可点区域却是整行（手机上点小三角太难） */
  width: 100%;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) { .place-issue-top:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); } }
.place-issue-top:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.place-issue-top[aria-expanded="true"] { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.place-issues li:last-child { border-bottom: 0; }
.place-issue { color: var(--ink); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.place-issue-best {
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  flex: none;
}
.place-issue-date { color: var(--ink-muted); text-align: right; }
.place-issue-add { color: var(--primary); font-size: 11px; font-weight: 600; text-align: right; white-space: nowrap; }
.place-issue-count { color: var(--ink); font-weight: 650; text-align: right; white-space: nowrap; }
/* 这一期开的什么号：跟在期号下面的一行小字，前区／后区只用一个竖线分隔，
   与明细的密度相称——这里要的是「能对上号」，不是再摆一排气泡。 */
.place-issue-balls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: .07em;
}
.place-issue-balls .rear { color: var(--secondary); }
.place-issue-balls i { margin: 0 7px; color: var(--line); font-style: normal; }

/* 行尾小三角：和省份行同一个语言（收起朝下、展开转 225°），
   让「这一行能点」不用靠说明文字 */
.place-issue-caret {
  justify-self: end;
  width: 6px;
  height: 6px;
  border: solid var(--ink-muted);
  border-width: 0 1.4px 1.4px 0;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .15s ease;
}
.place-issue-top[aria-expanded="true"] .place-issue-caret { transform: rotate(225deg) translate(-1px, -1px); }

/* 点开一期后的整期卡：号码 → 奖池 → 一等奖落点 → 奖级。
   底色比明细行深一档并往内缩，看得出「这是这一期的详情」而不是又一行 */
.place-issue-panel {
  display: grid;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 11px 12px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface);
}
.place-issue-panel[hidden] { display: none; }
.place-issue-item.is-open { padding-bottom: 8px; }
.place-issue-item.is-open .place-issue-balls { display: none; }
.place-issue-draw { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.place-issue-pool,
.place-issue-places { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; margin: 0; }
.place-issue-pool b { color: var(--ink); font-size: 16px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.place-issue-pool small { color: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.place-issue-empty { margin: 0; color: var(--ink-muted); font-size: 12px; line-height: 1.6; }
/* 奖级一行一条：奖级名 + 注数紧挨着，「单注 X 元」推到最右。
   不排成表格：明细行本来就窄，三列对齐会空出半行，反而读不成一句 */
.place-issue-prizes {
  display: grid;
  gap: 3px;
  margin: 2px 0 0;
  padding: 9px 0 0;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.place-issue-prize { display: flex; align-items: baseline; gap: 6px; margin: 0; }
.place-issue-prize-label { color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.place-issue-prize-count { color: var(--ink-soft); white-space: nowrap; }
.place-issue-prize-amount {
  margin-left: auto;
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}
/* 「单注」是这一列的口径说明，压成 10px 灰字，别和金额抢重量 */
.place-issue-prize-amount small { margin-right: 3px; color: var(--ink-muted); font-size: 10px; font-weight: 500; }
/* 展开一期后把明细区上限抬高：320px 装不下「一行 + 一张整期卡」，
   面板会被裁成半张，看着像加载失败 */
.place-issues.has-open { max-height: min(560px, 70vh); }
@media (max-width: 560px) {
  .place-row { grid-template-columns: 52px minmax(0, 1fr) auto 8px; gap: 8px; }
  .place-name { font-size: 12px; }
  /* 窄屏省掉日期列：期号已经能定位到具体一期，列定义也要跟着少一列
     （小三角那一列要留着，否则箭头会被挤到下一行） */
  .place-issue-top { grid-template-columns: minmax(0, 1fr) 50px 38px 10px; gap: 8px; }
  .place-issue-date { display: none; }
  .place-issue-prize { gap: 5px; }
}

.trend-tooltip {
  position: fixed;
  /* 高于吸顶的筛选条（z-index 6）：指针在图的上沿附近时，提示框会往上弹，
     层级别低于条子就会被它切掉半行 */
  z-index: 9;
  width: max-content;
  max-width: calc(100vw - 16px);
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  white-space: pre-line;
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  box-shadow: 0 10px 28px -12px #10182040;
}
.trend-point { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; color: var(--ink-soft); font-size: 13px; }
.trend-point label { flex: none; padding-top: 2px; }
.trend-slider { flex: 1; min-width: 0; max-width: 460px; }
.trend-point input {
  display: block;
  width: 100%;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}
.trend-point input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
}
.trend-point input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--primary) 45%, transparent);
}
.trend-point input::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
}
.trend-point input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
}
.trend-range { display: flex; justify-content: space-between; margin-top: 1px; color: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
#trend-detail { margin: 18px 0 0; color: var(--ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 当期开奖小卡：号码 / 奖池 / 一等奖落点。曲线一次只画一个奖级，
   这三行把「这期开的什么号、奖金从多大奖池里分、头奖落在哪」补上。 */
.draw-summary {
  display: grid;
  gap: 7px;
  margin: 8px 0 10px;
  padding: 10px 12px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
}
.draw-balls,
.draw-pool,
.draw-places {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.draw-balls[hidden], .draw-pool[hidden] { display: none; }
.draw-zone { display: inline-flex; align-items: center; gap: 4px; }
/* 两区之间留一口气：双色球是红+蓝、大乐透是前后区，只靠颜色分会认错 */
.draw-zone + .draw-zone { margin-left: 8px; }
.draw-zone-label { margin-right: 1px; color: var(--ink-muted); font-size: 11px; }
.draw-ball {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 10%, var(--paper));
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
}
.draw-zone[data-zone="rear"] .draw-ball {
  background: color-mix(in srgb, var(--secondary) 12%, var(--paper));
  color: var(--secondary);
}
.draw-label { margin-right: 4px; color: var(--ink-muted); font-size: 11.5px; }
.draw-pool b { color: var(--ink); font-size: 13px; font-weight: 700; }
.draw-pool small { color: var(--ink-muted); font-size: 11px; }
.draw-place {
  padding: 2px 8px 3px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line-soft));
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.draw-places-empty { color: var(--ink-muted); font-size: 11.5px; }
.trend-compare { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 6px; }
.trend-compare[hidden] { display: none; }
.trend-compare span {
  padding: 2px 9px 3px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.trend-compare span[data-direction="up"] { border-color: color-mix(in srgb, var(--primary) 32%, transparent); color: var(--primary); }

.trend-prizes { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.trend-prizes th, .trend-prizes td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.trend-prizes thead th { padding-bottom: 7px; border-bottom: 1px solid var(--line); color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.trend-prizes th:first-child, .trend-prizes td:first-child { width: 30%; }
.trend-prizes th:nth-child(2), .trend-prizes td:nth-child(2) { width: 30%; text-align: right; }
.trend-prizes th:last-child, .trend-prizes td:last-child { width: 40%; text-align: right; }
.trend-prizes .additional td { color: var(--ink-soft); }
.trend-prizes .additional th { padding-left: 14px; font-weight: 400; color: var(--ink-soft); }
.prize-tag {
  margin-left: 5px;
  padding: 1px 5px 2px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: 5px;
  color: var(--primary);
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.3;
  white-space: nowrap;
}
.trend-prizes tr.selected { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.trend-prizes tr.selected th { font-weight: 700; }

.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.card-head .analysis-caption { margin: 6px 0 0; max-width: 56ch; }
/* 覆盖率提示：补齐没完成时说明排名还会变，别让人把「63 注」当成全年真值 */
.places-note { margin: 10px 0 14px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.places-note b { color: var(--ink); font-weight: 600; }
.places-hint {
  margin: 14px 0 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.6;
}
.sort-switcher { margin: 0; padding: 2px; }
.sort-switcher button { padding: 5px 12px; font-size: 12.5px; }

.ball-zones { display: grid; gap: 18px; margin-top: 16px; }
.ball-zone { --zone: var(--primary); }
.ball-zone + .ball-zone { border-top: 1px dashed var(--line); padding-top: 18px; }

.zone-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-bottom: 10px; }
.zone-head h3 { margin: 0; color: var(--zone); font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.zone-meta { margin: 0; color: var(--ink-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.zone-meta span { white-space: nowrap; }

.zone-top { display: grid; gap: 12px; margin-bottom: 12px; }
@media (min-width: 760px) {
  .zone-top { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: end; }
}
.zone-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.zone-tiles div { padding: 8px 10px 9px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); }
.zone-tiles dt { color: var(--ink-muted); font-size: 11px; }
.zone-tiles dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  margin: 4px 0 0;
  color: var(--zone);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.zone-tiles dd small { color: var(--ink-soft); font-size: 11px; font-weight: 600; }

.zone-bands { margin: 0; }
.band-bar { display: flex; gap: 3px; height: 7px; }
.band-bar i { border-radius: 3px; background: var(--zone); }
.band-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.band-legend li { display: flex; align-items: baseline; gap: 5px; }
.band-legend b { color: var(--ink-soft); font-weight: 700; }

.ball-tables { display: grid; gap: 0 26px; }
.ball-tables[data-split="on"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ball-zone table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ball-zone col:nth-child(1) { width: 44px; }
.ball-zone col:nth-child(2) { width: auto; }
.ball-zone col:nth-child(3) { width: 52px; }
.ball-zone col:nth-child(4) { width: 60px; }
.ball-zone thead th { padding: 0 4px 6px; border-bottom: 1px solid var(--line); color: var(--ink-muted); font-size: 11px; font-weight: 600; text-align: left; }
.ball-zone th, .ball-zone td { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--line-soft); }
.ball-zone tbody th { color: var(--zone); font-weight: 700; }
@media (hover: hover) { .ball-zone tbody tr:hover { background: color-mix(in srgb, var(--zone) 4%, transparent); } }
.ball-zone th:nth-child(3), .ball-zone th:nth-child(4),
.ball-zone td:nth-child(3), .ball-zone td:nth-child(4) { text-align: right; }
.ball-zone thead th:nth-child(3), .ball-zone thead th:nth-child(4) { padding-right: 6px; }
.ball-zone td:nth-child(3) { color: var(--ink-soft); }
.ball-zone td:nth-child(4) { color: var(--ink-muted); font-size: 11.5px; }
.ball-zone td.missed-capped { color: var(--ink-muted); }
.ball-chip {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--zone) 24%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--zone) var(--heat, 10%), transparent);
  color: var(--zone);
  font-size: 12.5px;
  font-weight: 700;
}
.frequency { display: flex; align-items: center; gap: 6px; }
.frequency b { flex: none; min-width: 1.4em; color: var(--ink); font-weight: 700; }
.frequency .track {
  position: relative;
  flex: 1;
  min-width: 18px;
  height: 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--zone) 9%, transparent);
}
.frequency .fill { display: block; height: 100%; border-radius: 3px; background: var(--zone); opacity: .45; }
.frequency .expect { position: absolute; top: -2px; bottom: -2px; width: 1px; background: color-mix(in srgb, var(--ink) 32%, transparent); }
/* 热／冷固定用红／蓝，不跟分区主色走：大乐透前区是蓝的，跟着主色走会把
   「热」标成蓝色，正好读反。摇号页号码角的红点／蓝点也是这套语义，
   同一个词在两页不能是两种颜色。 */
.frequency .heat {
  flex: none;
  padding: 1px 5px 2px;
  border: 1px solid color-mix(in srgb, var(--hot) 38%, transparent);
  border-radius: 999px;
  color: var(--hot);
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
}
.ball-zone td[data-heat="cold"] .frequency .heat { border-color: color-mix(in srgb, var(--cold) 38%, transparent); color: var(--cold); }

.metric-note { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.metric-note summary { color: var(--ink-soft); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.metric-note dl { display: grid; gap: 6px; margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; }
.metric-note dl div { display: grid; gap: 1px; }
.metric-note dt { color: var(--ink); font-weight: 700; }
.metric-note dd { margin: 0; line-height: 1.6; }
@media (min-width: 700px) {
  .metric-note dl { grid-template-columns: max-content 1fr; gap: 8px 16px; }
  .metric-note dl div { display: contents; }
}

@media (max-width: 960px) {
  .trend-stats[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .trend-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trend-stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trend-stats[data-count="5"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .analysis-filters { gap: 8px; }
  .analysis-filters .switcher button, .trend-fields .switcher button { padding-inline: 11px; font-size: 13px; }
  .trend-stats { gap: 8px; }
  .trend-stats div { padding: 9px 9px 9px 13px; }
  .trend-stats dd { font-size: 16px; }
  .trend-prizes { font-size: 12.5px; }
  .trend-prizes .additional th { padding-left: 10px; }
  .sort-switcher button { padding: 4px 10px; font-size: 12px; }
  .zone-tiles { gap: 6px; }
  .zone-tiles div { padding: 7px 8px 8px; }
  .zone-tiles dd { font-size: 15px; }
  .zone-tiles dd small { font-size: 10.5px; }
  .ball-tables { gap: 0 16px; }
  .ball-zone table { font-size: 12px; }
  .ball-zone td:nth-child(4) { font-size: 11px; }
}
@media (max-width: 380px) {
  .trend-stats[data-count="3"] div { padding: 8px 6px 8px 11px; }
  .trend-stats[data-count="3"] dd { font-size: 14px; }
  .zone-tiles dd { font-size: 14px; gap: 1px 4px; }
  .zone-tiles dd small { font-size: 10px; }
  .ball-zone col:nth-child(1) { width: 38px; }
  .ball-zone col:nth-child(3) { width: 44px; }
  .ball-zone col:nth-child(4) { width: 54px; }
  .ball-chip { width: 26px; height: 26px; font-size: 12px; }
  .frequency { gap: 5px; }
  .frequency .heat { padding: 1px 3px 2px; }
}

/* 号码结构：和值直方图 + 重号分布 */
.structure-grid { display: grid; gap: 18px; margin-top: 18px; }
/* 两块都是「小标题 → 图 → 一句话」。说明行用 margin-top:auto 压在块底：
   左边多一行刻度、右边少一行，两句话也不会错开（用户报的就是这个「不对齐」）。 */
.structure-block { display: flex; flex-direction: column; margin: 0; }
.structure-block .structure-note { margin-top: auto; padding-top: 14px; }
/* 窄屏直方图靠三块统计卡撑高度，宽屏并排后每根柱子才不至于拉成一整块 */
@media (min-width: 900px) {
  .structure-grid { grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: stretch; }
  .histogram { height: 108px; }
}
/* 重号分档：原来是 7px 的分段条 + 一行图例，条子贴在小标题下、底下一大片空白，
   和图区高度差 27px。改成分档横条（复用「平均命中几个号」的 compare-row），
   条子加高、整块钉在 88/108px 的图区里，两栏的底边对得上。 */
.repeat-rows { min-height: 88px; margin-top: 0; gap: 10px; align-content: center; }
.repeat-rows .compare-row { grid-template-columns: 3em minmax(0, 1fr) 3.6em; }
.repeat-rows .compare-track { height: 18px; border-radius: 5px; }
.repeat-rows .compare-track i { opacity: .5; }
@media (min-width: 900px) { .repeat-rows { min-height: 108px; } }
#structure-stats dd { white-space: normal; }
.structure-block h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.structure-block h3 em {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.histogram {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 88px;
  border-bottom: 1px solid var(--line);
}
.histogram i {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--primary) 48%, transparent);
  transition: background .15s;
}
@media (hover: hover) { .histogram i:hover { background: var(--primary); } }
/* 理论均值刻度：实测均值贴着这条线，才说明窗口内没有偏向 */
.histogram-mark {
  position: absolute;
  top: -3px;
  bottom: 0;
  border-left: 1px dashed color-mix(in srgb, var(--ink-muted) 85%, transparent);
  pointer-events: none;
}
.histogram-axis {
  display: flex;
  justify-content: space-between;
  margin: 5px 0 0;
  color: var(--ink-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
#repeat-block .band-bar i { background: var(--primary); }
.structure-note { margin: 14px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.6; }
@media (max-width: 380px) {
  .histogram { height: 72px; gap: 2px; }
  .structure-block h3 { font-size: 12.5px; }
}

/* 规律检验：追热追冷条形对照 + 连号邻号列表 */
.compare-bars { display: grid; gap: 9px; margin-top: 4px; }
.compare-row {
  display: grid;
  grid-template-columns: 3.6em minmax(0, 1fr) 3.4em;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
}
.compare-row > span { white-space: nowrap; }
.compare-track {
  position: relative;
  height: 9px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.compare-track i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--primary);
  opacity: .42;
}
/* 理论值刻度：条形末端贴着这条线，才说明「追热」没有多命中。
   线和填充都压在轨道上，所以线要够深、填充要够淡，否则线会被盖掉。 */
.compare-track em {
  position: absolute;
  top: -4px;
  bottom: -4px;
  border-left: 1px dashed color-mix(in srgb, var(--ink) 62%, transparent);
}
.compare-row b { color: var(--ink); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.compare-row[data-tone="theory"] .compare-track i { background: var(--ink-muted); }

.pattern-list { display: grid; gap: 0; margin: 0; }
.pattern-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.pattern-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.pattern-list dt { color: var(--ink-muted); font-size: 12px; line-height: 1.5; }
.pattern-list dd { margin: 0; color: var(--ink); font-size: 15px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.pattern-list dd small { display: block; margin-top: 1px; color: var(--ink-muted); font-size: 10.5px; font-weight: 500; }

/* 单注体检 */
.check-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.check-form label { color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.check-form input {
  flex: 1 1 230px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
}
.check-form input::placeholder { color: color-mix(in srgb, var(--ink-muted) 78%, transparent); letter-spacing: .04em; }
.check-form input:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent); outline-offset: 1px; }
.check-form button {
  flex: none;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
@media (hover: hover) { .check-form button:hover { border-color: color-mix(in srgb, var(--primary) 36%, var(--line)); color: var(--primary); } }
.check-form .check-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
@media (hover: hover) { .check-form .check-primary:hover { filter: brightness(1.06); color: #fff; } }
.check-hint { margin: 8px 0 0; color: var(--ink-muted); font-size: 12px; line-height: 1.6; }
.check-error { margin: 8px 0 0; color: #bf2f26; font-size: 12.5px; font-weight: 600; }
.check-error[hidden] { display: none; }
#check-result { margin-top: 16px; }
#check-stats dd { white-space: normal; }
#check-facts { margin-top: 12px; }

/* 奖级概率表 */
.prize-table { width: 100%; border-collapse: collapse; margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }
.prize-table th, .prize-table td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: baseline; }
.prize-table thead th { border-bottom-color: var(--line); color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.prize-table tbody th { color: var(--primary); font-size: 13px; font-weight: 700; }
/* 窄屏把条件缩到奖级下面，这里必须允许换行：nowrap 会让整行条件撑成一行把表格顶出屏幕 */
.prize-table th small {
  display: none;
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: normal;
}
.prize-table .rule { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.prize-table th:nth-child(3), .prize-table td:nth-child(3),
.prize-table th:nth-child(4), .prize-table td:nth-child(4) { text-align: right; white-space: nowrap; }
.prize-table tbody tr:last-child th, .prize-table tbody tr:last-child td { border-bottom: 0; }
.prize-table tr[data-floating] td:last-child { color: var(--ink-muted); font-size: 12px; }
#prize-stats dd, #pattern-stats dd { white-space: normal; }
@media (max-width: 560px) {
  .prize-table thead th:nth-child(2), .prize-table tbody td:nth-child(2) { display: none; }
  .prize-table th small { display: block; }
  .prize-table { font-size: 12.5px; }
  /* 三张概率卡在 390 宽下放不下「1 / 21,425,712」，改成两列 */
  #prize-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .compare-row { grid-template-columns: 3.2em minmax(0, 1fr) 3em; gap: 7px; font-size: 11.5px; }
  .check-form button { padding: 9px 11px; font-size: 12.5px; }
}
.compare-axis { margin: 8px 0 0; color: var(--ink-muted); font-size: 11px; line-height: 1.5; }

/* —— 手机端触控尺寸 ——
   iOS HIG 的最小触控高度 44px。这一页里「查看期次」滑块只有 20px 高、落点行
   32px、筛选项 38px，手指很难停准；底部「体检」按钮同样。只在窄屏抬尺寸，
   桌面端密度不变。滑块只加高触控区，轨道与拇指仍是原来的 4/14px。 */
@media (max-width: 640px) {
  .trend-point input { height: 44px; }
  .place-row { min-height: 44px; }
  .analysis-filters .switcher button,
  .trend-fields .switcher button { min-height: 44px; }
  .check-form button { min-height: 44px; }
  /* 必须写在这里：analysis.css 在 style.css 之后加载，它自己的 14px 会盖掉
     style.css 里那条统一规则。16px 是为了 iOS 聚焦不放大。 */
  .check-form input { font-size: 16px; min-height: 44px; }
  /* 「这些数字怎么算」是一句话长的 <summary>，光靠字形只有 17px 高，点开还要
     精确命中那一小截。用 padding 撑热区 + 等量负 margin 抵消占位：视觉位置不动，
     也不影响它下面 <dl> 的间距。 */
  .metric-note summary { padding-block: 14px; margin-block: -14px; }
}

/* —— 389 及以下：让「彩种」和「统计范围」并排放一行 ——
   两组按钮自然宽度 132 + 206 = 338，再加 10px 间隙要 348。390 宽（iPhone 12
   起）的壳内宽 358 放得下，375（SE / 8）只有 343，就折成两行——吸顶壳从 122px
   涨到 182px，在 667 的视口里吃掉 27%，比顶部导航本身还高。
   按钮左右各收 3px 刚好省出 30px，44px 的高度不变。 */
@media (max-width: 389px) {
  .analysis-filters .switcher button { padding-inline: 8px; }
}
