/* The active battlefield shares one quiet canvas with its header and hand. */
.shell.battle-mode {
  background: #f4edda radial-gradient(circle, #c9b78d88 0.85px, transparent 1px) 0 0 / 15px 15px;
  background-attachment: fixed;
}
.shell.battle-mode > .topbar,
.shell.battle-mode .workspace,
.shell.battle-mode #battle-view,
.shell.battle-mode #battle-grid,
.shell.battle-mode #battle-view .arena-wrap,
.shell.battle-mode #battle-view .hand-dock,
.shell.battle-mode #battle-view :where(#hand, .camp-troops),
.shell.battle-mode #battle-view .energy-track {
  background: transparent;
  border: 0;
  box-shadow: none;
}
/* Flex layout returns the entire navigation height to the battlefield. */
.shell.battle-mode:not(:has(#level-transition:not([hidden]))) > .game-nav {
  display: none;
}
.shell.battle-mode #battle-view .energy-track > span,
.shell.battle-mode #battle-view .energy-track b {
  color: #254e59;
  text-shadow: none;
}
.shell.battle-mode #battle-view .energy-pips i {
  border-color: #6b9396;
  background: linear-gradient(90deg, #348f9e var(--fill), #d9d6c5 var(--fill));
}
.shell.battle-mode #battle-view :where(#hand, .camp-troops) .battle-empty-slot {
  background: #e5dcc933;
  border-color: #a99a76;
}

/* Full-screen reward scenes share one backdrop with the floating header. */
.shell:has(#battle-ending.won:not([hidden])[data-stage='hero']),
.shell:has(#battle-ending.won:not([hidden])[data-stage='rewards']) {
  --battle-interstitial-surface: radial-gradient(ellipse at 50% 38%, #396879, #102e46 65%, #081d32);
  background: var(--battle-interstitial-surface) center top / 100vw 100dvh fixed;
}
.shell #battle-ending.won[data-stage='hero'],
.shell #battle-ending.won[data-stage='rewards'] {
  background: var(--battle-interstitial-surface) center top / 100vw 100dvh fixed;
}

/* Six cards per row: enamel edges, readable nameplates and compact cost badges. */
.shell.battle-mode #battle-view .hand-dock {
  gap: 7px;
  padding-top: 6px;
}
#battle-view :where(#hand, .camp-troops) {
  gap: 6px;
}
#battle-view :where(#hand, .camp-troops) .card {
  border: 1.5px solid #759ea4;
  border-radius: 11px;
  background: #18384b;
  box-shadow:
    0 3px 0 #204551,
    0 5px 7px #4b422b24;
  transition:
    transform 0.16s ease-out,
    border-color 0.2s,
    filter 0.2s,
    box-shadow 0.2s;
}
#battle-view :where(#hand, .camp-troops) .troop-art {
  background: radial-gradient(ellipse at 50% 25%, #3c6d7c, #132c43 80%);
}
#battle-view :where(#hand, .camp-troops) .troop-art svg {
  border-radius: 8px;
}
#battle-view :where(#hand, .camp-troops) .card:not(.unaffordable) {
  border-color: #ead19a;
  box-shadow:
    0 3px 0 #8b7446,
    0 5px 8px #65502c22,
    inset 0 1px #fff4bc;
}
#battle-view :where(#hand, .camp-troops) .card-info {
  padding: 16px 3px 6px;
  background: linear-gradient(transparent, #102c40ee 38%, #102c40);
  border-bottom: 2px solid #69b3bb88;
  border-radius: 0 0 8px 8px;
}
#battle-view :where(#hand, .camp-troops) .card-info strong {
  font-size: clamp(9px, 1.65vw, 14px);
  line-height: 1.08;
  color: #fff0c8;
  text-shadow: 0 2px 1px #061c2c;
}
#battle-view :where(#hand, .camp-troops) .cost {
  padding: 2px 5px 3px;
  border: 1px solid #c1f6fa;
  border-radius: 7px 5px 9px 5px;
  background: linear-gradient(#408ea5, #18546e);
  color: #f2ffff;
  font:
    20px/1 'Lilita One',
    sans-serif;
  box-shadow:
    0 2px #092c40,
    inset 0 1px #e0ffff66;
  text-shadow: 0 1px #174052;
}
#battle-view :where(#hand, .camp-troops) .card-multiplier {
  top: 3px;
  right: 3px;
  bottom: auto;
  left: auto;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 3px 4px;
  border: 1px solid #e5cb89;
  background: #f5e4b4;
  border-radius: 5px;
  color: #334b52;
  font:
    900 10px/1 'Nunito',
    sans-serif;
  box-shadow: 0 2px 3px #071c3e55;
}
#battle-view :where(#hand, .camp-troops) .card.unaffordable {
  opacity: 0.82;
  filter: saturate(0.62);
  border-color: #8ba3a3;
}
#battle-view :where(#hand, .camp-troops) .card.unaffordable::after {
  inset: auto 4px 31px auto;
  padding: 2px 5px;
  border-radius: 5px;
  background: #102d40eb;
  color: #d7edf1;
  font:
    900 10px/1.2 'Nunito',
    sans-serif;
  border: 1px solid #a5c7cb88;
}
#battle-view :where(#hand, .camp-troops) .card.selected {
  transform: translateY(-5px);
  border-color: #fff1af;
  box-shadow:
    0 3px #b78935,
    0 0 0 2px #efbe55,
    0 0 18px #edc66880;
}
#battle-view :where(#hand, .camp-troops) .card.selected .card-info {
  border-bottom-color: #ffe49a;
}
.shell.battle-mode #battle-view :where(#hand, .camp-troops) .battle-empty-slot {
  position: relative;
  border: 1px dashed #b8a67d99;
  border-radius: 11px;
  background: linear-gradient(145deg, #e9ddc52b, #fff8e440);
  box-shadow: inset 0 1px 6px #b09c6c12;
}
#battle-view :where(#hand, .camp-troops) .battle-empty-slot::after {
  content: '+';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #b5a57b80;
  font:
    26px/1 'Nunito',
    sans-serif;
}
/* Persistent DOM segments interpolate regeneration; spending updates immediately. */
.shell.battle-mode #battle-view .energy-track {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 30px;
  min-height: 30px;
  height: 30px;
  padding: 3px 2px 2px;
}
#battle-view #energy-pips {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  border: 1px solid #b7a77f;
  border-radius: 10px;
  background: #d5c9ab;
  box-shadow:
    inset 0 2px 3px #806c4733,
    0 1px #fff9e9;
}
.shell.battle-mode #battle-view #energy-pips .energy-segment {
  display: block;
  position: relative;
  height: 12px;
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 3px;
  background: #b7b59f;
  box-shadow: inset 0 1px 2px #53644e4d;
  overflow: hidden;
}
.energy-segment-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  background: linear-gradient(#b1f4e4, #41b6b9 45%, #217c96);
  box-shadow:
    inset 0 1px #edfff5,
    1px 0 4px #e3ffff66;
  border-radius: inherit;
  transition: width 0.16s linear;
}
#energy-pips.is-spending .energy-segment-fill {
  transition: none;
}
.energy-segment.is-charging .energy-segment-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, #efffff88 50%, transparent 80%);
  background-size: 28px 100%;
  animation: battle-energy-flow 1.1s linear infinite;
}
#energy-pips.is-full .energy-segment-fill {
  background: linear-gradient(#fff4bd, #f3d16e 45%, #c59639);
  box-shadow: inset 0 1px #fffce3;
}
#energy-pips.is-paused .energy-segment-fill::after {
  animation-play-state: paused;
}
#battle-view .battle-energy-label {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
#battle-view .battle-energy-label > img {
  width: 19px;
  height: 24px;
  filter: drop-shadow(0 1px #fff8);
}
#battle-view .battle-energy-label > span {
  font:
    900 9px/1 'Nunito',
    sans-serif;
  letter-spacing: 0.6px;
}
#battle-view #energy-total {
  display: inline-block;
  font:
    20px/1 'Lilita One',
    sans-serif;
  font-variant-numeric: tabular-nums;
  min-width: 51px;
}
@keyframes battle-energy-flow {
  to {
    background-position: 28px 0;
  }
}
@media (max-width: 600px) {
  #battle-view :where(#hand, .camp-troops) {
    gap: 5px;
  }
  #battle-view :where(#hand, .camp-troops) .cost {
    font-size: 15px;
    padding: 2px 3px;
  }
  #battle-view :where(#hand, .camp-troops) .card-multiplier {
    font-size: 8px;
    padding: 2px;
    right: 2px;
    top: 2px;
  }
  #battle-view :where(#hand, .camp-troops) .card-info {
    padding: 14px 1px 5px;
  }
  #battle-view :where(#hand, .camp-troops) .card.unaffordable::after {
    font-size: 9px;
    right: 2px;
    bottom: 28px;
    padding: 2px 3px;
  }
  #battle-view .battle-energy-label > span {
    display: none;
  }
  #battle-view #energy-total {
    font-size: 17px;
    min-width: 43px;
  }
  #battle-view #energy-pips {
    gap: 2px;
    padding: 3px;
    border-radius: 7px;
  }
  .shell.battle-mode #battle-view #energy-pips .energy-segment {
    height: 10px;
    border-radius: 2px;
  }
  .shell.battle-mode #battle-view .energy-track {
    flex-basis: 26px;
    min-height: 26px;
    height: 26px;
    gap: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .energy-segment-fill {
    transition: none;
  }
  .energy-segment-fill::after {
    animation: none !important;
  }
  #battle-view :where(#hand, .camp-troops) .card {
    transition: none;
  }
}
