/* ===== battle-layout.css ===== */

#view-battle {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #1a1510;
}
#view-battle.active {
  display: block;
}

.battle-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #2a2218 0%, #15110c 70%);
}

/* ----- Token ----- */
.battle-token-wrap {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 144px;
  height: 144px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 100%;
}
.battle-token {
  width: 120px;
  height: 120px;
  object-fit: contain;
  transform: rotate(0deg);
  transition: transform 0.45s ease;
  filter: drop-shadow(0 2px 6px #000);
}
.battle-turn {
  position: absolute;
  left: 46px;
  bottom: 65px;
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
  pointer-events: none;
  z-index: 2;
  line-height: 1;
}

/* ----- Bandeaux ----- */
.battle-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(20, 16, 12, 0.92);
  display: flex;
  align-items: center;
  z-index: 25;
  padding: 0 70px 0 100px;
}
.battle-bar-top {
  top: 0;
  border-bottom: 1px solid #3a3228;
  justify-content: flex-start;
}
.battle-bar-bottom {
  bottom: 0;
  border-top: 1px solid #3a3228;
  justify-content: flex-start;
}
.battle-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.battle-bar-right {
  width: 40px;
  flex-shrink: 0;
}
.battle-player-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
.battle-avatar {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid #555;
  background: #111;
  flex-shrink: 0;
}
.battle-pseudo {
  font-size: 18px;
  font-weight: bold;
  color: #eee;
  letter-spacing: 1px;
  white-space: nowrap;
}
.battle-counters-center {
  display: flex;
  gap: 28px;
  align-items: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.battle-counters-inline {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-left: 8px;
}
.battle-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: bold;
  color: #ddd;
  cursor: default;
}
.battle-counter.clickable {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.battle-counter.clickable:hover {
  background: rgba(201, 162, 39, 0.15);
}
.battle-counter-icon {
  font-size: 20px;
  opacity: 0.9;
}

/* ----- Banc ----- */
.battle-chars {
  position: absolute;
  left: 120px;
  right: 54%;
  top: 70px;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 12px;
  z-index: 18;
  overflow: visible;
}
.battle-chars-col {
  display: flex;
  gap: 14px;
  justify-content: flex-start;
  align-items: center;
  min-height: 0;
}
.battle-chars-opp {
  order: 1;
}
.battle-chars-player {
  order: 2;
}
.battle-char-unit {
  position: relative;
  flex-shrink: 0;
  transform: scale(0.92);
  transform-origin: top left;
  margin-right: -8px;
  z-index: 1;
  padding-bottom: 44px;
}
.battle-char-unit:hover {
  z-index: 40;
}
.battle-char-card {
  position: relative;
  z-index: 1;
}
.battle-char-dead {
  filter: grayscale(1) brightness(0.45);
  opacity: 0.7;
}
.battle-char-down {
  filter: saturate(0.7) brightness(0.85);
  opacity: 0.85;
}

.battle-hand-disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
  /* PAS de pointer-events: none → hover zoom OK */
}

.battle-char-selectable {
  outline: 2px solid transparent;
  transition: outline-color 0.15s;
}
.battle-char-selectable:hover {
  outline-color: #c9a227;
}
.battle-char-selected {
  outline: 3px solid #c9a227 !important;
  filter: brightness(1.12);
}
.battle-char-disabled {
  opacity: 0.45;
}

/* ----- Main ----- */
.battle-hand {
  position: absolute;
  bottom: 64px;
  left: 40%;
  transform: translateX(-50%);
  display: flex;
  gap: 0;
  z-index: 15;
  max-width: 50vw;
  overflow-x: auto;
  padding: 6px;
  pointer-events: none;
}
.battle-hand-card {
  transform: scale(0.42);
  transform-origin: bottom center;
  margin: 0 -52px;
  flex-shrink: 0;
  pointer-events: auto;
}
.battle-hand-selectable {
  outline: 2px solid transparent;
  transition: outline-color 0.15s;
}
.battle-hand-selectable:hover {
  outline-color: #c9a227;
}
.battle-hand-selected {
  outline: 3px solid #c9a227 !important;
  filter: brightness(1.15);
}
.battle-hand-disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

/* ----- Quitter ----- */
.battle-exit {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid #666;
  background: #2a2a2a;
  color: #eee;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.battle-exit:hover {
  background: #3a3a3a;
  border-color: #aaa;
  color: #fff;
}

/* ----- Zone combat droite ----- */
.battle-combat-zone {
  position: absolute;
  top: 52px;
  right: 8px;
  bottom: 52px;
  width: min(720px, 54vw);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  pointer-events: none;
}
.battle-combat-zone,
.battle-combat-zone * {
  pointer-events: none;
}
.battle-combat-zone #btnBattleValidate,
.battle-combat-zone .battle-btn-validate,
.battle-combat-zone .battle-played-card,
.battle-combat-zone .battle-played-card *,
.battle-combat-zone .fullart,
.battle-combat-zone .fullart *,
.battle-combat-zone .fullart-equip-stack,
.battle-combat-zone .equip-hit {
  pointer-events: auto;
}
.battle-combat-top,
.battle-combat-bot {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.battle-combat-slot {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}
.battle-played-side {
  position: absolute;
  z-index: 25;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 1px;
}
#battlePlayedPlayer {
  left: auto;
  right: 600px;
  top: -5%;
  bottom: auto;
}
#battlePlayedOpp {
  left: auto;
  right: 600px;
  top: auto;
  bottom: -45%;
}
.battle-played-side.is-hidden {
  visibility: hidden;
  pointer-events: none;
}
.battle-played-card {
  transform: scale(0.36);
  transform-origin: top left;
  width: 122px;
  height: 170px;
  margin: 0 -90px 0 0;
  flex-shrink: 0;
  overflow: visible;
}

/* ----- Barre milieu ----- */
.battle-combat-mid {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-shrink: 0;
  padding: 10px 8px;
  z-index: 22;
  width: 100%;
}
.battle-combat-hint {
  color: #ddd;
  font-size: 20px;
  text-align: right;
  white-space: nowrap;
  flex: 1;
  text-shadow: 0 1px 3px #000;
}
.battle-btn-validate {
  padding: 12px 32px;
  background: #2a2218;
  border: 1px solid #c9a227;
  color: #f0d78c;
  font-size: 24px;
  font-family: Georgia, serif;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 8px;
}
.battle-btn-validate:hover:not(:disabled) {
  background: #3a3218;
  border-color: #e8c84a;
}
.battle-btn-validate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----- Fullart ----- */
.fullart {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 18px;
  background: rgba(0, 0, 0, 0.42);
  border-radius: 12px;
  padding: 0;
  height: 100%;
  min-height: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.fullart-text {
  flex: 1 1 auto;
  min-width: 160px;
  max-width: none;
  color: #e8e8e8;
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  text-align: left;
}
.battle-combat-top .fullart-text {
  justify-content: flex-start;
  padding-top: 28px;
}
.battle-combat-bot .fullart-text {
  justify-content: center;
  padding-top: 28px;
  padding-bottom: 0;
}
.fullart-spec {
  color: #c9a227;
  font-weight: bold;
  margin-bottom: 10px;
  font-size: 18px;
}
.fullart-desc {
  font-size: 15px;
  color: #ccc;
  line-height: 1.4;
}
.fullart-art {
  width: 220px;
  flex: 1 1 220;
  min-height: 0;
  background-size: contain;
  background-position: center top;
  background-repeat: no-repeat;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px #000;
  align-self: stretch;
}

/* ----- Inventaire 3 cases (banc, hors combat) ----- */
.battle-equip-row {
  position: absolute;
  left: 2px;
  bottom: 0px;
  z-index: 40;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0;
  pointer-events: none;
}
.battle-char-unit,
.battle-char-card {
  overflow: visible !important;
}

.battle-equip-cell {
  position: relative;
  width: 48px;
  height: 72px;
  background: transparent;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  pointer-events: none;
}
.battle-equip-cell.is-empty {
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}
.battle-equip-cell:not(.is-empty) {
  pointer-events: auto;
  cursor: pointer;
}

.equip-slot-card {
  width: 48px;
  height: 72px;
  overflow: hidden;
  pointer-events: none !important;
}
.battle-equip-cell .equip-slot-card,
.battle-equip-cell .equip-slot-card * {
  pointer-events: none !important;
}

.battle-equip-cell .equip-count {
  position: absolute;
  right: 1px;
  bottom: 1px;
  z-index: 2;
  background: #222;
  color: #f0c060;
  font-size: 11px;
  font-weight: bold;
  padding: 0 4px;
  border-radius: 7px;
  border: 1px solid #666;
  pointer-events: none !important;
}

.fullart-equip { left: 8px; bottom: 8px; z-index: 40; }



/* ----- Popup inventaire ----- */
.equip-overlay.discard-overlay.visible {
  z-index: 200;
}
.equip-box {
  max-width: 920px;
  width: 90%;
  max-height: 82vh;
  overflow: auto;
}
.equip-popup-body {
  text-align: left;
}
.equip-popup-section {
  margin-bottom: 18px;
}
.equip-popup-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #f0d78c;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #555;
  padding-bottom: 4px;
}
.equip-popup-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 10px;
  justify-content: flex-start;
}
.equip-popup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 140px;
}
.equip-popup-card {
  width: 140px;
  min-height: 210px;
}
.equip-popup-mini {
  width: 173px;
  height: 260px;
  pointer-events: auto !important;
  cursor: zoom-in;
}
.equip-popup-mini,
.equip-popup-mini .card {
  pointer-events: auto !important;
}
.equip-popup-dur {
  margin-top: 10px;
  font-size: 12px;
  color: #ccc;
  text-align: center;
  line-height: 1.2;
}
.equip-popup-empty {
  color: #888;
  padding: 20px;
  text-align: center;
}

.battle-hand-choose .battle-hand-card {
  cursor: pointer;
  outline: 2px solid #e74c3c;
  outline-offset: 2px;
}

.fullart-equip-stack {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 40;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 2px;
  pointer-events: auto;
}
.fullart-equip-item {
  width: 48px;
  height: 72px;
  pointer-events: auto;
  cursor: pointer;
}

.equip-hit {
  position: absolute;
  inset: 0;
  z-index: 50;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}
.battle-equip-cell:not(.is-empty) {
  position: relative;
  pointer-events: auto;
}

.battle-chars,
.battle-chars-col,
.battle-char-unit {
  pointer-events: none;
}
.battle-char-card,
.battle-equip-cell:not(.is-empty),
.equip-hit {
  pointer-events: auto;
}

/* ----- Bulle stats (base / X) ----- */
.stat,
.fullart-stat {
  position: relative;
}
#statHoverTip {
  position: fixed;
  z-index: 40000;
  display: none;
  pointer-events: none;
  min-width: 92px;
  max-width: 180px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(18, 14, 10, 0.94);
  border: 1px solid rgba(232, 196, 120, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  color: #f3e6c8;
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
}
#statHoverTip.visible {
  display: block;
}
#statHoverTip .tip-line {
  display: block;
}
#statHoverTip .tip-x {
  color: #e8c478;
  margin-top: 2px;
}

.battle-char-card .stat,
.battle-char-card .stat * {
  pointer-events: auto !important;
  cursor: help;
}
