/* Battle UI shares the setup screen's carved wood, parchment and gold. */
#battle {
  --battle-ink: #432a17;
  --battle-cream: #fff1d7;
  --battle-gold: #ffd34b;
  --battle-wood: linear-gradient(#a56838, #7b4225 52%, #65331e);
  --battle-paper: radial-gradient(ellipse at top, #fff8e9, #f0d4a7);
  --battle-edge: #63391f;
  font-family: "Nunito Sans", system-ui, sans-serif;
}
#battle *,
#battle *::before,
#battle *::after {
  box-sizing: border-box;
}
#battle [hidden] {
  display: none !important;
}
#battle button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
#battle button:disabled {
  cursor: wait;
  opacity: 0.55;
}
#battle button:focus-visible {
  outline: 3px solid #4bcbff;
  outline-offset: 4px;
}
#battle #hud {
  top: env(safe-area-inset-top, 0px);
  padding: 16px;
  align-items: flex-start;
  flex-wrap: nowrap;
  z-index: 5;
}
#battle #aliveBox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px 9px 10px;
  border: 3px solid var(--battle-edge);
  border-radius: 10px;
  background: var(--battle-paper);
  color: var(--battle-ink);
  box-shadow:
    inset 0 1px #fff,
    0 3px 0 #462819,
    0 5px 12px #20130840;
  letter-spacing: 0;
  line-height: 1;
}
#battle #aliveNum {
  display: block;
  color: #3d2b19;
  font:
    30px/1 "Lilita One",
    sans-serif;
}
.survivors-label {
  display: block;
  margin-top: 4px;
  color: #806041;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.battle-crest {
  display: grid;
  place-items: center;
  width: 36px;
  height: 44px;
  background: linear-gradient(#3c8dd3, #19457b);
  color: #ffda5a;
  border: 2px solid #d8aa4a;
  border-radius: 5px 5px 14px 14px;
  font:
    23px/1 "Segoe UI Symbol",
    sans-serif;
  text-shadow: 0 2px #25232a;
}
#battle .hud-actions {
  position: relative;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
#battle .hud-btn {
  min-height: 42px;
  padding: 9px 13px;
  border: 2px solid #75452a;
  border-radius: 7px;
  color: #fff4de;
  background: var(--battle-wood);
  box-shadow:
    inset 0 1px #e1ac66,
    0 2px 0 #4e2b1b;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0;
  text-shadow: 0 1px #472818;
}
#battle .hud-btn:hover {
  filter: brightness(1.12);
  color: #fff9e8;
}
#battle .hud-btn:active {
  transform: translateY(1px);
}
#battle .hud-btn.on,
#battle #controlsToggleBtn {
  background: linear-gradient(#ffe87c, #ffbf20 57%, #eba10e);
  border-color: #8d551c;
  color: #492b0e;
  text-shadow: 0 1px #fff3b0;
  box-shadow:
    inset 0 1px #fff4bb,
    0 3px 0 #6e3917,
    0 5px 10px #25150725;
}
#battle #controlsToggleBtn {
  min-width: 122px;
  font-size: 13px;
}
#battle #controlsToggleBtn::after {
  content: "⌄";
  display: inline-block;
  margin-left: 10px;
  font-size: 17px;
}
#battle #controlsToggleBtn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}
#battle #battleControls {
  position: absolute;
  top: 54px;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  gap: 14px;
  width: min(280px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 100px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 17px;
  border: 5px solid #8b512c;
  border-radius: 10px;
  background: var(--battle-paper);
  box-shadow:
    inset 0 0 0 1px #dcb17a,
    0 3px 0 #4e2b1b,
    0 12px 28px #28160750;
}
.hud-control-group {
  display: grid;
  min-width: 0;
  gap: 6px;
}
.control-help {
  color: #856044;
  font-size: 11px;
  line-height: 1.4;
}
#battle #battleControls .hud-btn {
  min-width: 0;
  white-space: normal;
}
.control-label {
  color: #856044;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}
.speed-switch,
.camera-switch {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 5px;
}
#battle .hud-utility {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid #bb945c66;
}
#battle #quitBtn {
  background: linear-gradient(#a4583c, #7e3629);
  border-color: #6c3426;
}
#battle #soundBtn[aria-pressed="false"] {
  background: #d3ba96;
  color: #725537;
  text-shadow: none;
  box-shadow: inset 0 1px #ffefcf;
}
#battle #feed {
  top: calc(env(safe-area-inset-top, 0px) + 102px);
  left: 16px;
  gap: 6px;
  max-width: min(260px, 44vw);
  z-index: 2;
}
#battle .feed-item {
  padding: 7px 10px;
  border: 1px solid #dbc395;
  border-left: 3px solid #d6a239;
  border-radius: 4px 8px 8px 4px;
  background: linear-gradient(100deg, #ffefd8f0, #efdab8e8);
  box-shadow: 0 2px 4px #301e1330;
  color: #806449;
  font:
    700 11px/1.45 "Nunito Sans",
    system-ui,
    sans-serif;
  overflow-wrap: anywhere;
}
#battle .feed-item b {
  color: #4e301b;
  font-weight: 900;
}
#battle #feed .feed-item:nth-child(n + 4) {
  display: none;
}
#battle #announce {
  font:
    clamp(54px, 13vw, 104px)/1 "Lilita One",
    sans-serif;
  color: #ffe264;
  -webkit-text-stroke: 2px #653817;
  text-shadow:
    0 4px #6f3c13,
    0 6px 15px #2f160b66;
  z-index: 3;
}
#battle #teamScores {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  left: auto;
  right: 16px;
  max-width: min(420px, 60vw);
  justify-content: flex-end;
  z-index: 2;
}
#battle .team-score {
  background: var(--battle-paper);
  color: #805d40;
  border: 1px solid #cfaa73;
  border-left: 4px solid var(--team-color);
  border-radius: 5px;
  box-shadow: 0 2px 4px #301b1840;
  font:
    700 11px/1.4 "Nunito Sans",
    sans-serif;
}
#battle .team-score strong {
  color: #51331e;
}
body.cinema-mode #cinema {
  background: radial-gradient(ellipse at center, transparent 65%, #24181120);
  font-family: "Nunito Sans", system-ui, sans-serif;
}
body.cinema-mode #cinema::before,
body.cinema-mode #cinema::after {
  height: clamp(6px, 2vh, 18px);
  background: #1d1712;
  box-shadow: none;
}
#battle .cinema-caption {
  left: 20px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  padding: 9px 14px 10px;
  border-left: 3px solid #f8cb56;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, #352316e8, #352316a0);
  text-shadow: 0 2px #28170e;
}
#battle #cinemaScene {
  color: #edcc8c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  margin-bottom: 3px;
}
#battle #cinemaShot {
  color: #fff1cf;
  font:
    20px/1.1 "Lilita One",
    sans-serif;
  letter-spacing: 0.3px;
}
#battle .cinema-name {
  padding: 5px 9px 7px;
  min-width: 68px;
  max-width: 150px;
  overflow: visible;
  border: 2px solid #a37b43;
  border-top: 3px solid var(--fighter-color, #e5b73f);
  border-radius: 7px;
  background: var(--battle-paper);
  color: var(--battle-ink);
  box-shadow:
    0 2px 0 #684323,
    0 3px 5px #281a1740;
  font:
    900 11px/1.2 "Nunito Sans",
    system-ui,
    sans-serif;
  text-align: center;
  text-shadow: none;
}
#battle .cinema-name::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  height: var(--label-stem, 7px);
  width: 1px;
  background: #f8dfa680;
}
.cinema-name-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
}
.cinema-health {
  display: block;
  height: 5px;
  overflow: hidden;
  background: #725038;
  border: 1px solid #ad8451;
  border-radius: 3px;
}
.cinema-health > span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(#ffffff55, #00000018), var(--health-color);
}
#battle #cinemaLoading {
  z-index: 4;
  background: radial-gradient(ellipse, #4d3926f5, #241b14fa);
  color: #ffdb79;
  font:
    18px/1.5 "Lilita One",
    sans-serif;
  letter-spacing: 1px;
  padding: 24px;
  text-align: center;
}
#battle #winner {
  z-index: 10;
  padding: max(24px, env(safe-area-inset-top, 0px)) 20px max(24px, env(safe-area-inset-bottom, 0px));
  background: #291e13c9;
  backdrop-filter: blur(7px);
  color: var(--battle-ink);
  justify-content: flex-start;
  gap: 0;
}
.victory-card {
  position: relative;
  width: min(730px, 100%);
  margin: auto 0;
  padding: 26px 28px 24px;
  border: 7px solid #8c502a;
  border-radius: 14px;
  background: var(--battle-paper);
  box-shadow:
    inset 0 0 0 2px #d2a164,
    0 5px 0 #4d2b1a,
    0 16px 50px #160e0d66;
}
#battle #winnerCloseBtn {
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 2px solid #734123;
  border-radius: 8px;
  background: var(--battle-wood);
  color: #fff0d0;
  box-shadow:
    inset 0 1px #d89c5f,
    0 2px #4e2b1b;
  font:
    26px/1 "Nunito Sans",
    sans-serif;
}
#battle #winner .crown {
  margin: 8px 20px 20px;
  color: #624021;
  font:
    26px/1.2 "Lilita One",
    sans-serif;
  letter-spacing: 0.5px;
  text-shadow: 0 1px #fff;
}
#battle #winnerPodium {
  margin: auto;
}
#battle #podiumThrones {
  padding: 10px;
  border: 2px solid #d5b47f;
  border-radius: 10px;
  background: linear-gradient(#f4e5cd, #c5a26e);
  box-shadow: inset 0 2px 12px #70431c20;
}
#battle #podiumStandings {
  margin-top: 10px;
}
#battle .podium-place {
  padding: 8px 5px;
  background: #fff8e7;
  border: 1px solid #ddc295;
  border-radius: 7px;
}
#battle .podium-rank {
  font:
    900 11px/1.4 "Nunito Sans",
    sans-serif;
  color: #9c7130;
}
#battle .podium-name,
#battle #winnerName {
  color: #4e3018;
  font:
    900 15px/1.4 "Nunito Sans",
    sans-serif;
  margin-top: 3px;
}
#battle #winnerStats {
  margin: 16px auto;
  color: #856241;
  font:
    800 12px/1.8 "Nunito Sans",
    sans-serif;
}
#battle #winnerExportStatus {
  color: #80542f;
  font:
    700 12px/1.5 "Nunito Sans",
    sans-serif;
}
#battle #winner .row {
  gap: 8px;
  margin-top: 15px;
  margin-bottom: 0;
}
#battle #winner .btn {
  min-height: 44px;
  border: 2px solid #86501c;
  border-radius: 8px;
  background: linear-gradient(#ffe77b, #ffba18);
  color: #4e2f10;
  box-shadow:
    inset 0 1px #fff3bb,
    0 3px #8d4d16;
  padding: 11px 14px;
  font:
    900 12px/1.3 "Nunito Sans",
    sans-serif;
  letter-spacing: 0;
  text-shadow: 0 1px #ffeaa0;
}
#battle #winner .btn.ghost {
  background: var(--battle-wood);
  color: #fff0d5;
  text-shadow: 0 1px #422819;
  border-color: #734021;
  box-shadow:
    inset 0 1px #c68b4e,
    0 3px #4c2b1a;
}
@media (max-width: 600px) {
  #battle #hud {
    padding: 12px;
    gap: 8px;
  }
  #battle #aliveBox {
    padding: 7px 10px 7px 7px;
    gap: 7px;
  }
  #battle #aliveNum {
    font-size: 25px;
  }
  .battle-crest {
    width: 30px;
    height: 38px;
    font-size: 20px;
  }
  .survivors-label {
    font-size: 9px;
  }
  #battle .hud-actions {
    flex: 0 1 auto;
    flex-wrap: nowrap;
  }
  #battle #controlsToggleBtn {
    min-width: 110px;
  }
  #battle #battleControls {
    width: min(270px, calc(100vw - 24px));
  }
  #battle #feed {
    left: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 90px);
    max-width: 43vw;
  }
  #battle .feed-item {
    padding: 5px 7px;
    font-size: 10px;
  }
  #battle:has(#battleControls:not([hidden])) #feed {
    opacity: 0;
  }
  #battle .cinema-name {
    min-width: 58px;
    max-width: 110px;
    font-size: 10px;
    padding: 4px 6px 5px;
  }
  #battle .cinema-caption {
    left: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    padding: 8px 10px;
  }
  #battle #cinemaShot {
    font-size: 18px;
  }
  #battle #teamScores {
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
    max-width: 65vw;
    max-height: 90px;
  }
  #battle #winner {
    padding-left: 12px;
    padding-right: 12px;
  }
  .victory-card {
    padding: 20px 12px 18px;
    border-width: 5px;
  }
  #battle #winner .crown {
    font-size: 21px;
    margin: 25px 0 16px;
  }
  #battle .podium-name,
  #battle #winnerName {
    font-size: 12px;
  }
  #battle .podium-rank {
    font-size: 9px;
  }
  #battle #winner .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  #battle #winner .btn {
    padding: 10px 7px;
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #battle .feed-item,
  #battle .crown,
  #battle #winnerPodium,
  #battle #winnerStats,
  #battle #winner .row {
    animation: none;
  }
}
