html:has(#battle-theater[open]) { overflow: hidden; }

#battle-theater {
  position: fixed;
  inset: 0;
  width: min(100vw, 1600px);
  max-width: none;
  height: min(100svh, 1050px);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  color: #f2f6f1;
  background: #070e13;
}
#battle-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(108deg, #130b1566, #14101b24 63%, #09192955), url('/releases/diaspora-20261202-ba87386c/art/vale-dust.webp') center 58% / cover;
}
#battle-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#battle-stage::after {
  z-index: 2;
  background:
    linear-gradient(#081116 0%, #091115ec 8%, transparent 22%, transparent 81%, #070e13 100%),
    radial-gradient(ellipse at 50% 45%, transparent 42%, #05090c86 100%);
}
#battle-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#battle-effects { pointer-events: none; }
.battle-top, .battle-forces, .battle-bottom, .battle-recap { position: absolute; z-index: 3; }
.battle-top, .battle-forces, .battle-bottom { left: clamp(.9rem, 4vw, 3.4rem); right: clamp(.9rem, 4vw, 3.4rem); }
.battle-top { top: clamp(.8rem, 3.5vh, 2.2rem); display: flex; justify-content: space-between; align-items: start; gap: .7rem; }
#battle-channel, #battle-phase { margin: 0; color: #e8c596; font: 600 .74rem/1.25 var(--mono); text-transform: uppercase; letter-spacing: .14em; }
#battle-title { margin: .32rem 0 0; font: 750 clamp(1.55rem, 3.8vw, 3.65rem)/.95 var(--display); letter-spacing: .005em; }
#battle-close { flex: none; }
#battle-close, .battle-actions button {
  min-height: 43px;
  border: 1px solid #6f877c92;
  border-radius: 2px;
  background: #182325de;
  color: #e2ebdf;
  white-space: nowrap;
}
#battle-close:hover, .battle-actions button:hover { background: #3d514d; }
#battle-close span { margin-left: .34rem; color: #e8c596; }
.battle-forces { top: clamp(5.15rem, 16vh, 8rem); display: flex; justify-content: space-between; gap: 1.2rem; pointer-events: none; }
.battle-force {
  --force: #ffd28d;
  width: min(22rem, 40%);
  padding: .58rem .65rem .49rem;
  border-top: 1px solid var(--force);
  background: linear-gradient(#142225d9, #101a1bb0);
  box-shadow: 0 7px 25px #0105074d;
}
.battle-force.own { --force: #86e8d1; order: -1; }
.battle-force div { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem; }
.battle-force strong { font: 650 clamp(.86rem, 1.65vw, 1.2rem)/1.1 var(--display); }
.battle-force output { color: var(--force); font: .77rem/1.1 var(--mono); white-space: nowrap; }
.battle-force meter { display: block; width: 100%; height: 6px; margin-top: .49rem; appearance: none; background: #071316; }
.battle-force meter::-webkit-meter-bar { height: 6px; border: 0; border-radius: 0; background: #273333; }
.battle-force meter::-webkit-meter-optimum-value { background: var(--force); }
.battle-force meter::-moz-meter-bar { background: var(--force); }
.battle-bottom { bottom: max(1.15rem, env(safe-area-inset-bottom)); display: flex; align-items: end; gap: clamp(.55rem, 2vw, 1.8rem); }
.battle-bottom > div:first-child { flex: 1; min-width: 0; }
#battle-phase { color: #e1eddc; }
#battle-progress { display: block; width: 100%; height: 4px; margin-top: .68rem; border: 0; background: #3d514e; accent-color: #ecc48c; }
#battle-progress::-webkit-progress-bar { background: #3d514e; }
#battle-progress::-webkit-progress-value { background: #ecc48c; }
.battle-actions { display: flex; gap: .4rem; }
.battle-recap {
  bottom: 5.2rem;
  left: 50%;
  width: min(27rem, calc(100% - 2rem));
  translate: -50%;
  padding: 1.1rem 1.45rem;
  border: 1px solid #b4966386;
  border-top: 2px solid #ecc48c;
  background: #121d21f6;
  box-shadow: 0 12px 40px #010408a6;
  text-align: center;
}
.battle-recap h3 { margin: 0 0 .55rem; font: 720 clamp(1.4rem, 4vw, 2rem)/1.1 var(--display); }
.battle-recap div { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; color: #c2d2cb; }
.battle-recap button { width: 100%; margin-top: .88rem; border-radius: 2px; }
#battle-error { margin: 0 0 .55rem; color: #ffbd94; }
.report-log [data-battle] { display: block; margin-top: .42rem; min-height: 34px; border-color: #b492657a; color: #ffe1b6; }

@media (max-width: 620px) {
  #battle-stage::before { inset: auto -14% 24% auto; }
  .battle-top { align-items: start; }
  #battle-close { min-height: 39px; font-size: .81rem; }
  .battle-forces { top: max(5.5rem, 12vh); gap: .43rem; }
  .battle-force { width: 50%; padding-inline: .42rem; }
  .battle-force div { align-items: start; flex-direction: column; gap: .26rem; }
  .battle-bottom { align-items: stretch; flex-direction: column; }
  .battle-actions button { flex: 1; }
  .battle-recap { bottom: 6.5rem; }
}
#sortie-theater { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; border: 0; margin: 0; padding: 0; overflow: hidden; background: #050b14; }
#sortie-theater iframe { display: block; width: 100%; height: 100%; border: 0; }
