/* =====================================================================
   The Arena.

   Player left and ember, opponent right and cyan, in every state. The two
   colour tokens are the only thing carrying identity through a fast fight,
   so nothing on this screen is allowed to reuse them for anything else.
   ===================================================================== */

/* ---------------------------------------------------------- opponents */
.opp-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.opp-card {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 16px 17px 14px;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--paper);
  font-family: var(--sans);
  transition: border-color .12s ease, transform .1s ease, background .12s ease;
}
.opp-card:hover { border-color: var(--coral); transform: translateY(-2px); }

.opp-top { display: flex; align-items: center; gap: 8px; }
.opp-tier {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid currentColor;
}
.tier-recruit { color: var(--dim); }
.tier-adept { color: var(--cyan); }
.tier-master { color: var(--gold); }
.tier-nemesis { color: var(--coral); }

.opp-standing { margin-left: auto; font-size: 11.5px; font-family: var(--mono); }
.opp-standing.up { color: var(--coral); }
.opp-standing.down { color: var(--dim); }
.opp-standing.even { color: var(--jade); }

.opp-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: .01em;
  margin: 0;
}
/* The line that teaches. It gets real space, because it is the tutorial. */
.opp-tagline {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--soft);
  min-height: 3.9em;
}
.opp-stats {
  display: flex;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--edge2);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
}

/* -------------------------------------------------------------- stage */
.arena-stage { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.fight-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}
.hp-side { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hp-side.right { align-items: flex-end; }
.hp-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .01em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.hp-bar {
  position: relative;
  width: 100%;
  height: 14px;
  background: var(--sunk);
  border: 1px solid var(--edge2);
  border-radius: 3px;
  overflow: hidden;
}
.hp-fill, .hp-ghost {
  position: absolute;
  top: 0; bottom: 0;
  width: 100%;
  border-radius: 2px;
}
.hp-side.right .hp-fill, .hp-side.right .hp-ghost { right: 0; }
.hp-side.left .hp-fill, .hp-side.left .hp-ghost { left: 0; }
/* The ghost drains behind the real bar so the size of a hit is legible after
   the number has already faded. */
.hp-ghost { background: rgba(237, 234, 226, .30); }
.hp-fill { z-index: 1; }

.fight-clock {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  color: var(--dim);
  min-width: 3.4ch;
  text-align: center;
}

.arena-frame {
  position: relative;
  border: 1px solid var(--edge2);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--void);
}
.arena-canvas { display: block; width: 100%; height: auto; }
.arena-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ------------------------------------------------------------ faceoff */
.faceoff {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 5%;
  background: rgba(11, 14, 26, .78);
  animation: fade-in .3s ease;
}
.faceoff-side { display: flex; flex-direction: column; gap: 3px; }
.faceoff-side.right { text-align: right; }
.fo-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .01em;
}
.fo-meta { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.fo-record { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.faceoff-vs {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 54px);
  color: var(--gold);
  letter-spacing: .04em;
}

/* ------------------------------------------------------------- effects */
.fx-dmg {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  animation: dmg-float 1.05s cubic-bezier(.2, .8, .3, 1) forwards;
  will-change: transform, opacity;
}
.fx-dmg.side-you { color: var(--coral); }
.fx-dmg.side-them { color: var(--paper); }
.fx-dmg.crit { font-size: 44px; color: var(--gold); }
.fx-dmg.blocked { opacity: .6; font-size: 22px; }

@keyframes dmg-float {
  0%   { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  18%  { transform: translate(-50%, -70%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, -140%) scale(1); opacity: 0; }
}

.fx-callout {
  position: absolute;
  left: 50%;
  top: 26%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: .1em;
  text-transform: uppercase;
  animation: callout .85s ease forwards;
}
.fx-callout.tone-cyan { color: var(--cyan); }
.fx-callout.tone-gold { color: var(--gold); }
.fx-callout.tone-bone { color: var(--paper); }

@keyframes callout {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

.fx-banner {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(42px, 9vw, 90px);
  letter-spacing: .04em;
  text-transform: uppercase;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .7);
  animation: banner .4s cubic-bezier(.2, 1.4, .4, 1);
}
.fx-banner.tone-gold { color: var(--gold); }
.fx-banner.tone-coral { color: var(--coral); }
.fx-banner.tone-bone { color: var(--paper); }

@keyframes banner {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* --------------------------------------------------------------- below */
.fight-below {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.log-panel { position: sticky; top: 76px; }
.fight-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  color: var(--soft);
}
.fight-log li { padding: 3px 0; border-bottom: 1px solid var(--edge2); }
.fight-log li:last-child { color: var(--paper); }

.fight-results { display: flex; flex-direction: column; gap: 12px; }

.result-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--edge2);
  border-left: 3px solid var(--rb, var(--gold));
  background: var(--panel);
}
.result-banner.win { --rb: var(--gold); }
.result-banner.lose { --rb: var(--coral); }
.result-banner span {
  font-family: var(--display);
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--rb);
}
.result-banner small { color: var(--soft); font-size: 14px; }

.moment {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--edge2);
  font-size: 14px;
}
.moment:last-child { border-bottom: 0; }
.moment-text { flex: 1; color: var(--soft); }

.panel.suggestion { border-left: 3px solid var(--cyan); }
.panel.suggestion p { color: var(--paper); margin-bottom: 12px; }

.fight-results .kv b.gold-num { color: var(--gold); }
.fight-results .kv b.cyan-num { color: var(--cyan); }
.result-actions { margin-top: 4px; }

/* -------------------------------------------------------------- mobile */
@media (max-width: 820px) {
  .fight-below { grid-template-columns: 1fr; }
  .log-panel { position: static; order: 2; }
  .fight-results { order: 1; }
  .fight-log { max-height: 180px; }
  .hp-name { font-size: 15px; }
  .opp-tagline { min-height: 0; }
}

/* ------------------------------------------------------ combo + intro fx */
.combo-counter {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) scale(.85);
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.combo-counter.show { opacity: 1; transform: translateX(-50%) scale(1); }

/* The VS burst: a punch of scale + brightness right before the faceoff card
   is torn away, so the cut to the drop-in reads as impact rather than a
   splice. */
.faceoff.burst {
  animation: vs-burst .26s cubic-bezier(.2, 1.6, .3, 1) forwards;
}
@keyframes vs-burst {
  0%   { transform: scale(1); filter: brightness(1); }
  40%  { transform: scale(1.05); filter: brightness(1.6); }
  100% { transform: scale(1.12); filter: brightness(0.4); opacity: 0; }
}
