/* Crash game (#/crash) */
.crash-page .game-layout > * { min-width: 0; }
.crash-stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* history pills */
.crash-history {
  display: flex; gap: 6px; min-height: 28px; overflow: hidden; align-items: center;
  -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent);
  mask-image: linear-gradient(90deg, #000 82%, transparent);
}
.crash-history-empty { font-size: 13px; }
.crash-pill {
  flex: none; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid; cursor: pointer;
  font: 700 12.5px/1 var(--font); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center;
  transition: transform .12s, filter .12s;
}
.crash-pill:hover { transform: translateY(-1px); filter: brightness(1.2); }
.crash-pill.red { color: var(--red); background: rgba(255, 92, 92, .1); border-color: rgba(255, 92, 92, .28); }
.crash-pill.green { color: var(--green); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .3); }
.crash-pill.gold { color: var(--gold); background: rgba(228, 174, 57, .14); border-color: rgba(228, 174, 57, .45); box-shadow: 0 0 14px -4px rgba(228, 174, 57, .7); }
.crash-history .crash-pill:first-child { animation: crash-pill-in .45s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes crash-pill-in { from { transform: translateX(-18px) scale(.7); opacity: 0; } }

/* graph */
.crash-graph {
  position: relative; height: 380px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line);
  background:
    radial-gradient(90% 80% at 0% 100%, rgba(239, 59, 59, .13), transparent 60%),
    radial-gradient(60% 60% at 100% 0%, rgba(139, 26, 26, .16), transparent 70%),
    linear-gradient(180deg, var(--bg2), #0b0809);
}
.crash-graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.crash-graph.crash-shake { animation: crash-shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes crash-shake {
  10%, 90% { transform: translate(-1px, 1px); }
  20%, 80% { transform: translate(3px, -2px); }
  30%, 50%, 70% { transform: translate(-5px, 2px); }
  40%, 60% { transform: translate(5px, -1px); }
}

.crash-center {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none; padding: 0 16px 24px;
}
.crash-label {
  min-height: 18px; font-family: var(--display); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.crash-mult {
  font-family: var(--display); font-size: clamp(46px, 8vw, 88px); line-height: 1.05; color: var(--text);
  font-variant-numeric: tabular-nums; text-shadow: 0 6px 34px rgba(0, 0, 0, .7); transition: color .2s, text-shadow .2s;
}
.crash-sub { min-height: 22px; margin-top: 10px; color: var(--muted); font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.crash-bar { width: min(260px, 62%); height: 6px; margin-top: 14px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.crash-bar i {
  display: block; height: 100%; transform-origin: left; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-lo), var(--accent), var(--accent-hi));
  box-shadow: 0 0 12px rgba(239, 59, 59, .6);
}
.crash-center.is-betting .crash-mult { font-size: clamp(38px, 6vw, 64px); }
.crash-center.is-flying .crash-mult { text-shadow: 0 0 40px rgba(239, 59, 59, .35), 0 6px 30px rgba(0, 0, 0, .7); }
.crash-center.is-cashed .crash-mult { color: var(--green); }
.crash-center.is-cashed .crash-sub { color: var(--green); }
.crash-center.is-crashed .crash-label { color: var(--red); }
.crash-center.is-crashed .crash-mult { color: var(--red); text-shadow: 0 0 44px rgba(255, 92, 92, .45), 0 6px 30px rgba(0, 0, 0, .7); animation: crash-pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.crash-center.is-starting .crash-mult { opacity: .55; }
@keyframes crash-pop { from { transform: scale(1.25); } }

.crash-result {
  position: absolute; top: 14px; right: 14px; padding: 8px 14px; border-radius: 12px; text-align: right;
  display: flex; flex-direction: column; gap: 2px; pointer-events: none;
  opacity: 0; transform: translateY(-10px) scale(.95); transition: opacity .25s, transform .35s cubic-bezier(.2, .9, .3, 1.3);
  backdrop-filter: blur(6px);
}
.crash-result.show { opacity: 1; transform: none; }
.crash-result small { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; opacity: .85; }
.crash-result b { font-size: 17px; display: inline-flex; align-items: center; justify-content: flex-end; }
.crash-result.win { background: rgba(52, 211, 153, .14); border: 1px solid rgba(52, 211, 153, .4); color: var(--green); box-shadow: 0 8px 30px -10px rgba(52, 211, 153, .6); }
.crash-result.lose { background: rgba(255, 92, 92, .12); border: 1px solid rgba(255, 92, 92, .35); color: var(--red); }

.crash-offline {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); padding: 6px 12px; border-radius: 99px;
  background: rgba(0, 0, 0, .6); color: var(--muted); font-size: 13px; font-weight: 600;
}

.crash-foot { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.crash-hash {
  border: 0; background: none; color: var(--dim); cursor: pointer; font: 500 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; padding: 4px 0;
}
.crash-hash:hover { color: var(--accent-hi); }

/* controls */
.crash-auto {
  display: flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px;
  padding: 4px 14px 4px 12px; transition: border-color .15s; cursor: text;
}
.crash-auto:focus-within { border-color: var(--accent); }
.crash-auto .input { border: 0; background: transparent; height: 32px; padding: 0 4px; flex: 1; min-width: 0; font-weight: 700; }
.crash-auto-x { color: var(--dim); font-weight: 700; font-size: 15px; }
.crash-auto-chips { display: flex; gap: 5px; min-width: 0; }
.crash-auto-chips .chip { flex: 1 1 0; min-width: 0; height: 28px; padding: 0; font-size: 12.5px; }

.crash-main { width: 100%; gap: 10px; }
/* The label is re-rendered every frame while flying: clicks must land on the button, not on a replaced child */
.crash-main * { pointer-events: none; }
.crash-main .price { font-size: 17px; }
.crash-main.is-cashout {
  height: 58px; font-size: 17px; color: #231703;
  animation: crash-glow 1.1s ease-in-out infinite;
}
.crash-main.is-cashout .coin { font-size: 18px; }
@keyframes crash-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(228, 174, 57, .55), 0 8px 26px -10px rgba(228, 174, 57, .8); }
  50% { box-shadow: 0 0 0 6px rgba(228, 174, 57, 0), 0 8px 34px -8px rgba(228, 174, 57, .95); }
}
.crash-main.is-won { background: rgba(52, 211, 153, .14); color: var(--green); border-color: rgba(52, 211, 153, .4); opacity: 1; }
.crash-main.is-placed { opacity: 1; color: var(--text); border-color: rgba(239, 59, 59, .45); background: rgba(239, 59, 59, .08); }
.crash-note { min-height: 0; margin-top: -6px; font-size: 12.5px; color: var(--muted); text-align: center; }
.crash-note:empty { display: none; }

/* players */
.crash-players { padding: 8px; }
.crash-players-empty { padding: 28px 16px; }
.crash-players-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); gap: 4px 12px; }
.crash-player {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto minmax(96px, auto); align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid transparent;
  transition: background .2s, opacity .2s;
}
.crash-player.me { border-color: rgba(239, 59, 59, .4); }
.crash-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.crash-player-bet { font-size: 13.5px; }
.crash-player-out { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13.5px; }
.crash-player.won { background: rgba(52, 211, 153, .08); }
.crash-player.won .crash-player-out { color: var(--green); }
.crash-player.lost { opacity: .6; }
.crash-player.lost .crash-player-out { color: var(--red); font-weight: 600; }

/* provably fair modal */
.crash-fair { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.crash-fair > div { display: flex; flex-direction: column; gap: 4px; }
.crash-fair span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.crash-fair code {
  display: block; padding: 8px 10px; border-radius: 8px; background: var(--bg2); border: 1px solid var(--line);
  font: 12.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; color: var(--text);
}
.crash-fair .crash-pill { align-self: flex-start; cursor: default; }
.crash-fair-formula { font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); margin: 0 0 12px; }
.crash-verify { margin-top: 10px; font-size: 13.5px; }
.crash-verify.ok { color: var(--green); }
.crash-verify.bad { color: var(--red); }

@media (max-width: 900px) {
  .crash-graph { height: 320px; }
}
@media (max-width: 600px) {
  .crash-graph { height: 264px; }
  .crash-result { top: 10px; right: 10px; padding: 6px 10px; }
  .crash-result b { font-size: 15px; }
  .crash-players { padding: 6px; }
  .crash-players-list { grid-template-columns: 1fr; }
  .crash-player { grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 8px; padding: 7px 8px; }
  .crash-player .avatar { width: 26px; height: 26px; font-size: 11px; }
  .crash-player-bet, .crash-player-out { font-size: 12.5px; }
  .crash-player-out { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .crash-graph.crash-shake, .crash-main.is-cashout, .crash-center.is-crashed .crash-mult, .crash-history .crash-pill:first-child { animation: none; }
}
