/* ============================================================
   VICTORY CORLENA - game.css
   The playing surface: flasks, essences, HUD, boosters.
   Tube width (--tw) and essence height (--ih) are set from JS
   so the board always fits the screen without scrolling.
   ============================================================ */

.play {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---------- HUD ---------- */

.hud {
  display: flex;
  gap: 8px;
  padding: 0 var(--pad) 8px;
}
.hud__cell {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 6px;
  text-align: center;
  min-width: 0;
}
.hud__v { font-size: 17px; font-weight: 800; line-height: 1.1; }
.hud__l { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.hud__cell.warn { border-color: var(--coral); background: var(--coral-l); }
.hud__cell.warn .hud__v { color: #C0392B; }

.stage-flag {
  margin: 0 auto 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--violet-l);
  color: var(--violet-d);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ---------- Board ---------- */

.board-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
}

.board {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--rowgap, 18px);
  width: 100%;
}

.board__row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--colgap, 12px);
}

/* ---------- Flask ---------- */

.tube {
  position: relative;
  width: var(--tw, 46px);
  height: calc(var(--ih, 34px) * var(--cap, 4) + 10px);
  padding: 4px;
  border: 2.5px solid rgba(16, 23, 54, .16);
  border-top-color: rgba(16, 23, 54, .10);
  border-radius: 9px 9px calc(var(--tw, 46px) * .42) calc(var(--tw, 46px) * .42);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(240,244,253,.9));
  box-shadow: inset 0 -6px 12px rgba(16, 23, 54, .05), var(--sh-1);
  transition: transform .16s cubic-bezier(.2,.9,.3,1.3), border-color .16s ease, box-shadow .16s ease;
  cursor: pointer;
}
.tube::after {
  content: "";
  position: absolute;
  top: 8px; left: 6px;
  width: 22%;
  height: 55%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .75);
  pointer-events: none;
}
.tube:active { transform: translateY(1px); }

.tube__inner {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  height: 100%;
  gap: 0;
}

.tube.sel {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .18), var(--sh-2);
  transform: translateY(-4px);
}
.tube.hint {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, .2), var(--sh-2);
}
.tube.done {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(34, 199, 122, .18), var(--sh-1);
}
.tube.done .tube__check {
  opacity: 1;
  transform: scale(1);
}
.tube__check {
  position: absolute;
  top: -9px; right: -7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--mint);
  color: #fff;
  display: grid; place-items: center;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.9,.3,1.6);
  box-shadow: 0 3px 8px rgba(34, 199, 122, .45);
}
.tube__check svg { width: 12px; height: 12px; }

.tube.locked {
  background: repeating-linear-gradient(135deg, #EEF1F8 0 8px, #E6EAF4 8px 16px);
  border-color: rgba(16, 23, 54, .12);
  cursor: not-allowed;
}
.tube__lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  pointer-events: none;
}
.tube__lock svg { width: 40%; height: auto; max-width: 22px; }
.tube__lock span { font-size: 9px; font-weight: 800; line-height: 1.05; text-align: center; }

.tube.bad { animation: tubeShake .34s ease; }
@keyframes tubeShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(5px); }
  70% { transform: translateX(-3px); }
}

/* ---------- Essence ---------- */

.ess {
  height: var(--ih, 34px);
  border-radius: 7px;
  position: relative;
  overflow: hidden;
  background: var(--c, #ccc);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .12), inset 0 3px 6px rgba(255, 255, 255, .3);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.4);
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.95);
  font-size: 11px;
  font-weight: 800;
}
.ess::before {
  content: "";
  position: absolute;
  left: 12%; top: 12%;
  width: 26%; height: 34%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .45);
}
.ess:first-child { border-radius: 7px 7px calc(var(--tw, 46px) * .3) calc(var(--tw, 46px) * .3); }
.ess.lift { transform: translateY(calc(var(--ih, 34px) * -0.42)); }

.ess.hid {
  background: linear-gradient(160deg, #D7DDEC, #B9C2DA);
  color: #56618A;
}
.ess.hid::after { content: "?"; font-size: 14px; font-weight: 800; }

.ess.wild {
  background: linear-gradient(150deg, #FFFFFF, #E7ECFA);
  color: #6E4BD8;
  border: 1.5px solid rgba(124, 92, 255, .35);
}
.ess.wild::after { content: "\2726"; font-size: 15px; }

.ess.frz::after {
  content: attr(data-f);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(220, 244, 255, .82), rgba(168, 216, 255, .78));
  color: #10496E;
  font-size: 12px;
  font-weight: 800;
  border-radius: inherit;
}
.ess.cb { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

.ess.pop { animation: essPop .34s cubic-bezier(.2,.9,.3,1.5); }
@keyframes essPop { 0% { transform: scale(.6); opacity: .3; } 100% { transform: none; opacity: 1; } }

/* ---------- Flying essences (pour animation) ---------- */

.fly {
  position: absolute;
  border-radius: 7px;
  background: var(--c, #ccc);
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .12), 0 4px 12px rgba(16, 23, 54, .18);
  display: grid; place-items: center;
  color: rgba(255,255,255,.95);
  font-size: 11px; font-weight: 800;
  will-change: transform;
}

/* ---------- Hint line ---------- */

.play__hint {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 6px 12px 4px;
  min-height: 26px;
}
.play__hint b { color: var(--teal-d); }

/* ---------- Booster bar ---------- */

.boosters {
  display: flex;
  gap: 7px;
  padding: 4px var(--pad) calc(12px + var(--safe-b));
  overflow-x: auto;
  scrollbar-width: none;
}
.boosters::-webkit-scrollbar { display: none; }

.booster {
  position: relative;
  flex: 0 0 auto;
  width: 60px;
  padding: 8px 4px 6px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform .12s ease, border-color .16s ease, background .16s ease;
}
.booster:active { transform: scale(.94); }
.booster svg { width: 20px; height: 20px; color: var(--violet-d); }
.booster span { font-size: 9.5px; font-weight: 700; color: var(--ink-2); line-height: 1.1; text-align: center; }
.booster b {
  position: absolute;
  top: -6px; right: -4px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(20, 184, 166, .4);
}
.booster.off { opacity: .42; }
.booster.off b { background: var(--ink-4); box-shadow: none; }
.booster.armed { border-color: var(--violet); background: var(--violet-l); }
.booster.armed svg { color: var(--violet-d); }

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

.prep {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(244, 246, 252, .88);
  z-index: 5;
  border-radius: var(--r-lg);
}
.prep__spin {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--teal);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.prep span { font-size: 12.5px; color: var(--ink-3); font-weight: 700; }

/* ---------- Practice bench mini board ---------- */

.bench-board { padding: 10px 0; }

/* Left-handed layout mirrors the booster bar so the thumb reaches it. */
#device.lefty .boosters { flex-direction: row-reverse; }
#device.lefty .hud { flex-direction: row-reverse; }
