/* Edge readouts leave the battlefield available for movement gestures. */
.arena {
  --combat-ink: #101017;
  --combat-ivory: #fff4df;
  --combat-vermilion: #ff704c;
  --combat-ash: #ddd5c6;
  --hud-x: max(12px, env(safe-area-inset-left));
  --hud-end: max(12px, env(safe-area-inset-right));
}
.battle-top-overlay {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
}
.combat-head {
  display: grid;
  grid-template-columns: minmax(0, 230px) 1fr auto 44px;
  align-items: start;
  column-gap: 8px;
  row-gap: 4px;
  padding: max(10px, env(safe-area-inset-top)) var(--hud-end) 0 var(--hud-x);
  background: linear-gradient(to bottom, #0909109c, transparent);
  color: var(--combat-ivory);
}
.fighter-status {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
  padding: 4px 11px 5px 4px;
  background: linear-gradient(101deg, #18151bf7 55%, #17151ed9);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  border-top: 2px solid var(--combat-vermilion);
}
.fighter-seal {
  display: grid;
  place-items: end center;
  flex: none;
  width: 35px;
  height: 39px;
  overflow: hidden;
  background: repeating-linear-gradient(125deg, #fff2d000 0 7px, #fff2d040 7px 8px), #da513b;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 78% 100%, 0 100%);
}
.fighter-seal canvas { width: 36px; height: 36px; }
.fighter-lines { flex: 1 1 auto; min-width: 0; }
.fighter-title, .fighter-life, .fighter-spirit { display: flex; align-items: center; gap: 6px; }
.fighter-title { justify-content: space-between; }
.fighter-title strong { font-size: 16px; line-height: 1.18; letter-spacing: .04em; white-space: nowrap; }
.fighter-title #lvl { font: 700 12px/1 var(--mono); color: #ffb995; }
.fighter-life { margin: 2px 0; }
.hp-rail, .spirit-rail, .fighter-xp, .foe-rail { overflow: hidden; background: #50494c; }
.hp-rail, .spirit-rail { flex: 1; }
.hp-rail { height: 7px; transform: skewX(-8deg); }
.fighter-life #hudHp { color: var(--combat-ivory); font: 700 12px/1 var(--mono); white-space: nowrap; }
.hp-rail i, .spirit-rail i, .fighter-xp i, .foe-rail i { display: block; height: 100%; }
.hp-rail i { background: var(--combat-vermilion); }
.fighter-xp { height: 2px; margin-top: 3px; }
.fighter-xp i { background: #e4d4b3; }
.fighter-spirit { margin-top: 4px; }
.fighter-spirit small { color: #ffdcc3; font: 650 12px/1.1 var(--body); white-space: nowrap; }
.spirit-rail { height: 3px; }
.spirit-rail i { background: #f3bd83; }
.fighter-spirit.kido-charge small { color:#e6c6ff; }
.fighter-spirit.kido-charge .spirit-rail i { background:#c594ff; }

.combat-time {
  grid-column: 3;
  display: grid;
  text-align: right;
  color: var(--combat-ivory);
  align-self: start;
  padding: 3px 7px 4px 9px;
  background: #14131be6;
  border-bottom: 2px solid #c0573f;
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px);
}
.combat-time b { font: italic 900 26px/.95 var(--mono); letter-spacing: -.075em; }
.combat-time span { margin-top: 4px; color: var(--combat-ash); font-size: 12px; line-height: 1; }
.pause-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  position: relative;
  z-index: 4;
  pointer-events: auto;
}
.pause-mark::before {
  content: "";
  position: absolute;
  inset: 3px 0 3px 5px;
  background: #17171fe8;
  box-shadow: inset 0 -2px #9b8879;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.pause-mark i { position: relative; width: 4px; height: 15px; margin-left: -5px; background: var(--combat-ivory); box-shadow: 7px 0 var(--combat-ivory); }
.pause-mark:focus-visible { outline-offset: 0; }
.battle-location {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-self: start;
  gap: 2px 7px;
  padding: 3px 9px 3px 6px;
  max-width: 100%;
  background: #17161ce8;
  border-inline-start: 2px solid #be5845;
  color: var(--combat-ash);
  font-size: 12px;
  line-height: 1.25;
}
.battle-location span { white-space: nowrap; }
.battle-location span:empty { display: none; }
.battle-location #wave { color: #ffd8b5; font-weight: 800; }
.battle-location #deadline { color: var(--combat-ivory); }
.battle-location #deadline.urgent { color: #ffb38e; }

.combat-announcements {
  display: grid;
  gap: 5px;
  justify-items: center;
  width: min(365px, calc(100% - var(--hud-x) - var(--hud-end)));
  margin: 7px auto 0;
  pointer-events: none;
}
.foe-hud, .battle-notice {
  width: 100%;
  padding: 6px 12px 7px;
  color: var(--combat-ivory);
  background: #16131aed;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 7px);
}
.foe-heading { display: flex; gap: 9px; align-items: center; }
.foe-heading span { padding: 1px 5px; background: #e9dac1; color: #261c1a; font: 800 12px/1.25 var(--body); }
.foe-heading b, .battle-notice strong { font-size: 15px; line-height: 1.3; }
.foe-rail { height: 4px; margin-top: 4px; }
.foe-rail #bossfill { background: #ff6758; }
.foe-technique { margin-top: 4px; }
.foe-technique strong { color: #ffd6ae; font-size: 14px; }
.foe-technique small, .battle-notice span { color: #f5ebde; font-size: 13px; line-height: 1.34; }
.foe-technique strong, .foe-technique small, .battle-notice strong, .battle-notice span { display: block; }
.battle-notice { border-left: 3px solid var(--combat-vermilion); width: fit-content; max-width: 100%; text-align: center; }
.battle-notice strong { color: #ffb595; }
.battle-notice span:empty { display: none; }

.battle-footer {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  padding: 11px var(--hud-end) max(12px, env(safe-area-inset-bottom)) var(--hud-x);
  color: var(--combat-ivory);
  pointer-events: none;
  background: linear-gradient(to top, #10101882, transparent);
}
.step-reference, .release-reference {
  display: grid;
  width: max-content;
  max-width: 100%;
  padding: 4px 9px 5px;
  background: #15141be8;
  border-left: 2px solid #a7d4d1;
}
.step-heading { display: flex; gap: 4px; align-items: center; }
.step-heading canvas { width: 18px; height: auto; }
.step-heading strong { font-size: 15px; line-height: 1.25; }
.step-reference #dashGesture { margin: 2px 0 0; color: var(--combat-ivory); font-size: 13px; line-height: 1.35; }
.step-reference #dashState { margin: 1px 0 0; color: #b9efdb; font: 650 12px/1.35 var(--body); font-variant-numeric: tabular-nums; }
.step-reference #dashState.cool { color: #ffbe9e; }
.battle-keys { display: none; font-size: 12px; color: var(--combat-ash); line-height: 1.35; }
.release-readout { display: grid; justify-items: end; gap: 3px; max-width: 53%; }
.release-reference {
  justify-items: end;
  border-left: 0;
  border-right: 3px solid var(--combat-vermilion);
  text-align: right;
}
.release-reference strong { color: #ffb08e; font-size: 15px; line-height: 1.25; }
.release-reference small { font-size: 13px; line-height: 1.35; }
.release-reference[data-stage="full"] { border-color: #fff3d9; }
.release-reference[data-stage="full"] strong { color: var(--combat-ivory); }
.release-reference.kido-charge:not([data-stage="full"]) { border-color:#c594ff; }
.release-reference.kido-charge:not([data-stage="full"]) strong { color:#e6c6ff; }
.held-relic, .equipped-form { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; background: #16131be6; color: #f5dac0; font-size: 12px; }
.held-relic canvas { width: 17px; height: 17px; }
.equipped-form { border-inline-end: 2px solid var(--combat-vermilion); color: #fff0d8; }
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  .battle-keys { display: block; }
}
@media (min-width: 820px), (min-width: 680px) and (max-height: 540px) {
  .combat-announcements { position: absolute; top: max(9px, env(safe-area-inset-top)); left: 50%; width: min(35vw, 385px); transform: translateX(-50%); margin: 0; }
  .battle-location { max-width: min(29vw, 230px); }
}
@media (max-width: 540px) {
  .combat-head { grid-template-columns: minmax(0, 210px) 1fr auto 44px; column-gap: 4px; }
}
@media (max-width: 359px), (max-height: 540px) and (orientation: landscape) {
  .fighter-seal { width: 29px; height: 33px; }
  .fighter-seal canvas { width: 29px; height: 29px; }
  .fighter-title strong { font-size: 14px; }
  .combat-time b { font-size: 22px; }
  .combat-head { grid-template-columns: minmax(0, 180px) 1fr auto 44px; column-gap: 3px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .battle-footer { padding-top: 0; padding-bottom: max(5px,env(safe-area-inset-bottom)); }
  .step-reference { grid-template-columns: auto auto; gap: 0 7px; align-items: center; }
  .step-reference #dashState, .step-reference .battle-keys { grid-column: 1 / -1; }
  .combat-head { padding-top: max(5px,env(safe-area-inset-top)); }
}

.release-cut[data-form="hogyokuAizen"] { background: #090610; }
.release-cut[data-form="hogyokuAizen"] .cut-panel {
  color: #fbf3fd;
  background: linear-gradient(107deg,#312d47 0 44%,#775c91 44% 45%,#251e35 45%);
  border-color: #eee4f1;
  box-shadow: 0 5px #9878a9,0 -5px #7d638f;
}
.release-cut[data-form="hogyokuAizen"] .cut-panel::before {
  background: repeating-linear-gradient(127deg,#6d5d78 0 4px,#c4b3cd 5px 6px,#574762 7px 19px);
}

.boss-alarm {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0,1fr);
  align-items: center;
  gap: 3px 10px;
  padding: 6px 13px 7px;
  border-block: 2px solid #f07c52;
  color: var(--combat-ivory);
  background: linear-gradient(105deg,#54252a,#22151cf8 66%);
  clip-path: polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px);
  pointer-events: none;
}
.boss-alarm-tag {
  padding: 2px 6px 2px 9px;
  color: #201419;
  background: #ff9a6c;
  font: 900 14px/1.2 var(--body);
  letter-spacing: .16em;
}
.boss-alarm strong { font: 900 17px/1.25 var(--body); }
.boss-alarm span { grid-column: 1/-1; color: #ffe3cb; font-size: 13px; line-height: 1.3; }
.boss-alarm:not([hidden]) ~ .foe-hud .foe-heading,
.boss-alarm:not([hidden]) ~ .battle-notice { display: none; }

.combat-style-switch {
  pointer-events: auto;
  touch-action: manipulation;
  display: grid;
  justify-content: start;
  align-content: center;
  gap: 2px;
  min-width: 92px;
  min-height: 46px;
  padding: 4px 12px 5px 10px;
  color: var(--combat-ivory);
  background: #1b1920f5;
  border: 1px solid #b28c74;
  border-inline-start: 3px solid #f5ae86;
  box-shadow: inset 0 -3px #554039;
  text-align: start;
  line-height: 1.2;
}
.combat-style-switch span { font-size: 15px; font-weight: 800; }
.combat-style-switch small { font-size: 12px; color: #f3c4a4; }
.combat-style-switch[aria-pressed="true"] { border-color: #7dafba; border-inline-start-color: #a7f2ed; box-shadow: inset 0 -3px #314f59; }
.combat-style-switch[aria-pressed="true"] small { color: #b9ebef; }
.combat-style-switch:active { transform: translateY(1px); }
.combat-style-switch:disabled { opacity: .7; }
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  .combat-style-switch small::after { content: " · Q"; }
}

.combat-time .hud-gold { color: #ffe092; }
.coin-ledger { color: #ffdc98; font-weight: 750; }

.release-cut:is([data-form$="Mask"],[data-form="ulquiorraSegunda"]):not([data-form="ichigoMask"]) .cut-panel {
  border-color: #ddd0bf; background: #29242b; box-shadow: 0 5px #8e5856, 0 -5px #8e5856;
}
.release-cut:is([data-form$="Mask"],[data-form="ulquiorraSegunda"]):not([data-form="ichigoMask"]) .cut-panel::before {
  background: repeating-linear-gradient(136deg,#f1e7ce 0 12px,#b7a9a7 12px 17px,#332b38 17px 24px);
}
.release-cut[data-form="yamamotoBankai"] .cut-panel { background:#331f21; border-color:#edaf73; }
.release-cut[data-form="yamamotoBankai"] .cut-panel::before {
  background:repeating-linear-gradient(112deg,#301a21 0 10px,#b75e40 10px 16px,#f9cf83 16px 19px);
}
.release-cut[data-form="hitsugayaBankai"] .cut-panel { background:#152e40; border-color:#c3fcf9; }
.release-cut[data-form="hitsugayaBankai"] .cut-panel::before {
  background:repeating-linear-gradient(56deg,#81bfce 0 12px,#c6eff1 12px 15px,#59829b 15px 18px);
}
.release-cut[data-form="darkRukia"] .cut-panel { background:#302034; border-color:#c7a0c4; }
.release-cut[data-form="darkRukia"] .cut-panel::before { background:#916c93; }
.release-cut[data-form="komamuraBankai"] .cut-panel { background:#332b30; border-color:#c89972; }
.release-cut[data-state="shunko"] .cut-panel {background:#282132;border-color:#ffcf53;}
.release-cut[data-state="shunko"] .cut-panel::before {background:repeating-linear-gradient(123deg,#5c4469 0 14px,#392c47 14px 18px,#ffcf53 18px 20px);}
.release-cut[data-form="komamuraBankai"] .cut-panel::before { background:repeating-linear-gradient(0deg,#843e44 0 8px,#29262c 8px 12px,#a57562 12px 14px); }
.release-cut:is([data-form="ichigoTrue"],[data-form="ichigoFullbring"],[data-form="ginjoBankai"]) .cut-panel { background:#20272a; border-color:#e2dbcc; }
.release-cut:is([data-form="ichigoTrue"],[data-form="ichigoFullbring"],[data-form="ginjoBankai"]) .cut-panel::before { background:repeating-linear-gradient(127deg,#dcdacb 0 11px,#8c9293 11px 14px,#42464c 14px 17px); }

/* The transformation takes one spread: the original combat sprite in its own
   inked panel, with the technique name kept upright on the facing panel. */
#releaseCut .cut-panel {
  display:grid;grid-template-columns:minmax(80px, .83fr) minmax(0,1.18fr);
  gap:0;align-items:stretch;width:min(100%,920px);justify-self:center;
  min-height:clamp(124px,25vmin,225px);border-block-width:4px;
}
#releaseCut .cut-portrait {
  position:relative;display:grid;place-items:center;isolation:isolate;
  transform:none;clip-path:polygon(0 0,100% 0,86% 100%,0 100%);
  background:linear-gradient(107deg,transparent 74%,#17141b 74.5% 77%,#f6ecd8 77.5% 79%,transparent 79.5%),
    radial-gradient(ellipse at 42% 48%,#fffae6 0 26%,#e5d8bc 54%,#a1988c 100%);
}
#releaseCut .cut-portrait::before {
  content:"";position:absolute;inset:0;z-index:-1;opacity:.57;
  background:repeating-conic-gradient(from 68deg at 40% 51%,transparent 0deg 12deg,#39353b 12.3deg 12.9deg,transparent 13.1deg 20deg);
  mask-image:radial-gradient(ellipse at 40% 51%,transparent 0 27%,black 88%);
}
#releaseCut .cut-portrait canvas {
  display:block;width:83%;height:clamp(98px,21vmin,176px);object-fit:contain;
  margin-inline-end:8%;transform:skewY(5deg);filter:drop-shadow(2px 2px 0 #fff9e7);
}
#releaseCut .cut-caption {
  min-width:0;align-self:center;padding:10px max(12px,3vw) 12px 4px;
}
#releaseCut .cut-caption strong {
  margin-top:4px;overflow-wrap:anywhere;
  font:900 clamp(24px,5.8vmin,56px)/1.12 "Songti TC","Noto Serif TC","PMingLiU",serif;
  letter-spacing:.02em;
}
#releaseCut[data-form="rukiaBankai"] .cut-portrait canvas {transform:none;}
@media (prefers-reduced-motion:reduce) {
  #releaseCut .cut-panel {animation:none;}
}
