/* ----------------------------------------------------------------- crash */

/*
 * The curve on the left, who is in on the right, and the last two dozen
 * rounds along the bottom bar. The multiplier is the loudest thing on the
 * screen, because it is the only thing anybody is looking at.
 */

.cr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  margin-bottom: 14px;
}

.cr-frame {
  position: relative;
  margin: 0;
}

/* The last rounds ride over the top of the board, out of the way. */
.cr-top {
  position: absolute;
  top: 12px;
  right: 14px;
  left: 14px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.cr-top .cr-strip {
  pointer-events: auto;
}

.cr-stage {
  padding: 0;
}

.cr-board {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: min(58vh, 560px);
  background:
    radial-gradient(80% 90% at 50% 110%, rgba(204, 255, 0, 0.12), transparent 62%),
    linear-gradient(180deg, #0a1016, #05080d);
  overflow: hidden;
}

/* A grid behind the curve, so the climb has something to climb against. */
.cr-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 40px;
  pointer-events: none;
}

.cr-graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cr-line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px rgba(204, 255, 0, 0.5));
}

.cr-fill {
  fill: rgba(204, 255, 0, 0.09);
  stroke: none;
}

.cr-board.is-done .cr-fill {
  fill: rgba(248, 113, 113, 0.09);
}

/* The head of the curve, so the eye has something to follow. */
.cr-tip {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.18), 0 0 18px rgba(204, 255, 0, 0.6);
}

.cr-board.is-done .cr-tip {
  background: var(--down);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18), 0 0 18px rgba(248, 113, 113, 0.6);
}

.cr-board.is-done .cr-line {
  stroke: var(--down);
  filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.5));
}

.cr-face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.cr-multiplier {
  font-size: clamp(46px, 7vw, 86px);
  font-weight: 700;
  line-height: 1;
  color: var(--lime);
  text-shadow: 0 8px 40px rgba(204, 255, 0, 0.35);
}

.cr-multiplier.is-crashed {
  color: var(--down);
  text-shadow: 0 8px 40px rgba(248, 113, 113, 0.35);
}

.cr-state {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.cr-rule {
  font-size: 11px;
  color: var(--text-faint);
}

/* --------------------------------------------------------- who is in */

.cr-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.cr-side h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.cr-players {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 380px;
  overflow-y: auto;
}

.cr-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'name bet' 'out out';
  gap: 2px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-deep);
  font-size: 12px;
}

.cr-player-name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-player-bet {
  grid-area: bet;
  color: var(--text-dim);
}

.cr-player-out {
  grid-area: out;
  font-size: 11px;
  color: var(--text-faint);
}

.cr-player.is-out {
  border: 1px solid color-mix(in srgb, var(--lime) 40%, var(--line));
}

.cr-player.is-out .cr-player-out {
  color: var(--lime);
}

.cr-empty {
  padding: 18px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

/* ------------------------------------------------------- the last ones */

.cr-strip {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 26px);
  mask-image: linear-gradient(90deg, transparent, #000 26px);
}

.cr-strip::-webkit-scrollbar {
  display: none;
}

/* Written long so the square buttons of the frame bar cannot claim these. */
.cr-strip .cr-past {
  display: inline-flex;
  align-items: center;
  flex: none;
  width: auto;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.82);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.cr-strip .cr-past:hover {
  border-color: color-mix(in srgb, var(--lime) 55%, var(--line));
}

.cr-strip .cr-past.is-high {
  border-color: color-mix(in srgb, var(--lime) 45%, var(--line));
  color: var(--lime);
}

.cr-strip .cr-past.is-low {
  color: var(--text-faint);
}

/* ---------------------------------------------------------- controls */

.cr-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.cr-bet-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cr-bet-row .amount-field {
  flex: 1;
  min-width: 180px;
}

.cr-moves {
  display: flex;
  gap: 10px;
}

.cr-moves .button {
  min-width: 140px;
}

.cr-note {
  margin: 0;
  min-height: 18px;
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 960px) {
  .cr-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cr-top {
    top: 8px;
    left: 10px;
    right: 10px;
  }
}
