/* 袋鼠猜倍数 · 夜场拳击机 */
.limbo {
  position: fixed; inset: 0; z-index: 10; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; container: boxing / size;
  padding: var(--safe-t, 0px) 0 calc(var(--safe-b, 0px) + 10px);
  --bg: #0a0a0a; --surface: #151515; --surface-2: #1f1f1f; --line: #262626;
  --ink: #fff; --ink-2: #a6a6a6; --ink-3: #8a8a8a; --neon: #e5ff3c; --selected: #a7b934; --neon-ink: #101108; --bad: #ff5a5a; /* 输掉的钱一律这个红(test/loss-amount.test.js) */
  --sans: system-ui, -apple-system, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.limbo[hidden] { display: none; }
.limbo :where(p, h2, h3) { margin: 0; }
/* 用 :where 把重置的权重压到 0:后面单个 class 的按钮样式才盖得过它(button 的 background:none 会吃掉底色) */
.limbo :where(button) { appearance: none; border: 0; margin: 0; padding: 0; font: inherit; color: inherit; background: none; cursor: pointer; }
.limbo button:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
.limbo img { -webkit-user-drag: none; pointer-events: none; }
/* 按钮里面的字一律点不到:按下、松手、click 都落在按钮本身 */
.limbo button > *, .limbo button * { pointer-events: none; }

/* 顶栏:返回、标题、余额、音乐与音效。长标题折两行，给两个独立开关留足点按空间。 */
.lb-top { flex: none; display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 8px 12px; }
.lb-back, .lb-music, .lb-sound { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.lb-back svg, .lb-music svg, .lb-sound svg { width: 20px; height: 20px; }
.lb-music[aria-pressed="false"], .lb-sound[aria-pressed="false"] { color: var(--ink-2); }
.lb-title { flex: 1; min-width: 0; text-align: center; font-size: clamp(16px, 5vw, 20px); font-weight: 800; line-height: 1.12; letter-spacing: .02em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lb-bal { flex: none; max-width: 35%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 10px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 374px) { .lb-top { gap: 4px; } .lb-title { font-size: 16px; } }
@media (max-width: 359px) { .lb-top { gap: 6px; padding-left: 12px; padding-right: 12px; } .lb-bal { padding: 6px 9px; font-size: 13px; } }

/* Both layers show the same cabinet. Keeping the whole canvas in view preserves the
   contact point and the scale from the smallest Telegram sheet to a desktop. */
.lb-hero { flex: none; display: grid; grid-template-rows: auto auto; border: 1px solid #38352e; background: #101212; overflow: hidden; border-radius: 16px; margin: 0 12px; }
.lb-stage { isolation: isolate; position: relative; width: 100%; aspect-ratio: 4 / 3; background: radial-gradient(ellipse at 48% 60%, #202021, #0b0e12 72%); }
.lb-poster, .lb-night-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.lb-night-canvas[hidden] { display: none; }
.lb-readout { position: relative; min-width: 0; display: grid; align-items: center; grid-template-columns: repeat(2,minmax(0,1fr)); min-height: 40px; column-gap: 8px; padding: 4px 11px; border-top: 1px solid #363229; background: linear-gradient(105deg,#191a1a,#171817 55%,#22201b); }
.lb-meter { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.lb-meter small { color: #b8b7ae; font-size: 10px; line-height: 1.1; }
.lb-meter b { color: #f3dbad; font-weight: 750; font-size: clamp(13px,3.8vw,22px); line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-meter [data-big] { color: #fcf9f0; font-size: clamp(12px,3.5vw,21px); }
/* Float the receipt over the arena floor. Both score meters and all controls keep their places. */
.lb-cardwrap {
  position: absolute; z-index: 1; inset-inline: 8px; bottom: calc(100% + 8px);
  max-width: 272px; margin-inline: auto 0; container-type: inline-size; pointer-events: none;
}
.lb-cardwrap:not(:empty) {
  padding: 7px 12px; border-radius: 10px; color: var(--ink);
  background: rgba(27,35,21,.96); box-shadow: inset 3px 0 var(--neon), inset 0 0 0 1px #485036, 0 3px 10px #0006;
  animation: lb-receipt-in .16s ease-out;
}
.lb-hero[data-outcome="miss"] .lb-cardwrap:not(:empty) {
  background: rgba(34,25,26,.96); box-shadow: inset 3px 0 #ac484b, inset 0 0 0 1px #4b3537, 0 3px 10px #0006;
}
@keyframes lb-receipt-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.lb-card, .lb-card-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: baseline; gap: 8px; }
.lb-card { line-height: 1.15; }
.lb-card-big { color: var(--neon); font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.lb-card.is-miss .lb-card-big { color: #f3dddd; }
.lb-card-amt { color: #f7ffe1; text-align: right; font: 850 23px/1.1 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap; }
@supports (width: 1cqw) {
  .lb-card-amt { font-size: min(24px, calc(57cqw / var(--aw,6))); }
}
.lb-card.is-miss .lb-loss { color: var(--bad); }
.lb-card-detail { margin-top: 3px; color: #b8beb0; font: 550 11px/1.25 var(--sans); }
.lb-card-detail > :last-child { text-align: right; overflow-wrap: anywhere; }
.lb-net { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 5px; }
.lb-net b { color: #f2f5e9; font-weight: 700; font-variant-numeric: tabular-nums; }
/* ---------- 控制面板 ---------- */
.lb-panel { flex: 1 0 auto; align-content: space-evenly; display: grid; gap: 8px; padding: 10px 16px 0; }
/* 等服务器的时候不收第二下 */
.lb-panel.lb-busy { pointer-events: none; }
/* 等回复超过 0.3 秒:面板暗下去(「开始」写着「进行中」,不跟着暗) */
.lb-panel.lb-busy.lb-wait > :not(.lb-go) { opacity: .55; }
/* 演的时候(点火到出结果)目标、注额两块灰掉,最近结果和「进行中」照样亮 */
.lb-panel.is-rolling .lb-box { opacity: .68; }

.lb-label { display: block; font-size: 13px; font-weight: 800; line-height: 1.2; }
/* 最近结果:一排小胶囊,最新在最左;≥ 2 倍柠檬色、其余灰;放不下就横着滑 */
.lb-recent { display: grid; gap: 6px; padding: 8px 12px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.lb-recent-row { display: flex; align-items: center; gap: 6px; min-height: 28px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
.lb-recent-row::-webkit-scrollbar { display: none; }
.lb-chip { flex: none; padding: 4px 9px; border-radius: 8px; background: #232323; box-shadow: inset 0 0 0 1px #2f2f2f; color: var(--ink-2); font-style: normal; font-size: 12px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.lb-chip.is-hot { background: rgba(229, 255, 61, .08); box-shadow: inset 0 0 0 1.5px rgba(229, 255, 61, .75); color: var(--neon); }
.lb-chip.is-new { animation: lb-chip-in .3s ease-out; }
@keyframes lb-chip-in { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.lb-recent-empty { font-size: 12px; color: var(--ink-3); }

/* 目标倍数 / 下注金额:标题、− 数字 +、底下五颗快捷键 */
.lb-box { display: grid; gap: 7px; padding: 8px 12px 10px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.lb-row { display: flex; align-items: stretch; gap: 10px; }
.lb-step { flex: none; display: grid; place-items: center; width: 54px; min-height: 44px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); font-size: 26px; font-weight: 600; }
.lb-step:disabled { opacity: .35; }
.lb-field { flex: 1; min-width: 0; display: grid; place-items: center; min-height: 44px; border-radius: 12px; background: #0e0e0e; box-shadow: inset 0 0 0 1px var(--line); cursor: text; }
.lb-in { display: inline-flex; align-items: baseline; justify-content: center; gap: 3px; max-width: 100%; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* 框的宽由 limbo.js 照字数写(几个 ch):「2.00」紧贴着「x」、「RM」紧贴着数字,一起置中 */
.lb-in input { width: 5ch; min-width: 0; max-width: 10ch; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: center; outline: none; -webkit-user-select: text; user-select: text; }
.lb-in input:disabled { color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
.lb-unit { font-size: .8em; }
.lb-box.lb-target-box { grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; }
.lb-target-value { justify-self: end; display: inline-flex; align-items: center; min-height: 30px; cursor: text; }
.lb-target-value .lb-in { color: var(--neon); font-size: 21px; line-height: 1; gap: 1px; }
.lb-target-value input, .lb-target-value input:disabled { color: inherit; -webkit-text-fill-color: currentColor; text-align: right; }
.lb-target-value input:focus-visible { outline: 1px solid var(--neon); outline-offset: 2px; border-radius: 3px; }
.lb-target-box .lb-quick, .lb-slider-row { grid-column: 1 / -1; }
.lb-slider-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; column-gap: 8px; }
.lb-slider-row > span { color: var(--ink-2); font: 600 10px/1 system-ui,sans-serif; font-variant-numeric: tabular-nums; }
.lb-target-slider {
  --track: linear-gradient(to right,var(--selected) 0% var(--fill,0%),#383838 var(--fill,0%) 100%);
  --thumb: linear-gradient(90deg,transparent 37%,#555f15 37% 42%,transparent 42% 57%,#555f15 57% 62%,transparent 62%) center / 14px 8px no-repeat, var(--neon);
  display: block; box-sizing: border-box; width: 100%; height: 44px; min-width: 0; padding: 0; margin: 0;
  appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; direction: ltr;
}
.lb-target-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 9px; background: var(--track); }
.lb-target-slider::-moz-range-track { height: 6px; border-radius: 9px; background: var(--track); }
.lb-target-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; box-sizing: border-box; width: 25px; height: 25px; margin-top: -9.5px; border: 0; border-radius: 50%; background: var(--thumb); box-shadow: 0 2px 5px #0008; }
.lb-target-slider::-moz-range-thumb { box-sizing: border-box; width: 25px; height: 25px; border: 0; border-radius: 50%; background: var(--thumb); box-shadow: 0 2px 5px #0008; }
.lb-target-slider:focus-visible { outline: 2px solid var(--neon); outline-offset: -2px; border-radius: 8px; }
.lb-target-slider:active { cursor: grabbing; }
.lb-target-slider:disabled { cursor: default; }
.lb-quick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.lb-qbtn { min-width: 0; min-height: 34px; padding: 0 2px; border-radius: 10px; background: #181818; color: #aaa; box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-qbtn.is-on { background: var(--selected); color: var(--neon-ink); box-shadow: none; }
.lb-qbtn:active:not(:disabled), .lb-step:active:not(:disabled), .lb-music:active, .lb-sound:active { transform: scale(.97); }
.lb-panel.is-rolling :is(.lb-qbtn,.lb-step):disabled { opacity: 1; }

/* The wager card and its action use the cup game's charcoal and lime palette. */
.lb-bet-box .lb-step { background: #181818; color: #aaa; box-shadow: inset 0 0 0 1px var(--line); }
.lb-bet-box .lb-field { background: transparent; box-shadow: none; }
.lb-bet-box .lb-in { color: #aaa; }
.lb-bet-box .lb-in input { color: inherit; }
.lb-bet-box .lb-field:focus-within { box-shadow: inset 0 0 0 1px var(--neon); }
.lb-go { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; border-radius: 999px; background: #1c1d10; color: var(--neon); font-size: 22px; font-weight: 900; letter-spacing: .06em; box-shadow: inset 0 0 0 2px currentColor; }
.limbo .lb-go:focus-visible { outline-color: currentColor; }
.lb-go:active:not(:disabled) { transform: scale(.98); }
.lb-go:disabled { opacity: .4; }
.lb-go.is-rolling:disabled { opacity: 1; color: #c4c4c4; background: #202020; box-shadow: inset 0 0 0 1px #3b3b3b; }
.lb-spin { display: none; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px dotted currentColor; }
.lb-go.is-rolling .lb-spin { display: block; animation: lb-spin .9s linear infinite; }
@keyframes lb-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.lb-hint { min-height: 22px; font-size: 12px; color: var(--ink-3); text-align: center; }

/* 规则卡在 .limbo 外面(弹层):目标倍数、注额的范围和单局最高派彩 */
.sim-table.lb-rules-table { width: 100%; table-layout: fixed; font-size: 13px; margin-top: 10px; }
.lb-rules-table td { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Laptop previews keep the same 390px handset and reading distances as the mini app. */
@media (min-width: 600px) {
  .limbo {
    --app-max-width: 390px;
    width: 390px; max-width: 100%; height: min(100dvh,844px); margin: auto;
    box-shadow: 0 6px 40px #0005;
  }
  .lb-title { font-size: 19.5px; }
  .lb-meter b { font-size: 14.82px; }
  .lb-meter [data-big] { font-size: 13.65px; }
}

/* Telegram overlays consume space inside the viewport. Size the game to its usable content box. */
@container boxing (max-height: 800px) or (max-width: 359px) {
  .lb-top { min-height: 46px; padding: 4px 12px; }
  .lb-back { width: 36px; height: 36px; }
  .lb-panel { gap: 7px; padding: 8px 12px 0; }
  .lb-recent { grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 9px; padding: 5px 10px; }
  .lb-recent-row { min-height: 26px; }
  .lb-box {
    grid-template-columns: minmax(64px,.57fr) minmax(0,1fr);
    align-items: center; gap: 6px 7px; padding: 8px 10px;
  }
  .lb-quick { grid-column: 1 / -1; gap: 6px; }
  .lb-step { width: 36px; }
  .lb-row { gap: 4px; }
  .lb-step, .lb-field { min-height: 34px; }
  .lb-in { font-size: 18px; }
  .lb-qbtn { min-height: 30px; font-size: 14px; }
  .lb-go { min-height: 46px; font-size: 19px; }
  .lb-hint { min-height: 22px; }
}
@container boxing (max-height: 700px) {
  /* Keep the full 4:3 art and punch contact point when the action needs more room. */
  .lb-stage { justify-self: center; width: min(100%, max(192px, calc((100cqh - 410px) * 4 / 3))); }
  .lb-readout { min-height: 32px; padding-block: 3px; }
  .lb-cardwrap:not(:empty) { bottom: calc(100% + 4px); padding: 4px 9px; }
  .lb-top { min-height: 44px; padding-block: 3px; }
  .lb-panel { gap: 5px; padding-top: 6px; }
  .lb-box { padding-block: 6px; gap: 5px; }
  .lb-recent { padding-block: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-chip.is-new, .lb-go.is-rolling .lb-spin, .lb-cardwrap:not(:empty) { animation: none; }
}
