/* 选号页 v2 (spec §11): 机选 | 自选, 号码单 bar + sheet, 「给老板看」. Uses tokens from tokens.css. */

/* ======================= 机选 | 自选 ======================= */

.mode-seg { margin: 14px 0; }
.seg--card .seg-item[aria-checked="true"] { color: #fff; }
.pick-pane > .card:first-child { margin-top: 0; }

/* 机选 cards: 换一注 | 复制 | 加入号码单 — equal thirds (spec §12) */
.gen-actions--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gen-action--add { color: var(--accent); background: var(--accent-soft); }
.gen-action--add.is-added { color: var(--positive); background: var(--positive-soft); }
.gen-action--add svg { stroke-width: 2.4; }
.results-actions .btn svg { stroke-width: 2.4; }

/* Every game (spec §32.10.6): 排列3 / 福彩3D take two 玩法 rows (直选 | 组选, then the forms); 快乐8 its 选几 grid
   above them (the confirm form's .keno-play buttons). */
.play-card > .seg + .seg { margin-top: 8px; }
.picker-keno-plays { margin-bottom: 12px; }
.picker-keno-plays .zone-head { margin-bottom: 8px; }
/* A 快乐8 card with more than ten numbers (选十复式 12 个): the card's balls are bigger than the 32px cells of the
   drawn-numbers grid (balls--keno-draw), so they wrap like the 选十单式 card's instead of overlapping. */
.gen-balls .balls.balls--keno-draw { display: flex; flex-wrap: wrap; gap: 6px; }

/* ======================= 自选 ======================= */

.manual-card > .seg { margin-bottom: 10px; }
.manual-controls { display: grid; gap: 8px; margin-bottom: 10px; }
.manual-controls > .picker-keno-plays { margin-bottom: 4px; }
.manual-zones > .legend { margin-top: 12px; }
.manual-hint { padding: 0 2px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.manual-zone { margin-top: 18px; }
.manual-zone .zone-head { flex-wrap: wrap; row-gap: 2px; }
.manual-zone .zone-counter { font-variant-numeric: tabular-nums; }
.manual-zone .zone-hint { margin: -4px 0 10px; }

/* 胆码 / 拖码 mode toggle (per zone) */
.seg--mode { margin-bottom: 8px; }
.seg--mode .seg-item { min-height: 44px; font-size: 15px; }
.seg--mode .seg-count { min-width: 1ch; }
.mode-swatch {
  --c: var(--ball-red);
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mode-swatch--blue { --c: var(--ball-blue); }
.mode-swatch--dan { background: var(--c); box-shadow: 0 0 0 2px var(--surface-3), 0 0 0 3.5px var(--pineapple); }
.mode-swatch--tuo { box-shadow: inset 0 0 0 2.5px var(--c); }
.mode-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.mode-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); flex-shrink: 0; }
.mode-note[data-mode="dan"] { color: #8A5600; }
.mode-note[data-mode="dan"]::before { background: var(--pineapple-deep); }

.manual-zone .num-grid { padding: 8px; margin: 0 -8px; border-radius: 20px; transition: background-color var(--dur-2); }
.manual-zone .num-grid[data-mode="dan"] { background: color-mix(in srgb, var(--pineapple) 14%, transparent); }

/* 胆 = filled ball with a gold ring and a 「胆」 badge; 拖 = ring. */
.num-cell[data-state="dan"] {
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  background:
    radial-gradient(ellipse 42% 30% at 40% 20%, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 100%),
    radial-gradient(circle at 50% 35%, var(--cl) 0%, var(--c) 48%, var(--cd) 100%);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.16), 0 0 0 2px var(--surface), 0 0 0 4.5px var(--pineapple);
  animation: cell-pop 320ms var(--ease-spring);
}
.num-cell[data-state="dan"]::after {
  content: "胆";
  position: absolute;
  top: -6px; right: -6px;
  display: grid;
  place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--pineapple);
  color: #4A2C00;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  text-shadow: none;
  box-shadow: 0 0 0 2px var(--surface);
}
.num-cell[data-state="tuo"] {
  background: var(--surface);
  color: var(--c);
  box-shadow: inset 0 0 0 2.5px var(--c);
  animation: cell-pop 320ms var(--ease-spring);
}
.num-cell.nope { animation: nope 400ms ease-in-out; }
@media (prefers-color-scheme: dark) {
  .num-cell[data-state="tuo"] { background: transparent; color: color-mix(in srgb, var(--cl) 75%, #fff); box-shadow: inset 0 0 0 2.5px var(--cl); }
  .mode-note[data-mode="dan"] { color: #FFD06A; }
}

.manual-status { margin-top: 16px; }
.manual-status strong { font-weight: 800; }
.manual-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.manual-actions .btn { min-height: 52px; padding: 0 12px; }
.manual-actions .btn svg { stroke-width: 2.2; }

/* 幸运数字 of a digit game: 「固定某一位」 pills (万位 8) and the sheet's lead line. */
.lucky-fixed-list { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.lucky-fixed { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.lucky-fixed-lead { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.lucky-fixed-lead svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.lucky-picker--fixed .zone-section--digits:first-of-type { margin-top: 12px; }

/* ======================= 号码单 floating bar ======================= */

.page.has-slip .page-body { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 108px); }

.slip-bar {
  position: fixed;
  z-index: 35;
  left: 50%;
  bottom: calc(max(calc(var(--safe-bottom) - 8px), 14px) + var(--tabbar-h) + 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(360px, calc(100% - 2 * var(--gutter)));
  padding: 5px;
  border-radius: var(--r-pill);
  color: #fff;
  background: linear-gradient(135deg, #8A43B0 0%, var(--mangosteen) 55%, var(--mangosteen-deep) 100%);
  box-shadow: 0 12px 30px rgba(62, 20, 82, 0.34), 0 2px 6px rgba(62, 20, 82, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.slip-bar.is-entering { animation: slip-bar-in 460ms var(--ease-spring) both; }
@keyframes slip-bar-in { from { opacity: 0; transform: translate(-50%, 28px) scale(0.94); } to { opacity: 1; transform: translate(-50%, 0); } }
.slip-bar.bump .slip-bar-icon { animation: bump 360ms var(--ease-spring); }
.slip-bar-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 6px 0 4px;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: inherit;
  text-align: left;
}
.slip-bar-main:active { background: rgba(255, 255, 255, 0.10); }
.slip-bar-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.slip-bar-icon svg { width: 21px; height: 21px; }
.slip-bar-count {
  position: absolute;
  top: -3px; right: -5px;
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--pineapple);
  color: #3A1F00;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 0 0 2px var(--mangosteen);
}
.slip-bar-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
/* 「号码单 N 注 ·」 shrinks (…) on a narrow phone; the amount, the part that matters, always shows in full. */
.slip-bar-label { display: flex; gap: 0.3em; min-width: 0; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.slip-bar-label-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.slip-bar-amount { flex-shrink: 0; }
.slip-bar-sub { font-size: 11.5px; color: rgba(255, 255, 255, 0.74); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-bar-chevron { width: 18px; height: 18px; opacity: 0.7; transform: rotate(180deg); }
.slip-bar-boss {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-height: 48px;
  padding: 0 14px 0 11px;
  border: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(135deg, var(--cta-1) 0%, var(--cta-2) 100%);
  color: var(--cta-text);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(255, 140, 30, 0.35);
  transition: transform var(--dur-1) var(--ease-out);
}
.slip-bar-boss svg { width: 19px; height: 19px; stroke-width: 2.2; }
.slip-bar-boss:active { transform: scale(0.95); }
@media (prefers-color-scheme: dark) {
  .slip-bar { background: linear-gradient(135deg, #7A3A9C 0%, #5A2775 55%, #3A1650 100%); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(255, 255, 255, 0.14); }
  .slip-bar-count { box-shadow: 0 0 0 2px #5A2775; }
}
@media (max-width: 374px) {
  .slip-bar-boss { padding: 0 10px; font-size: 14px; }
  .slip-bar-label { font-size: 14.5px; }
}

/* ======================= 号码单 sheet ======================= */

.slip-sheet { display: grid; gap: 14px; }
.slip-lead { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.slip-lead svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.slip-list { display: grid; gap: 8px; }
.slip-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.slip-index {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  margin-top: 1px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}
.slip-item-main { display: grid; gap: 8px; min-width: 0; }
.slip-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 24px; }
.slip-item-cost { font-size: 13px; font-weight: 600; color: var(--text-3); }
.slip-item .balls, .slip-item .zone-line { gap: 5px; }
.slip-item .ball--sm { --size: var(--ball-row); }
.slip-item .zone-lines { gap: 8px; }
.slip-del { margin: -10px -10px -10px auto; color: var(--text-3); }
.slip-del svg { width: 20px; height: 20px; }
.slip-del:active:not(:disabled) { color: var(--danger); }
.slip-empty { display: grid; justify-items: center; gap: 6px; padding: 18px 12px 8px; text-align: center; }
.slip-empty strong { font-size: 16px; }
.slip-empty span:last-child { font-size: 13.5px; color: var(--text-2); }
.slip-settings { padding: 0 14px; border-radius: 18px; background: var(--surface-3); }
@media (prefers-color-scheme: dark) { .slip-settings { background: var(--surface-2); } }
.slip-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--pineapple-soft) 100%);
}
.slip-total-label { font-size: 14px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.slip-total-value { font-size: 28px; font-weight: 800; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slip-tools { display: flex; justify-content: flex-end; margin: -8px 0 -4px; }
.slip-clear { color: var(--danger); }
.slip-records { margin-top: 0; }

/* ======================= 「给老板看」 ======================= */

/* Always a white, high-contrast sheet (also in dark mode), so the shop owner can read it at a glance. */
.boss {
  --boss-fs: clamp(28px, 7.4vw, 44px);
  --boss-ink: #111111;
  --boss-muted: #5B5B5B;
  --boss-line: #E3E3E3;
  --boss-red: #C4161C;
  --boss-blue: #1446C8;
  position: fixed;
  inset: 0;
  z-index: 140;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  color-scheme: light;
  background: #FFFFFF;
  color: var(--boss-ink);
  cursor: pointer;
  animation: boss-in 220ms var(--ease-out) both;
}
.boss.is-leaving { animation: boss-out 180ms var(--ease-out) both; }
@keyframes boss-in { from { opacity: 0; transform: scale(0.98); } }
@keyframes boss-out { to { opacity: 0; transform: scale(0.99); } }
.boss-sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 6px) max(14px, var(--safe-right)) calc(var(--safe-bottom) + 28px) max(14px, var(--safe-left));
}
.boss-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.boss-caption { font-size: 14px; font-weight: 600; color: var(--boss-muted); }
.boss-done {
  min-width: 76px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--boss-ink);
  color: #FFFFFF;
  font-size: 17px;
  font-weight: 700;
}
.boss-done:focus-visible { outline: 3px solid #6B2F8A; outline-offset: 2px; }
.boss-headline {
  margin: 6px 0 4px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--boss-ink);
  font-size: clamp(22px, 6.2vw, 30px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.boss-group { margin-top: 14px; }
.boss-group-title {
  margin: 0 0 4px;
  padding: 6px 12px;
  border-radius: 10px;
  background: #F1F1F1;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}
.boss-line { padding: 10px 0; border-bottom: 1px solid var(--boss-line); }
.boss-line:last-child { border-bottom: 0; }

/* Numbers: two digits, heavy, sized by --boss-fs (JS may shrink it, never below 28px). */
.boss-nums {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12em 0.22em;
  min-width: 0;
  font-family: var(--font-rounded);
  font-size: var(--boss-fs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.12;
}
.boss-num { letter-spacing: -0.015em; white-space: nowrap; }
.boss-num--red { color: var(--boss-red); }
.boss-num--blue { color: var(--boss-blue); }
.boss-zone { display: inline-flex; flex-wrap: nowrap; gap: 0.22em; }
.boss-sep { display: inline-grid; place-items: center; color: var(--boss-ink); }
.boss-sep--bar { width: 4px; height: 0.95em; margin: 0 0.08em; border-radius: 2px; background: var(--boss-ink); }
.boss-sep--plus { font-size: 0.85em; font-weight: 900; }

.boss-line--single { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; }
.boss-index {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border: 2px solid #8C8C8C;
  border-radius: 11px;
  font-family: var(--font-rounded);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: var(--boss-muted);
}
.boss-line--zones { display: grid; gap: 6px; }
.boss-item-size { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--boss-muted); }
.boss-zone-row { display: grid; grid-template-columns: 51px minmax(0, 1fr); align-items: start; gap: 8px; }
.boss-zone-label {
  display: grid;
  place-items: center;
  min-height: 1.9em;
  margin-top: calc((var(--boss-fs) * 1.12 - 1.9em) / 2);
  padding: 0 6px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}
.boss-zone-label--red { background: #FDE7E6; color: var(--boss-red); }
.boss-zone-label--blue { background: #E4ECFD; color: var(--boss-blue); }
.boss-zone-gap {
  display: flex;
  align-items: center;
  padding-left: calc(51px + 8px);
  font-family: var(--font-rounded);
  font-size: calc(var(--boss-fs) * 0.8);
  font-weight: 900;
  line-height: 1;
}
.boss-zone-gap--line { height: 0; margin: 2px 0 2px calc(51px + 8px); padding: 0; border-top: 2px dashed #BDBDBD; }
/* One zone (组选, 七乐彩, 快乐8): the numbers take the whole row. A digit game's positions have longer labels
   (第1位), so their label column is wider. */
.boss-zone-row--bare { grid-template-columns: minmax(0, 1fr); }
.boss--digits .boss-zone-row:not(.boss-zone-row--bare) { grid-template-columns: 64px minmax(0, 1fr); }
.boss--digits .boss-zone-gap { padding-left: calc(64px + 8px); }
.boss-tag {
  display: inline-grid;
  place-items: center;
  height: 1.3em;
  padding: 0 0.28em;
  border-radius: 0.22em;
  border: 2px solid var(--boss-ink);
  font-family: var(--font);
  font-size: 0.6em;
  font-weight: 800;
  color: var(--boss-ink);
}
.boss-tag--dan { background: var(--boss-ink); color: #FFFFFF; }
/* 胆拖 rows: tag + numbers runs; the tag is centred on the first row of numbers (line-height 1.12). */
.boss-nums--wrap { align-items: flex-start; }
.boss-run { display: flex; align-items: flex-start; gap: inherit; }
.boss-run--grow { flex: 1 1 auto; } /* own line when it does not fit beside 胆 in full (see .zone-run--grow) */
.boss-run-nums { display: flex; flex-wrap: wrap; gap: inherit; }
.boss-run > .boss-tag { margin-top: calc((1.12em / 0.6 - 1.3em) / 2); }
.boss-slash { color: var(--boss-muted); font-weight: 700; }
.boss-foot { margin-top: 18px; padding-top: 16px; border-top: 3px dashed var(--boss-ink); text-align: center; }
.boss-footer-text { font-size: clamp(24px, 6.6vw, 32px); font-weight: 800; letter-spacing: 0.12em; }
.boss-hint { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--boss-muted); }
.boss-awake::before { content: "· "; }

@media (max-width: 380px) {
  .boss-sheet { padding-left: max(12px, var(--safe-left)); padding-right: max(12px, var(--safe-right)); }
  .boss-line--single { gap: 6px; }
}
/* The new games' headlines are longer (「排列5 直选定位复式 4注 1倍 共8元」): they wrap between words, never inside one. */
.boss:not(.boss--ssq):not(.boss--dlt) .boss-headline { word-break: keep-all; overflow-wrap: anywhere; }
/* A digit game's bet is a few single digits: bigger (排列5 「2 4 4 8 0」); the fit still shrinks a long 7星彩 row. */
.boss--digits { --boss-fs: clamp(36px, 11vw, 60px); }
@media (orientation: landscape) and (max-height: 500px) {
  .boss { --boss-fs: clamp(28px, 4.6vw, 44px); }
  .boss--digits { --boss-fs: clamp(36px, 7vw, 60px); }
  .boss-headline { font-size: 24px; }
}
