/* A full-height battlefield: controls live in the existing side rail. */
body[data-game="battleground"] .game-shell {
  position: relative;
  grid-template-rows: minmax(0, 1fr) max-content;
  min-height: 720px;
}
body[data-game="battleground"] .arena-column {
  grid-template-rows: minmax(0, 1fr) clamp(74px, 8dvh, 100px);
  gap: 8px;
}
body[data-game="battleground"] .arena { min-height: 390px; }
.arena-controls { position: absolute; top: calc(clamp(8px, .6vw, 16px) + 18px); left: calc(clamp(8px, .6vw, 16px) + 10px); width: calc(var(--rail) - 22px); z-index: 10; display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
body[data-game="battleground"] .synergy-panel { padding-top: 60px; }
.arena-controls .icon-button { width: 30px; height: 32px; }
#exit-button { flex: 1; min-height: 32px; padding: 5px 8px; border: 1px solid #9981b5; border-radius: 6px; background: linear-gradient(145deg, #342a49, #171925); color: #eee1ff; font-size: 11px; letter-spacing: 1px; }
#exit-button:hover { border-color: #ead3ff; box-shadow: 0 0 14px #bb8cff45; }
.battle-controls > .round-banner {
  display: grid; grid-template-columns: max-content max-content; grid-template-rows: 18px 12px; justify-content: center;
  flex-shrink: 0; width: min(100%, 170px); min-width: 0; height: 40px; min-height: 0;
  margin: 0 auto; padding: 4px 0; border: 0;
  border-radius: 0; gap: 2px 10px; background: none; box-shadow: none; clip-path: none;
}
.battle-controls > .round-banner strong { grid-column: 1; grid-row: 1; font-size: 18px; letter-spacing: .5px; text-shadow: none; }
.battle-controls > .round-banner .round-track { grid-column: 2; grid-row: 1; gap: 5px; justify-self: start; }
.battle-controls > .round-banner .round-track i { width: 7px; height: 7px; }
.battle-controls > .round-banner #phase-label { grid-column: 1 / -1; grid-row: 2; font-size: 10px; margin: 0; text-align: center; letter-spacing: .4px; }
body[data-game="battleground"] .rival-row.self .rival-life i { background: transparent; }

/* Standings use aligned cards; ranks no longer hang off the portraits. */
body[data-game="battleground"] .rivals-panel {
  padding: 16px 8px 10px;
  background: linear-gradient(165deg, #211b34f5, #101626f5);
  overflow: hidden;
}
body[data-game="battleground"] .rivals-panel .panel-heading { flex-shrink: 0; margin: 0 2px 12px; padding: 0 4px 12px; }
body[data-game="battleground"] .rivals-panel .panel-heading h2 { margin: 0; font-size: 12px; letter-spacing: 1.5px; }
body[data-game="battleground"] .rivals-panel .ambient-current,
body[data-game="battleground"] .rivals-panel .ambient-mote { display: none; }
body[data-game="battleground"] .rivals-panel .ambient-aura { opacity: .08; }
body[data-game="battleground"] #standings { flex: 1; min-height: 0; gap: 7px; padding: 0 1px 2px; overflow-y: auto; }
body[data-game="battleground"] #standings::before { display: none; }
body[data-game="battleground"] .rival-row {
  display: grid; grid-template-columns: clamp(34px, 2vw, 44px) minmax(0, 1fr); gap: 8px;
  flex-shrink: 0; min-height: 64px; margin: 0; padding: 8px 7px;
  border: 1px solid #8b8fa426; border-radius: 8px;
  background: linear-gradient(110deg, #33304d65, #151b2b8c) !important;
  box-shadow: inset 0 1px #ffffff05;
}
body[data-game="battleground"] .rival-row.self { border-color: #a394ec70; background: linear-gradient(110deg, #4c3d6d75, #252840bb) !important; }
body[data-game="battleground"] .rival-row.current { border-color: #d5b77b80; background: linear-gradient(110deg, #57462e50, #232238bb) !important; }
body[data-game="battleground"] .rival-avatar,
body[data-game="battleground"] .rival-row.self .rival-avatar {
  width: 100%; height: auto; aspect-ratio: 1; border: 1px solid #8c8eab75; border-radius: 50%;
  background: #171c30; box-shadow: 0 0 0 3px #080d1845;
}
body[data-game="battleground"] .rival-row.self .rival-avatar { border-color: #c3b4ff; }
body[data-game="battleground"] .rival-row.current .rival-avatar { border-color: #e3c48a; box-shadow: 0 0 0 3px #e3c48a12; }
body[data-game="battleground"] .rival-detail { display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 4px 5px; text-align: left; align-items: center; }
body[data-game="battleground"] .rival-detail > strong { grid-column: 1; font-size: clamp(12px, .7vw, 15px); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #e1e5ef; }
body[data-game="battleground"] .rival-rank { grid-column: 2; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #b2adc930; border-radius: 5px; font-size: 10px; font-weight: 600; color: #a6acc4; background: #0b112459; font-variant-numeric: tabular-nums; }
body[data-game="battleground"] .rival-row.self .rival-rank { color: #d2c6ff; border-color: #b2a0f050; }
body[data-game="battleground"] .rival-row.current .rival-rank { color: #efd5a1; border-color: #ccb07b50; }
body[data-game="battleground"] .rival-life { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: nowrap; gap: 5px; margin: 0; padding: 0; border: 0; background: none; }
body[data-game="battleground"] .rival-life b { font-size: clamp(18px, 1vw, 24px); font-weight: 650; line-height: 1; color: #eee1c7; font-variant-numeric: tabular-nums; }
body[data-game="battleground"] .rival-life i { font-size: 9px; letter-spacing: .8px; color: #929bb1; background: transparent; }
body[data-game="battleground"] .rival-row.self .rival-life b { color: #d4c8ff; }
body[data-game="battleground"] .rival-hp { grid-column: 1 / -1; width: 100%; height: 3px; margin: 0; background: #8089a526; border-radius: 3px; }
body[data-game="battleground"] .rival-hp i { background: linear-gradient(90deg, #7a8ba9, #b9c8d9); border-radius: inherit; }
body[data-game="battleground"] .rival-row.self .rival-hp i { background: linear-gradient(90deg, #8974c6, #c5b0ff); }
body[data-game="battleground"] .rival-row.current .rival-hp i { background: linear-gradient(90deg, #9c8053, #e5c68d); }
body[data-game="battleground"] .rival-row.out { opacity: .45; }
body[data-game="battleground"] .rival-row.out .rival-avatar,
body[data-game="battleground"] .rival-row.out .rival-detail { opacity: 1; }
@media (min-width: 1101px) {
  body[data-game="battleground"] .rivals-panel { display: flex; flex-direction: column; }
}
@media (min-width: 1101px) and (max-height: 1000px) {
  body[data-game="battleground"] #standings { gap: 5px; }
  body[data-game="battleground"] .rival-row { min-height: 55px; padding-block: 5px; }
  body[data-game="battleground"] .rival-detail { row-gap: 3px; }
  body[data-game="battleground"] .rival-life b { font-size: 18px; }
}

body[data-game="battleground"] .enchantment-arena .ornament-glint { animation: none; }

.interest-orbs { display: flex; gap: 4px; min-height: 16px; align-items: center; margin-top: 5px; }
.interest-orb { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; color: #766347; opacity: .35; }
.interest-orb .arena-icon { width: 14px; height: 14px; margin: 0 !important; }
.interest-orb.lit { color: #ffe1a0; opacity: 1; background: #e6b65924; box-shadow: 0 0 8px #ffd16e66; animation: interest-shimmer 2.8s ease-in-out infinite; animation-delay: calc(var(--orb-index) * -0.35s); }
.result-rewards .interest-orbs { display: inline-flex; justify-content: center; width: 100%; }
.interest-orbs.paid .interest-orb.lit { animation: interest-collect .8s ease-out both; animation-delay: calc(var(--orb-index) * .1s); }
@keyframes interest-shimmer { 50% { transform: translateY(-2px) scale(1.08); opacity: .75; } }
@keyframes interest-collect { from { transform: translateY(12px) scale(.3); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.tactics-exit-dialog { width: min(540px, calc(100vw - 24px)); }
.tactics-exit-dialog h2 { font-size: clamp(23px, 4vw, 32px); }
.tactics-exit-dialog .dialog-actions { flex-wrap: wrap; }
.tactics-exit-dialog .dialog-actions > button { flex: 1 1 130px; }

@media (min-width: 1101px) {
  body[data-game="battleground"] { --rail: clamp(190px, 11vw, 280px); --right-rail: clamp(170px, 9vw, 240px); }
  body[data-game="battleground"] .shop-dock { min-height: 200px; }
}
@media (min-width: 751px) and (max-width: 1100px) {
  body[data-game="battleground"] { --rail: 180px; }
  body[data-game="battleground"] .game-shell { grid-template-rows: 720px auto; }
}
@media (max-width: 750px) {
  body[data-game="battleground"] .game-shell { position: relative; grid-template-rows: auto auto; min-height: 100dvh; padding-top: 50px; }
  body[data-game="battleground"] .arena-column { grid-template-rows: 558px 84px; }
  .arena-controls { position: absolute; top: 8px; left: 8px; right: 8px; width: auto; margin: 0; }
  body[data-game="battleground"] .synergy-panel { padding-top: 15px; }
  .battle-controls > .round-banner { width: 100%; height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: 18px 8px auto; gap: 4px; padding: 0; align-self: center; }
  .battle-controls > .round-banner strong { grid-column: 1; grid-row: 1; justify-self: center; }
  .battle-controls > .round-banner .round-track { grid-column: 1; grid-row: 2; justify-self: center; gap: 4px; }
  .battle-controls > .round-banner #phase-label { grid-column: 1; grid-row: 3; }
}
body[data-effects="reduced"] .interest-orb { animation: none !important; }
body[data-ambient-paused="true"] .interest-orb { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .interest-orb { animation: none !important; }
}
