/* ===== Return-to-battle bar (non-blocking) ===== */
.tida-return-battle {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 0 8px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #2a1c14, #17110e);
  border-bottom: 1px solid #8a5538;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.tida-return-battle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #c9a45a;
  background: linear-gradient(160deg, #a87634, #624020);
  color: #fff0ce !important;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none !important;
  text-shadow: 0 1px 0 #0006;
  box-shadow: inset 0 1px 0 rgba(255, 230, 170, 0.25);
}

.tida-return-battle-btn img {
  width: 16px;
  height: 16px;
}

.tida-return-battle-btn:active {
  filter: brightness(1.08);
  transform: scale(0.99);
}

body.tida-app-page .tida-return-battle,
body.tida-world-page .tida-return-battle {
  margin: 0;
}

/* ===== Mobile battle stage ===== */
.battle-status-strip--legacy {
  display: none !important;
}

.battle-stage {
  margin: 0 0 8px;
  border: 1px solid #6e5a38;
  border-radius: 10px;
  overflow: hidden;
  background: #0c1218;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.battle-stage-hud {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(180deg, #1a242e, #10171f);
  border-bottom: 1px solid #5d4c30;
}

.battle-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  padding: 5px;
  border-radius: 8px;
  background: rgba(8, 12, 16, 0.55);
  border: 1px solid #4a4030;
}

.battle-chip--foe {
  flex-direction: row;
  border-color: #5a3532;
  background: rgba(28, 14, 14, 0.45);
}

.battle-chip-face {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 38px;
  border: 2px solid #c9a45a;
  background: #0a0e12;
}

.battle-chip--foe .battle-chip-face {
  border-color: #c06a5c;
}

.battle-chip-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.battle-chip-q {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #9aa3a8;
  font-weight: 700;
}

.battle-chip-meta {
  min-width: 0;
  flex: 1;
}

.battle-chip-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}

.battle-chip-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f1e4c4;
  font-size: 12px;
}

.battle-chip-lvl {
  margin-left: auto;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid #5e5132;
  background: #29251a;
  color: #e3c26d;
  font-size: 10px;
  flex: 0 0 auto;
}

.battle-chip-hp {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #080a0c;
  border: 1px solid #343a3e;
}

.battle-chip-hp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8bc45f, #3f7a35);
}

.battle-chip--foe .battle-chip-hp i {
  background: linear-gradient(90deg, #e07168, #8f2f2a);
}

.battle-chip-nums {
  margin-top: 2px;
  color: #aeb8bd;
  font-size: 10px;
}

.battle-chip.is-flash {
  animation: battle-chip-flash 0.45s ease-out;
}

@keyframes battle-chip-flash {
  0% { box-shadow: inset 0 0 0 1px #ffd27a; }
  100% { box-shadow: none; }
}

.battle-arena {
  position: relative;
  min-height: 210px;
  background-size: cover;
  background-position: center;
  background-color: #132028;
}

.battle-arena::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 12, 16, 0.18), rgba(8, 12, 16, 0.42));
  pointer-events: none;
}

.battle-arena-caption {
  position: relative;
  z-index: 2;
  margin: 8px 10px 0;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(10, 14, 18, 0.72);
  border: 1px solid rgba(201, 164, 90, 0.35);
  color: #d8c79a;
  font-size: 11px;
  text-align: center;
}

.battle-fighter-slot {
  position: absolute;
  bottom: 18px;
  z-index: 3;
  width: 42%;
  max-width: 150px;
  text-align: center;
}

.battle-fighter-slot--self {
  left: 4%;
}

.battle-fighter-slot--foe {
  right: 4%;
}

.battle-fig-shadow {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 72%;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55), transparent 70%);
}

.battle-fig-body {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(212, 175, 95, 0.85);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 10px 18px rgba(0, 0, 0, 0.4);
  background: #10161c;
}

.battle-fighter-slot--foe .battle-fig-body {
  border-color: rgba(198, 98, 88, 0.9);
}

.battle-fig-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.battle-fig-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #d8c79a;
  font-size: 28px;
  font-weight: 700;
}

.battle-pet-slot {
  position: absolute;
  top: -8px;
  z-index: 4;
  width: 42px;
  text-align: center;
}

.battle-pet-slot--self { left: -2px; }
.battle-pet-slot--foe { right: -2px; }

.battle-pet-slot img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #7aa35a;
  background: #0d1218;
  display: block;
  margin: 0 auto;
}

.battle-pet-slot span {
  display: block;
  margin-top: 2px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.65);
  color: #cfe3b2;
  font-size: 9px;
}

.battle-float {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 5;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  animation: battle-float-up 1.05s ease-out forwards;
}

.battle-float--out { color: #ffe27a; }
.battle-float--in { color: #ff6f66; }

@keyframes battle-float-up {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1); }
}

.battle-fighter-slot.is-attacking .battle-fig-body {
  animation: battle-lunge 0.42s ease-out;
}

.battle-fighter-slot--self.is-attacking .battle-fig-body {
  animation-name: battle-lunge-right;
}

.battle-fighter-slot--foe.is-attacking .battle-fig-body {
  animation-name: battle-lunge-left;
}

.battle-fighter-slot.is-hit .battle-fig-body {
  animation: battle-hit-shake 0.42s ease-out;
}

@keyframes battle-lunge-right {
  0% { transform: translateX(0); }
  40% { transform: translateX(18px) scale(1.04); }
  100% { transform: translateX(0); }
}

@keyframes battle-lunge-left {
  0% { transform: translateX(0); }
  40% { transform: translateX(-18px) scale(1.04); }
  100% { transform: translateX(0); }
}

@keyframes battle-hit-shake {
  0%, 100% { transform: translateX(0); filter: none; }
  25% { transform: translateX(-6px); filter: brightness(1.35) saturate(1.2); }
  50% { transform: translateX(6px); filter: brightness(1.15); }
  75% { transform: translateX(-3px); }
}

/* controls */
.battle-pad {
  margin: 0 0 8px;
  padding: 10px 8px 8px;
  border: 1px solid #6e5a38;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 78% 12%, rgba(140, 60, 40, 0.16), transparent 48%),
    linear-gradient(180deg, #1a232c, #0c1218);
  box-shadow: inset 0 1px 0 rgba(212, 180, 110, 0.1);
}

.battle-pad-main {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-bottom: 10px;
}

.battle-spheres {
  display: flex;
  gap: 5px;
  flex: 1;
  min-width: 0;
  justify-content: space-between;
  padding-bottom: 12px;
}

.battle-sphere,
.battle-sphere.is-empty {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  text-decoration: none;
  text-align: center;
}

.battle-sphere-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}

.battle-sphere-orb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  z-index: 1;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(201, 164, 90, 0.55);
}

.battle-sphere.is-empty {
  opacity: 0.65;
}

.battle-sphere.is-empty .battle-sphere-frame {
  position: absolute;
  inset: 0;
}

.battle-sphere.is-cd .battle-sphere-orb {
  filter: grayscale(0.45) brightness(0.7);
}

.battle-sphere.is-ready .battle-sphere-orb {
  animation: battle-sphere-pulse 2.4s ease-in-out infinite;
}

@keyframes battle-sphere-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(120, 180, 255, 0.2); }
  50% { box-shadow: 0 0 16px rgba(180, 210, 255, 0.45); }
}

.battle-sphere.is-ready:active {
  transform: scale(0.95);
}

.battle-sphere-cd {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #8a7344;
  color: #f0d58a;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.battle-sphere-name {
  display: block;
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #cbb88a;
  font-size: 8px;
  line-height: 1.1;
  text-shadow: 0 1px 2px #000;
}

.battle-attack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 76px;
  flex: 0 0 76px;
  margin-bottom: 2px;
  text-decoration: none;
  color: #ffe7a8;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.battle-attack-art {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.55));
}

.battle-attack span {
  margin-top: -4px;
  text-shadow: 0 1px 0 #000, 0 0 8px rgba(180, 60, 30, 0.5);
}

.battle-attack:active {
  transform: scale(0.95);
}

/* Compact secondary actions: any / reply / guard */
.battle-pad-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.battle-pad-targets.has-two .battle-target {
  flex: 1 1 0;
  min-width: 0;
}

.battle-target {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  flex: 1 1 auto;
  min-height: 38px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid #6a5a3a;
  background: linear-gradient(165deg, #24303aee, #121820f0);
  color: #efe2c0;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 220, 150, 0.07);
  line-height: 1.15;
}

.battle-target-art {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.battle-target-art--icon {
  width: 16px;
  height: 16px;
  flex-basis: 16px;
  filter: none;
}

.battle-target-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.battle-target--any {
  border-color: #7a6640;
}

.battle-target--reply {
  border-color: #7a4a40;
  background: linear-gradient(165deg, #352824ee, #1a1212f0);
  color: #f3c8b8;
}

.battle-target--guard {
  flex: 1 1 100%;
  border-color: #5a6a40;
  background: linear-gradient(160deg, #2a3428, #141a12);
}

.battle-target em {
  display: inline;
  margin-left: 4px;
  font-style: normal;
  color: #c9b48a;
  font-weight: 600;
  font-size: 10px;
}

.battle-target:active {
  filter: brightness(1.1);
  transform: scale(0.98);
}

.battle-elixirs {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(122, 102, 64, 0.35);
}

.battle-elixir,
.battle-elixir.is-empty {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  background: transparent;
  text-decoration: none;
  text-align: center;
}

.battle-elixir-frame,
.battle-elixir-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 1;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}

.battle-elixir-art {
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(201, 164, 90, 0.45);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  filter: none;
}

.battle-elixir.is-empty {
  opacity: 0.6;
}

.battle-elixir.is-cd .battle-elixir-art {
  filter: grayscale(0.4) brightness(0.72);
}

.battle-elixir.is-ready:active {
  transform: scale(0.95);
}

.battle-elixir-cd {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid #8a7344;
  color: #f0d58a;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

/* Stage density */
.battle-arena {
  min-height: 188px;
}

.battle-fig-body {
  width: 84px;
  height: 84px;
}

.battle-stage-hud {
  padding: 6px;
  gap: 5px;
}

.battle-chip {
  padding: 4px;
  gap: 6px;
}

.battle-chip-face {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.battle-float {
  font-size: 22px;
}

@media (max-width: 360px) {
  .battle-sphere,
  .battle-sphere.is-empty {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
  .battle-attack {
    width: 66px;
    flex-basis: 66px;
  }
  .battle-attack-art {
    width: 62px;
    height: 62px;
  }
  .battle-target {
    min-height: 34px;
    padding: 4px 6px;
    font-size: 10px;
  }
  .battle-target-art {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }
  .battle-elixir,
  .battle-elixir.is-empty {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .battle-fig-body {
    width: 72px;
    height: 72px;
  }
  .battle-arena { min-height: 170px; }
}

