/* Combat de Smapimon (public/js/smapimon-battle.js) : le tableau du combat en bas, comme celui de
   la boxe (les deux bestioles, la manche, ce qui s'est passé ; pour les dresseurs, les quatre coups
   et les boutons), et la fiche du ring (le choix de sa bestiole). Verre et jetons de app.css ; les
   cœurs pleins ou vides et les crans de jauge se lisent à leur forme, pas seulement à leur couleur. */

.smb-hud {
  position: absolute;
  left: var(--dock-left);
  bottom: calc(var(--edge) + var(--dock-h) + var(--gap) + 46px);
  translate: -50% 0;
  transition:
    left var(--slide),
    bottom var(--slide);
  z-index: 8;
  width: min(600px, calc(100vw - 2 * var(--sp-3)));
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  animation: smb-in var(--dur-slow) var(--ease-sheet) backwards;
}
body.smapimon-fighting .smb-hud {
  bottom: calc(var(--edge) + var(--dock-h) + var(--gap));
}
.smb-hud.leaving {
  animation: smb-out var(--dur-base) var(--ease-in) forwards;
}
@keyframes smb-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}
@keyframes smb-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

/* --- Les deux bestioles et le centre --- */
.smb-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-3);
}
.smb-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}
.smb-side.right {
  flex-direction: row-reverse;
  text-align: right;
}
.smb-side.empty {
  opacity: 0.5;
}
.smb-side.empty :is(.smb-hearts, .smb-gauge, .smb-chips) {
  visibility: hidden;
}
.smb-portrait {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 56px;
  border-radius: var(--r-md);
  background: var(--fill);
}
.smb-portrait canvas {
  image-rendering: pixelated;
}
.smb-who {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.smb-side.right .smb-who {
  align-items: flex-end;
}
.smb-beast {
  font-size: var(--fs-callout);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smb-trainer {
  font-size: var(--fs-footnote);
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smb-hearts {
  display: flex;
  gap: 2px;
  color: var(--red);
}
.smb-heart {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  opacity: 0.75;
}
.smb-heart.full {
  fill: currentColor;
  opacity: 1;
}
.smb-gauge {
  display: flex;
  gap: 3px;
}
.smb-gauge i {
  width: 16px;
  height: 7px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.smb-gauge i.on {
  background: var(--accent);
}
.smb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
}
.smb-side.right .smb-chips {
  justify-content: flex-end;
}
.smb-chip {
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: var(--fs-caption);
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  background: var(--fill-2);
  color: var(--text-2);
}
.smb-chip.done {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.smb-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 120px;
  max-width: 180px;
  text-align: center;
  line-height: 1.15;
}
.smb-round {
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}
.smb-clock {
  font-size: var(--fs-title-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  min-height: 1.1em;
}
.smb-clock.urgent {
  color: var(--red);
}
.smb-state {
  font-size: var(--fs-footnote);
  color: var(--text-2);
}

/* --- Ce qui s'est passé --- */
.smb-lines {
  margin: 0;
  min-height: 1.3em;
  font-size: var(--fs-sub);
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
}
.smb-lines.past {
  font-weight: 400;
  color: var(--text-2);
}

/* --- Les coups d'un dresseur (touches 1 à 4) et ses boutons --- */
.smb-moves {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.smb-moves[hidden],
.smb-actions[hidden] {
  display: none;
}
.smb-move {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 7px 9px;
  border: none;
  border-radius: var(--r-md);
  background: var(--fill);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-press) var(--ease-out);
}
.smb-move:hover:not(:disabled) {
  background: var(--fill-2);
}
.smb-move:active:not(:disabled) {
  transform: scale(0.97);
}
.smb-move:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.smb-move:disabled {
  cursor: default;
  opacity: 0.45;
}
.smb-move.picked {
  background: var(--accent);
  color: var(--accent-text);
  opacity: 1;
}
.smb-move kbd {
  flex: none;
  margin-top: 1px;
}
.smb-move.picked kbd {
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
  box-shadow: none;
}
.smb-move-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.smb-move-text b {
  font-size: var(--fs-sub);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.smb-move-text small {
  font-size: var(--fs-caption);
  line-height: 1.25;
  color: var(--text-2);
}
.smb-move.picked .smb-move-text small {
  color: inherit;
  opacity: 0.85;
}
.smb-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.smb-rules {
  margin: 0;
  font-size: var(--fs-caption);
  text-align: center;
  color: var(--text-3);
}

@media (max-width: 640px) {
  .smb-moves {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .smb-portrait {
    width: 48px;
    height: 44px;
  }
  .smb-center {
    min-width: 84px;
  }
}

/* --- La fiche du ring : sa bestiole, son coup spécial --- */
.smb-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.smb-pick {
  display: grid;
  place-items: center;
  width: 52px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--r-sm);
  background: var(--fill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.smb-pick:hover {
  background: var(--fill-2);
}
.smb-pick[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.smb-pick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.smb-pick-art {
  image-rendering: pixelated;
}
.smb-card-special,
.smb-card-rules,
.smb-card-board {
  font-size: var(--fs-footnote);
  color: var(--text-2);
}
.smb-card-special b {
  color: var(--text);
}
