/* v2.29 battle usability: true board-centered heroes and stable spell targeting */

.combatant {
  grid-template-columns: minmax(0, 1fr) 76px;
  grid-template-rows: 1fr;
  min-height: 154px;
  gap: 12px;
  padding: 9px 18px 13px;
}

/* Both hero circles use the full combatant width as their centering reference,
   rather than the hand column, so they sit on the exact board centerline. */
.combatant > .hero-badge {
  position: absolute;
  left: 50%;
  z-index: 20;
  width: 58px;
  min-height: 58px;
  border-width: 2px;
  transform: translateX(-50%);
  pointer-events: auto;
}

.player-combatant > .hero-badge {
  top: 8px;
}

.cpu-combatant > .hero-badge {
  bottom: -50px;
}

.combatant > .hand-wrap {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  min-width: 0;
  padding-top: 45px;
}

.cpu-combatant > .hand-wrap {
  padding-top: 0;
}

.combatant > .deck-area {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

/* Hide redundant board captions and hand counts. */
.combatant .zone-heading,
.field-label {
  display: none !important;
}

.cpu-combatant {
  z-index: 4;
}

.combatant .hero-name {
  font-size: .58rem;
}

.combatant .hero-badge strong {
  font-size: .56rem;
}

.combatant .hero-badge strong b {
  font-size: .92rem;
}

/* The player menu opens from the true board center as well. */
.player-action-menu {
  left: 50%;
  bottom: 94px;
  transform: translateX(-50%);
}

.player-action-menu::after {
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
}

.hand-card.spell-drag-ready {
  cursor: grab;
  touch-action: none;
}

.hand-card.spell-drag-ready:hover,
.hand-card.spell-drag-ready:focus-visible {
  border-color: #fff0a8;
  box-shadow: 0 12px 25px rgba(0, 0, 0, .36), 0 0 0 3px rgba(255, 224, 112, .18);
}

.hand-card.spell-dragging {
  opacity: .36;
  cursor: grabbing;
}

.field-card.spell-drag-target,
.hero-badge.spell-drag-target {
  cursor: crosshair !important;
  border-color: #ffe58d !important;
  box-shadow: 0 0 0 4px rgba(255, 224, 112, .24), 0 8px 19px rgba(0, 0, 0, .35) !important;
  animation: spellDragTargetPulse .72s ease-in-out infinite alternate;
}

.field-card.spell-drag-active,
.hero-badge.spell-drag-active {
  border-color: #fff8cf !important;
  box-shadow: 0 0 0 6px rgba(255, 231, 133, .34), 0 12px 28px rgba(0, 0, 0, .42) !important;
  filter: brightness(1.18);
}

.field-card.spell-drag-active {
  transform: translateY(-4px) scale(1.035);
}

/* A centered hero must keep the exact same screen position while highlighted. */
.combatant > .hero-badge.spell-drag-active {
  transform: translateX(-50%) scale(1.035) !important;
}

.spell-touch-drag-ghost {
  border-color: #ffe58d !important;
  box-shadow: 0 18px 34px rgba(0, 0, 0, .42), 0 0 0 4px rgba(255, 224, 112, .28) !important;
}

/* Make CPU actions impossible to miss without hiding the field for too long. */
.cpu-action-notice-v226 {
  top: 45%;
  z-index: 90;
  width: min(calc(100% - 34px), 500px);
  padding: 12px 18px 13px;
  border: 2px solid rgba(255, 155, 135, .72);
  background: linear-gradient(180deg, rgba(64, 31, 21, .97), rgba(31, 20, 16, .97));
  box-shadow: 0 16px 38px rgba(0, 0, 0, .48), inset 0 0 0 2px rgba(255, 218, 187, .05);
  transform: translate(-50%, -50%) scale(.94);
}

.cpu-action-notice-v226.show {
  transform: translate(-50%, -50%) scale(1);
}

.cpu-action-notice-v226 .cpu-action-kicker {
  font-size: .6rem;
  letter-spacing: .18em;
}

.cpu-action-notice-v226 .cpu-action-main {
  font-size: 1rem;
  white-space: normal;
}

.cpu-action-notice-v226 .cpu-action-detail {
  font-size: .7rem;
}

.cpu-attack-arrow-v226 {
  z-index: 84 !important;
}

.cpu-damage-float-v226 {
  z-index: 86 !important;
}

@keyframes spellDragTargetPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.16); }
}

@media (max-width: 760px) {
  .combatant {
    grid-template-columns: minmax(0, 1fr) 55px;
    min-height: 132px;
    gap: 7px;
    padding: 7px 8px 10px;
  }

  .combatant > .hero-badge {
    left: 50%;
    width: 48px;
    min-height: 48px;
  }

  .player-combatant > .hero-badge {
    top: 7px;
  }

  .cpu-combatant > .hero-badge {
    bottom: -43px;
  }

  .combatant > .hand-wrap {
    padding-top: 38px;
  }

  .cpu-combatant > .hand-wrap {
    padding-top: 0;
  }

  .combatant .hero-name {
    font-size: .51rem;
  }

  .combatant .hero-badge strong {
    font-size: .5rem;
  }

  .combatant .hero-badge strong b {
    font-size: .8rem;
  }

  .player-action-menu {
    left: 50%;
    bottom: 78px;
    width: 164px;
  }

  .cpu-action-notice-v226 {
    top: 43%;
    width: calc(100% - 18px);
    padding: 10px 12px 11px;
  }

  .cpu-action-notice-v226 .cpu-action-main {
    font-size: .82rem;
  }

  .cpu-action-notice-v226 .cpu-action-detail {
    font-size: .62rem;
  }
}

@media (max-width: 430px) {
  .combatant {
    grid-template-columns: minmax(0, 1fr) 49px;
  }

  .combatant > .hero-badge {
    left: 50%;
    width: 44px;
    min-height: 44px;
  }

  .player-combatant > .hero-badge {
    top: 6px;
  }

  .combatant > .hand-wrap {
    padding-top: 34px;
  }

  .cpu-combatant > .hero-badge {
    bottom: -40px;
  }

  .cpu-combatant > .hand-wrap {
    padding-top: 0;
  }

  .player-action-menu {
    left: 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .field-card.spell-drag-target,
  .hero-badge.spell-drag-target {
    animation: none;
  }
}
