/* ============================================================================
 * shell.css — Ganbei TMA v5.1 play shell (KTV neon)
 * ----------------------------------------------------------------------------
 * Single-canvas mobile layout. Aviator-like flow density, neon KTV skin.
 * Thumb-zone dock. Always-on HUD. No welcome gate. No stacked play sheets.
 * ========================================================================== */

.app {
  position: relative; z-index: 1;
  max-width: 430px;
  margin: 0 auto;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 70% 42% at 12% 0%, rgba(255,45,146,0.26) 0%, transparent 55%),
    radial-gradient(ellipse 62% 38% at 92% 6%, rgba(45,226,255,0.18) 0%, transparent 52%),
    radial-gradient(ellipse 50% 28% at 50% 100%, rgba(168,85,247,0.16) 0%, transparent 55%),
    linear-gradient(180deg, #140816 0%, #08040e 40%, #050308 100%);
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    0
    env(safe-area-inset-left, 0px);
  overflow: hidden;
}

/* ---------- Topbar: avatar chip + compact chrome ---------- */
.topbar {
  padding: 8px 10px 4px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; z-index: 50; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.avatar-btn {
  width: 40px; height: 40px; position: relative; cursor: pointer;
  flex-shrink: 0;
}
.avatar-btn::before {
  content: ''; position: absolute; inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--magenta, #ff2d92), var(--cyan, #2de2ff), var(--violet, #a855f7), var(--magenta, #ff2d92));
  opacity: 0.95;
  filter: drop-shadow(0 0 8px rgba(255,45,146,0.55));
}
.avatar-btn-inner {
  position: absolute; inset: 2px; border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, var(--avatar-c1, #2a0a24), var(--avatar-c2, #0a0612));
  display: grid; place-items: center;
  color: var(--cyan, #2de2ff);
  font-family: 'Noto Serif SC', serif;
  font-size: 15px; font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 0 rgba(0,0,0,0.5);
}
.avatar-btn-inner .portrait,
.ch-portrait .portrait,
.ch-avatar .portrait {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  border-radius: 50%;
  filter: saturate(1.28) contrast(1.08) hue-rotate(-6deg);
}
.avatar-btn-inner .glyph,
.ch-portrait .glyph,
.ch-avatar .glyph { position: relative; z-index: 1; }
.avatar-btn-inner.has-portrait .glyph,
.ch-portrait.has-portrait .glyph,
.ch-avatar.has-portrait .glyph { display: none; }
.avatar-btn:active { transform: scale(0.94); }

.brand-text { line-height: 1.05; min-width: 0; }
.brand-text .tag {
  font-family: 'Noto Serif SC', serif;
  font-size: 15px; letter-spacing: 0.4px;
  color: var(--tier-color, var(--ink));
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255,45,146,0.35), 0 1px 2px rgba(0,0,0,0.5);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 42vw;
}
.brand-text .ver {
  font-size: 8px; letter-spacing: 1.2px;
  color: var(--cyan, #2de2ff); text-transform: uppercase; font-weight: 700;
  opacity: 0.8;
}

.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 30px; height: 30px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(45,226,255,0.32);
  border-radius: 50%;
  color: var(--cyan, #2de2ff);
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 0 10px rgba(45,226,255,0.18);
}
.icon-btn:active { transform: scale(0.92); }

.music-btn {
  width: 30px; height: 30px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,45,146,0.32);
  border-radius: 50%;
  color: var(--hot-pink, #ff4dcf);
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  box-shadow: 0 0 10px rgba(255,45,146,0.16);
}
.music-btn:active { transform: scale(0.92); }
.music-btn svg { display: block; }
.music-btn .mute-x1, .music-btn .mute-x2 { display: none; }
.music-btn.muted { color: var(--tg-hint); border-color: rgba(120,120,130,0.4); box-shadow: none; }
.music-btn.muted .waves { display: none; }
.music-btn.muted .mute-x1, .music-btn.muted .mute-x2 { display: inline; stroke: #ff4dcf; }
.music-btn.playing { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(45,226,255,0.22), 0 0 12px rgba(45,226,255,0.28); }

.mode-toggle {
  display: flex; background: rgba(0,0,0,0.55);
  border: 1px solid rgba(168,85,247,0.28);
  border-radius: 999px; padding: 2px;
}
.mode-toggle button {
  background: none; border: none; color: var(--tg-hint);
  padding: 4px 8px; border-radius: 999px;
  cursor: pointer; font-family: inherit; font-weight: 800; font-size: 9px;
  letter-spacing: 0.4px;
}
.mode-toggle button.active.real { background: var(--usdt); color: white; }
.mode-toggle button.active.free {
  background: linear-gradient(180deg, var(--cyan), #148aa0); color: #041014;
}

/* ---------- Always-on HUD ---------- */
.hud {
  padding: 0 10px 4px;
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 0.95fr 0.55fr;
  gap: 5px;
  z-index: 50; flex-shrink: 0;
}
.hud > div {
  background: rgba(5,3,8,0.62);
  border: 1px solid rgba(45,226,255,0.22);
  border-radius: 9px;
  padding: 5px 8px 4px;
  backdrop-filter: blur(6px);
  min-width: 0;
  box-shadow: 0 0 12px rgba(45,226,255,0.08);
}
.hud .lbl {
  font-size: 8px; letter-spacing: 1.1px; color: var(--tg-hint); text-transform: uppercase;
  line-height: 1;
}
.hud .val {
  font-weight: 800; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink);
  margin-top: 2px; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud .wallet .currency {
  display: inline-block;
  font-size: 7px; padding: 1px 4px; border-radius: 3px;
  background: var(--usdt); color: white; margin-left: 3px; vertical-align: middle;
}
.hud .wallet .currency.gan { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #2a0d0d; }
.hud .mult .val {
  color: var(--cyan);
  text-shadow: 0 0 calc(var(--glow) * 14px) rgba(45,226,255, calc(0.45 + var(--glow) * 0.7));
}
.hud .mult.tier-2 .val { color: #7af6ff; }
.hud .mult.tier-3 .val { color: #ff4dcf; }
.hud .mult.tier-4 .val { color: #ff2d92; }
.hud .mult.tier-5 .val { color: #ff2d92; text-shadow: 0 0 18px rgba(255,45,146,0.9); }
.hud .profit .val { color: var(--jade-bright); font-size: 12px; text-shadow: 0 0 8px rgba(61,255,176,0.35); }
.hud .streak .val { color: #ff9d3c; text-shadow: 0 0 6px rgba(255,157,60,0.4); }
.hud .streak.hot .val { color: #ff2d92; text-shadow: 0 0 10px rgba(255,45,146,0.7); }

/* aliases so existing JS that targets .strip still styles HUD */
.strip .mult .val { display: inline-block; }
.strip .mult.bump .val { animation: mult-bump 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes mult-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}

/* ---------- History rail ---------- */
.history-rail {
  padding: 3px 10px 4px;
  display: flex; gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
  z-index: 40;
  min-height: 28px;
  align-items: center;
  flex-shrink: 0;
}
.history-rail::-webkit-scrollbar { display: none; }
.history-rail .hr-empty {
  font-size: 8px; letter-spacing: 1.4px;
  color: rgba(200,190,255,0.32);
  text-transform: uppercase;
  text-align: center;
  width: 100%;
  font-weight: 600;
}
.history-chip {
  flex: 0 0 auto;
  appearance: none;
  font-family: inherit;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(45,226,255,0.28);
  color: var(--cyan);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  white-space: nowrap;
  cursor: pointer;
}
.history-chip.cashout { background: rgba(61,255,176,0.16); border-color: var(--jade-bright); color: var(--jade-bright); }
.history-chip.perfect { background: rgba(245,217,138,0.22); border-color: var(--gold-bright); color: var(--gold-bright); box-shadow: 0 0 8px rgba(245,217,138,0.4); }
.history-chip.bust { background: rgba(255,45,146,0.14); border-color: rgba(255,45,146,0.65); color: #ff8ad8; }
.history-chip.bigwin { background: rgba(255,45,146,0.18); border-color: #ff2d92; color: #ff2d92; box-shadow: 0 0 6px rgba(255,45,146,0.35); }

.hist-pop {
  position: fixed;
  left: 50%;
  top: 120px;
  transform: translateX(-50%);
  background: rgba(8,4,14,0.97);
  border: 1.5px solid rgba(45,226,255,0.5);
  border-radius: 12px;
  padding: 9px 14px;
  z-index: 400;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, visibility 0.16s;
  text-align: center;
  min-width: 148px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.7), 0 0 22px rgba(255,45,146,0.2);
}
.hist-pop.show { opacity: 1; visibility: visible; }
.hist-pop .hp-kind {
  font-size: 8px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--tg-hint); font-weight: 800;
}
.hist-pop .hp-mult {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900; font-size: 20px; color: var(--cyan);
  line-height: 1.1; margin: 2px 0;
}
.hist-pop .hp-profit { font-size: 12px; font-weight: 800; color: var(--jade-bright); }
.hist-pop.bust .hp-mult, .hist-pop.bust .hp-profit { color: #ff8ad8; }

/* ---------- Progressive-win punch (hero of the play surface) ---------- */
.win-line {
  flex-shrink: 0;
  z-index: 45;
  padding: 2px 12px 6px;
  text-align: center;
  pointer-events: none;
}
.win-line .wl-cn {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  line-height: 1.15;
  color: #fff;
  text-shadow:
    0 0 10px rgba(255,45,146,0.75),
    0 0 22px rgba(45,226,255,0.35),
    0 2px 4px rgba(0,0,0,0.75);
}
.win-line .wl-en {
  margin-top: 1px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(45,226,255,0.45);
}
.win-line.live .wl-cn {
  color: #fff6ff;
  text-shadow:
    0 0 12px rgba(255,45,146,0.95),
    0 0 26px rgba(45,226,255,0.5),
    0 2px 4px rgba(0,0,0,0.8);
}

/* ---------- Play canvas ---------- */
.table-wrap {
  position: relative; flex: 1 1 0;
  min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 0 12px 4px;
  z-index: 30;
}
.table-wrap .scene-bg {
  position: absolute; inset: 0;
  background-image: url('../brand/characters/cast-hero-v2-2.png');
  background-size: 160% auto;
  background-position: center 18%;
  background-repeat: no-repeat;
  filter: brightness(0.36) saturate(1.5) hue-rotate(-16deg) contrast(1.12);
  opacity: 0.58;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 70%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 70%, transparent 100%);
  pointer-events: none;
}
.table-wrap .scene-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 32%, rgba(5,3,8,0.62) 100%),
    linear-gradient(180deg, rgba(255,45,146,0.08), transparent 28%, transparent 70%, rgba(45,226,255,0.08));
  pointer-events: none;
}
.ktv-floor {
  position: absolute;
  left: 8%; right: 8%;
  bottom: 4%;
  height: 28%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,45,146,0.22), transparent 62%),
    linear-gradient(180deg, rgba(45,226,255,0.1), transparent 80%);
  filter: blur(10px);
  opacity: 0.7;
  transform: perspective(400px) rotateX(68deg);
}
.table-surface {
  width: 100%; flex: 1 1 0;
  min-height: 0;
  perspective: 800px;
  perspective-origin: 50% 20%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}

/* Club LED board — live stage mult + profit */
.stage-board {
  position: absolute;
  top: 1%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  pointer-events: none;
  min-width: 42%;
  padding: 4px 14px 5px;
  text-align: center;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8,4,16,0.55), rgba(5,3,8,0.35));
  border: 1px solid rgba(45,226,255,0.18);
  box-shadow: 0 0 16px rgba(255,45,146,0.12);
  opacity: 0.38;
  transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.stage-board.live {
  opacity: 1;
  border-color: rgba(45,226,255,0.55);
  box-shadow:
    0 0 18px rgba(255,45,146,0.35),
    0 0 28px rgba(45,226,255,0.22),
    inset 0 0 12px rgba(45,226,255,0.08);
}
.stage-board.climb {
  animation: stage-board-climb 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes stage-board-climb {
  0%   { transform: translateX(-50%) scale(1); }
  35%  { transform: translateX(-50%) scale(1.12); box-shadow: 0 0 28px rgba(255,45,146,0.7), 0 0 40px rgba(45,226,255,0.45); }
  100% { transform: translateX(-50%) scale(1); }
}
.stage-mult {
  position: static;
  top: auto; left: auto;
  transform: none;
  z-index: 6;
  pointer-events: none;
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  font-size: clamp(30px, 10vw, 46px);
  color: var(--cyan);
  text-shadow:
    0 0 14px rgba(45,226,255,0.75),
    0 0 28px rgba(255,45,146,0.4),
    0 3px 8px rgba(0,0,0,0.8);
  letter-spacing: 0.5px;
  opacity: 1;
  transition: opacity 0.25s, transform 0.25s, color 0.25s;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stage-mult.live { opacity: 1; color: #fff; }
.stage-mult.climb {
  animation: stage-mult-flash 0.52s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes stage-mult-flash {
  0%   { transform: scale(1); }
  32%  { transform: scale(1.18); color: #fff; text-shadow: 0 0 22px #ff2d92, 0 0 36px #2de2ff; }
  100% { transform: scale(1); }
}
.stage-profit {
  margin-top: 2px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.6px;
  font-variant-numeric: tabular-nums;
  color: var(--jade-bright);
  text-shadow: 0 0 10px rgba(61,255,176,0.45);
  opacity: 0.35;
}
.stage-profit.live { opacity: 1; }

.climb-toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.92);
  z-index: 12;
  pointer-events: none;
  display: flex; align-items: baseline; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(5,3,8,0.82);
  border: 1px solid rgba(255,45,146,0.55);
  box-shadow: 0 0 16px rgba(255,45,146,0.35), 0 0 22px rgba(45,226,255,0.18);
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  font-weight: 800;
}
.climb-toast.show {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: climb-toast-in 0.42s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.climb-toast .ct-shot {
  font-family: 'Noto Serif SC', serif;
  font-size: 13px; color: #fff;
}
.climb-toast .ct-arrow { color: var(--cyan); font-size: 12px; }
.climb-toast .ct-mult {
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; color: var(--cyan);
  text-shadow: 0 0 10px rgba(45,226,255,0.7);
}
.climb-toast .ct-profit { font-size: 12px; color: var(--jade-bright); }
@keyframes climb-toast-in {
  0%   { transform: translateX(-50%) translateY(10px) scale(0.86); opacity: 0; }
  70%  { transform: translateX(-50%) translateY(-2px) scale(1.04); opacity: 1; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

.tray-led {
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(90deg, transparent 0%, rgba(255,45,146,0.55) 18%, rgba(45,226,255,0.55) 50%, rgba(168,85,247,0.5) 82%, transparent 100%);
  opacity: 0.22;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
          mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
  -webkit-mask-clip: content-box, border-box;
          mask-clip: content-box, border-box;
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  padding: 2px;
}

/* ---------- Thumb dock ---------- */
.dock {
  z-index: 50;
  flex-shrink: 0;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent 0%, rgba(8,4,14,0.92) 18%, #08040e 40%);
}
.dock-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.dock-row:last-of-type { margin-bottom: 7px; }

.bet-chips { display: flex; gap: 4px; flex: 1; min-width: 0; }
.bet-chips button {
  flex: 1;
  background: rgba(255,45,146,0.08);
  border: 1px solid rgba(255,45,146,0.24);
  color: var(--ink);
  padding: 8px 0;
  border-radius: 9px;
  font-size: 12px; font-weight: 800;
  font-family: inherit; cursor: pointer;
  min-height: 36px;
}
.bet-chips button.active {
  background: rgba(45,226,255,0.18);
  border-color: var(--cyan);
  color: #9ff7ff;
  box-shadow: 0 0 10px rgba(45,226,255,0.25);
}
.bet-field {
  width: 78px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(45,226,255,0.28);
  border-radius: 9px;
  padding: 4px 7px 3px;
  display: flex; flex-direction: column;
}
.bet-field .lbl {
  font-size: 8px; color: var(--tg-hint); letter-spacing: 1.2px; text-transform: uppercase;
}
.bet-field input {
  width: 100%;
  background: none; border: none; outline: none;
  color: var(--ink); font-size: 16px; font-weight: 800;
  font-family: inherit; text-align: right;
  font-variant-numeric: tabular-nums;
}

.mod {
  display: flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(168,85,247,0.22);
  border-radius: 10px;
  padding: 4px 6px;
  min-height: 36px;
}
.dock-row.mods { gap: 5px; }
.mod.poison { flex: 1.4; min-width: 0; }
.mod.auto { flex: 0 0 auto; }
.poison-chips { display: flex; gap: 3px; flex: 1; min-width: 0; }
.poison-chips button {
  flex: 1;
  min-width: 0;
  background: rgba(255,45,146,0.08);
  border: 1px solid rgba(255,45,146,0.22);
  color: var(--ink);
  padding: 5px 0;
  border-radius: 7px;
  font-size: 10px; font-weight: 800;
  font-family: inherit; cursor: pointer;
}
.poison-chips button.active {
  background: rgba(255,45,146,0.32);
  border-color: #ff2d92;
  color: #ffd0ee;
  box-shadow: 0 0 8px rgba(255,45,146,0.3);
}
.dock.round-lock .bet-chips,
.dock.round-lock .bet-field,
.dock.round-lock .mod { pointer-events: none; opacity: 0.42; }
.mod .lbl-text {
  font-size: 8px; color: var(--tg-hint); letter-spacing: 1px;
  text-transform: uppercase; font-weight: 700; white-space: nowrap;
}
.step {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(45,226,255,0.3);
  background: rgba(45,226,255,0.1);
  color: var(--cyan);
  font-size: 16px; font-weight: 800;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0; line-height: 1;
}
.step:active { transform: scale(0.92); }
.mod .v {
  color: var(--cyan); font-size: 13px; font-weight: 800;
  min-width: 18px; text-align: center; font-variant-numeric: tabular-nums;
}
.mod .v.off { color: var(--tg-hint); font-weight: 600; font-size: 10px; }

.auto-tog {
  border: 1px solid rgba(45,226,255,0.3);
  background: rgba(45,226,255,0.08);
  color: var(--tg-hint);
  border-radius: 7px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.6px;
  padding: 5px 7px;
  cursor: pointer;
  font-family: inherit;
}
.auto-tog.on {
  background: rgba(61,255,176,0.2);
  border-color: var(--jade-bright);
  color: var(--jade-bright);
}

.mod input[type=range] {
  flex: 1; appearance: none; height: 3px;
  background: linear-gradient(90deg, var(--magenta) 0%, var(--cyan) 100%);
  border-radius: 4px; outline: none; min-width: 0;
}
.mod input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(45,226,255,0.25), 0 2px 6px rgba(0,0,0,0.4);
}

.main-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  font-family: 'Noto Serif SC', serif;
  font-weight: 900; font-size: 17px;
  letter-spacing: 2px; cursor: pointer;
  min-height: 50px;
}
.main-btn.play {
  background: linear-gradient(180deg, #ff4dcf, #c4187a);
  color: #14030c;
  box-shadow: 0 4px 16px rgba(255,45,146,0.4), 0 0 18px rgba(255,45,146,0.25);
}
.main-btn.cashout {
  background: linear-gradient(180deg, var(--jade-bright), var(--jade));
  color: #04130b;
  box-shadow: 0 4px 14px rgba(61,255,176, calc(0.4 + var(--glow) * 0.5)), 0 0 16px rgba(61,255,176,0.25);
}
.main-btn:active { transform: translateY(1px); }
.main-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; animation: none; }

/* ---------- Inline outcome banner (not a screen) ---------- */
.outcome {
  position: absolute;
  left: 10px; right: 10px;
  bottom: calc(100% + 6px);
  background: linear-gradient(180deg, rgba(20,8,22,0.96), rgba(5,3,8,0.96));
  border: 1.5px solid var(--accent, var(--cyan));
  border-radius: 12px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  z-index: 55;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.22s, transform 0.22s, visibility 0.22s;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5), 0 0 18px rgba(45,226,255,0.18);
}
.dock { position: relative; }
.outcome.show {
  opacity: 1; visibility: visible; transform: translateY(0);
  pointer-events: auto;
}
.outcome .out-title {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900; font-size: 16px;
  color: var(--accent, var(--cyan));
  line-height: 1.1;
  white-space: nowrap;
}
.outcome .out-sub {
  font-size: 8px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--tg-hint); font-weight: 700;
}
.outcome .out-stats { margin-left: auto; text-align: right; }
.outcome .out-mult {
  font-weight: 900; font-size: 15px; color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.outcome .out-profit { font-size: 12px; font-weight: 800; color: var(--jade-bright); }
.outcome.bust .out-profit { color: #ff8ad8; }
.outcome .out-rebet {
  display: none; /* dock button is the primary; banner is informational */
}

/* ---------- Compact character sheet (not full-screen) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
  z-index: 200;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 430px; margin: 0 auto;
  background: linear-gradient(180deg, #160818, #08040e);
  border-top: 1px solid rgba(45,226,255,0.32);
  border-radius: 18px 18px 0 0;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
  z-index: 201;
  max-height: 58vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -8px 28px rgba(255,45,146,0.18);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: rgba(45,226,255,0.45);
  border-radius: 2px;
  margin: -4px auto 10px;
}
.sheet-title {
  font-size: 14px; font-weight: 800;
  margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.sheet-title .x { font-size: 22px; color: var(--tg-hint); cursor: pointer; padding: 0 4px; }

.mw-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: radial-gradient(ellipse at 20% 50%, rgba(255,45,146,0.22), transparent 60%),
              rgba(0,0,0,0.4);
  border: 1px solid rgba(45,226,255,0.35);
  border-radius: 10px;
  padding: 7px 10px;
  margin-bottom: 10px;
}
.mw-banner .mw-k {
  font-size: 8px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--cyan); font-weight: 800;
}
.mw-banner .mw-n {
  font-weight: 900; font-size: 14px; color: var(--gold-bright);
}

.char-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
}
.char-card {
  aspect-ratio: 0.78;
  background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.7));
  border: 1.5px solid var(--tier-color, var(--tier-common));
  border-radius: 11px;
  padding: 16px 4px 6px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  gap: 3px;
  cursor: pointer;
  position: relative; overflow: hidden;
}
.char-card:active { transform: scale(0.97); }
.char-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top, var(--avatar-c1) 0%, transparent 70%);
  opacity: 0.25; pointer-events: none;
}
.char-card.locked { border-color: rgba(120,120,130,0.4); --tier-color: rgba(120,120,130,0.5); }
.char-card.locked::before { opacity: 0.05; }
.char-card.locked .ch-card-name { color: var(--tg-hint); }
.char-card.locked .ch-portrait { filter: grayscale(1) brightness(0.5); }
.char-card.selected { box-shadow: 0 0 0 2px var(--tier-color), 0 6px 16px rgba(0,0,0,0.5), 0 0 14px rgba(255,45,146,0.25); }
.char-card .ch-portrait {
  width: clamp(36px, 12vw, 48px);
  height: clamp(36px, 12vw, 48px);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--avatar-c1, var(--red)), var(--avatar-c2, var(--red-deep)));
  display: grid; place-items: center;
  color: var(--cyan);
  font-family: 'Noto Serif SC', serif;
  font-size: 20px; font-weight: 900;
  position: relative; z-index: 1; overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(45,226,255,0.35), 0 0 10px rgba(255,45,146,0.25);
}
.char-card .ch-info {
  display: flex; flex-direction: column;
  align-items: center; gap: 1px;
  width: 100%; position: relative; z-index: 1; text-align: center;
}
.char-card .ch-card-name {
  font-family: 'Noto Serif SC', serif;
  font-weight: 900; font-size: 12px; color: var(--ink); line-height: 1.05;
}
.char-card .ch-card-en {
  font-size: 7px; color: var(--tg-hint); letter-spacing: 0.6px;
  text-transform: uppercase; font-weight: 600;
}
.char-card .ch-tier {
  position: absolute; top: 4px; right: 4px;
  font-size: 6px; font-weight: 800; letter-spacing: 0.6px;
  color: var(--tier-color); text-transform: uppercase; z-index: 2;
  background: rgba(0,0,0,0.45);
  padding: 1px 4px; border-radius: 3px;
  border: 1px solid var(--tier-color);
}
.char-card .ch-lock {
  font-size: 7px; color: var(--tg-hint);
  letter-spacing: 0.4px; text-transform: uppercase; font-weight: 700;
}
.char-card.unlocked .ch-lock { color: var(--tier-color); }
.char-card.selected .ch-lock::before { content: '✓ '; }

/* ---------- Provably fair sheet ---------- */
.pf-body { font-size: 13px; color: var(--ink); line-height: 1.5; }
.pf-body .pf-intro {
  padding: 10px 12px;
  background: rgba(45,226,255,0.06);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  margin-bottom: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
}
.pf-body .pf-row {
  display: flex; flex-direction: column;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 3px;
}
.pf-body .pf-row:last-of-type { border-bottom: none; }
.pf-body .pf-label {
  font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; font-weight: 700;
  color: var(--tg-hint);
}
.pf-body .pf-val { font-size: 13px; color: var(--ink); font-weight: 600; }
.pf-body .pf-val.mono {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--cyan);
  word-break: break-all;
  padding: 6px 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(45,226,255,0.18);
  border-radius: 6px;
  font-weight: 500;
}
.pf-actions { display: flex; gap: 8px; margin-top: 12px; }
.pf-actions .pf-btn {
  flex: 1; padding: 11px;
  background: linear-gradient(180deg, #ff4dcf, #c4187a);
  color: #14030c;
  border: none; border-radius: 10px;
  font-weight: 800; font-size: 12px;
  cursor: pointer; letter-spacing: 0.3px;
}
.pf-actions .pf-btn.secondary {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
}

/* ---------- Toast / reaction (brief, non-blocking) ---------- */
.toast {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top, 0px));
  left: 50%; transform: translateX(-50%) translateY(-12px);
  background: linear-gradient(180deg, #c4187a, #6b1048);
  color: #fff;
  font-family: 'Noto Serif SC', serif;
  font-weight: 900;
  padding: 8px 16px; border-radius: 999px;
  font-size: 15px; letter-spacing: 1.5px;
  border: 2px solid var(--cyan);
  box-shadow: 0 8px 22px rgba(0,0,0,0.65), 0 0 18px rgba(255,45,146,0.4);
  z-index: 100; pointer-events: none; white-space: nowrap;
  opacity: 0; visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.2s, visibility 0.2s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.bust { background: linear-gradient(180deg, #000, #1a0a14); color: #ff4dcf; border-color: #ff4dcf; }
.toast.bigwin { background: linear-gradient(180deg, #ff2d92, #7f1d4d); color: #fff; border-color: #ff2d92; }
.toast.climb { background: linear-gradient(180deg, #1a0a24, #0a0614); color: var(--cyan); border-color: var(--magenta); }

.char-reaction {
  position: fixed;
  bottom: calc(158px + env(safe-area-inset-bottom, 0px));
  left: 14px; right: 14px;
  max-width: 402px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(22,8,24,0.94), rgba(8,4,14,0.94));
  border: 1px solid var(--tier-color, rgba(45,226,255,0.3));
  border-radius: 12px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s;
  z-index: 90; pointer-events: none;
  backdrop-filter: blur(8px);
}
.char-reaction.show { transform: translateY(0); opacity: 1; }
.char-reaction .ch-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(145deg, var(--avatar-c1, var(--red)), var(--avatar-c2, var(--red-deep)));
  display: grid; place-items: center;
  color: var(--cyan);
  font-family: 'Noto Serif SC', serif;
  font-size: 16px; font-weight: 900;
  box-shadow: 0 0 0 2px var(--tier-color), 0 0 10px rgba(255,45,146,0.35);
  flex-shrink: 0;
  overflow: hidden; position: relative;
}
.char-reaction .ch-name {
  font-size: 8px; letter-spacing: 1.2px;
  color: var(--tier-color); text-transform: uppercase; font-weight: 700;
}
.char-reaction .ch-line {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700; font-size: 13px;
  color: var(--ink); line-height: 1.2;
}

/* ---------- Height breakpoints ---------- */
@media (max-height: 750px) {
  .topbar { padding: 6px 10px 3px; }
  .avatar-btn { width: 36px; height: 36px; }
  .hud .val { font-size: 13px; }
  .main-btn { padding: 12px; font-size: 15px; min-height: 46px; }
  .stage-mult { font-size: 28px; }
  .win-line .wl-cn { font-size: 14px; }
}
@media (max-height: 670px) {
  .hud { gap: 4px; }
  .hud > div { padding: 4px 6px; }
  .bet-chips button { padding: 6px 0; min-height: 32px; }
  .main-btn { padding: 10px; font-size: 14px; min-height: 42px; }
  .mod { min-height: 32px; }
  .win-line { padding: 1px 10px 3px; }
  .win-line .wl-cn { font-size: 13px; }
  .stage-board { padding: 2px 10px 3px; }
}
