/* ---------- Vials ---------- */

.stage { justify-content: center; gap: 12px; padding: 8px 10px; }

/* ---------- status ---------- */

.statusbar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.chip {
  flex: 1 1 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 6px 4px;
  text-align: center;
}
.chip span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.chip b {
  display: block;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* ---------- the rack ---------- */

.board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.rack {
  display: grid;
  grid-template-columns: repeat(var(--per-row, 4), auto);
  justify-content: center;
  align-content: center;
  column-gap: var(--rack-gap-x, 10px);
  /* Row gap has to clear a lifted ball sitting above the tube below it. */
  row-gap: calc(var(--ball, 28px) + 14px);
}

.tube {
  position: relative;
  width: calc(var(--ball, 28px) + 10px);
  height: calc(var(--ball, 28px) * 4 + 9px + 10px);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 2px solid var(--line);
  border-top: 0;
  /* open at the top, rounded like a test tube at the bottom */
  border-radius: 3px 3px calc(var(--ball, 28px) * .55) calc(var(--ball, 28px) * .55);
  background: rgb(255 255 255 / .028);
  transition: border-color .12s, background .12s;
}

.tube.is-open { border-color: var(--accent); background: rgb(122 162 255 / .09); }
.tube.is-done { border-color: var(--ok); background: rgb(85 185 114 / .08); }
.tube.is-nope { animation: v-shake .35s; }

@keyframes v-shake {
  25% { transform: translateX(-5px); }
  60% { transform: translateX(5px); }
}

.ball {
  flex: 0 0 auto;
  width: var(--ball, 28px);
  height: var(--ball, 28px);
  border-radius: 50%;
  /* a little sheen so the balls read as spheres, not flat discs */
  background-image: radial-gradient(circle at 32% 28%, rgb(255 255 255 / .38), transparent 55%);
  box-shadow: inset 0 -2px 4px rgb(0 0 0 / .28);
}

.ball.is-new { animation: v-drop .18s var(--ease); }
@keyframes v-drop { from { transform: translateY(-40%) scale(.85); } }

/* The held ball hovers above its tube. Taking it out of flow is safe — it's
   always the top one, so nothing below it shifts. */
.ball.is-lifted {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 5px);
  transform: translateX(-50%);
  animation: v-lift .16s var(--ease);
  box-shadow: inset 0 -2px 4px rgb(0 0 0 / .28), 0 4px 12px rgb(0 0 0 / .5);
}
@keyframes v-lift { from { bottom: 78%; } }

.c0  { background-color: #e0574a; }
.c1  { background-color: #e08a2f; }
.c2  { background-color: #d9c04a; }
.c3  { background-color: #7fc65a; }
.c4  { background-color: #2fae7a; }
.c5  { background-color: #3fb8c9; }
.c6  { background-color: #4d90e6; }
.c7  { background-color: #7a6be0; }
.c8  { background-color: #c46be0; }
.c9  { background-color: #e06ba0; }
.c10 { background-color: #a98a6a; }

/* ---------- overlay ---------- */

.overlay {
  position: absolute;
  inset: -8px;
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgb(14 16 20 / .87);
  z-index: 5;
  text-align: center;
  padding: 0 20px;
  animation: fade-in .25s var(--ease);
}
.overlay[hidden] { display: none; }
.overlay b { font-size: 25px; font-weight: 800; }
.overlay p { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---------- difficulty ---------- */

.pad { display: flex; gap: 6px; justify-content: center; }
.pad .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 4px;
  font-size: 13px;
}
.pad .btn.is-on { background: var(--accent); border-color: transparent; color: #0b0e14; }
