/* Isolated beUI-inspired Crash redesign in lime tones.
   Rollback: remove the <link>/<script> from index.html and dev.html, delete crash-ui.css/js. */
#tab-crash {
  --cr-lime: #d1f581;
  --cr-lime-soft: rgba(209,245,129,.12);
  --cr-line: rgba(197,225,153,.18);
  --cr-amber: #f0c779;
  --cr-ice: #dfe9df;
  --cr-rose: #ff8794;
}

/* recent rounds strip */
#tab-crash .crash-history {
  position: relative;
  min-height: 42px; margin: 2px 0 10px; padding: 7px 10px;
  align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface-1);
}
#tab-crash .cr-last-empty { font: 500 12px/1 var(--font-body); color: var(--text-3); }
#tab-crash .crash-chip {
  height: 26px; padding: 0 9px; border-radius: 8px;
  font: 700 12px/1 var(--font-mono);
  border: 1px solid rgba(209,245,129,.22);
  background: var(--cr-lime-soft); color: var(--cr-lime);
  animation: crChipIn .35s cubic-bezier(.2,.9,.3,1) both;
}
#tab-crash .crash-chip.c-red { color: var(--cr-rose); border-color: rgba(255,116,133,.28); background: rgba(255,116,133,.1); }
#tab-crash .crash-chip.c-gold { color: var(--cr-amber); border-color: rgba(240,199,121,.25); background: rgba(240,199,121,.1); }
@keyframes crChipIn { from { opacity: 0; transform: translateY(-5px) scale(.9); } to { opacity: 1; transform: none; } }

/* stage */
#tab-crash .crash {
  height: 236px; margin-bottom: 12px; overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--cr-line);
  background:
    radial-gradient(80% 60% at 20% 100%, rgba(140,182,153,.09), transparent 70%),
    linear-gradient(180deg, #10191d, #0b1418 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 10px 30px rgba(0,0,0,.35);
}
#tab-crash .crash__scene { z-index: 1; }
#tab-crash .crash__scene canvas { filter: saturate(.89) contrast(1.028); }
#tab-crash .cr-grid {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 25% 25%;
  animation: crGridIn .6s ease-out both;
}
#tab-crash .cr-grid::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 26px;
  height: 1px; background: linear-gradient(90deg, transparent, rgba(204,255,74,.4), transparent);
}
@keyframes crGridIn { from { opacity: 0; } to { opacity: 1; } }
#tab-crash .cr-axis {
  position: absolute; right: 8px; z-index: 3; pointer-events: none;
  font: 600 10px/1 var(--font-mono); color: rgba(255,255,255,.28);
}
#tab-crash .cr-axis--1 { top: 22%; } #tab-crash .cr-axis--2 { top: 48%; } #tab-crash .cr-axis--3 { bottom: 30px; }
#tab-crash .cr-time {
  position: absolute; left: 0; right: 0; bottom: 8px; z-index: 3;
  display: flex; justify-content: space-around; pointer-events: none;
  font: 600 10px/1 var(--font-mono); color: rgba(255,255,255,.22);
}
/* readout */
#tab-crash .crash__value { left: 16px; top: 18px; z-index: 4; }
#tab-crash .crash__value b {
  font: 900 52px/1 var(--font-display); letter-spacing: -.05em;
  color: var(--cr-ice); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 28px rgba(209,245,129,.24);
  transition: color .25s ease, text-shadow .25s ease;
}
#tab-crash .crash.is-flying .crash__value b { color: var(--cr-lime); text-shadow: 0 0 32px rgba(209,245,129,.42); }
#tab-crash .crash.is-crashed .crash__value b { color: var(--cr-rose); text-shadow: 0 0 28px rgba(255,116,133,.38); }
#tab-crash #cr-big { transform-origin: left 55%; }
#tab-crash .cr-mult-group { display: inline-block; transform-origin: 44% 65%; }
#tab-crash .cr-mult-cell { display: inline-block; }
#tab-crash .cr-mult-digit { min-width: 1ch; text-align: center; }
#tab-crash .cr-mult-cell > span { display: inline-block; }
#tab-crash #cr-big.cr-mult--wide { font-size: 40px; }
#tab-crash .crash__value > span {
  font: 700 12px/1.2 var(--font-body); color: var(--text-2);
  margin-top: 10px; display: flex; align-items: center; gap: 7px;
}
#tab-crash .crash__value > span::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cr-lime); box-shadow: 0 0 10px var(--cr-lime);
  animation: crBlink 1.4s ease-in-out infinite;
}
#tab-crash .crash__value > span.won { color: var(--cr-lime); }
#tab-crash .crash__value > span.lost { color: #ff6b7a; }
@keyframes crBlink { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
#tab-crash .crash__phase {
  right: 14px; top: 14px; z-index: 5;
  height: 26px; padding: 0 11px; border-radius: 9px;
  font: 800 10px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid rgba(209,245,129,.4); background: var(--cr-lime-soft); color: var(--cr-lime);
}
#tab-crash .crash.is-crashed .crash__phase { border-color: rgba(255,116,133,.45); background: rgba(255,116,133,.12); color: var(--cr-rose); }
#tab-crash .crash.is-betting .crash__phase { border-color: rgba(240,199,121,.4); background: rgba(240,199,121,.12); color: var(--cr-amber); }
/* flight trail */
#tab-crash .cr-trail {
  position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%;
  pointer-events: none;
}
#tab-crash .cr-trail-line {
  fill: none; stroke: var(--cr-lime); stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(204,255,74,.45));
}
#tab-crash .cr-trail-area { fill: url(#crTrailFill); opacity: .55; }
#tab-crash .cr-cross { display: none; stroke: #ff5c6a; stroke-width: 2.4; stroke-linecap: round; }
#tab-crash .crash.is-crashed .cr-trail-line { stroke: #ff5c6a; filter: drop-shadow(0 0 6px rgba(255,64,83,.5)); }
#tab-crash .crash.is-crashed .cr-trail-area { fill: url(#crTrailFillRed); }
#tab-crash .crash.is-crashed .cr-cross { display: block; }
#tab-crash .crash.is-crashed .cr-plane { opacity: 0; }
/* plane */
#tab-crash .cr-plane {
  position: absolute; z-index: 4; left: 0; top: 0;
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  transform: translate(var(--px, 18px), var(--py, 190px)) rotate(var(--rot, 0deg));
  filter: drop-shadow(0 0 10px rgba(204,255,74,.5));
  pointer-events: none;
}
#tab-crash .cr-plane svg { width: 100%; height: 100%; }
#tab-crash .crash.is-crashed .cr-plane { animation: crCrashSpin .5s ease-out both; filter: drop-shadow(0 0 14px rgba(255,64,83,.6)); }
@keyframes crCrashSpin { to { transform: translate(var(--px), var(--py)) rotate(160deg) scale(.7); opacity: .4; } }

/* controls */
#tab-crash .cr-bar { height: 3px; border-radius: 2px; margin: -6px 0 14px; background: rgba(255,255,255,.06); }
#tab-crash .cr-bar-fill { background: linear-gradient(90deg, var(--cr-lime), #e9ffae); box-shadow: 0 0 12px rgba(204,255,74,.5); }
#tab-crash .field-group .overline { color: var(--text-3); letter-spacing: .12em; font-size: 10px; }
#tab-crash .field { background: linear-gradient(180deg, rgba(255,255,255,.03), transparent), var(--surface-1); border-color: var(--cr-line); }
#tab-crash .field:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(204,255,74,.08); }
#tab-crash #cr-cta {
  height: 62px; margin-top: 12px;
  background: linear-gradient(100deg, #b5dc66, #ddf59a) !important;
  color: #101402 !important;
  font: 900 17px/1 var(--font-body);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(197,225,121,.24), inset 0 1px 0 rgba(255,255,255,.6), inset 0 -3px 0 rgba(0,0,0,.18) !important;
}
#tab-crash #cr-cta small { font-weight: 700; opacity: .6; }
#tab-crash #cr-cta.take { background: linear-gradient(100deg, #cde987, #f1f6ce) !important; }
/* players */
#tab-crash .cr-players .list { background: var(--surface-1); border-color: var(--line); border-radius: 16px; }
#tab-crash .cr-p { background: rgba(255,255,255,.025); border-color: rgba(255,255,255,.04); }
#tab-crash .cr-p.me { border-color: var(--cr-lime); box-shadow: inset 0 0 0 1px rgba(204,255,74,.35), 0 0 18px rgba(204,255,74,.08); }
#tab-crash .cr-p.won .cr-p-res { color: var(--cr-lime); }
#tab-crash .cr-p.won { background: rgba(204,255,74,.08); border-color: rgba(204,255,74,.3); }
#tab-crash .cr-p.lost .cr-p-res { color: #ff6b7a; }
#tab-crash .cr-dot { background: var(--cr-lime); box-shadow: 0 0 10px rgba(204,255,74,.7); }
#tab-crash .cr-p-more { color: var(--text-3); }
@media (prefers-reduced-motion: reduce) {
  #tab-crash .cr-plane, #tab-crash .crash.is-crashed .cr-plane { animation: none !important; transition: none !important; }
}

@media (max-width: 370px) {
  #tab-crash .crash__value b { font-size: 36px; }
  #tab-crash #cr-big.cr-mult--wide { font-size: 31px; }
  #tab-crash .crash__phase { padding-inline: 7px; letter-spacing: .06em; }
}

/* While the rocket scene animates, a fixed backdrop-filter blur over it forces the browser to re-blur every frame — the
   biggest mobile jank source after fill rate. Swap the blur for a solid tint on the bottom nav during the flight; it still
   reads as glass and the recomposite cost disappears. The glass-nav variant already runs blur-free (navigation.css). */
body.cr-anim .tabbar { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.cr-anim .glass-nav .tabbar { background: linear-gradient(155deg, #11161dF2, #0b0e13 60%, #0f141bF2) !important; }
