/* ==========================================================================
   TRIUMPH MARVION - board.css
   The gameplay screen: scoreboard HUD, the pitch-lined board, the pieces,
   the booster tray and every merge effect.
   ========================================================================== */

.screen--game .screen__scroll {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* the board never scrolls under the finger */
}
.screen--game .screen__pad { display: none; }

/* ==========================================================================
   SCOREBOARD HUD
   ========================================================================== */
.hud { flex: 0 0 auto; }

.hud__board {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--r-lg);
  background:
    linear-gradient(170deg, rgba(12, 40, 33, .95), rgba(7, 26, 22, .95)),
    var(--navy);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hud__cell {
  text-align: center;
  padding: 3px 2px;
  border-radius: 11px;
  transition: background .2s var(--ease), color .2s;
}
.hud__cell + .hud__cell { border-left: 1px solid var(--line-2); }
.hud__lab {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hud__val {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.hud__cell--score .hud__val { color: var(--gold-b); }
.hud__cell.is-low .hud__val { color: var(--bad); animation: lowPulse 1s var(--ease) infinite; }
@keyframes lowPulse { 50% { opacity: .5; } }

.objective {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: var(--r);
  background: rgba(232, 193, 90, .07);
  border: 1px solid rgba(232, 193, 90, .2);
  transition: background .3s var(--ease);
}
.objective.is-done { background: rgba(47, 203, 138, .1); border-color: rgba(47, 203, 138, .3); }
.objective__row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.objective__ico { color: var(--gold-b); display: flex; flex: 0 0 auto; }
.objective.is-done .objective__ico { color: var(--good); }
.objective__text {
  flex: 1 1 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.objective__count {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-b);
  font-variant-numeric: tabular-nums;
}

/* How full the board is. Sits with the rest of the HUD rather than floating
   free under it, so it reads as a gauge and not a stray progress bar. */
.pressure {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 6px 11px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid var(--line-2);
}
.pressure__lab {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color .3s var(--ease);
}
.pressure__bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
.pressure i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--emerald), var(--teal-b));
  transition: width .3s var(--ease), background .3s;
}
.pressure.is-high { border-color: rgba(226, 96, 79, .32); background: rgba(226, 96, 79, .07); }
.pressure.is-high .pressure__lab { color: var(--bad); }
.pressure.is-high i { background: linear-gradient(90deg, var(--warn), var(--bad)); }

/* ==========================================================================
   BOARD
   ========================================================================== */
.boardwrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 12px 0;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  gap: 7px;
  width: min(100%, 400px);
  aspect-ratio: 1 / 1;
  max-height: 100%;
  padding: 9px;
  border-radius: var(--r-xl);
  background:
    repeating-linear-gradient(90deg,
      rgba(18, 135, 107, .16) 0 calc(100% / var(--n) / 1.6),
      rgba(9, 60, 48, .16) calc(100% / var(--n) / 1.6) calc(100% / var(--n) / .8)),
    linear-gradient(170deg, #0B2C24, #061C18);
  border: 1px solid rgba(30, 192, 143, .22);
  box-shadow:
    var(--shadow-2),
    inset 0 0 0 1px rgba(255, 255, 255, .04),
    inset 0 0 40px rgba(0, 0, 0, .35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* Pitch centre circle behind the cells */
.board::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 42%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .06);
  border-radius: 50%;
  pointer-events: none;
}
.board::after {
  content: "";
  position: absolute;
  left: 9px; right: 9px; top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, .05);
  pointer-events: none;
}
.board.is-targeting { box-shadow: var(--shadow-2), 0 0 0 2px var(--gold); }

.cell {
  position: relative;
  border-radius: 13px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .05);
  display: grid;
  place-items: center;
  transition: background .18s var(--ease), border-color .18s, box-shadow .18s;
}
.cell--blocked {
  background:
    repeating-linear-gradient(45deg,
      rgba(255, 255, 255, .05) 0 5px,
      rgba(255, 255, 255, .01) 5px 10px),
    rgba(0, 0, 0, .35);
  border-color: rgba(255, 255, 255, .07);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .4);
}
.cell--locked {
  background: rgba(226, 96, 79, .09);
  border-color: rgba(226, 96, 79, .3);
}
.cell__lock {
  display: grid;
  place-items: center;
  color: rgba(255, 190, 180, .9);
}
.cell__lock b {
  position: absolute;
  bottom: 5px; right: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--bad);
}
.cell--goal {
  background: rgba(232, 193, 90, .09);
  border-color: rgba(232, 193, 90, .34);
  box-shadow: inset 0 0 16px rgba(232, 193, 90, .1);
}
.cell--goal.is-done {
  background: rgba(47, 203, 138, .12);
  border-color: rgba(47, 203, 138, .4);
}
.cell__goal {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 222, 138, .7);
  pointer-events: none;
}
.cell__goal b {
  position: absolute;
  bottom: 4px;
  font-size: 10px;
  font-weight: 800;
}

.cell.is-src { border-color: var(--teal-b); box-shadow: 0 0 0 2px rgba(53, 214, 208, .3); }
.cell.is-sel { border-color: rgba(53, 214, 208, .55); }
.cell.is-target {
  border-color: var(--emerald-b);
  box-shadow: 0 0 0 2px rgba(30, 192, 143, .45);
  background: rgba(30, 192, 143, .12);
}
.cell.is-target.is-bad {
  border-color: var(--bad);
  box-shadow: 0 0 0 2px rgba(226, 96, 79, .4);
  background: rgba(226, 96, 79, .1);
}
.cell.is-hint { box-shadow: 0 0 0 2px rgba(232, 193, 90, .6); }
.cell.is-hint-to { box-shadow: 0 0 0 2px rgba(232, 193, 90, .32); }

/* ==========================================================================
   PIECES
   ========================================================================== */
.piece {
  position: absolute;
  inset: 6%;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background:
    radial-gradient(120% 100% at 30% 18%, rgba(255, 255, 255, .16), transparent 58%),
    linear-gradient(165deg, var(--p2, #12876B), var(--p1, #0B5745));
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .16s var(--ease);
  animation: pieceIn .2s var(--ease) both;
}
@keyframes pieceIn {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: none; }
}
.piece svg { width: 78%; height: 78%; }
body.big-tiles .piece svg { width: 90%; height: 90%; }

.piece__tier {
  position: absolute;
  top: 3px; left: 5px;
  font-size: 9.5px;
  font-weight: 800;
  color: rgba(255, 255, 255, .5);
  letter-spacing: .02em;
}
.piece.is-drag { z-index: 8; box-shadow: 0 10px 24px rgba(0, 0, 0, .5); }
.piece.is-frozen { filter: saturate(.45) brightness(.92); }
.piece__frost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(190, 240, 255, .85);
  background: linear-gradient(150deg, rgba(150, 225, 255, .28), rgba(90, 175, 220, .16));
  border-radius: 11px;
  border: 1px solid rgba(190, 240, 255, .4);
}

/* Higher tiers get a warmer rim, so the ladder is legible at a glance. */
.piece--t9, .piece--t10, .piece--t12 { border-color: rgba(255, 222, 138, .4); }
.piece--t11 { border-color: rgba(234, 242, 255, .4); }
.piece--t12 {
  box-shadow:
    0 3px 14px rgba(232, 193, 90, .4),
    inset 0 1px 0 rgba(255, 255, 255, .35);
}

.piece--special {
  background:
    radial-gradient(120% 100% at 30% 18%, rgba(255, 255, 255, .14), transparent 58%),
    linear-gradient(165deg, #123A33, #071F1B);
  border-color: rgba(232, 193, 90, .45);
}
.piece__tag {
  position: absolute;
  bottom: 2px;
  left: 0; right: 0;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 222, 138, .85);
}
.piece--bomb { border-color: rgba(226, 96, 79, .5); }
.piece--wildcard { animation: wildGlow 2.4s ease-in-out infinite; }
@keyframes wildGlow {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .35), 0 0 0 0 rgba(232, 193, 90, .0); }
  50%      { box-shadow: 0 3px 10px rgba(0, 0, 0, .35), 0 0 14px 2px rgba(232, 193, 90, .35); }
}

/* ==========================================================================
   EFFECTS
   ========================================================================== */
.fx-merge .piece { animation: fxMerge .38s var(--ease) both; }
@keyframes fxMerge {
  0%   { transform: scale(.72); }
  55%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
.fx-spawn .piece { animation: fxSpawn .32s var(--ease) both; }
@keyframes fxSpawn {
  0%   { opacity: 0; transform: scale(.5) translateY(-10px); }
  100% { opacity: 1; transform: none; }
}
.fx-boom { animation: fxBoom .42s var(--ease) both; }
@keyframes fxBoom {
  0%   { box-shadow: 0 0 0 0 rgba(226, 96, 79, .6); background: rgba(226, 96, 79, .3); }
  100% { box-shadow: 0 0 0 16px rgba(226, 96, 79, 0); }
}
.fx-unlock { animation: fxGood .5s var(--ease) both; }
.fx-goal   { animation: fxGood .5s var(--ease) both; }
@keyframes fxGood {
  0%   { box-shadow: 0 0 0 0 rgba(47, 203, 138, .65); }
  100% { box-shadow: 0 0 0 15px rgba(47, 203, 138, 0); }
}
.fx-thaw { animation: fxThaw .5s var(--ease) both; }
@keyframes fxThaw {
  0%   { box-shadow: 0 0 0 0 rgba(150, 225, 255, .7); }
  100% { box-shadow: 0 0 0 15px rgba(150, 225, 255, 0); }
}
.fx-hit { animation: fxHit .3s var(--ease) both; }
@keyframes fxHit {
  0%, 100% { transform: none; }
  50% { transform: scale(.94); }
}
.fx-shake { animation: fxShake .26s var(--ease) both; }
@keyframes fxShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.board__fx { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.pop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 900;
  color: var(--gold-b);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  animation: popUp .85s var(--ease) both;
  white-space: nowrap;
  pointer-events: none;
}
.pop--chain { color: var(--teal-b); font-size: 17px; }
.pop--big   { color: #fff; font-size: 18px; }
.pop--good  { color: var(--good); font-size: 12px; letter-spacing: .1em; }
@keyframes popUp {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  25%  { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1); }
}

.combo {
  position: absolute;
  top: 8px; right: 10px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 13px;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--teal), var(--teal-d));
  border: 1px solid rgba(53, 214, 208, .5);
  box-shadow: 0 6px 20px rgba(18, 167, 158, .4);
  opacity: 0;
  transform: scale(.7) translateY(-6px);
  transition: opacity .2s var(--ease), transform .25s var(--ease);
  pointer-events: none;
}
.combo.is-on { opacity: 1; transform: none; }
.combo b { font-size: 20px; font-weight: 900; line-height: 1; }
.combo span { font-size: 8px; font-weight: 800; letter-spacing: .18em; opacity: .85; }

body.reduce-motion .fx-merge .piece,
body.reduce-motion .fx-spawn .piece,
body.reduce-motion .fx-boom,
body.reduce-motion .pop,
body.reduce-motion .piece { animation: none !important; }

/* ==========================================================================
   BOOSTER TRAY
   ========================================================================== */
.tray {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 9px 2px calc(6px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  scrollbar-width: none;
}
.tray::-webkit-scrollbar { display: none; }
.tray .boost { flex: 1 0 62px; min-width: 62px; }

/* ==========================================================================
   SMALL SCREENS
   ========================================================================== */
@media (max-height: 700px) {
  .hud__val { font-size: 17px; }
  .boardwrap { padding: 6px 0; }
  .tray .boost { flex: 1 0 56px; min-width: 56px; padding: 7px 3px 5px; }
  .boost__name { font-size: 8.5px; }
}
@media (max-height: 600px) {
  .objective { padding: 7px 9px; margin-top: 6px; }
  .objective__row { margin-bottom: 5px; }
  .hud__board { padding: 6px 8px; }
  .hud__val { font-size: 15px; }
}
