/* =========================================================================
   NEON KENO — styles.css
   Layout, glassmorphism surfaces, number board states, controls, overlays.
   ====================================================================== */

:root {
  --bg: #0b0e14;
  --bg-deep: #05070b;
  --cyan: #00f3ff;
  --magenta: #ff007f;
  --green: #00ff66;
  --gold: #ffd700;
  --white: #ffffff;
  --muted: #7f8a9a;

  --glass: linear-gradient(135deg, rgba(0, 243, 255, .12), rgba(255, 0, 127, .08));
  --panel: linear-gradient(160deg, rgba(24, 34, 48, .78), rgba(10, 15, 23, .86));
  --hairline: rgba(150, 190, 220, .16);
  --hairline-soft: rgba(150, 190, 220, .09);

  --radius-lg: 1.6cqw;
  --radius-md: 1.1cqw;
  --radius-sm: .75cqw;

  /* 中文界面：拉丁字符仍用 Rajdhani 保留科技感，中文回退到系统黑体 */
  --font-ui: "Rajdhani", "Chakra Petch", "PingFang SC", "HarmonyOS Sans SC",
             "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC",
             "Bahnschrift", "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  --font-num: "SF Mono", "Roboto Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}

/* ------------------------------------------------------------- reset ---- */

*,
*::before,
*::after { box-sizing: border-box; }

/* The page scrolls when the cabinet cannot fit. The original build pinned
   html/body to 100% with overflow:hidden, so on any viewport shorter than
   the cabinet the controls were simply unreachable. */
html {
  margin: 0;
  padding: 0;
  min-height: 100%;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #16202e 0%, transparent 60%),
    radial-gradient(90% 60% at 50% 110%, #12202b 0%, transparent 55%),
    var(--bg-deep);
  color: var(--white);
  font-family: var(--font-ui);
  font-weight: 600;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;      /* becomes flex-start via min-height query below */
  justify-content: center;
}

/* When the cabinet is taller than the viewport, centring would clip the top
   half beyond the scroll origin. Anchor to the top and let the page scroll. */
@media (max-height: 560px) {
  body { align-items: flex-start; }
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* --------------------------------------------------------- app shell ----
   Sizing strategy
   ---------------
   The cabinet is a fixed-aspect portrait console. Rather than pinning it to
   100dvh (which clipped everything below the fold on short screens), the
   height is CLAMPED to a comfortable range and the width is derived from
   that height, so the aspect ratio is preserved at every size:

     effective height = clamp(min, 100dvh, max)
     width            = min(100vw, height * aspect)

   When the viewport is shorter than --cab-min-h the cabinet keeps its
   minimum height and the page scrolls instead of hiding the controls. */
#app {
  --cab-aspect: .615;
  --cab-min-h: 560px;
  --cab-max-h: 1040px;

  /* dvh where supported, vh as the fallback for older engines. */
  --cab-h: clamp(var(--cab-min-h), 100vh, var(--cab-max-h));
  --cab-h: clamp(var(--cab-min-h), 100dvh, var(--cab-max-h));

  position: relative;
  width: min(100vw, calc(var(--cab-h) * var(--cab-aspect)));
  height: var(--cab-h);
  flex: 0 0 auto;
  margin: auto;
  container-type: size;
  container-name: cabinet;
  overflow: hidden;
  background:
    radial-gradient(80% 40% at 50% 0%, rgba(0, 243, 255, .10), transparent 65%),
    linear-gradient(180deg, #0d1118 0%, var(--bg) 45%, #070a10 100%);
  box-shadow: 0 0 60px rgba(0, 0, 0, .9);
}

#cabinet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 1.4cqw;
  padding: max(1.8cqw, env(safe-area-inset-top)) 2.4cqw
           max(1.8cqw, env(safe-area-inset-bottom)) 2.4cqw;
  font-size: 3.4cqw;
}

/* Faint scanline texture — kept extremely subtle. */
#app::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .012) 0 1px,
    transparent 1px 3px
  );
  z-index: 60;
}

/* ----------------------------------------------------------- top hud ---- */

#topHud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2cqw;
  padding: 1.2cqw 1.6cqw;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  backdrop-filter: blur(8px);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 1.4cqw;
  min-width: 0;
}

.brand-mark {
  width: 3.4cqw;
  height: 3.4cqw;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b9fbff, var(--cyan) 45%, #05505f);
  box-shadow: 0 0 2cqw rgba(0, 243, 255, .8), inset 0 0 .6cqw rgba(0, 0, 0, .5);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.brand-text b {
  font-size: 2.9cqw;
  letter-spacing: .16em;
  color: #dff6ff;
}
.brand-text i {
  font-style: normal;
  font-size: 2cqw;
  letter-spacing: .22em;
  color: var(--muted);
  text-transform: uppercase;
}

.hud-meter {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
  padding: .4cqw 1.6cqw .4cqw 0;
  border-right: 1px solid var(--hairline-soft);
}
.meter-label {
  font-size: 1.9cqw;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.meter-value {
  font-size: 3.4cqw;
  font-variant-numeric: tabular-nums;
  color: #eaf7ff;
  text-shadow: 0 0 1.6cqw rgba(0, 243, 255, .45);
}
.meter-value.flash { animation: valueFlash .55s ease-out; }

.hud-actions {
  display: flex;
  gap: 1cqw;
}

.icon-btn {
  width: 7cqw;
  height: 7cqw;
  padding: 1.7cqw;
  border-radius: var(--radius-md);
  color: #9fb4c6;
  background: linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015));
  border: 1px solid var(--hairline-soft);
  transition: color .18s, border-color .18s, transform .1s, box-shadow .18s;
}
.icon-btn:hover { color: var(--cyan); border-color: rgba(0, 243, 255, .4); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ico-off { display: none; }
.icon-btn.is-muted { color: #6b7787; }
.icon-btn.is-muted .ico-on { display: none; }
.icon-btn.is-muted .ico-off { display: block; }
.icon-btn.is-active {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.7);
  background: rgba(255, 215, 0, 0.16);
  box-shadow: 0 0 2cqw rgba(255, 215, 0, 0.45);
}

/* ----------------------------------------------------------- tracker ---- */

#tracker {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.1cqw;
  padding: 1.6cqw 1.8cqw;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--hairline);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 1cqw 4cqw rgba(0, 0, 0, .55);
  backdrop-filter: blur(10px);
}

.multiplier-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.8cqw;
  width: 100%;
}

.mult-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6cqw 0.3cqw;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
  border: 1.5px solid rgba(150, 190, 220, .12);
  transition: all .2s cubic-bezier(.2, .8, .2, 1);
  min-height: 5cqw;
  user-select: none;
}

.mult-hits {
  font-size: 1.6cqw;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #526375;
  line-height: 1;
}

.mult-val {
  font-size: 2.3cqw;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #6e8297;
  margin-top: .2cqw;
  line-height: 1.1;
}

/* Dimmed unhit state */
.mult-box.is-dim {
  opacity: .45;
  filter: grayscale(0.4);
}

/* Has valid payout for selected spots */
.mult-box.has-multiplier {
  opacity: .85;
  border-color: rgba(0, 243, 255, .25);
  background: rgba(0, 243, 255, .03);
}
.mult-box.has-multiplier .mult-hits {
  color: #8da5ba;
}
.mult-box.has-multiplier .mult-val {
  color: var(--cyan);
}

/* When a hit occurs — LIGHTING UP! */
.mult-box.is-hit {
  opacity: 1;
  filter: none;
  background: rgba(0, 243, 255, .18);
  border-color: var(--cyan);
  box-shadow: 0 0 1.8cqw rgba(0, 243, 255, .6), inset 0 0 1cqw rgba(0, 243, 255, .35);
  transform: scale(1.03);
}
.mult-box.is-hit .mult-hits {
  color: #e0fdff;
  text-shadow: 0 0 .8cqw rgba(0, 243, 255, .8);
}
.mult-box.is-hit .mult-val {
  color: #ffffff;
  text-shadow: 0 0 1.2cqw rgba(0, 243, 255, .9);
}

/* Winning hit multiplier (hits >= min paying hit for spot count) */
.mult-box.is-winning-hit {
  background: linear-gradient(135deg, rgba(255, 215, 0, .28), rgba(0, 255, 102, .22));
  border-color: var(--gold);
  box-shadow: 0 0 2.5cqw rgba(255, 215, 0, .85), inset 0 0 1.2cqw rgba(255, 215, 0, .5);
  animation: multLighting .45s cubic-bezier(.2, 1.5, .4, 1);
}
.mult-box.is-winning-hit .mult-hits {
  color: #fff9db;
  text-shadow: 0 0 1cqw rgba(255, 215, 0, .9);
}
.mult-box.is-winning-hit .mult-val {
  color: #ffe600;
  text-shadow: 0 0 1.6cqw rgba(255, 215, 0, 1);
}

/* The rung that just landed — a brighter ring on top of is-hit /
   is-winning-hit so the eye tracks the newest ball. */
.mult-box.is-current-hit {
  transform: scale(1.09);
  border-color: #ffffff;
  box-shadow:
    0 0 2.2cqw rgba(255, 255, 255, .75),
    0 0 3.4cqw rgba(0, 243, 255, .55),
    inset 0 0 1.2cqw rgba(255, 255, 255, .4);
}

.mult-box.is-current-hit.is-winning-hit {
  box-shadow:
    0 0 2.6cqw rgba(255, 255, 255, .8),
    0 0 4cqw rgba(255, 215, 0, .9),
    inset 0 0 1.4cqw rgba(255, 240, 180, .5);
}

.mult-box.is-current-hit .mult-val {
  color: #ffffff;
  text-shadow: 0 0 1.6cqw rgba(255, 255, 255, .95);
}

@media (prefers-reduced-motion: reduce) {
  .mult-box.is-current-hit { transform: none; }
}

@keyframes multLighting {
  0% { transform: scale(.92); filter: brightness(1); }
  50% { transform: scale(1.12); filter: brightness(1.8); }
  100% { transform: scale(1.03); filter: brightness(1); }
}

.tracker-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1cqw;
  margin-top: .3cqw;
  padding-top: 1.2cqw;
  border-top: 1px solid var(--hairline-soft);
}
.stat {
  display: flex;
  align-items: baseline;
  gap: .8cqw;
  min-width: 0;
}
.stat em {
  font-style: normal;
  font-size: 1.95cqw;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat b {
  font-size: 3.1cqw;
  font-variant-numeric: tabular-nums;
  color: #e8f6ff;
}
.stat b i {
  font-style: normal;
  color: var(--muted);
  font-size: .72em;
}
.stat-hits b { color: var(--green); text-shadow: 0 0 1.6cqw rgba(0, 255, 102, .5); }
.stat-win b { color: var(--gold); text-shadow: 0 0 1.6cqw rgba(255, 215, 0, .45); }
.stat-win.bump b { animation: valueFlash .5s ease-out; }

/* ------------------------------------------------------------- stage ---- */

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#machineCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.stage-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2%;
  margin: 0;
  text-align: center;
  font-size: 2.1cqw;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 3;
  transition: opacity .3s;
  pointer-events: none;
}
.stage-hint.is-hidden { opacity: 0; }

/* ------------------------------------------------------- number board --- */

#numberBoard {
  /* These match LAYOUT in machineCanvas.js. app.js rewrites them at boot
     from the same constants; keeping them in sync here avoids a jump on
     the very first paint. */
  position: absolute;
  left: 10%;
  right: 10%;
  top: 35%;
  bottom: 14.5%;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  min-height: 0;
  gap: 1.1cqw;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 1.4cqw;
  font-size: 3cqw;
  font-variant-numeric: tabular-nums;
  color: #b6c6d6;
  background:
    linear-gradient(165deg, rgba(58, 74, 94, .55), rgba(18, 25, 36, .8));
  border: 1px solid rgba(160, 195, 225, .14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .09),
    inset 0 -2px 4px rgba(0, 0, 0, .45),
    0 .5cqw 1.4cqw rgba(0, 0, 0, .5);
  transition: transform .14s cubic-bezier(.2, 1.4, .4, 1), color .2s,
              border-color .2s, box-shadow .25s, background .25s;
}

@media (hover: hover) {
  .cell:not(.is-locked):hover {
    color: #e6f6ff;
    border-color: rgba(0, 243, 255, .45);
    transform: translateY(-2%);
  }
}
.cell:active:not(.is-locked) { transform: scale(.94); }

/* Selected — magenta neon (the player's own marks). */
.cell.is-selected {
  color: #ffe3f0;
  border-color: var(--magenta);
  background: linear-gradient(165deg, rgba(255, 0, 127, .3), rgba(60, 8, 33, .8));
  box-shadow:
    inset 0 0 1.6cqw rgba(255, 0, 127, .45),
    0 0 2.4cqw rgba(255, 0, 127, .55);
}
.cell.is-selected::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, .35);
  opacity: .5;
  pointer-events: none;
}

/* Drawn but not chosen — cool cyan acknowledgement. */
.cell.is-drawn {
  color: #d9f7ff;
  border-color: rgba(0, 243, 255, .6);
  background: linear-gradient(165deg, rgba(0, 243, 255, .16), rgba(8, 28, 38, .82));
  box-shadow: inset 0 0 1.2cqw rgba(0, 243, 255, .3), 0 0 1.6cqw rgba(0, 243, 255, .3);
}

/* Chosen AND drawn — the payline. */
.cell.is-hit {
  color: #0a1a10;
  border-color: var(--green);
  background: linear-gradient(165deg, #7dffb4, #00d64f 60%, #009a38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .6),
    0 0 3.2cqw rgba(0, 255, 102, .8);
  text-shadow: none;
}

.cell.is-locked { cursor: default; }
.cell.pop { animation: cellPop .42s cubic-bezier(.2, 1.5, .4, 1); }
.cell.flash-hit { animation: hitFlash .7s ease-out; }
.cell.flash-miss { animation: missFlash .5s ease-out; }

/* ---------------------------------------------------------- controls ---- */

#controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.3cqw;
  padding: 1.6cqw;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--hairline);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 -1cqw 4cqw rgba(0, 0, 0, .5);
  backdrop-filter: blur(10px);
}

.control-row {
  display: flex;
  align-items: stretch;
  gap: 1.3cqw;
}

.bet-stepper {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 1cqw;
  padding: .8cqw;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
}

.step-btn {
  width: 8cqw;
  height: 8cqw;
  flex: none;
  padding: 2.2cqw;
  border-radius: 1cqw;
  color: #cfe4f2;
  background: linear-gradient(165deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03));
  border: 1px solid var(--hairline);
  transition: transform .1s, color .18s, border-color .18s;
}
.step-btn:hover { color: var(--cyan); border-color: rgba(0, 243, 255, .45); }
.step-btn:active { transform: scale(.9); }
.step-btn[disabled] { opacity: .3; cursor: default; transform: none; }

.bet-face {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
}
.bet-face em {
  font-style: normal;
  font-size: 1.85cqw;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--muted);
}
.bet-face b {
  font-size: 3.6cqw;
  font-variant-numeric: tabular-nums;
  color: #f0faff;
}

.payout-face {
  flex: 0 0 34%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  padding: .8cqw 1cqw;
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, rgba(255, 215, 0, .2), rgba(90, 66, 6, .35));
  border: 1px solid rgba(255, 215, 0, .38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.payout-face em {
  font-style: normal;
  font-size: 1.85cqw;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(255, 226, 130, .75);
}
.payout-face b {
  font-size: 3.6cqw;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-shadow: 0 0 2cqw rgba(255, 215, 0, .6);
}
.payout-face.bump { animation: goldBump .6s ease-out; }

.control-row-main { align-items: center; }

.ghost-btn {
  flex: 0 0 22%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5cqw;
  padding: 1.3cqw .6cqw;
  border-radius: var(--radius-md);
  color: #9fb4c6;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
  font-size: 1.85cqw;
  letter-spacing: .16em;
  text-transform: uppercase;
  transition: color .18s, border-color .18s, transform .1s, opacity .2s;
}
.ghost-btn svg { width: 4.4cqw; height: 4.4cqw; }
.ghost-btn:hover { color: var(--cyan); border-color: rgba(0, 243, 255, .35); }
.ghost-btn:active { transform: scale(.94); }
.ghost-btn[disabled] { opacity: .32; cursor: default; transform: none; }

.play-btn {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4cqw;
  height: 11cqw;
  border-radius: 1.6cqw;
  overflow: hidden;
  color: #04220f;
  background: linear-gradient(180deg, #96ffc4 0%, #14e36a 42%, #05a648 100%);
  border: 1px solid rgba(200, 255, 220, .6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .75),
    inset 0 -3px 6px rgba(0, 60, 25, .5),
    0 0 3.6cqw rgba(0, 255, 102, .5);
  transition: transform .1s, box-shadow .3s, filter .3s;
  animation: playBreathe 3.2s ease-in-out infinite;
}
.play-btn .play-ico { width: 4.6cqw; height: 4.6cqw; fill: currentColor; stroke: none; }
.play-label {
  font-size: 4cqw;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  padding-left: .3em;
}
.play-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .85), transparent 62%);
  opacity: 0;
  pointer-events: none;
}
.play-btn:hover { transform: scale(1.03); }
.play-btn:active { transform: scale(.96); }
.play-btn.ignite .play-glow { animation: ignite .55s ease-out; }

.play-btn[disabled] {
  cursor: default;
  animation: none;
  transform: none;
  filter: saturate(.15) brightness(.6);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .4);
}
.play-btn.is-busy {
  background: linear-gradient(180deg, #7fd9ff 0%, #12a9d8 42%, #0a6c8e 100%);
  color: #032230;
  filter: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 3cqw rgba(0, 243, 255, .45);
}

/* ---------------------------------------------------------- overlays ---- */

.overlay-result {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
}
.overlay-result.is-open { opacity: 1; }

.result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6cqw;
  padding: 4cqw 8cqw;
  border-radius: 2.4cqw;
  background: linear-gradient(160deg, rgba(10, 24, 18, .92), rgba(5, 10, 14, .95));
  border: 1px solid rgba(0, 255, 102, .5);
  box-shadow: 0 0 8cqw rgba(0, 255, 102, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
  transform: scale(.85);
  transition: transform .38s cubic-bezier(.2, 1.5, .4, 1);
}
.is-open .result-card { transform: scale(1); }

.overlay-result.is-loss .result-card {
  border-color: rgba(150, 175, 200, .3);
  box-shadow: 0 0 5cqw rgba(0, 0, 0, .6);
}

.result-title {
  font-size: 3.2cqw;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--green);
  text-shadow: 0 0 2.4cqw rgba(0, 255, 102, .8);
}
.overlay-result.is-loss .result-title { color: var(--muted); text-shadow: none; }

.result-amount {
  font-size: 8cqw;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-shadow: 0 0 3.4cqw rgba(255, 215, 0, .7);
  line-height: 1;
}
.overlay-result.is-loss .result-amount { font-size: 5cqw; color: #b9c8d6; text-shadow: none; }

.result-sub {
  font-size: 2.2cqw;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--muted);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 26%;
  transform: translate(-50%, 1cqw);
  z-index: 50;
  padding: 1.4cqw 3cqw;
  border-radius: 10cqw;
  font-size: 2.4cqw;
  letter-spacing: .1em;
  color: #ffe3ef;
  background: rgba(38, 8, 22, .92);
  border: 1px solid rgba(255, 0, 127, .5);
  box-shadow: 0 0 3cqw rgba(255, 0, 127, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ sheets ---- */

.sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 4cqw;
}
.sheet-layer[hidden] { display: none; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 10, .78);
  backdrop-filter: blur(6px);
}

.sheet {
  position: relative;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 3cqw;
  border-radius: 2.2cqw;
  background: linear-gradient(160deg, rgba(22, 32, 45, .96), rgba(8, 12, 19, .98));
  border: 1px solid var(--hairline);
  box-shadow: 0 2cqw 8cqw rgba(0, 0, 0, .8);
  animation: sheetIn .3s cubic-bezier(.2, 1.2, .4, 1);
}
.sheet[hidden] { display: none; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  margin-bottom: 1.6cqw;
}
.sheet-head h2 {
  margin: 0;
  font-size: 3.4cqw;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: #dff4ff;
}
.sheet-close { flex: none; }

.sheet-note {
  margin: 0 0 2cqw;
  font-size: 2.1cqw;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--muted);
  line-height: 1.5;
}

.spot-tabs {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: .8cqw;
  margin-bottom: 2.2cqw;
}
.spot-tab {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: .9cqw;
  font-size: 2.4cqw;
  color: #93a6b8;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--hairline-soft);
  transition: color .2s, border-color .2s, background .2s;
}
.spot-tab.is-on {
  color: #04220f;
  background: linear-gradient(180deg, #8dffbd, #0fce62);
  border-color: rgba(0, 255, 102, .6);
}

.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7cqw;
}
.pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1cqw;
  padding: 1.1cqw 1.6cqw;
  border-radius: .9cqw;
  font-size: 2.5cqw;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
}
.pay-row span { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 2.1cqw; }
.pay-row b { color: var(--gold); font-variant-numeric: tabular-nums; }
.pay-row.is-zero b { color: #5d6875; }
.pay-row.is-top { border-color: rgba(255, 215, 0, .4); background: rgba(255, 215, 0, .07); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding: 1.8cqw 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 2.8cqw;
  color: #cfe0ee;
}

.switch {
  width: 11cqw;
  height: 5.6cqw;
  flex: none;
  border-radius: 10cqw;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--hairline);
  position: relative;
  transition: background .22s, border-color .22s;
}
.switch i {
  position: absolute;
  top: 50%;
  left: .6cqw;
  width: 4cqw;
  height: 4cqw;
  border-radius: 50%;
  background: #8fa3b5;
  transform: translateY(-50%);
  transition: left .22s cubic-bezier(.3, 1.4, .4, 1), background .22s;
}
.switch[aria-checked="true"] {
  background: rgba(0, 255, 102, .22);
  border-color: rgba(0, 255, 102, .55);
}
.switch[aria-checked="true"] i { left: calc(100% - 4.6cqw); background: var(--green); }

.sheet-action {
  width: 100%;
  margin-top: 2.4cqw;
  padding: 1.8cqw;
  border-radius: 1.2cqw;
  font-size: 2.6cqw;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #cfe4f2;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--hairline);
  transition: color .2s, border-color .2s;
}
.sheet-action:hover { color: var(--cyan); border-color: rgba(0, 243, 255, .45); }

/* ------------------------------------------------------------- debug ---- */

.debug-panel {
  position: absolute;
  top: 12cqw;
  left: 2.4cqw;
  z-index: 58;
  margin: 0;
  padding: 1.4cqw;
  border-radius: 1cqw;
  font-family: var(--font-num);
  font-size: 1.9cqw;
  line-height: 1.55;
  color: #8ef0ff;
  background: rgba(3, 8, 12, .85);
  border: 1px solid rgba(0, 243, 255, .3);
  pointer-events: none;
  white-space: pre;
}
.debug-panel[hidden] { display: none; }

/* -------------------------------------------------------- animations ---- */

@keyframes pipPulse {
  0%, 100% { box-shadow: 0 0 1.4cqw rgba(0, 243, 255, .4), inset 0 0 .8cqw rgba(0, 243, 255, .25); }
  50%      { box-shadow: 0 0 3cqw rgba(0, 243, 255, .85), inset 0 0 1.6cqw rgba(0, 243, 255, .45); }
}
@keyframes pipPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}
@keyframes cellPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes hitFlash {
  0%   { transform: scale(1);   filter: brightness(2.4); }
  35%  { transform: scale(1.16); filter: brightness(1.4); }
  100% { transform: scale(1);   filter: brightness(1); }
}
@keyframes missFlash {
  0%   { filter: brightness(1.9); }
  100% { filter: brightness(1); }
}
@keyframes valueFlash {
  0%   { transform: scale(1);    filter: brightness(2); }
  40%  { transform: scale(1.14); filter: brightness(1.3); }
  100% { transform: scale(1);    filter: brightness(1); }
}
@keyframes goldBump {
  0%   { transform: scale(1);   box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 0 0 rgba(255,215,0,0); }
  40%  { transform: scale(1.05); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 0 4cqw rgba(255,215,0,.7); }
  100% { transform: scale(1);   box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 0 0 rgba(255,215,0,0); }
}
@keyframes playBreathe {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -3px 6px rgba(0,60,25,.5), 0 0 2.4cqw rgba(0,255,102,.35); }
  50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,.75), inset 0 -3px 6px rgba(0,60,25,.5), 0 0 5cqw rgba(0,255,102,.7); }
}
@keyframes ignite {
  0%   { opacity: .95; transform: scale(.25); }
  100% { opacity: 0;   transform: scale(2.2); }
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(3cqw) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------- responsive tweaks ---- */

/* Wide/short cabinets (mobile landscape, small laptops): tighten vertical
   rhythm so the machine keeps its presence. */
@container cabinet (max-height: 520px) {
  #cabinet { gap: 1cqw; padding: 1.4cqw 1.8cqw; }
  #tracker { gap: .8cqw; padding: 1.2cqw 1.4cqw; }
  #controls { gap: 1cqw; padding: 1.2cqw; }
}

/* Very large cabinets (desktop): stop type from becoming cartoonish. */
@media (min-width: 1100px) and (min-height: 900px) {
  #cabinet { font-size: min(3.4cqw, 22px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ==========================================================================
   BOOT / PRELOADER
   Sits inside the cabinet so it inherits the frame, and is removed from the
   DOM once the assets are ready.
   ========================================================================== */

.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4cqw;
  padding: 8cqw;
  text-align: center;
  background:
    radial-gradient(70% 50% at 50% 35%, rgba(0, 243, 255, .10), transparent 70%),
    linear-gradient(180deg, #0d1118 0%, var(--bg) 55%, #070a10 100%);
  transition: opacity .45s ease, visibility .45s ease;
}

.boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4cqw;
}

.boot-ring {
  width: 16cqw;
  height: 16cqw;
  margin-bottom: 2cqw;
  border-radius: 50%;
  border: .9cqw solid rgba(0, 243, 255, .18);
  border-top-color: var(--cyan);
  box-shadow: 0 0 4cqw rgba(0, 243, 255, .35);
  animation: bootSpin 1s linear infinite;
}

.boot-name {
  font-size: 6.4cqw;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--white);
  text-shadow: 0 0 3cqw rgba(0, 243, 255, .5);
}

.boot-sub {
  font-size: 2.6cqw;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--muted);
}

.boot-track {
  width: min(56cqw, 320px);
  height: 1.1cqw;
  min-height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}

.boot-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .35s cubic-bezier(.2, .8, .3, 1);
}

.boot-label {
  margin: 0;
  font-size: 2.3cqw;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes bootSpin { to { transform: rotate(360deg); } }

/* Hide the cabinet chrome until boot finishes so nothing flashes unstyled. */
body:not(.is-booted) #cabinet > *:not(.boot-screen) { opacity: 0; }
#cabinet > * { transition: opacity .4s ease; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Wider, shorter windows: let the console grow a little rather than
   staying a narrow sliver in the middle of a desktop display. */
@media (min-width: 900px) and (min-height: 700px) {
  #app { --cab-max-h: 1100px; }
}

/* Very short viewports — phones in landscape, small laptops. The cabinet
   holds its minimum height and the page scrolls to reach the controls. */
@media (max-height: 620px) {
  #app {
    --cab-min-h: 580px;
    box-shadow: none;
  }
  body { padding-block: 12px; }
}

/* Narrow phones: reclaim padding so the board keeps its tap targets. */
@media (max-width: 360px) {
  #cabinet { padding-left: 1.6cqw; padding-right: 1.6cqw; }
}

/* Coarse pointers get larger minimum hit areas regardless of cqw scaling. */
@media (pointer: coarse) {
  /* NOTE: never give .cell a min-height here. The board is an absolutely
     positioned band between the sphere and the pipe; a minimum row height
     makes the grid overflow that band and collide with the pipe. Cell size
     is governed by the band itself. */
  .icon-btn { min-width: 32px; min-height: 32px; }
  .step-btn { min-width: 34px; min-height: 34px; }
}

/* Respect reduced-motion for the boot sequence too. */
@media (prefers-reduced-motion: reduce) {
  .boot-ring { animation: none; }
  .boot-bar { transition: none; }
  #cabinet > * { transition: none; }
}

/* =========================================================================
 * 中文界面排版微调（zh-CN）
 * 原版是为全大写英文设计的：大字距 + uppercase。中文字符等宽且无大小写，
 * 沿用原字距会显得松散、字号偏小，故单独放宽字号、收紧字距。
 * ====================================================================== */
:root { --muted-zh: #9aa7b8; }

/* 小号标签：余额 / 注额 / 上次奖金 / 球数 / 命中 / 当前奖金 */
.meter-label,
.bet-face em,
.payout-face em,
.tracker-stats .stat em {
  font-size: 2.4cqw;
  letter-spacing: .06em;
  text-transform: none;
  color: var(--muted-zh);
  font-weight: 600;
}

/* 舞台提示 */
.stage-hint {
  font-size: 2.6cqw;
  letter-spacing: .08em;
  text-transform: none;
  color: var(--muted-zh);
}

/* 品牌区中文 */
.brand-text b,
.boot-name {
  letter-spacing: .04em;
}
.brand-text i,
.boot-sub {
  letter-spacing: .08em;
  text-transform: none;
  font-style: normal;
}

/* 底部按钮文字 */
.ghost-btn span { letter-spacing: .04em; }
.play-label { letter-spacing: .12em; }

/* 设置 / 赔率表面板 */
.sheet-head h2 { letter-spacing: .04em; }
.sheet-note { letter-spacing: .02em; }
.setting-row span { letter-spacing: .02em; }
.pay-row span { letter-spacing: .02em; }

/* 结果浮层 */
.result-title { letter-spacing: .08em; }

/* 赔率表：原版两列是为 "3 hits / 8.2×" 这类短英文设计的，
   中文 "命中 3 个" 更长，两列会留下大片空白，故改为单列并行的紧凑排布 */
.pay-grid {
  grid-template-columns: 1fr;
  gap: .6cqw;
}
.pay-row {
  padding: .95cqw 1.8cqw;
  font-size: 2.6cqw;
}
.pay-row span {
  font-size: 2.4cqw;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted-zh);
}
.pay-row b { font-size: 2.8cqw; }

/* =========================================================================
   LIVE DRAW — 直播开奖信息条 / 开奖记录
   新增于「每分钟开奖」改版。沿用毛玻璃面板与霓虹色板。
   ====================================================================== */

/* 品牌改为 "LIVE 基诺"，比原来的四字更宽，收紧字距避免顶着余额区 */
.brand-text b {
  white-space: nowrap;
  letter-spacing: .05em;
}
.brand-text i {
  letter-spacing: .14em;
}

#liveBar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: .55cqw;
  padding: .95cqw 1.6cqw;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255, 45, 85, .12), rgba(10, 15, 23, .92) 60%);
  border: 1px solid rgba(255, 45, 85, .26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.live-row {
  display: flex;
  align-items: center;
  gap: 1.6cqw;
  line-height: 1.1;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: .75cqw;
  flex: none;
  padding: .35cqw .9cqw .35cqw .75cqw;
  border-radius: 99px;
  background: rgba(255, 45, 85, .16);
  border: 1px solid rgba(255, 45, 85, .45);
}
.live-badge b {
  font-size: 1.95cqw;
  letter-spacing: .1em;
  color: #ffd6de;
}

.live-dot {
  width: .95cqw;
  height: .95cqw;
  border-radius: 50%;
  background: #ff2d55;
  box-shadow: 0 0 1.4cqw rgba(255, 45, 85, .95);
  animation: livePulse 1.3s ease-in-out infinite;
}

/* 封盘 / 开奖时整体换色，让状态一眼可读 */
#liveBar.is-closed { border-color: rgba(255, 215, 0, .32); background: linear-gradient(160deg, rgba(255, 215, 0, .10), rgba(10, 15, 23, .92) 60%); }
#liveBar.is-closed .live-badge { background: rgba(255, 215, 0, .14); border-color: rgba(255, 215, 0, .45); }
#liveBar.is-closed .live-badge b { color: #ffe9a6; }
#liveBar.is-closed .live-dot { background: var(--gold); box-shadow: 0 0 1.4cqw rgba(255, 215, 0, .9); }

#liveBar.is-drawing .live-badge { background: rgba(255, 45, 85, .26); border-color: rgba(255, 45, 85, .8); }
#liveBar.is-drawing .live-dot { animation-duration: .45s; }

.live-issue {
  display: flex;
  align-items: baseline;
  gap: .6cqw;
  min-width: 0;
}
.live-issue em,
.live-clock em,
.live-recent em {
  font-style: normal;
  font-size: 1.7cqw;
  letter-spacing: .16em;
  color: var(--muted);
}
.live-issue b {
  font-family: var(--font-num);
  font-size: 2.05cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  color: #cfe4f2;
}

.live-clock {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: .7cqw;
  flex: none;
}
.live-clock b {
  font-family: var(--font-num);
  font-size: 2.5cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: #eaf7ff;
  text-shadow: 0 0 1.4cqw rgba(0, 243, 255, .4);
}
/* 最后 10 秒开始催促 */
.live-clock.is-urgent b {
  color: #ff8fa3;
  text-shadow: 0 0 1.6cqw rgba(255, 45, 85, .85);
  animation: clockPulse .9s ease-in-out infinite;
}

.live-recent {
  display: flex;
  align-items: center;
  gap: 1cqw;
  min-height: 3cqw;
}
.live-recent em { flex: none; }

.mini-balls {
  display: flex;
  flex-wrap: wrap;
  gap: .45cqw;
  min-width: 0;
}
.mini-ball {
  display: grid;
  place-items: center;
  width: 2.5cqw;
  height: 2.5cqw;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 1.45cqw;
  font-variant-numeric: tabular-nums;
  color: #bfe9ff;
  background: rgba(0, 243, 255, .1);
  border: 1px solid rgba(0, 243, 255, .3);
}
.mini-ball.is-hit {
  color: #06131a;
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 1.1cqw rgba(0, 255, 102, .7);
}
.mini-balls .placeholder {
  font-size: 1.7cqw;
  color: var(--muted);
  letter-spacing: .12em;
}

/* ----------------------------------------------------- 开奖记录 弹层 ---- */

.history-list {
  display: flex;
  flex-direction: column;
  gap: .8cqw;
  margin-top: 1cqw;
}

/* 一行：期号 | 10 个球 | 命中数 */
.history-item {
  display: flex;
  align-items: center;
  gap: .9cqw;
  padding: .65cqw .9cqw;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
}
.history-item.is-mine {
  border-color: rgba(255, 215, 0, .35);
  background: rgba(255, 215, 0, .07);
}

.history-issue {
  flex: none;
  font-family: var(--font-num);
  font-size: 1.45cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: #9fb4c6;
}

.history-balls {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .38cqw;
  min-width: 0;
}

/* 记录里的球要比顶部横条的大得多，否则两位数字挤在 13px 的圆里看不清 */
.history-balls .mini-ball {
  width: 5.9cqw;
  height: 5.9cqw;
  font-size: 2.5cqw;
  letter-spacing: 0;
}

.history-tag {
  flex: none;
  min-width: 5.2cqw;
  white-space: nowrap;
  text-align: right;
  font-size: 1.45cqw;
  letter-spacing: .04em;
  color: var(--muted);
}
.history-item.is-mine .history-tag {
  color: var(--gold);
  font-weight: 700;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.72); }
}

@keyframes clockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}


/* =========================================================================
 THREE-COLOUR BET CHIPS — 三种颜色的下注方式
 绿=小额 / 蓝=中额 / 金=大额，点一下直接把注额跳到该档，
 仍可用左右「−/+」微调，所以是"快捷方式"而非替代。
 ====================================================================== */

.control-row-chips {
  align-items: center;
  gap: 1cqw;
  padding: .2cqw 0;
}

.chips-label {
  flex: none;
  font-size: 1.7cqw;
  letter-spacing: .16em;
  color: var(--muted);
}

.bet-chips {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1cqw;
}

.bet-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6cqw;
  padding: .75cqw .6cqw;
  border-radius: var(--radius-sm);
  font-size: 1.9cqw;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
  color: #b9c9d6;
  transition: color .16s, border-color .16s, box-shadow .16s, transform .08s, background .16s;
}
.bet-chip:active { transform: scale(.96); }
.bet-chip[disabled] { opacity: .34; cursor: default; transform: none; }

.chip-dot {
  width: 1.15cqw;
  height: 1.15cqw;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}

/* 三色各自的主题色 */
.bet-chip.is-green   { --chip: var(--green); }
.bet-chip.is-cyan    { --chip: var(--cyan); }
.bet-chip.is-magenta { --chip: var(--magenta); }

/* 筹码上是"绿 1-12"这种写法，区间数字弱化一档 */
.bet-chip span { display: inline-flex; align-items: baseline; gap: .35cqw; }
.bet-chip span b {
  font-size: 1.5cqw;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}
.bet-chip.is-on span b { color: inherit; opacity: .8; }

.bet-chip .chip-dot { background: var(--chip); box-shadow: 0 0 1cqw var(--chip); }

.bet-chip.is-on {
  color: #f2fbff;
  border-color: var(--chip);
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  box-shadow: 0 0 1.6cqw color-mix(in srgb, var(--chip) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* =========================================================================
 RECENT DRAWS STRIP — 近期开奖（横向滚动，每期一张卡）
 放在直播条内，紧贴期号与倒计时，是玩家最常瞄的一行。
 ====================================================================== */

/* --------------------------------------------------- 上期开奖（单期） ---- */

.live-last {
  display: flex;
  align-items: center;
  gap: 1cqw;
  padding-top: .55cqw;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.last-label {
  flex: none;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.last-label em {
  font-style: normal;
  font-size: 1.55cqw;
  letter-spacing: .16em;
  color: var(--muted);
}
.last-label b {
  font-family: var(--font-num);
  font-size: 1.45cqw;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: #7f96a8;
}

.last-balls {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .42cqw;
  min-width: 0;
}

/* 只显示一期，球可以放大到看得清两位数 */
.last-balls .mini-ball {
  width: 3.1cqw;
  height: 3.1cqw;
  font-size: 1.5cqw;
  letter-spacing: 0;
}

.last-balls .placeholder {
  font-size: 1.7cqw;
  color: var(--muted);
  letter-spacing: .12em;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.72); }
}

@keyframes clockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}


/* =========================================================================
 THREE-COLOUR BET CHIPS — 三种颜色的下注方式
 绿=小额 / 蓝=中额 / 金=大额，点一下直接把注额跳到该档，
 仍可用左右「−/+」微调，所以是"快捷方式"而非替代。
 ====================================================================== */

.control-row-chips {
  align-items: center;
  gap: 1cqw;
  padding: .2cqw 0;
}

.chips-label {
  flex: none;
  font-size: 1.7cqw;
  letter-spacing: .16em;
  color: var(--muted);
}

.bet-chips {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1cqw;
}

.bet-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6cqw;
  padding: .75cqw .6cqw;
  border-radius: var(--radius-sm);
  font-size: 1.9cqw;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
  color: #b9c9d6;
  transition: color .16s, border-color .16s, box-shadow .16s, transform .08s, background .16s;
}
.bet-chip:active { transform: scale(.96); }
.bet-chip[disabled] { opacity: .34; cursor: default; transform: none; }

.chip-dot {
  width: 1.15cqw;
  height: 1.15cqw;
  border-radius: 50%;
  flex: none;
  background: currentColor;
}

/* 三色各自的主题色 */
.bet-chip.is-green   { --chip: var(--green); }
.bet-chip.is-cyan    { --chip: var(--cyan); }
.bet-chip.is-magenta { --chip: var(--magenta); }

/* 筹码上是"绿 1-12"这种写法，区间数字弱化一档 */
.bet-chip span { display: inline-flex; align-items: baseline; gap: .35cqw; }
.bet-chip span b {
  font-size: 1.5cqw;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}
.bet-chip.is-on span b { color: inherit; opacity: .8; }

.bet-chip .chip-dot { background: var(--chip); box-shadow: 0 0 1cqw var(--chip); }

.bet-chip.is-on {
  color: #f2fbff;
  border-color: var(--chip);
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  box-shadow: 0 0 1.6cqw color-mix(in srgb, var(--chip) 55%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* =========================================================================
 RECENT DRAWS STRIP — 近期开奖（横向滚动，每期一张卡）
 放在直播条内，紧贴期号与倒计时，是玩家最常瞄的一行。
 ====================================================================== */

.recent-strip {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 1.6cqw;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: .2cqw;
  mask-image: linear-gradient(to right, #000 92%, transparent 100%);
}
.recent-strip::-webkit-scrollbar { display: none; }

.recent-card {
  flex: none;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: .7cqw;
  padding: .3cqw .8cqw .3cqw .7cqw;
  border-radius: 99px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--hairline-soft);
}
.recent-card.is-latest {
  border-color: rgba(0, 243, 255, .38);
  background: rgba(0, 243, 255, .07);
}
.recent-card.is-mine { border-color: rgba(255, 215, 0, .42); }

.recent-issue {
  flex: none;
  font-family: var(--font-num);
  font-size: 1.5cqw;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  letter-spacing: .02em;
}
.recent-card.is-latest .recent-issue { color: #9fe6ff; }

.recent-card .mini-balls { flex: none; flex-wrap: nowrap; gap: .32cqw; }
.recent-card .mini-ball {
  width: 2.05cqw;
  height: 2.05cqw;
  font-size: 1.25cqw;
}

.recent-strip .placeholder {
  font-size: 1.7cqw;
  color: var(--muted);
  letter-spacing: .12em;
  align-self: center;
}



/* =========================================================================
 COLOUR ZONES ON THE BOARD — 数字盘上的颜色归属
 每个格左上角一个小色点，说明它属于哪一色；
 选中某色时，该组整片发光，玩家不用记区间也能看懂。
 ====================================================================== */

.cell::before {
  content: "";
  position: absolute;
  top: .5cqw;
  left: .5cqw;
  width: .5cqw;
  height: .5cqw;
  border-radius: 50%;
  background: var(--cell-color, transparent);
  opacity: .8;
  pointer-events: none;
  transition: opacity .2s, box-shadow .2s;
}

/* 与摇奖机里球的实际配色一致：绿 / 青蓝 / 品红 */
.cell[data-color="green"]   { --cell-color: var(--green); }
.cell[data-color="cyan"]    { --cell-color: var(--cyan); }
.cell[data-color="magenta"] { --cell-color: var(--magenta); }

/* 已选定的颜色分区。
   必须排除 .is-hit —— 否则"我选的色"的底色会盖掉"已命中"的绿色，
   玩家看不到哪几个球真的中了。 */
.cell.is-color-pick:not(.is-hit):not(.is-drawn):not(.is-color-hit) {
  color: #f2fbff;
  border-color: var(--cell-color);
  background:
    linear-gradient(165deg,
      color-mix(in srgb, var(--cell-color) 18%, transparent),
      rgba(18, 25, 36, .82));
  box-shadow:
    inset 0 0 1.6cqw color-mix(in srgb, var(--cell-color) 30%, transparent),
    0 0 1.6cqw color-mix(in srgb, var(--cell-color) 32%, transparent);
}
.cell.is-color-pick:not(.is-hit)::before {
  opacity: 1;
  box-shadow: 0 0 1.2cqw var(--cell-color);
}

/* =========================================================================
 COLOUR ODDS PANEL — 颜色投资时替换 1-10 命中倍数格
 押两个颜色时，"命中 1-10 个"这套格子表达不了两注各自的赔率，
 改成三张卡：色名 / 赔率区间 / 本局已开出多少球。
 ====================================================================== */

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .8cqw;
  width: 100%;
}
.color-grid[hidden] { display: none; }

/* .multiplier-grid 自身是 display:grid，会盖掉 [hidden] 的 display:none，
   必须显式声明，否则切到颜色模式时两个面板会同时出现 */
.multiplier-grid[hidden] { display: none; }

.color-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25cqw;
  padding: .9cqw .5cqw;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
  font-variant-numeric: tabular-nums;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.color-box.is-green   { --cc: var(--green); }
.color-box.is-cyan    { --cc: var(--cyan); }
.color-box.is-magenta { --cc: var(--magenta); }

.cb-head {
  display: flex;
  align-items: center;
  gap: .5cqw;
  font-size: 1.85cqw;
  letter-spacing: .12em;
  color: #cfdfec;
}
.cb-dot {
  width: 1.1cqw;
  height: 1.1cqw;
  border-radius: 50%;
  background: var(--cc);
  box-shadow: 0 0 1cqw var(--cc);
}

.cb-odds {
  font-size: 1.65cqw;
  letter-spacing: .02em;
  color: var(--muted);
}
.cb-count {
  font-size: 2.3cqw;
  font-weight: 700;
  color: #eaf7ff;
  line-height: 1.1;
}

/* 已投的颜色 */
.color-box.is-on {
  border-color: var(--cc);
  background: color-mix(in srgb, var(--cc) 12%, transparent);
  box-shadow: inset 0 0 1.4cqw color-mix(in srgb, var(--cc) 22%, transparent);
}
.color-box.is-on .cb-odds { color: #d8ecf7; }

/* 本局开得最多的颜色 */
.color-box.is-top {
  box-shadow: 0 0 1.8cqw color-mix(in srgb, var(--cc) 45%, transparent),
              inset 0 0 1.4cqw color-mix(in srgb, var(--cc) 22%, transparent);
}
.color-box.is-top .cb-count { color: var(--cc); }


/* 颜色模式下"已开出且属于我押的颜色"的格子：
   用该号自身的颜色点亮，而不是统一的绿色 —— 押两个颜色时才能分清是哪一色。 */
.cell.is-color-hit {
  color: #ffffff;
  border-color: var(--cell-color);
  background:
    linear-gradient(165deg,
      color-mix(in srgb, var(--cell-color) 45%, transparent),
      rgba(12, 18, 28, .86));
  box-shadow:
    inset 0 0 1.6cqw color-mix(in srgb, var(--cell-color) 55%, transparent),
    0 0 1.8cqw color-mix(in srgb, var(--cell-color) 50%, transparent);
}
.cell.is-color-hit::before {
  opacity: 1;
  box-shadow: 0 0 1.2cqw var(--cell-color);
}

/* ------------------------------------------------- 赔率表：颜色区块 ---- */

.pay-subhead {
  margin: 2.2cqw 0 .8cqw;
  font-size: 1.9cqw;
  font-weight: 700;
  letter-spacing: .14em;
  color: #b9cfe0;
}

.color-pay-grid {
  display: flex;
  flex-direction: column;
  gap: .6cqw;
}

.color-pay-row {
  display: flex;
  align-items: center;
  gap: .8cqw;
  padding: .75cqw 1cqw;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--hairline-soft);
  font-variant-numeric: tabular-nums;
}
.color-pay-row.is-green   { --cc: var(--green); }
.color-pay-row.is-cyan    { --cc: var(--cyan); }
.color-pay-row.is-magenta { --cc: var(--magenta); }

.cpr-dot {
  width: 1.1cqw;
  height: 1.1cqw;
  flex: none;
  border-radius: 50%;
  background: var(--cc);
  box-shadow: 0 0 1cqw var(--cc);
}
.cpr-name {
  flex: none;
  font-size: 1.75cqw;
  letter-spacing: .1em;
  color: #d7e6f2;
}
.cpr-count {
  flex: none;
  font-size: 1.55cqw;
  color: var(--muted);
}
.cpr-per {
  margin-left: auto;
  font-size: 1.8cqw;
  font-weight: 700;
  color: #eaf7ff;
}
.cpr-max {
  flex: none;
  min-width: 9cqw;
  text-align: right;
  font-size: 1.5cqw;
  color: var(--muted);
}

/* =========================================================================
 直播条精修：把"直播中 / 期号 / 倒计时 / 上期开奖"做出主次
 ====================================================================== */

#liveBar {
  padding: 1.1cqw 1.6cqw 1cqw;
  gap: .8cqw;
}

.live-row { gap: 1.2cqw; }

/* 倒计时是最需要一眼看到的，单独放大并加发光 */
.live-clock {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .1cqw;
  line-height: 1;
  flex: none;
}
.live-clock em {
  font-size: 1.5cqw;
  letter-spacing: .18em;
  color: #9fb4c6;
}
.live-clock b {
  font-family: var(--font-num);
  font-size: 3.1cqw;
  font-weight: 700;
  letter-spacing: .01em;
  color: #eaf7ff;
  text-shadow: 0 0 1.8cqw rgba(0, 243, 255, .55);
}
.live-clock.is-urgent b {
  color: #ff8fa3;
  text-shadow: 0 0 2cqw rgba(255, 45, 85, .9);
}

/* 期号弱化，让位给倒计时 */
.live-issue { flex: 1 1 auto; min-width: 0; }
.live-issue b { font-size: 2.1cqw; }

/* =========================================================================
 赔率表：颜色行改成"左颜色 / 右赔率"两栏，字号放大
 ====================================================================== */

.color-pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2cqw;
  padding: 1.1cqw 1.3cqw;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--hairline-soft);
  border-left-width: .35cqw;
  border-left-color: var(--cc);
}

.cpr-left {
  display: flex;
  align-items: center;
  gap: .8cqw;
  min-width: 0;
}
.cpr-left b {
  font-size: 2.3cqw;
  font-weight: 700;
  letter-spacing: .1em;
  color: #eaf7ff;
}
.cpr-left em {
  font-style: normal;
  font-size: 1.75cqw;
  color: var(--muted);
}

.cpr-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}
.cpr-right b {
  font-size: 2.7cqw;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cc);
  text-shadow: 0 0 1.4cqw color-mix(in srgb, var(--cc) 45%, transparent);
}
.cpr-right em {
  font-style: normal;
  font-size: 1.6cqw;
  color: var(--muted);
}

/* =========================================================================
 直播条：改成单行 —— 直播中 / 期号 / 上期开奖 / 倒计时 挤在一排，
 上期开奖的球按号码所属颜色着色。
 ====================================================================== */

#liveBar {
  padding: .9cqw 1.4cqw;
  gap: 0;
}
#liveBar .live-row {
  flex-wrap: nowrap;
  gap: .9cqw;
}

/* 倒计时横排，避免把整条撑成两行高 */
.live-clock {
  flex-direction: row;
  align-items: baseline;
  gap: .5cqw;
  margin-left: 0;
}
.live-clock em { font-size: 1.55cqw; letter-spacing: .14em; }
.live-clock b { font-size: 2.9cqw; }

/* 期号压缩一点，给球腾位置 */
.live-issue { flex: 0 1 auto; }
.live-issue em { font-size: 1.5cqw; letter-spacing: .1em; }
.live-issue b { font-size: 1.9cqw; }

/* 上期开奖：占据中间弹性空间，球靠右贴住倒计时 */
.last-balls {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .32cqw;
  min-width: 0;
}
.last-balls .mini-ball {
  width: 3.2cqw;
  height: 3.2cqw;
  font-size: 1.55cqw;
  letter-spacing: 0;
}
.last-balls .placeholder {
  font-size: 1.6cqw;
  color: var(--muted);
  letter-spacing: .1em;
}

/* --------------------------------------------------- 球按颜色着色 ---- */

.mini-ball {
  --bc: #9fd4ea;
  color: var(--bc);
  background: rgba(255, 255, 255, .05);
  border: 1px solid color-mix(in srgb, var(--bc) 48%, transparent);
}
.mini-ball[data-color="green"]   { --bc: var(--green); }
.mini-ball[data-color="cyan"]    { --bc: var(--cyan); }
.mini-ball[data-color="magenta"] { --bc: var(--magenta); }

/* 命中/我押中的球：实心填充该球自己的颜色 */
.mini-ball.is-hit {
  color: #06131a;
  background: var(--bc);
  border-color: var(--bc);
  box-shadow: 0 0 1.1cqw color-mix(in srgb, var(--bc) 65%, transparent);
}

/* 单行里其实有富余宽度，把上期开奖的球再放大一档，两位数才读得清 */
.last-balls .mini-ball {
  width: 3.8cqw;
  height: 3.8cqw;
  font-size: 1.8cqw;
  font-weight: 700;
}
.last-balls { gap: .3cqw; }

/* 期号再收一点，给球让位 */
.live-issue b { font-size: 1.8cqw; letter-spacing: 0; }

/* 倒计时前加一道细分割，视觉上把"开奖信息"和"倒计时"分开 */
.live-clock {
  padding-left: .9cqw;
  border-left: 1px solid rgba(255, 255, 255, .1);
}

/* 单行里的极简"上期"标签，避免中间那串小球来路不明 */
.last-tag {
  flex: none;
  font-size: 1.45cqw;
  letter-spacing: .12em;
  color: var(--muted);
  padding-left: .9cqw;
  border-left: 1px solid rgba(255, 255, 255, .1);
}

/* "上期 + 小球"作为一个整体贴右，避免标签和球之间被弹性空隙拉开 */
.last-tag { margin-left: auto; }
.last-balls { flex: 0 0 auto; }
