/* ===========================================================
   BATTLE SCENE v2 — Full Kingdom War Animation
   =========================================================== */

/* ── Wrapper ── */
.bs2-wrap {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #06010f 0%, #0d0530 40%, #180a05 100%);
  font-family: 'Inter', sans-serif;
  color: #f1f5f9;
  user-select: none;
}

/* ── Background ── */
.bs2-bg {
  position: absolute; inset: 0; overflow: hidden; z-index: 0;
  background:
    radial-gradient(ellipse at 20% 60%, rgba(59,130,246,.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 60%, rgba(220,38,38,.12)  0%, transparent 55%),
    radial-gradient(ellipse at 50% 30%, rgba(251,191,36,.06) 0%, transparent 50%);
}
.bs2-star {
  position: absolute; border-radius: 50%;
  background: #fff;
  animation: star-twinkle 3s ease-in-out infinite alternate;
}
@keyframes star-twinkle { from{opacity:.2} to{opacity:.9} }
.bs2-ground {
  position: absolute; bottom: 0; left: 0; right: 0; height: 60px;
  background: linear-gradient(180deg, transparent, rgba(120,53,15,.25));
}

/* ── Header ── */
.bs2-header {
  position: relative; z-index: 2;
  text-align: center; padding: 14px 12px 8px;
  border-bottom: 1px solid rgba(251,191,36,.2);
}
.bs2-title {
  font-size: 1.3rem; font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(135deg, #fbbf24, #fcd34d, #f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 10px rgba(251,191,36,.5));
}
.bs2-sub {
  font-size: .62rem; font-weight: 700; letter-spacing: 3px;
  color: rgba(251,191,36,.55); margin-top: 1px;
}
.bs2-for {
  font-size: .68rem; font-weight: 600; color: rgba(255,255,255,.5);
  margin-top: 3px;
}
.bs2-for span { color: #fbbf24; font-weight: 800; }

/* ── Main Arena ── */
.bs2-arena {
  position: relative; z-index: 2;
  display: flex; align-items: flex-start;
  padding: 8px 6px 0;
  gap: 4px;
}

/* ── Side panels ── */
.bs2-side {
  display: flex; flex-direction: column; align-items: center;
  width: 95px; flex-shrink: 0;
  gap: 3px;
}
.bs2-tag {
  font-size: .55rem; font-weight: 800; letter-spacing: 1.5px;
  padding: 2px 8px; border-radius: 20px;
}
.blue-tag { background: rgba(59,130,246,.25); color: #93c5fd; border: 1px solid rgba(59,130,246,.4); }
.red-tag  { background: rgba(220,38,38,.25);  color: #fca5a5; border: 1px solid rgba(220,38,38,.4); }
.bs2-hname { font-size: .62rem; font-weight: 800; letter-spacing: .8px; }
.blue-name { color: #60a5fa; }
.red-name  { color: #f87171; }
.bs2-score { font-size: .75rem; font-weight: 800; color: #fbbf24; }
.bs2-wins-label { font-size: .55rem; color: rgba(255,255,255,.4); }

/* ── Centre panel ── */
.bs2-centre {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 4px;
}
.bs2-progress-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 12px 8px;
  width: 100%;
  text-align: center;
}
.bs2-progress-title { font-size: .55rem; font-weight: 700; letter-spacing: 2px; color: rgba(255,255,255,.4); }
.bs2-progress-day   { font-size: 1rem;   font-weight: 900; color: #fbbf24; margin: 2px 0; }
.bs2-day-result     { font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 20px; margin: 4px auto; display: inline-block; }
.win-result  { background: rgba(59,130,246,.25); color: #93c5fd; border: 1px solid rgba(59,130,246,.4); animation: pulse-win 1.5s ease infinite; }
.lose-result { background: rgba(220,38,38,.2);  color: #fca5a5; border: 1px solid rgba(220,38,38,.35); }
.draw-result { background: rgba(245,158,11,.2); color: #fcd34d; border: 1px solid rgba(245,158,11,.35); }
@keyframes pulse-win {
  0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,.4); }
  50%      { box-shadow: 0 0 12px 4px rgba(59,130,246,.25); }
}

/* Progress bar */
.bs2-progbar {
  display: flex; height: 16px; border-radius: 8px; overflow: hidden;
  margin: 6px 0 2px; border: 1px solid rgba(255,255,255,.08);
}
.bs2-progbar-blue {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  transition: width 1.2s ease; min-width: 8px;
  display: flex; align-items: center; padding-left: 4px;
}
.bs2-progbar-red {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  transition: width 1.2s ease; min-width: 8px;
}
.bs2-progbar-labels {
  display: flex; justify-content: space-between;
  font-size: .58rem; color: rgba(255,255,255,.4); padding: 0 2px;
}

/* ── Day Shields ── */
.bs2-shields {
  display: flex; justify-content: center; gap: 5px; flex-wrap: nowrap;
  overflow-x: auto; width: 100%; padding: 2px 0 4px;
}
.bs2-shield {
  display: flex; flex-direction: column; align-items: center; gap: 1px; flex-shrink: 0;
}
.bs2-shield-icon {
  width: 28px; height: 32px;
  clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%);
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 900; color: #fff;
  transition: transform .3s;
}
.s-won .bs2-shield-icon  { background: linear-gradient(160deg,#fbbf24,#d97706); animation: shield-glow2 1.8s ease infinite; }
.s-cur .bs2-shield-icon  { background: linear-gradient(160deg,#3b82f6,#1d4ed8); animation: shield-pulse2 1s ease infinite; }
.s-pend .bs2-shield-icon { background: rgba(255,255,255,.08); color: rgba(255,255,255,.3); }
.bs2-shield-day { font-size: .48rem; font-weight: 700; letter-spacing: .5px; color: rgba(255,255,255,.4); }
.bs2-shield-won { font-size: .45rem; font-weight: 800; color: #fbbf24; }

@keyframes shield-glow2 {
  0%,100% { filter: drop-shadow(0 0 4px rgba(251,191,36,.7)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 10px rgba(251,191,36,1)); transform: scale(1.1); }
}
@keyframes shield-pulse2 {
  0%,100% { filter: drop-shadow(0 0 4px rgba(59,130,246,.7)); }
  50%      { filter: drop-shadow(0 0 10px rgba(59,130,246,1)); }
}

/* ── Characters ── */
.bs2-char-wrap {
  position: relative; width: 88px; height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.bs2-char-svg { width: 88px; position: relative; z-index: 2; overflow: visible; }

/* King winning glow */
.king-glow { filter: drop-shadow(0 0 16px rgba(59,130,246,.7)); }
.queen-glow { filter: drop-shadow(0 0 16px rgba(220,38,38,.7)); }

/* King cape wave */
.king-cape { animation: cape-wave 2s ease-in-out infinite; transform-origin: 42px 80px; }
.queen-cape { animation: cape-wave 2s ease-in-out infinite alternate; transform-origin: 52px 112px; }
@keyframes cape-wave {
  0%,100% { d: path("M42,80 Q20,110 18,155"); }
  50%      { d: path("M42,80 Q14,108 22,158"); }
}

/* King sword raise */
.king-svg .king-sword-arm { animation: sword-raise 0.8s cubic-bezier(.34,1.56,.64,1) forwards; }
.king-plume { animation: plume-bob 1.5s ease-in-out infinite; transform-origin: 50px 42px; }
@keyframes plume-bob {
  0%,100% { transform: rotate(0deg); }
  50%      { transform: rotate(8deg); }
}

/* Sword tip glow */
.sword-tip-glow { animation: tip-glow 1s ease-in-out infinite; }
@keyframes tip-glow {
  0%,100% { opacity:.9; r:5; }
  50%      { opacity:1; r:7; filter:drop-shadow(0 0 8px #fbbf24); }
}

/* Queen cape flowing */
.queen-hair { animation: hair-flow 2s ease-in-out infinite alternate; }
@keyframes hair-flow {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}

/* Horse front legs raised */
.horse-front-legs.legs-raised .front-leg-r {
  animation: leg-raise-r 0.8s cubic-bezier(.34,1.56,.64,1) forwards;
}
.horse-front-legs.legs-raised .front-leg-l {
  animation: leg-raise-l 0.8s cubic-bezier(.34,1.56,.64,1) 0.1s forwards;
}
@keyframes leg-raise-r {
  from { transform: rotate(0deg); transform-origin: 88px 165px; }
  to   { transform: rotate(-70deg); transform-origin: 88px 165px; }
}
@keyframes leg-raise-l {
  from { transform: rotate(0deg); transform-origin: 76px 165px; }
  to   { transform: rotate(-60deg); transform-origin: 76px 165px; }
}
.horse-front-legs.legs-raised .hoof-r,
.horse-front-legs.legs-raised .hoof-l { opacity: 0; }

/* Queen sword raise */
.queen-sword-arm {
  animation: queen-sword-raise 0.8s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes queen-sword-raise {
  from { transform: rotate(20deg); }
  to   { transform: rotate(-10deg); }
}

/* Horse mane */
.horse-mane { animation: mane-flow 1.8s ease-in-out infinite alternate; transform-origin: 94px 78px; }
@keyframes mane-flow {
  from { transform: rotate(-5deg); }
  to   { transform: rotate(5deg); }
}

/* ── Light Rays ── */
.light-rays-svg {
  position: absolute; inset: -20px; z-index: 1;
  animation: rays-spin 8s linear infinite;
  pointer-events: none;
}
@keyframes rays-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
.light-ray { animation: ray-pulse 2s ease-in-out infinite alternate; }
@keyframes ray-pulse { from{opacity:.15} to{opacity:.4} }

/* ── Battlefield ── */
.bs2-battlefield {
  position: relative; z-index: 2;
  display: flex; align-items: flex-end;
  min-height: 110px;
  padding: 6px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.25));
  gap: 6px;
}

/* Army panels */
.bs2-army-left, .bs2-army-right {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.army-label-top { font-size: .55rem; font-weight: 700; letter-spacing: 1px; }
.blue-label { color: #60a5fa; }
.red-label  { color: #f87171; }
.army-label-bot { font-size: .55rem; color: #fbbf24; font-weight: 700; }
.army-soldiers-wrap { position: relative; height: 52px; width: 100%; }

/* Individual soldiers */
.army-soldier {
  position: absolute; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: all 0.6s cubic-bezier(.34,1.56,.64,1);
}
.sol-head { width: 9px; height: 9px; border-radius: 50%; }
.sol-body { width: 7px; height: 12px; border-radius: 2px; }
.sol-legs { width: 9px; height: 8px;
  background: repeating-linear-gradient(90deg,
    currentColor 0, currentColor 3px, transparent 3px, transparent 5px);
}
.sol-star { position: absolute; top: -10px; font-size: .5rem; animation: star-pop .4s ease-out; }
@keyframes star-pop { from{transform:scale(0)} to{transform:scale(1)} }

/* Blue soldiers */
.blue-s .sol-head { background: #93c5fd; }
.blue-s .sol-body { background: #1d4ed8; }
.blue-s .sol-legs { color: #1e3a8a; }
.blue-s { animation: march-r 1.1s ease-in-out infinite; }
.blue-s.active .sol-head { background: #60a5fa; box-shadow: 0 0 4px #60a5fa; }
.blue-s.advanced .sol-body { background: #3b82f6; }

/* Red soldiers */
.red-s .sol-head { background: #fca5a5; }
.red-s .sol-body { background: #dc2626; }
.red-s .sol-legs { color: #991b1b; }
.red-s { animation: march-l 1.1s ease-in-out infinite; }
.red-s.active .sol-head { background: #f87171; box-shadow: 0 0 4px #ef4444; }
.red-s.advanced .sol-body { background: #ef4444; }

/* Inactive soldiers are dimmed */
.army-soldier:not(.active) { opacity: .3; }

@keyframes march-r {
  0%,100% { transform: translateY(0) scaleY(1); }
  30%      { transform: translateY(-4px) scaleY(.95); }
  60%      { transform: translateY(0) scaleY(1); }
  80%      { transform: translateY(-2px) scaleY(.97); }
}
@keyframes march-l {
  0%,100% { transform: translateY(0) scaleY(1) scaleX(-1); }
  30%      { transform: translateY(-4px) scaleY(.95) scaleX(-1); }
  60%      { transform: translateY(0) scaleY(1) scaleX(-1); }
  80%      { transform: translateY(-2px) scaleY(.97) scaleX(-1); }
}

/* ── Castle (battlefield) ── */
.bs2-castle-center {
  flex-shrink: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
}
.castle2-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.c2-towers { display: flex; align-items: flex-end; gap: 2px; }
.c2-tower {
  width: 20px; height: 44px;
  background: linear-gradient(180deg, #57534e, #292524);
  border-radius: 2px 2px 0 0;
  border: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-around; align-items: flex-start; padding-top: 3px;
}
.c2-main {
  width: 52px;
  background: linear-gradient(180deg, #78716c, #292524);
  border-radius: 2px 2px 0 0;
  border: 1px solid rgba(255,255,255,.12);
}
.c2-merlons { display: flex; justify-content: space-around; padding: 0 3px; margin-top: -6px; }
.c2-merlon  { width: 6px; height: 6px; background: #a8a29e; border-radius: 1px 1px 0 0; }
.c2-emblem  { text-align: center; font-size: 1.1rem; padding: 2px 0; filter: drop-shadow(0 0 6px rgba(251,191,36,.8)); }
.c2-gate {
  width: 16px; height: 14px; border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #0c0a09; margin: 0 auto;
  border: 1px solid rgba(255,255,255,.06);
}
.c2-flag {
  position: absolute; top: -10px; font-size: .9rem;
  animation: flag2 1.5s ease-in-out infinite alternate;
}
.c2-flag.lf { left: -8px; }
.blue-flag { color: #3b82f6; filter: drop-shadow(0 0 4px #3b82f6); }
.red-flag  { color: #ef4444; filter: drop-shadow(0 0 4px #ef4444); }
@keyframes flag2 { from{transform:rotate(-12deg)} to{transform:rotate(12deg)} }
.c2-fire {
  position: absolute; bottom: 0; left: -14px; font-size: .8rem;
  animation: fire2 .5s ease-in-out infinite alternate;
}
.c2-fire2 { left: auto; right: -14px; animation-delay: .25s; }
@keyframes fire2 { from{transform:scaleY(1) rotate(-5deg)} to{transform:scaleY(1.3) rotate(5deg)} }
.c2-name {
  font-size: .48rem; font-weight: 900; letter-spacing: 1px;
  color: #fbbf24; text-align: center; margin-top: 2px; white-space: nowrap;
}

/* ── Bottom Stats ── */
.bs2-stats {
  position: relative; z-index: 2;
  display: flex; gap: 6px; padding: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.bs2-stat-box {
  flex: 1; background: rgba(255,255,255,.04); border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08); padding: 8px 10px;
}
.bs2-stat-title { font-size: .52rem; font-weight: 800; letter-spacing: 1px; color: rgba(255,255,255,.4); margin-bottom: 5px; }
.bs2-stat-row { display: flex; justify-content: space-between; font-size: .65rem; font-weight: 700; padding: 1px 0; }
.blue-row { color: #93c5fd; }
.red-row  { color: #fca5a5; }
.kingdom-box { text-align: center; }
.bs2-kingdom-name { font-size: .7rem; font-weight: 800; color: #fbbf24; }
.bs2-kingdom-sub  { font-size: .52rem; color: rgba(255,255,255,.35); margin-top: 2px; }
.bs2-sum-row { font-size: .62rem; font-weight: 600; padding: 1px 0; color: rgba(255,255,255,.6); }
.sum-win  { color: #60a5fa; font-weight: 800; }
.sum-lose { color: #f87171; font-weight: 800; }

/* ── Victory Particles ── */
.bs2-particles {
  position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden;
}
.bs2-p {
  position: absolute; border-radius: 50%;
  animation: conf-fall 3s linear infinite;
}
@keyframes conf-fall {
  0%   { transform: translateY(-20px) rotate(0);   opacity: 1; }
  100% { transform: translateY(500px)  rotate(720deg); opacity: 0; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .bs2-title   { font-size: 1rem; }
  .bs2-side    { width: 72px; }
  .bs2-char-wrap, .bs2-char-svg { width: 70px; height: 130px; }
  .bs2-shields { gap: 3px; }
  .bs2-shield-icon { width: 24px; height: 28px; }
  .bs2-stats   { flex-direction: column; gap: 4px; }
}
