/* v2.37 compact board layout shared by PC and smartphone */

.table-board {
  position: relative;
}

/* Hamburger menu lives in the upper-left corner of the battle board. */
.battle-menu-button {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 70;
  width: 58px;
  height: 48px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 11px 13px;
  border: 1px solid rgba(115, 171, 224, .72);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(33, 47, 62, .98), rgba(20, 29, 39, .98));
  box-shadow: 0 8px 18px rgba(0, 0, 0, .32), inset 0 0 0 1px rgba(255, 255, 255, .04);
  cursor: pointer;
  touch-action: manipulation;
}

.battle-menu-button span {
  width: 27px;
  height: 3px;
  border-radius: 999px;
  background: #f5f5f2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.battle-menu-button:hover,
.battle-menu-button:focus-visible,
.battle-menu-button.menu-open {
  border-color: #a9d8ff;
  background: linear-gradient(180deg, rgba(43, 62, 81, .99), rgba(23, 35, 47, .99));
  outline: none;
}

/* The hero badges are status displays now, not menu buttons. */
button.player-hero {
  cursor: default !important;
  pointer-events: none;
}

.combatant .hero-name {
  display: none !important;
}

.combatant > .hero-badge {
  width: 58px;
  min-height: 58px;
  gap: 1px;
}

.combatant .hero-badge strong {
  display: grid;
  justify-items: center;
  gap: 0;
  font-size: .55rem;
  line-height: 1.05;
}

.combatant .hero-badge strong b {
  font-size: 1.05rem;
  line-height: 1;
}

/* Align each status badge with the horizontal border behind it. */
.cpu-combatant > .hero-badge {
  bottom: -30px !important;
}

.player-combatant > .hero-badge {
  top: -30px !important;
}

/* Remove textual deck captions; only the stack/count remains. */
.deck-stack > span {
  display: none !important;
}

.cpu-combatant {
  min-height: 168px;
  padding: 16px 18px 18px;
}

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

.cpu-combatant > .deck-area {
  align-self: center;
}

/* Player hand remains centered while utilities occupy the bottom-left. */
.player-combatant {
  min-height: 182px;
  padding: 34px 18px 14px 122px;
}

.player-combatant > .hand-wrap {
  grid-column: 1 / -1 !important;
  width: 100%;
  padding-top: 18px !important;
  justify-self: center;
}

.player-combatant .player-hand {
  justify-content: center;
}

.player-combatant > .deck-area {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 28;
  width: 94px;
  display: grid;
  justify-items: stretch;
  gap: 8px;
  padding: 10px 9px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 14px;
  background: rgba(38, 25, 15, .56);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
}

.player-combatant > .deck-area .discard-count {
  text-align: center;
}

/* Compact mana pips replace all text in the energy meters. */
.element-energy-meter {
  min-width: 0 !important;
  width: 100%;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 7px 8px;
  border: 1px solid rgba(91, 142, 191, .7);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(32, 45, 59, .98), rgba(19, 28, 38, .98));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03), 0 5px 12px rgba(0, 0, 0, .22);
}

.cpu-combatant .element-energy-meter {
  width: 100%;
}

.mana-pips {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.mana-pip {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12), 0 1px 3px rgba(0, 0, 0, .34);
}

.mana-fire { background: #c94e51; }
.mana-earth { background: #927448; }
.mana-wind { background: #5b8d70; }
.mana-water { background: #4c83b9; }

/* Reuse the player deck control as the compact end-turn button during action. */
.player-deck {
  margin-inline: auto;
}

.player-deck.turn-end-mode {
  width: 100% !important;
  min-height: 58px;
  aspect-ratio: auto !important;
  border-width: 2px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(255, 231, 179, .08), 0 5px 14px rgba(0, 0, 0, .3) !important;
}

.player-deck.turn-end-mode strong {
  font-size: .82rem !important;
  line-height: 1.25 !important;
  white-space: nowrap;
}

.player-deck:not(.turn-end-mode) {
  width: 58px;
}

/* Board menu now opens from the upper-left hamburger. */
.player-action-menu {
  position: absolute !important;
  top: 74px !important;
  left: 18px !important;
  bottom: auto !important;
  z-index: 75;
  width: 174px;
  transform: none !important;
}

.player-action-menu::after {
  display: none !important;
}

.player-action-menu-title {
  display: none;
}

#menuSkipSummon,
#menuSkipAttack,
#menuRestart {
  display: none !important;
}

#menuBattleLog,
#menuSurrender {
  display: block;
}

/* Keep the drop zone broad and visually anchored like the approved mockup. */
.player-drop-zone.summon-target {
  border-color: rgba(200, 190, 65, .42);
  background: rgba(255, 227, 92, .025);
}

.player-drop-zone.summon-target:empty::after {
  margin-right: auto;
  padding-left: 10px;
  color: rgba(255, 242, 201, .62);
}

@media (max-width: 760px) {
  .battle-menu-button {
    top: 12px;
    left: 12px;
    width: 50px;
    height: 43px;
    padding: 10px 11px;
    border-radius: 12px;
  }

  .battle-menu-button span {
    width: 23px;
    height: 2px;
  }

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

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

  .cpu-combatant {
    min-height: 148px;
    padding: 12px 8px 14px;
  }

  .cpu-combatant > .hero-badge {
    bottom: -25px !important;
  }

  .player-combatant {
    min-height: 170px;
    padding: 31px 7px 10px 92px;
  }

  .player-combatant > .hero-badge {
    top: -25px !important;
  }

  .player-combatant > .hand-wrap {
    padding-top: 15px !important;
  }

  .player-combatant > .deck-area {
    left: 7px;
    bottom: 8px;
    width: 78px;
    gap: 6px;
    padding: 7px 6px;
    border-radius: 11px;
  }

  .element-energy-meter {
    min-height: 33px;
    padding: 6px;
    border-radius: 9px;
  }

  .mana-pips {
    gap: 3px;
  }

  .mana-pip {
    width: 9px;
    height: 9px;
  }

  .player-deck.turn-end-mode {
    min-height: 53px;
    border-radius: 10px;
  }

  .player-deck.turn-end-mode strong {
    font-size: .7rem !important;
    white-space: normal;
  }

  .player-deck:not(.turn-end-mode) {
    width: 48px;
  }

  .player-action-menu {
    top: 60px !important;
    left: 12px !important;
    width: 154px;
  }

  .cpu-combatant > .deck-area {
    padding-top: 4px;
  }
}

@media (max-width: 430px) {
  .player-combatant {
    min-height: 164px;
    padding-left: 84px;
  }

  .player-combatant > .deck-area {
    width: 72px;
  }

  .player-deck.turn-end-mode strong {
    font-size: .66rem !important;
  }

  .mana-pip {
    width: 8px;
    height: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .battle-menu-button {
    transition: none;
  }
}
