/* ============================================================================
   THE CRANE — Cartoon "brick & crane" skin for the tower stacking game.
   Aesthetic: bright sky, glossy cream stickers, thick dark outlines, candy gold
   buttons, brick-red surround — mimics the underlying arcade game.
   Layout scales off --u (1% of the play-field width), set by app.js.
   ========================================================================== */

:root {
  --bg-0: #79d0ec;
  --bg-1: #a9e4f3;
  --bg-2: #ffffff;
  --gold: #ffc42e;
  --gold-2: #ffe488;
  --gold-deep: #e6890f;
  --gold-edge: #b86908;
  --cyan: #1497b8;
  --magenta: #ff4d8d;
  --danger: #ef3b2e;
  --win: #2fae5b;
  --brick: #e8552d;
  --brick-deep: #b73c19;
  --cream: #fffaf0;
  --outline: #4a2f1a;
  --text: #4a2f1a;
  --muted: #a3784e;
  --line: #4a2f1a;
  --glass: #fffaf0;
  --glass-2: #fff5e4;
  --display: "Lilita One", "Trebuchet MS", sans-serif;
  --body: "Fredoka", "Helvetica Neue", Arial, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--body);
  color: var(--text);
  /* Brick wall surround (the play-field canvas sits on top). */
  background: #c2492c url("bricks.svg") repeat;
  background-size: 128px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-root {
  position: relative;
  overflow: hidden;
  margin: auto;
  background: var(--bg-0);
  box-shadow: 0 0 calc(var(--u) * 14) rgba(0, 0, 0, 0.85);
  font-size: calc(var(--u) * 3.7);
}

#canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  transform-origin: 50% 100%;
  transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

/* atmospheric vignette + top/bottom scrims over the live canvas */
#casino::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    135% 105% at 50% 38%,
    transparent 72%,
    rgba(20, 70, 95, 0.16) 100%
  );
}

#game-root.is-high #casino::after {
  background:
    radial-gradient(
      130% 100% at 50% 40%,
      transparent 46%,
      rgba(40, 6, 20, 0.5) 100%
    ),
    linear-gradient(
      to bottom,
      rgba(4, 6, 12, 0.55) 0%,
      transparent 18%,
      transparent 72%,
      rgba(40, 6, 20, 0.55) 100%
    );
}

#game-root.is-danger #casino::after {
  background:
    radial-gradient(
      130% 100% at 50% 40%,
      transparent 40%,
      rgba(70, 6, 22, 0.62) 100%
    ),
    linear-gradient(
      to bottom,
      rgba(40, 4, 10, 0.6) 0%,
      transparent 16%,
      transparent 70%,
      rgba(70, 6, 22, 0.6) 100%
    );
  animation: danger-pulse 1.6s ease-in-out infinite;
}

@keyframes danger-pulse {
  50% {
    opacity: 0.72;
  }
}

#casino {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* contain off-screen sliders (action bar / panel) so they never make the
     play-field scrollable, which would let a focus event shift the layout */
  overflow: hidden;
}

.casino-ui {
  pointer-events: auto;
}

/* ---- shared bits --------------------------------------------------------- */
.coin-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  background: url("coin.png") center / contain no-repeat;
  vertical-align: -0.12em;
  margin-right: 0.35em;
  flex: none;
}

.coin-ico--lg {
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.24em;
}

/* Inline coin image (mirrors .coin-ico sizing) for emoji-style coin slots. */
.coin-img {
  display: inline-block;
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: -0.15em;
}
.coin-img--xl {
  width: 1.3em;
  height: 1.3em;
  vertical-align: -0.22em;
}

/* ============================================================================
   LOADING
   ========================================================================== */
#loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 90% at 50% 20%, #141d33 0%, var(--bg-0) 70%);
  font-size: calc(var(--u) * 3.7);
  transition: opacity 0.5s ease;
}

#loading.is-done {
  opacity: 0;
  pointer-events: none;
}

.loading__inner {
  text-align: center;
  width: 70%;
}

.loading__logo {
  display: block;
  width: min(42%, calc(var(--u) * 25));
  height: auto;
  margin: 0 auto calc(var(--u) * 2.2);
  object-fit: contain;
  filter: drop-shadow(0 calc(var(--u) * 0.8) 0 rgba(74, 47, 26, 0.28));
}

.loading__title {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: 0.68em;
  font-size: 0.82em;
  color: var(--muted);
  margin-left: 0.68em;
}

.loading__bar {
  margin: 1.6em auto 0.6em;
  width: 100%;
  height: 0.5em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}

.loading__fill {
  height: 100%;
  width: 0;
  border-radius: 1em;
  background: linear-gradient(
    90deg,
    var(--gold-deep),
    var(--gold),
    var(--gold-2)
  );
  box-shadow: 0 0 0.6em rgba(255, 197, 61, 0.8);
  transition: width 0.25s ease;
}

.loading__pct {
  font-family: var(--display);
  font-weight: 600;
  color: var(--gold);
}

.loading__hint {
  margin-top: 0.5em;
  font-size: 0.8em;
  color: var(--muted);
}

/* ============================================================================
   PRE-ROUND / BET SCREEN (Chunky Stacker Aesthetic)
   ========================================================================== */

/* Full-screen bright sky backdrop */
.bet-screen.theme-builder-casual {
  background: linear-gradient(180deg, #cdeff9 0%, #93dbf0 52%, #76cce7 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: fade-in 0.35s ease;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--u) * 4) calc(var(--u) * 4) calc(var(--u) * 2);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 4);
}

/* --- Top Bar: Wallet & Stake Panels --- */
.top-bar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--u) * 3);
}

.chunky-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--u) * 2) calc(var(--u) * 3);
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
}

.chunky-panel__label {
  font-family: var(--body);
  font-weight: 700;
  font-size: calc(var(--u) * 2.8);
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: calc(var(--u) * 0.5);
}

.chunky-panel__row {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1);
}

.chunky-panel__value {
  font-family: var(--display);
  font-size: calc(var(--u) * 6);
  color: var(--text);
  line-height: 1;
}

/* --- Shared Panel Container --- */
.pre-round-body {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 4);
}

.section-chunky {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}

.section-title {
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: var(--brick);
  text-shadow: 0 calc(var(--u) * 0.5) 0 #fff;
  letter-spacing: 0.05em;
  text-align: center;
}

/* --- Chunky Inputs & Dropdowns --- */
.chunky-input {
  width: 100%;
  padding: calc(var(--u) * 3) calc(var(--u) * 4);
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 4.5);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.chunky-input:focus {
  outline: none;
  border-color: var(--gold-deep);
}

/* Add custom dropdown arrow */
select.chunky-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='12'%3E%3Cpath fill='%234a2f1a' d='M8 12 0 0h16z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right calc(var(--u) * 4) center;
}

/* --- Chunky Chips --- */
.chips-grid-flat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--u) * 3);
}

.btn-chunky-chip {
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  padding: calc(var(--u) * 2.5) 0;
  font-family: var(--display);
  font-size: calc(var(--u) * 4.5);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
}

/* 3D push down effect */
.btn-chunky-chip:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}

.btn-chunky-chip.is-active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #3a2410;
}

.btn-chunky-chip.is-locked {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline) !important;
}

/* --- Custom Row --- */
.custom-row-chunky {
  display: flex;
  gap: calc(var(--u) * 2);
}

.custom-row-chunky .chunky-input {
  flex: 1;
}

.btn-chunky-action {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  padding: 0 calc(var(--u) * 4);
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: #3a2410;
  cursor: pointer;
}

.btn-chunky-action:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}

/* --- Footer & Action Area --- */
.footer-area {
  padding: calc(var(--u) * 3) calc(var(--u) * 4) calc(var(--u) * 5);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 3);
}

.nav-row-flat {
  display: flex;
  gap: calc(var(--u) * 2);
}

.btn-chunky-small {
  flex: 1;
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  padding: calc(var(--u) * 2) 0;
  font-family: var(--display);
  font-size: calc(var(--u) * 3.5);
  color: var(--text);
  cursor: pointer;
}

.btn-chunky-small:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}

/* --- Massive Start Button --- */
.btn-massive {
  width: 100%;
  padding: calc(var(--u) * 3.5);
  background: linear-gradient(
    180deg,
    var(--gold-2),
    var(--gold) 48%,
    var(--gold-deep)
  );
  border: calc(var(--u) * 1) solid var(--outline);
  border-radius: calc(var(--u) * 4);
  box-shadow:
    0 calc(var(--u) * 2) 0 var(--outline),
    0 calc(var(--u) * 4) calc(var(--u) * 2) rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
}

.btn-massive:active {
  transform: translateY(calc(var(--u) * 2));
  box-shadow:
    0 0 0 var(--outline),
    0 calc(var(--u) * 1) calc(var(--u) * 1) rgba(0, 0, 0, 0.2);
}

.btn-massive__text {
  font-family: var(--display);
  font-size: calc(var(--u) * 7);
  color: #3a2410;
  text-shadow: 0 calc(var(--u) * 0.5) 0 rgba(255, 255, 255, 0.6);
  letter-spacing: 0.08em;
}

.btn-massive.is-broke {
  background: #a3784e; /* muted brown for broke state */
  filter: grayscale(0.5);
}

/* ============================================================================
   HUD (top bar)
   ========================================================================== */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  gap: calc(var(--u) * 1.5);
  padding: calc(var(--u) * 3) calc(var(--u) * 3) calc(var(--u) * 2);
  font-size: calc(var(--u) * 3.7);
}

.hud__cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.42em 0.55em;
  border-radius: 0.55em;
  background: var(--glass);
  -webkit-backdrop-filter: blur(calc(var(--u) * 2));
  backdrop-filter: blur(calc(var(--u) * 2));
  border: 1px solid var(--line);
  box-shadow: 0 0.2em 0.6em rgba(0, 0, 0, 0.35);
}

.hud__cell--wallet {
  flex: 1.5;
}
.hud__cell--risk {
  flex: 1.2;
}

.hud__label {
  font-size: 0.58em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud__value,
.hud__coin {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.18em;
  line-height: 1;
  display: flex;
  align-items: center;
}

.hud__coin {
  color: var(--gold);
}
.hud__value--next {
  color: var(--cyan);
}

.hud__value.is-warn {
  color: var(--gold-2);
}
.hud__value.is-danger {
  color: var(--danger);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.45;
  }
}

.risk-pill {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1em;
  align-self: flex-start;
  padding: 0.12em 0.5em;
  border-radius: 1em;
  border: 1px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================================================
   ALTIMETER GAUGE (the signature multiplier climb)
   ========================================================================== */
.gauge {
  position: absolute;
  right: calc(var(--u) * 3);
  top: 22%;
  bottom: 24%;
  width: calc(var(--u) * 9);
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transform: translateX(40%);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  font-size: calc(var(--u) * 3.7);
}

.gauge.is-active {
  opacity: 1;
  transform: none;
}

.gauge__rail {
  position: relative;
  width: calc(var(--u) * 3.4);
  height: 100%;
  border-radius: 1em;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(0, 0, 0, 0.35)
  );
  border: 1px solid var(--line);
  box-shadow: inset 0 0 calc(var(--u) * 2) rgba(0, 0, 0, 0.6);
  overflow: visible;
}

.gauge__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-radius: 1em;
  background: linear-gradient(
    180deg,
    var(--gold-2),
    var(--gold) 35%,
    var(--cyan) 100%
  );
  box-shadow: 0 0 calc(var(--u) * 3) var(--glow, rgba(46, 242, 255, 0.35));
  transition: height 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.gauge__tick {
  position: absolute;
  right: calc(100% + 0.4em);
  transform: translateY(50%);
  font-size: 0.56em;
  color: var(--muted);
  font-family: var(--display);
  white-space: nowrap;
}

.gauge__tick::after {
  content: "";
  position: absolute;
  right: -0.5em;
  top: 50%;
  width: 0.4em;
  height: 1px;
  background: var(--line);
}

.gauge__marker {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: calc(var(--u) * 5.4);
  height: calc(var(--u) * 5.4);
  transform: translate(-50%, 50%);
  transition: bottom 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.gauge__marker-val {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82em;
  color: #07121a;
  background: radial-gradient(
    circle at 40% 35%,
    var(--gold-2),
    var(--gold) 60%,
    var(--gold-deep)
  );
  border-radius: 50%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 calc(var(--u) * 3) var(--glow, rgba(255, 197, 61, 0.55)),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.combo-badge {
  position: absolute;
  bottom: calc(100% + 0.6em);
  right: 0;
  white-space: nowrap;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.62em;
  letter-spacing: 0.08em;
  padding: 0.3em 0.55em;
  border-radius: 0.5em;
  opacity: 0;
  transform: translateY(0.4em) scale(0.9);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  background: rgba(0, 0, 0, 0.55);
}

.combo-badge.is-show {
  opacity: 1;
  transform: none;
}
.combo-badge.is-combo {
  color: var(--cyan);
  box-shadow: 0 0 0.8em rgba(46, 242, 255, 0.6);
}
.combo-badge.is-hot {
  color: #fff;
  background: linear-gradient(90deg, var(--danger), var(--magenta));
  box-shadow: 0 0 1em rgba(255, 77, 141, 0.8);
  animation: hot-bob 0.5s ease-in-out infinite alternate;
}

@keyframes hot-bob {
  to {
    transform: translateY(-0.15em) scale(1.04);
  }
}

/* ============================================================================
   payout glow tiers (shared by gauge + cashout button)
   ========================================================================== */
.glow-warm {
  --glow: rgba(255, 197, 61, 0.55);
}
.glow-hot {
  --glow: rgba(255, 142, 40, 0.8);
}
.glow-blaze {
  --glow: rgba(255, 77, 141, 0.85);
}
.glow-nova {
  --glow: rgba(46, 242, 255, 0.95);
}

/* ============================================================================
   ACTION BAR (drop + cash out + tension)
   ========================================================================== */
.action-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: calc(var(--u) * 3) calc(var(--u) * 4) calc(var(--u) * 5);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2.2);
  transform: translateY(130%);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.2, 1);
  font-size: calc(var(--u) * 3.7);
}

.action-bar.is-open {
  transform: none;
}

.tension {
  text-align: center;
}

.tension__line {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.92em;
}

.tension__now {
  color: var(--gold);
}
.tension__vs {
  color: var(--muted);
  font-size: 0.8em;
  text-transform: uppercase;
}
.tension__next {
  color: var(--cyan);
}

.tension__warn {
  margin-top: 0.35em;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.05em;
  height: 1.1em;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tension__warn.is-show {
  opacity: 1;
}
.tension__warn.is-warn {
  color: var(--gold-2);
}
.tension__warn.is-danger {
  color: var(--danger);
  animation: blink 1s steps(2, start) infinite;
}

.action-bar__buttons {
  display: flex;
  gap: calc(var(--u) * 3);
  align-items: stretch;
}

.cashout-btn {
  flex: 1;
  width: 100%;
  position: relative;
  border: none;
  border-radius: 0.85em;
  padding: 0.55em 0.7em;
  cursor: pointer;
  color: #2a1700;
  background: linear-gradient(
    180deg,
    var(--gold-2) 0%,
    var(--gold) 45%,
    var(--gold-deep) 100%
  );
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow:
    0 0.3em 0.8em rgba(0, 0, 0, 0.45),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
  transition:
    transform 0.1s ease,
    box-shadow 0.25s ease,
    filter 0.2s ease;
  overflow: hidden;
}

.cashout-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.65),
    transparent
  );
  transform: skewX(-18deg);
}

.cashout-btn.is-armed::before {
  animation: sheen 2.6s ease-in-out infinite;
}

@keyframes sheen {
  0% {
    left: -60%;
  }
  55%,
  100% {
    left: 130%;
  }
}

.cashout-btn__label {
  font-weight: 600;
  font-size: 0.72em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.85;
}

.cashout-btn__coin {
  font-weight: 700;
  font-size: 1.7em;
  display: flex;
  align-items: center;
}

.cashout-btn__mult {
  font-weight: 600;
  font-size: 0.72em;
  opacity: 0.8;
}

.cashout-btn:disabled {
  filter: grayscale(0.7) brightness(0.8);
  opacity: 0.55;
  cursor: default;
}

.cashout-btn.is-armed:active {
  transform: scale(0.97);
}
.cashout-btn.glow-warm {
  box-shadow:
    0 0 calc(var(--u) * 5) var(--glow),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
}
.cashout-btn.glow-hot {
  box-shadow:
    0 0 calc(var(--u) * 7) var(--glow),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
}
.cashout-btn.glow-blaze {
  box-shadow:
    0 0 calc(var(--u) * 9) var(--glow),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
  animation: armed-shake 2.4s ease-in-out infinite;
}
.cashout-btn.glow-nova {
  box-shadow:
    0 0 calc(var(--u) * 13) var(--glow),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
  animation: armed-shake 1.3s ease-in-out infinite;
}

@keyframes armed-shake {
  0%,
  92%,
  100% {
    transform: translate(0, 0) rotate(0);
  }
  94% {
    transform: translate(-0.5%, 0) rotate(-0.4deg);
  }
  96% {
    transform: translate(0.5%, 0) rotate(0.4deg);
  }
  98% {
    transform: translate(-0.3%, 0) rotate(-0.2deg);
  }
}

/* ============================================================================
   SCREENS (shared)
   ========================================================================== */
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  font-size: calc(var(--u) * 3.7);
  background: linear-gradient(
    180deg,
    rgba(7, 9, 15, 0.82),
    rgba(7, 9, 15, 0.92)
  );
  -webkit-backdrop-filter: blur(calc(var(--u) * 3));
  backdrop-filter: blur(calc(var(--u) * 3));
}

.screen.is-open {
  display: flex;
}

/* ============================================================================
   BET SCREEN
   ========================================================================== */
.bet-screen.is-open {
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.bet__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--u) * 4) calc(var(--u) * 4) calc(var(--u) * 2);
}

.bet__header {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2.5);
}

.bet__brand {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  font-family: var(--display);
}

.bet__brand-mark {
  color: var(--gold);
  font-size: 1.1em;
}
.bet__brand-name {
  font-weight: 700;
  letter-spacing: 0.3em;
}
.bet__brand-sub {
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-size: 0.8em;
}

.bet__wallet {
  position: relative;
  text-align: center;
  padding: calc(var(--u) * 3.5) calc(var(--u) * 3);
  border-radius: 1em;
  background:
    radial-gradient(
      120% 130% at 50% 0%,
      rgba(255, 197, 61, 0.14),
      transparent 60%
    ),
    var(--glass-2);
  border: 1px solid rgba(255, 197, 61, 0.28);
  box-shadow: 0 0.5em 1.4em rgba(0, 0, 0, 0.5);
}

.bet__wallet-label {
  font-size: 0.68em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.bet__wallet-coin {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.8em;
  line-height: 1.1;
  color: var(--gold);
  text-shadow: 0 0 0.5em rgba(255, 197, 61, 0.45);
}

.bet__table {
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  align-items: center;
  margin-top: 0.3em;
}

.table-badge {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.8em;
  padding: 0.12em 0.7em;
  border-radius: 1em;
  border: 1px solid currentColor;
}

.bet__table-meta {
  font-size: 0.66em;
  color: var(--muted);
}

.bet__status {
  display: flex;
  gap: calc(var(--u) * 2);
}

.streak-chip,
.rank-chip {
  flex: 1;
  text-align: center;
  font-size: 0.7em;
  font-weight: 600;
  padding: 0.5em 0.4em;
  border-radius: 0.6em;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--muted);
}

.streak-chip.is-hot {
  color: #fff;
  border-color: var(--magenta);
  box-shadow: 0 0 0.8em rgba(255, 77, 141, 0.5);
}

.bet__panel {
  margin-top: calc(var(--u) * 3);
}
.bet__section {
  margin-top: calc(var(--u) * 3.5);
}

.bet__h {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.74em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.8em;
}

/* quick pick dropdown */
.preset-select {
  width: 100%;
  padding: 0.7em 2.2em 0.7em 0.9em;
  border-radius: 0.7em;
  border: 1px solid var(--line);
  background-color: var(--glass);
  color: var(--text);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23FFC53D' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9em center;
}

.preset-select:focus {
  outline: none;
  border-color: var(--gold);
}
.preset-select option {
  background: #0b0f1a;
  color: var(--text);
}

/* presets */
.presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(var(--u) * 2);
}

.preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  padding: 0.7em 0.2em;
  border-radius: 0.7em;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.preset__icon {
  font-size: 1.3em;
}
.preset__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.76em;
}
.preset__detail {
  font-size: 0.56em;
  color: var(--muted);
  text-align: center;
}
.preset:active {
  transform: scale(0.95);
}
.preset.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0.9em rgba(255, 197, 61, 0.45);
  background: linear-gradient(180deg, rgba(255, 197, 61, 0.16), var(--glass));
}

/* chips */
.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--u) * 2);
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  padding: 0.7em 0.4em;
  border-radius: 0.7em;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: var(--glass);
  color: var(--text);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95em;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.chip:active {
  transform: scale(0.95);
}

.chip.is-active {
  border-style: solid;
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(255, 197, 61, 0.2), var(--glass));
  box-shadow: 0 0 0.9em rgba(255, 197, 61, 0.5);
}

.chip.is-locked {
  opacity: 0.35;
  cursor: default;
}

.custom {
  margin-top: calc(var(--u) * 2.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
}

.custom__label {
  font-size: 0.72em;
  color: var(--muted);
}
.custom__field {
  display: flex;
  gap: 0.5em;
}

.custom__input {
  width: calc(var(--u) * 26);
  padding: 0.5em 0.7em;
  border-radius: 0.6em;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--display);
  font-size: 0.9em;
  text-align: right;
}

.custom__input:focus {
  outline: none;
  border-color: var(--gold);
}

.custom__apply {
  padding: 0.5em 0.9em;
  border-radius: 0.6em;
  border: 1px solid var(--gold);
  background: rgba(255, 197, 61, 0.14);
  color: var(--gold);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.82em;
  cursor: pointer;
}

/* risks */
.risks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: calc(var(--u) * 1.8);
}

.risk {
  --accent: var(--cyan);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1em;
  padding: 0.65em 0.2em;
  border-radius: 0.7em;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.risk__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82em;
  color: var(--accent);
}
.risk__tag {
  font-size: 0.52em;
  color: var(--muted);
  text-align: center;
}
.risk:active {
  transform: scale(0.95);
}

.risk.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 1em color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 16%, transparent),
    var(--glass)
  );
}

.risk-blurb {
  margin-top: 1em;
  font-size: 0.72em;
  color: var(--muted);
  padding-left: 0.8em;
  border-left: 2px solid var(--cyan);
  line-height: 1.4;
}

/* preview */
.preview {
  margin-top: calc(var(--u) * 4);
  border-radius: 0.9em;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.preview__head {
  display: flex;
  justify-content: space-between;
  padding: 0.6em 0.9em;
  font-size: 0.66em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.preview__risk {
  font-family: var(--display);
  font-weight: 700;
}
.preview__rows {
  padding: 0.3em 0.5em 0.5em;
}

.preview__row {
  display: grid;
  grid-template-columns: 1fr auto 1.3fr;
  align-items: center;
  gap: 0.5em;
  padding: 0.42em 0.4em;
  border-top: 1px solid var(--line);
}

.preview__row:first-child {
  border-top: none;
}
.preview__floor {
  font-size: 0.78em;
  color: var(--muted);
}
.preview__mult {
  font-family: var(--display);
  font-weight: 700;
  color: var(--cyan);
  font-size: 0.9em;
}

.preview__pay {
  justify-self: end;
  display: flex;
  align-items: center;
  font-family: var(--display);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.95em;
}

/* footer */
.bet__footer {
  padding: calc(var(--u) * 2.5) calc(var(--u) * 4) calc(var(--u) * 4.5);
  background: linear-gradient(180deg, transparent, rgba(7, 9, 15, 0.9) 30%);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2.5);
}

.bet__nav {
  display: flex;
  gap: calc(var(--u) * 2);
}

.nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.55em;
  border-radius: 0.6em;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-size: 0.72em;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn__ico {
  font-size: 1.1em;
}
.nav-btn:active {
  transform: scale(0.97);
}

.start-btn {
  width: 100%;
  padding: 0.85em;
  border: none;
  border-radius: 0.9em;
  cursor: pointer;
  color: #2a1700;
  background: linear-gradient(
    180deg,
    var(--gold-2),
    var(--gold) 50%,
    var(--gold-deep)
  );
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12em;
  box-shadow:
    0 0.4em 1.2em rgba(255, 197, 61, 0.35),
    inset 0 0.1em 0.2em rgba(255, 255, 255, 0.5);
  transition: transform 0.1s ease;
}

.start-btn:active {
  transform: scale(0.98);
}
.start__main {
  font-weight: 700;
  font-size: 1.25em;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.start__sub {
  font-size: 0.7em;
  font-weight: 600;
  opacity: 0.75;
}

.start-btn.is-broke {
  background: linear-gradient(180deg, #2a3450, #1a2138);
  color: var(--text);
  box-shadow: 0 0.4em 1.2em rgba(0, 0, 0, 0.4);
}

/* ============================================================================
   RESULT SCREEN
   ========================================================================== */
.result-screen {
  align-items: center;
  justify-content: center;
}
.result-screen.is-open {
  display: flex;
}

.result-card {
  width: 84%;
  max-height: 90%;
  overflow-y: auto;
  padding: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 4.5);
  border-radius: 1.2em;
  text-align: center;
  background: var(--glass-2);
  border: 1px solid var(--line);
  box-shadow: 0 1em 3em rgba(0, 0, 0, 0.6);
  animation: card-pop 0.4s cubic-bezier(0.2, 1.1, 0.3, 1);
}

@keyframes card-pop {
  from {
    opacity: 0;
    transform: translateY(6%) scale(0.92);
  }
}

.result-card--win {
  border-color: rgba(255, 197, 61, 0.4);
}
.result-card--loss {
  border-color: rgba(255, 59, 83, 0.4);
}

.result__tier {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1em;
  margin-bottom: 0.4em;
}

.result__emoji {
  font-size: 2.6em;
}

.result__tier-label {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 1.1em;
  text-transform: uppercase;
}

.tier--nice .result__tier-label,
.tier--big .result__tier-label {
  color: var(--gold);
  text-shadow: 0 0 0.5em rgba(255, 197, 61, 0.6);
}
.tier--massive .result__tier-label {
  color: var(--magenta);
  text-shadow: 0 0 0.6em rgba(255, 77, 141, 0.7);
}
.tier--insane .result__tier-label {
  color: var(--cyan);
  text-shadow: 0 0 0.7em rgba(46, 242, 255, 0.8);
  animation: hue 1.5s linear infinite;
}
.tier--loss .result__tier-label {
  color: var(--danger);
}

@keyframes hue {
  to {
    filter: hue-rotate(40deg);
  }
}

.result__headline {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15em;
  margin-bottom: 1em;
}

.result__stats {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  margin: 0 auto 1.2em;
  text-align: left;
}

.rstat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55em 0.8em;
  border-radius: 0.6em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

.rstat__label {
  color: var(--muted);
  font-size: 0.82em;
}
.rstat__value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05em;
}
.rstat__value--gold {
  color: var(--gold);
  font-size: 1.35em;
}
.rstat__value--win {
  color: var(--win);
}
.rstat__value--loss {
  color: var(--danger);
}
.rstat__value--muted {
  color: var(--muted);
}
.rstat--gold {
  border-color: rgba(255, 197, 61, 0.35);
}

.result__streak {
  font-family: var(--display);
  font-weight: 600;
  color: var(--magenta);
  font-size: 0.85em;
  margin-bottom: 1em;
}

.result__nudge {
  font-size: 0.78em;
  color: var(--muted);
  margin-bottom: 1.2em;
  line-height: 1.4;
}

.result__actions {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}

.result-btn {
  padding: 0.8em;
  border-radius: 0.8em;
  border: 1px solid var(--line);
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1em;
  letter-spacing: 0.04em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  transition: transform 0.1s ease;
  background: var(--glass);
  color: var(--text);
}

.result-btn:active {
  transform: scale(0.98);
}

.result-btn--primary {
  border: none;
  color: #2a1700;
  background: linear-gradient(
    180deg,
    var(--gold-2),
    var(--gold) 50%,
    var(--gold-deep)
  );
  box-shadow: 0 0.4em 1.1em rgba(255, 197, 61, 0.35);
}

.result-btn--gold {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(255, 197, 61, 0.1);
}

.result-btn--ghost {
  color: var(--muted);
}

/* ============================================================================
   PANELS (leaderboard / missions / history)
   ========================================================================== */
.panel-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: rgba(4, 6, 12, 0.6);
  -webkit-backdrop-filter: blur(calc(var(--u) * 2));
  backdrop-filter: blur(calc(var(--u) * 2));
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  font-size: calc(var(--u) * 3.7);
}

.panel-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.panel {
  width: 100%;
  max-height: 86%;
  display: flex;
  flex-direction: column;
  border-radius: 1.2em 1.2em 0 0;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: 0 -1em 3em rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.panel-overlay.is-open .panel {
  transform: none;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: calc(var(--u) * 3) calc(var(--u) * 3) calc(var(--u) * 1.5);
  border-bottom: 1px solid var(--line);
}

.panel__tabs {
  flex: 1;
  display: flex;
  gap: calc(var(--u) * 1.5);
}

.panel-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  padding: 0.55em 0.3em;
  border-radius: 0.6em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.76em;
  cursor: pointer;
}

.panel-tab.is-active {
  color: var(--gold);
  background: rgba(255, 197, 61, 0.12);
  border-color: rgba(255, 197, 61, 0.35);
}

.panel__close {
  width: calc(var(--u) * 8);
  height: calc(var(--u) * 8);
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-size: 0.9em;
  cursor: pointer;
  flex: none;
}

.panel__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--u) * 3);
}

/* records */
.records {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}

.record-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.8em 1em;
  border-radius: 0.7em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

.record-row__ico {
  font-size: 1.3em;
}
.record-row__label {
  flex: 1;
  font-size: 0.82em;
  color: var(--muted);
}

.record-row__value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1em;
  color: var(--gold);
}

/* missions */
.rank-banner {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.8em 1em;
  border-radius: 0.8em;
  margin-bottom: calc(var(--u) * 2.5);
  background: linear-gradient(
    90deg,
    rgba(255, 77, 141, 0.18),
    rgba(46, 242, 255, 0.14)
  );
  border: 1px solid var(--line);
}

.rank-banner__label {
  font-size: 0.66em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.rank-banner__name {
  flex: 1;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1em;
}
.rank-banner__pts {
  font-family: var(--display);
  font-weight: 700;
  color: var(--cyan);
}

.mission-list {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}

.mission {
  padding: 0.8em 1em;
  border-radius: 0.7em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

.mission.is-done {
  border-color: rgba(52, 245, 160, 0.4);
  background: rgba(52, 245, 160, 0.08);
}
.mission__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mission__name {
  font-family: var(--display);
  font-weight: 600;
}
.mission__pts {
  font-family: var(--display);
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85em;
}
.mission__check {
  color: var(--win);
  font-weight: 700;
}
.mission__desc {
  font-size: 0.72em;
  color: var(--muted);
  margin: 0.25em 0 0.6em;
}

.mission__bar {
  height: 0.4em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mission__bar-fill {
  height: 100%;
  border-radius: 1em;
  background: linear-gradient(90deg, var(--cyan), var(--win));
  transition: width 0.4s ease;
}

.mission.is-done .mission__bar-fill {
  background: var(--win);
}

/* history */
.history {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.5);
}

.history-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.7em 1em;
  border-radius: 0.7em;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}

.history-row__dot {
  font-size: 0.9em;
}
.history-row--win .history-row__dot {
  color: var(--win);
}
.history-row--loss .history-row__dot {
  color: var(--danger);
}
.history-row__main {
  flex: 1;
}
.history-row__line {
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.history-row__mult {
  font-family: var(--display);
  font-weight: 700;
}
.history-row__risk {
  font-size: 0.68em;
  font-weight: 600;
}
.history-row__floor {
  font-size: 0.68em;
  color: var(--muted);
}
.history-row__sub {
  font-size: 0.64em;
  color: var(--muted);
  margin-top: 0.15em;
}
.history-row__profit {
  font-family: var(--display);
  font-weight: 700;
}
.history-row__profit.is-pos {
  color: var(--win);
}
.history-row__profit.is-neg {
  color: var(--danger);
}

.history-empty {
  text-align: center;
  padding: calc(var(--u) * 10) calc(var(--u) * 4);
  color: var(--muted);
  font-size: 0.85em;
}

.history-empty__ico {
  font-size: 2.5em;
  margin-bottom: 0.4em;
}

/* ============================================================================
   EFFECTS (toasts, big win, coin burst, shake)
   ========================================================================== */
.fx-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
  font-size: calc(var(--u) * 3.7);
}

.toast {
  position: absolute;
  top: calc(var(--u) * 28);
  left: 50%;
  transform: translate(-50%, -1.5em);
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.6em 1.1em;
  border-radius: 1.5em;
  font-weight: 600;
  font-size: 0.82em;
  background: var(--glass-2);
  border: 1px solid var(--line);
  box-shadow: 0 0.4em 1.2em rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  white-space: nowrap;
}

.toast.is-in {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast--hot {
  color: #fff;
  border-color: var(--magenta);
  box-shadow: 0 0 1.2em rgba(255, 77, 141, 0.6);
}
.toast--combo {
  color: var(--cyan);
  border-color: var(--cyan);
}
.toast--win {
  color: var(--win);
  border-color: var(--win);
}
.toast--bad {
  color: var(--danger);
  border-color: var(--danger);
}

.toast--mission {
  color: var(--text);
  border-color: var(--gold);
}
.toast__badge {
  font-size: 1.4em;
}
.toast__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9em;
}
.toast__sub {
  font-size: 0.72em;
  color: var(--muted);
}

.bigwin {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.25s ease,
    transform 0.35s cubic-bezier(0.2, 1.4, 0.3, 1);
}

.bigwin.is-in {
  opacity: 1;
  transform: scale(1);
}
.bigwin.is-out {
  opacity: 0;
  transform: scale(1.3);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}
.bigwin__emoji {
  font-size: 5em;
  filter: drop-shadow(0 0 0.2em rgba(255, 197, 61, 0.8));
}

.bigwin__label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.4em;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-shadow: 0 0 0.4em rgba(255, 197, 61, 0.8);
}

.bigwin--big .bigwin__label {
  color: var(--gold);
}
.bigwin--massive .bigwin__label {
  color: var(--magenta);
  text-shadow: 0 0 0.5em rgba(255, 77, 141, 0.9);
}
.bigwin--insane .bigwin__label {
  color: var(--cyan);
  text-shadow: 0 0 0.6em rgba(46, 242, 255, 1);
  animation: hue 0.8s linear infinite;
}

.coin-burst {
  position: absolute;
  left: 50%;
  top: 46%;
}

.coin-bit {
  position: absolute;
  width: calc(var(--u) * 3.4);
  height: calc(var(--u) * 3.4);
  background: url("coin.png") center / contain no-repeat;
  animation: coin-fly var(--d, 0.9s) ease-out var(--delay, 0s) forwards;
}

@keyframes coin-fly {
  0% {
    transform: translate(0, 0) scale(0.3);
    opacity: 0;
  }
  15% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.6);
    opacity: 0;
  }
}

#game-root.is-shaking {
  animation: shake 0.5s ease;
}
#game-root.is-shaking-hard {
  animation: shake-hard 0.6s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-0.5%, 0.3%);
  }
  50% {
    transform: translate(0.5%, -0.3%);
  }
  75% {
    transform: translate(-0.3%, 0.2%);
  }
}

@keyframes shake-hard {
  0%,
  100% {
    transform: translate(0, 0);
  }
  15% {
    transform: translate(-1.2%, 0.6%) rotate(-0.3deg);
  }
  30% {
    transform: translate(1.2%, -0.6%) rotate(0.3deg);
  }
  45% {
    transform: translate(-1%, 0.5%);
  }
  60% {
    transform: translate(1%, -0.4%);
  }
  80% {
    transform: translate(-0.5%, 0.2%);
  }
}

/* desktop niceties: keep portrait box, round its corners off-canvas */
@media (min-aspect-ratio: 1/1) {
  #game-root {
    border-radius: calc(var(--u) * 2);
  }
}

/* ============================================================================
   CARTOON SKIN — glossy cream "stickers", candy-gold buttons, thick outlines.
   Appended last so it wins the cascade over the original neon styling.
   ========================================================================== */

/* loading splash -> bright sky */
#loading {
  background: radial-gradient(120% 95% at 50% 0%, #d4f1fb, #79d0ec) !important;
}
.loading__logo,
.loading__title {
  color: var(--brick);
  text-shadow: 0 0.06em 0 rgba(255, 255, 255, 0.6);
}
.loading__hint,
.loading__pct {
  color: #6a3f12;
}
.loading__bar {
  background: rgba(255, 255, 255, 0.65);
  border: 0.1em solid var(--outline);
}
.loading__fill {
  background: linear-gradient(90deg, var(--gold-2), var(--gold-deep));
}

/* HUD readouts -> cream sticker pills */
.hud__cell {
  background: var(--cream);
  border: 0.12em solid var(--outline);
  border-radius: 0.7em;
  box-shadow:
    0 0.22em 0 rgba(74, 47, 26, 0.4),
    0 0.32em 0.5em rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.hud__label {
  color: var(--muted);
  font-family: var(--body);
  font-weight: 600;
}
.hud__value {
  color: var(--text);
}
.hud__coin {
  color: var(--gold-deep);
}
.hud__value--next {
  color: var(--cyan);
}
.hud__value.is-warn {
  color: var(--brick);
}
.hud__value.is-danger {
  color: var(--danger);
}

/* altimeter gauge */
.gauge__rail {
  background: var(--cream);
  border: 0.1em solid var(--outline);
}
.gauge__fill {
  background: linear-gradient(var(--gold-2), var(--gold));
}
.gauge__tick {
  color: #fff;
  text-shadow: 0 0 0.25em rgba(0, 0, 0, 0.5);
}
.gauge__marker-val {
  background: var(--cream);
  color: var(--text);
  border: 0.1em solid var(--outline);
  border-radius: 0.5em;
}
.combo-badge {
  background: var(--brick);
  color: #fff;
  border: 0.1em solid var(--outline);
}

/* action bar */
.tension__now,
.tension__next,
.tension__vs,
.tension__warn {
  text-shadow:
    0 0 0.22em #fff,
    0 0.05em 0.08em #fff,
    0 0 0.5em #fff;
}
.cashout-btn {
  background: linear-gradient(var(--gold-2), var(--gold) 48%, var(--gold-deep));
  border: 0.14em solid var(--outline);
  border-radius: 0.8em;
  color: #3a2410;
  box-shadow:
    0 0.28em 0 var(--gold-edge),
    0 0.42em 0.6em rgba(0, 0, 0, 0.32);
}
.cashout-btn__label,
.cashout-btn__amount,
.cashout-btn__mult {
  color: #3a2410;
  text-shadow: 0 0.06em 0 rgba(255, 255, 255, 0.5);
}
.cashout-btn.is-armed:active,
.cashout-btn:active {
  transform: translateY(0.14em);
  box-shadow:
    0 0.12em 0 var(--gold-edge),
    0 0.2em 0.4em rgba(0, 0, 0, 0.3);
}
.cashout-btn:disabled {
  filter: grayscale(0.45) brightness(0.94);
}

/* bet screen */
.bet__brand-name {
  color: var(--brick);
}
.bet__brand-sub {
  color: var(--gold-deep);
}
.bet__brand-mark {
  color: var(--gold);
}
.bet__wallet {
  background: var(--cream);
  border: 0.14em solid var(--outline);
  border-radius: 1em;
  box-shadow:
    0 0.3em 0 rgba(74, 47, 26, 0.35),
    0 0.45em 0.7em rgba(0, 0, 0, 0.22);
}
.bet__wallet-label {
  color: var(--muted);
}
.bet__wallet-value {
  color: var(--gold-deep);
}
.bet__h {
  color: var(--brick);
}
.preset-select {
  background-color: var(--cream);
  border: 0.12em solid var(--outline);
  border-radius: 0.7em;
  color: var(--text);
  box-shadow: 0 0.2em 0 rgba(74, 47, 26, 0.3);
}
.chip {
  background: var(--cream);
  border: 0.12em solid var(--outline);
  color: var(--text);
  box-shadow: 0 0.2em 0 rgba(74, 47, 26, 0.3);
}
.chip.is-active {
  background: linear-gradient(var(--gold-2), var(--gold));
  color: #3a2410;
}
.chip.is-locked {
  opacity: 0.42;
}
.custom__input {
  background: #fff;
  border: 0.12em solid var(--outline);
  color: var(--text);
}
.custom__label {
  color: var(--muted);
}
.custom__apply {
  background: linear-gradient(var(--gold-2), var(--gold));
  border: 0.12em solid var(--outline);
  color: #3a2410;
}
.nav-btn {
  background: var(--cream);
  border: 0.12em solid var(--outline);
  color: var(--text);
  box-shadow: 0 0.2em 0 rgba(74, 47, 26, 0.3);
}
.start-btn {
  background: linear-gradient(var(--gold-2), var(--gold) 48%, var(--gold-deep));
  border: 0.16em solid var(--outline);
  border-radius: 0.9em;
  color: #3a2410;
  box-shadow:
    0 0.3em 0 var(--gold-edge),
    0 0.45em 0.7em rgba(0, 0, 0, 0.3);
}
.start-btn .start__main {
  color: #3a2410;
  text-shadow: 0 0.06em 0 rgba(255, 255, 255, 0.5);
}
.start-btn .start__sub {
  color: #6a3f12;
}
.start-btn:active {
  transform: translateY(0.14em);
  box-shadow: 0 0.12em 0 var(--gold-edge);
}

/* result screen */
.result-card {
  background: var(--cream);
  border: 0.16em solid var(--outline);
  border-radius: 1.1em;
  box-shadow:
    0 0.4em 0 rgba(74, 47, 26, 0.4),
    0 0.6em 1em rgba(0, 0, 0, 0.3);
}
.result__headline {
  color: var(--text);
}
.result__nudge,
.result__streak {
  color: var(--muted);
}
.rstat {
  background: #fff4e0;
  border: 0.1em solid rgba(74, 47, 26, 0.2);
  border-radius: 0.55em;
}
.rstat__value {
  color: var(--text);
}
.rstat__value--gold {
  color: var(--gold-deep);
}
.rstat__value--win {
  color: var(--win);
}
.rstat__value--loss {
  color: var(--danger);
}
.rstat__value--muted {
  color: var(--muted);
}
.result-btn--primary {
  background: linear-gradient(var(--gold-2), var(--gold) 48%, var(--gold-deep));
  border: 0.14em solid var(--outline);
  color: #3a2410;
  box-shadow: 0 0.26em 0 var(--gold-edge);
}
.result-btn--ghost {
  background: var(--cream);
  border: 0.12em solid var(--outline);
  color: var(--text);
}

/* panels */
.panel {
  background: var(--cream);
  border: 0.14em solid var(--outline);
}
.panel__close {
  color: var(--text);
}
.panel-tab {
  color: var(--muted);
}
.panel-tab.is-active {
  color: var(--brick);
}
.record-row,
.history-row {
  background: #fff4e0;
  border: 0.1em solid rgba(74, 47, 26, 0.18);
  border-radius: 0.6em;
  color: var(--text);
}

/* full-screen backdrops -> bright sky for the menu, soft scrim for popups */
.bet-screen {
  background: linear-gradient(180deg, #cdeff9 0%, #93dbf0 52%, #76cce7 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.result-screen {
  background: linear-gradient(
    180deg,
    rgba(18, 52, 72, 0.48),
    rgba(16, 42, 60, 0.6)
  );
}
.panel-overlay {
  background: rgba(18, 52, 72, 0.5);
}
.history-empty,
.history-empty__ico {
  color: var(--text);
}
.bet__footer {
  background: linear-gradient(
    180deg,
    transparent,
    rgba(118, 204, 231, 0.55) 45%
  );
}

/* ============================================================================
   ACCOUNTS · AUTH · CASHIER · ADMIN  (chunky cartoon skin)
   Added for the mock account system. Player-facing UI lives inside the portrait
   game box (sizes off --u); the admin console is a separate full-window view
   (sizes off rem, since --u is only defined on #game-root).
   ========================================================================== */

/* --- bet screen: brand + account chip + add coins -------------------------- */
.bet-userbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 2);
}

.bet-brand {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1);
  font-family: var(--display);
}
.bet-brand__mark {
  display: block;
  width: calc(var(--u) * 7.2);
  height: calc(var(--u) * 7.2);
  object-fit: contain;
  filter: drop-shadow(0 calc(var(--u) * 0.35) 0 rgba(74, 47, 26, 0.28));
}
.bet-brand__name {
  color: var(--brick);
  font-size: calc(var(--u) * 4.5);
  letter-spacing: 0.12em;
  text-shadow: 0 calc(var(--u) * 0.4) 0 #fff;
}

.bet-acct {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.5);
  padding: calc(var(--u) * 1) calc(var(--u) * 2.5) calc(var(--u) * 1)
    calc(var(--u) * 1);
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 8);
  box-shadow: 0 calc(var(--u) * 1.2) 0 var(--outline);
  color: var(--text);
  font-family: var(--body);
  cursor: pointer;
}
.bet-acct:active {
  transform: translateY(calc(var(--u) * 1.2));
  box-shadow: 0 0 0 var(--outline);
}
.bet-acct__ava {
  width: calc(var(--u) * 7);
  height: calc(var(--u) * 7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  border: calc(var(--u) * 0.5) solid var(--outline);
  color: #3a2410;
  font-family: var(--display);
  font-size: calc(var(--u) * 3.2);
  flex: none;
}
.bet-acct__name {
  font-weight: 700;
  font-size: calc(var(--u) * 3.2);
  max-width: calc(var(--u) * 24);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bet-acct__caret {
  color: var(--muted);
  font-size: calc(var(--u) * 2.6);
}

.btn-add-coins {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 1.5);
  width: 100%;
  padding: calc(var(--u) * 2.5);
  background: linear-gradient(180deg, #6fe0a0, var(--win));
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: #0d3b22;
  text-shadow: 0 calc(var(--u) * 0.4) 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
}
.btn-add-coins:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}
.btn-add-coins__plus {
  font-size: calc(var(--u) * 5);
  line-height: 0;
}

/* --- auth screen ----------------------------------------------------------- */
.auth-screen {
  background: linear-gradient(180deg, #cdeff9 0%, #93dbf0 52%, #76cce7 100%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.auth__scroll {
  flex: 1;
  min-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--u) * 3) calc(var(--u) * 5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: calc(var(--u) * 2.5);
}
.auth__brand {
  text-align: center;
  line-height: 1;
  position: relative;
}
.auth__brand-logo {
  display: block;
  width: calc(var(--u) * 17);
  height: calc(var(--u) * 17);
  max-width: 40%;
  margin: 0 auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
}
.auth__brand-name {
  font-family: var(--display);
  font-size: calc(var(--u) * 5.6);
  color: var(--brick);
  letter-spacing: 0.12em;
  /* white halo so the wordmark stays legible over the crane art */
  text-shadow:
    0 calc(var(--u) * 0.5) 0 #fff,
    0 0 calc(var(--u) * 1.2) #fff,
    0 0 calc(var(--u) * 2.4) rgba(255, 255, 255, 0.85);
  /* overlay the wordmark on the logo, nudged DOWN so the crane's hanging
     building shows above the text. ADJUST `top` to move the text: bigger =
     lower (more building visible), smaller/0 = back to centered. */
  position: absolute;
  top: calc(var(--u) * 3.8);
  left: 0;
  right: 0;
  height: calc(var(--u) * 17);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.auth__brand-sub {
  font-family: var(--display);
  font-size: calc(var(--u) * 4.5);
  color: var(--gold-deep);
  letter-spacing: 0.4em;
}
.auth__tagline {
  margin-top: calc(var(--u) * 0.5);
  font-size: calc(var(--u) * 3);
  color: var(--text);
  opacity: 0.85;
}

@media (max-width: 600px) {
  .auth__scroll {
    gap: calc(var(--u) * 3.2);
  }

  .auth__brand-logo {
    width: calc(var(--u) * 24);
    height: calc(var(--u) * 24);
    max-width: 58%;
  }

  .auth__brand-name {
    top: calc(var(--u) * 5.4);
    height: calc(var(--u) * 24);
    font-size: calc(var(--u) * 7.1);
  }

  .auth__tagline {
    margin-top: calc(var(--u) * 1);
    font-size: calc(var(--u) * 3.7);
    line-height: 1.2;
  }
}

.auth__card {
  background: var(--cream);
  border: calc(var(--u) * 1) solid var(--outline);
  border-radius: calc(var(--u) * 5);
  box-shadow: 0 calc(var(--u) * 2) 0 var(--outline);
  padding: calc(var(--u) * 3.5);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2.5);
}
.auth__tabs {
  display: flex;
  gap: calc(var(--u) * 2);
}
.auth-tab {
  flex: 1;
  padding: calc(var(--u) * 2.2);
  background: transparent;
  border: calc(var(--u) * 0.6) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  font-family: var(--display);
  font-size: calc(var(--u) * 3.6);
  color: var(--muted);
  cursor: pointer;
}
.auth-tab.is-active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #3a2410;
  box-shadow: 0 calc(var(--u) * 1) 0 var(--outline);
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}
.auth__field {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1);
}
.auth__field-label {
  font-size: calc(var(--u) * 2.8);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.auth__input {
  width: 100%;
  padding: calc(var(--u) * 2.3) calc(var(--u) * 3);
  background: #fff;
  border: calc(var(--u) * 0.7) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: var(--text);
}
.auth__input:focus {
  outline: none;
  border-color: var(--gold-deep);
}
/* the display-name field only appears in sign-up mode */
.auth__field--display {
  display: none;
}
.auth-screen.is-signup .auth__field--display {
  display: flex;
}
.auth__message {
  min-height: calc(var(--u) * 4);
  font-size: calc(var(--u) * 3);
  font-weight: 600;
  text-align: center;
  color: var(--danger);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.auth__message.is-show {
  opacity: 1;
}
.auth__submit {
  width: 100%;
  padding: calc(var(--u) * 3);
  background: linear-gradient(
    180deg,
    var(--gold-2),
    var(--gold) 48%,
    var(--gold-deep)
  );
  border: calc(var(--u) * 0.9) solid var(--outline);
  border-radius: calc(var(--u) * 3.5);
  box-shadow: 0 calc(var(--u) * 1.8) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 5);
  color: #3a2410;
  text-shadow: 0 calc(var(--u) * 0.4) 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
}
.auth__submit:active {
  transform: translateY(calc(var(--u) * 1.8));
  box-shadow: 0 0 0 var(--outline);
}
.auth__divider {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2);
  color: var(--muted);
  font-size: calc(var(--u) * 3);
}
.auth__divider::before,
.auth__divider::after {
  content: "";
  flex: 1;
  height: calc(var(--u) * 0.4);
  background: rgba(74, 47, 26, 0.25);
  border-radius: 1em;
}
.auth__demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--u) * 1.5);
  width: 100%;
  padding: calc(var(--u) * 2.8);
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: var(--text);
  cursor: pointer;
}
.auth__demo:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}
.auth__hint {
  text-align: center;
  font-size: calc(var(--u) * 2.6);
  color: var(--muted);
  line-height: 1.6;
}
.auth__hint b {
  color: var(--brick);
}

/* --- account panel (slide-up sheet, reuses .panel / .panel-overlay) -------- */
.acct__title {
  flex: 1;
  font-family: var(--display);
  font-size: calc(var(--u) * 4.5);
  color: var(--brick);
}
.acct__body {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 3.5);
}
.acct__head {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2.5);
}
.acct__avatar {
  width: calc(var(--u) * 12);
  height: calc(var(--u) * 12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  border: calc(var(--u) * 0.7) solid var(--outline);
  color: #3a2410;
  font-family: var(--display);
  font-size: calc(var(--u) * 5);
  flex: none;
}
.acct__id {
  flex: 1;
  min-width: 0;
}
.acct__name {
  font-family: var(--display);
  font-size: calc(var(--u) * 4.5);
  color: var(--text);
}
.acct__since {
  font-size: calc(var(--u) * 2.6);
  color: var(--muted);
}
.acct__badge {
  font-family: var(--display);
  font-size: calc(var(--u) * 2.6);
  padding: calc(var(--u) * 0.6) calc(var(--u) * 1.6);
  border-radius: 1em;
  border: calc(var(--u) * 0.5) solid var(--outline);
  background: #fff4e0;
  color: var(--brick);
}
.acct__badge.is-demo {
  background: var(--cyan);
  color: #fff;
}
.acct__balance {
  text-align: center;
  padding: calc(var(--u) * 3);
  background: #fff4e0;
  border: calc(var(--u) * 0.7) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.2) 0 var(--outline);
}
.acct__balance-label {
  font-size: calc(var(--u) * 2.8);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.acct__balance-coin {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: calc(var(--u) * 7);
  color: var(--gold-deep);
}
.acct__section {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}
.acct__h {
  font-family: var(--display);
  font-size: calc(var(--u) * 3.4);
  color: var(--brick);
}
.acct-amounts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--u) * 2.6);
}
/* A lone trailing chip (e.g. the 5th of 5 presets) spans both columns, so the
   grid never leaves an empty cell — every row stays balanced. */
.acct-amount:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.acct-amount {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
  padding: calc(var(--u) * 2);
  background: var(--cream);
  border: calc(var(--u) * 0.7) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  box-shadow: 0 calc(var(--u) * 1.2) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 3.4);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.acct-amount.is-active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #3a2410;
}
.acct-amount:active {
  transform: translateY(calc(var(--u) * 1.2));
  box-shadow: 0 0 0 var(--outline);
}
.acct-custom {
  /* Breathing room above (from the preset chips) and below (to the deposit
     button) — the deposit view stacks these in a plain block with no gap. */
  margin: calc(var(--u) * 2.8) 0;
}
.acct-custom__input {
  width: 100%;
  padding: calc(var(--u) * 2.5) calc(var(--u) * 3);
  background: #fff;
  border: calc(var(--u) * 0.7) solid var(--outline);
  border-radius: calc(var(--u) * 2.5);
  font-family: var(--display);
  font-size: calc(var(--u) * 3.6);
  color: var(--text);
}
.acct-custom__input:focus {
  outline: none;
  border-color: var(--gold-deep);
}
.acct-deposit {
  width: 100%;
  padding: calc(var(--u) * 2.8);
  background: linear-gradient(180deg, #6fe0a0, var(--win));
  border: calc(var(--u) * 0.8) solid var(--outline);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--outline);
  font-family: var(--display);
  font-size: calc(var(--u) * 4);
  color: #0d3b22;
  cursor: pointer;
}
.acct-deposit:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--outline);
}
.acct__note {
  font-size: calc(var(--u) * 2.5);
  color: var(--muted);
  text-align: center;
  /* Clear the deposit button's chunky drop shadow so the note never overlaps. */
  margin-top: calc(var(--u) * 3);
}
.acct-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--u) * 2);
}
.acct-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--u) * 2) calc(var(--u) * 2.5);
  background: #fff4e0;
  border: calc(var(--u) * 0.5) solid rgba(74, 47, 26, 0.25);
  border-radius: calc(var(--u) * 2);
}
.acct-stat__label {
  font-size: calc(var(--u) * 2.8);
  color: var(--muted);
}
.acct-stat__value {
  font-family: var(--display);
  font-size: calc(var(--u) * 3.4);
  color: var(--text);
}
.acct-stat__value.is-gold {
  color: var(--gold-deep);
}
.acct-stat__value.is-win {
  color: var(--win);
}
.acct-stat__value.is-loss {
  color: var(--danger);
}
.acct-tx {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.5);
}
.acct-tx__row {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 2);
  padding: calc(var(--u) * 1.8) calc(var(--u) * 2.2);
  background: #fff4e0;
  border: calc(var(--u) * 0.5) solid rgba(74, 47, 26, 0.2);
  border-radius: calc(var(--u) * 2);
}
.acct-tx__ico {
  font-size: calc(var(--u) * 4);
}
.acct-tx__main {
  flex: 1;
}
.acct-tx__label {
  font-weight: 700;
  font-size: calc(var(--u) * 3);
  color: var(--text);
}
.acct-tx__time {
  font-size: calc(var(--u) * 2.4);
  color: var(--muted);
}
.acct-tx__amt {
  font-family: var(--display);
  font-size: calc(var(--u) * 3.2);
}
.acct-tx__amt.is-pos {
  color: var(--win);
}
.acct-tx__amt.is-neg {
  color: var(--danger);
}
.acct-tx__empty {
  text-align: center;
  color: var(--muted);
  font-size: calc(var(--u) * 3);
  padding: calc(var(--u) * 4);
}
.acct-logout {
  width: 100%;
  padding: calc(var(--u) * 2.8);
  background: var(--cream);
  border: calc(var(--u) * 0.8) solid var(--danger);
  border-radius: calc(var(--u) * 3);
  box-shadow: 0 calc(var(--u) * 1.5) 0 var(--brick-deep);
  font-family: var(--display);
  font-size: calc(var(--u) * 3.8);
  color: var(--danger);
  cursor: pointer;
  margin-top: calc(var(--u) * 1);
}
.acct-logout:active {
  transform: translateY(calc(var(--u) * 1.5));
  box-shadow: 0 0 0 var(--brick-deep);
}

/* --- admin console (full-window, rem-based) -------------------------------- */
.adm-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: linear-gradient(180deg, #cdeff9 0%, #93dbf0 60%, #76cce7 100%);
  color: var(--text);
  font-family: var(--body);
  overflow: hidden;
}
.adm-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: clamp(12px, 3vw, 28px);
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vw, 20px);
}
.adm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.adm-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
}
.adm-brand__mark {
  color: var(--gold);
  font-size: 1.8rem;
}
.adm-brand__name {
  color: var(--brick);
  font-size: 1.8rem;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 0 #fff;
}
.adm-brand__tag {
  color: var(--gold-deep);
  font-size: 0.9rem;
  letter-spacing: 0.3em;
}
.adm-header__actions {
  display: flex;
  gap: 8px;
}
.adm-btn {
  font-family: var(--display);
  font-size: 0.95rem;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  border: 2px solid var(--outline);
  box-shadow: 0 3px 0 var(--outline);
  background: var(--cream);
  color: var(--text);
  cursor: pointer;
}
.adm-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--outline);
}
.adm-btn--gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #3a2410;
}
.adm-btn--logout {
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 3px 0 var(--brick-deep);
}
.adm-btn--ghost {
  background: #fff;
}
.adm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(8px, 1.5vw, 16px);
}
.adm-kpi {
  background: var(--cream);
  border: 3px solid var(--outline);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--outline);
  padding: clamp(12px, 2vw, 20px);
  text-align: center;
}
.adm-kpi__value {
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--text);
  line-height: 1;
}
.adm-kpi__label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}
.adm-kpi--gold .adm-kpi__value {
  color: var(--gold-deep);
}
.adm-kpi--win .adm-kpi__value {
  color: var(--win);
}
.adm-kpi--loss .adm-kpi__value {
  color: var(--danger);
}
.adm-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: clamp(12px, 2vw, 20px);
  align-items: start;
}
@media (max-width: 860px) {
  .adm-grid {
    grid-template-columns: 1fr;
  }
}
.adm-card {
  background: var(--cream);
  border: 3px solid var(--outline);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--outline);
  padding: clamp(12px, 2vw, 18px);
  min-width: 0; /* let the table scroll inside its grid track instead of overflowing the page */
}
.adm-card__title {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--brick);
  margin-bottom: 12px;
}
.adm-table {
  width: 100%;
  overflow-x: auto;
}
.adm-table__head,
.adm-row {
  display: grid;
  grid-template-columns: 2fr repeat(7, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 720px;
}
.adm-table__head {
  padding: 8px 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.adm-row {
  padding: 10px;
  border-radius: 10px;
  background: #fff4e0;
  border: 2px solid rgba(74, 47, 26, 0.18);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.adm-row:hover {
  transform: translateY(-1px);
  border-color: var(--gold-deep);
}
.adm-col {
  font-size: 0.9rem;
}
.adm-col--num {
  text-align: right;
  font-family: var(--display);
}
.adm-col--player {
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-num--gold {
  color: var(--gold-deep);
}
.adm-num--win {
  color: var(--win);
}
.adm-num--loss {
  color: var(--danger);
}
.adm-num--muted {
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.8rem;
}
.adm-ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-deep));
  border: 2px solid var(--outline);
  color: #3a2410;
  font-family: var(--display);
  font-size: 0.8rem;
}
.adm-ava--lg {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}
.adm-row__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.adm-tag {
  font-family: var(--display);
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1.5px solid var(--outline);
}
.adm-tag--demo {
  background: var(--cyan);
  color: #fff;
}
.adm-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.adm-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.adm-feed__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fff4e0;
  border: 2px solid rgba(74, 47, 26, 0.16);
}
.adm-feed__ico {
  font-size: 1.2rem;
}
.adm-feed__main {
  flex: 1;
  min-width: 0;
}
.adm-feed__label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-feed__time {
  font-size: 0.7rem;
  color: var(--muted);
}
.adm-feed__amt {
  font-family: var(--display);
  font-size: 0.9rem;
}
.adm-feed__amt.is-pos {
  color: var(--win);
}
.adm-feed__amt.is-neg {
  color: var(--danger);
}
.adm-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 52, 72, 0.5);
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}
.adm-drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}
.adm-drawer {
  width: min(440px, 92vw);
  height: 100%;
  background: var(--cream);
  border-left: 4px solid var(--outline);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.adm-drawer-overlay.is-open .adm-drawer {
  transform: none;
}
.adm-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 2px solid rgba(74, 47, 26, 0.2);
}
.adm-drawer__title {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--brick);
}
.adm-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.adm-dprofile {
  display: flex;
  gap: 12px;
  align-items: center;
}
.adm-dname {
  font-family: var(--display);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.adm-dmeta {
  font-size: 0.78rem;
  color: var(--muted);
}
.adm-dbalance {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #fff4e0;
  border: 2px solid var(--outline);
  border-radius: 12px;
}
.adm-dbalance__label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
}
.adm-dbalance__value {
  font-family: var(--display);
  font-size: 1.8rem;
  color: var(--gold-deep);
  display: flex;
  align-items: center;
}
.adm-adjust {
  display: flex;
  gap: 8px;
}
.adm-adjust__input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border: 2px solid var(--outline);
  border-radius: 10px;
  font-family: var(--display);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
.adm-dstats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.adm-dstat {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  background: #fff4e0;
  border: 1.5px solid rgba(74, 47, 26, 0.2);
  border-radius: 8px;
}
.adm-dstat__label {
  font-size: 0.78rem;
  color: var(--muted);
}
.adm-dstat__value {
  font-family: var(--display);
  font-size: 0.9rem;
}
.adm-dsub {
  font-family: var(--display);
  color: var(--brick);
  font-size: 1rem;
}
.adm-dlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.adm-dround {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff4e0;
  border: 1.5px solid rgba(74, 47, 26, 0.18);
  border-radius: 8px;
  font-size: 0.8rem;
}
.adm-dround__dot.is-win {
  color: var(--win);
}
.adm-dround__dot.is-loss {
  color: var(--danger);
}
.adm-dround__mult {
  font-family: var(--display);
}
.adm-dround__floor {
  color: var(--muted);
}
.adm-dround__bet {
  flex: 1;
  color: var(--muted);
}
.adm-dround__profit.is-pos {
  color: var(--win);
  font-family: var(--display);
}
.adm-dround__profit.is-neg {
  color: var(--danger);
  font-family: var(--display);
}
