#stage.battle {
  --match-gold:#ffe5a4; --match-cream:#fff5e3;--match-plum:#31213e;
  display:grid; grid-template-columns:minmax(0,min(100%,660px));
  grid-template-rows:auto auto minmax(0,1fr) auto; justify-content:center;
  align-content:stretch; justify-items:stretch; gap:7px; position:relative;
  box-sizing:border-box;width:100%;height:100dvh;min-height:0;
  padding:calc(env(safe-area-inset-top) + clamp(7px,2.1dvh,23px)) max(8px,env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 8px) max(8px,env(safe-area-inset-left));
  color:var(--match-cream);
}
#stage.battle[hidden] { display:none; }
#stage .match-heading,#stage .match-ribbon,#stage .battle-tools:has(> :not([hidden])) {
  border:1px solid #f4ce9c9c; box-shadow:inset 0 1px #ffe6bb40,0 3px 9px #21112570;
  background:linear-gradient(145deg,#493451f5,#31213ff5 75%);
}
#stage .match-heading {display:flex;align-items:center;gap:9px;border-radius:18px;padding:6px 9px;}
#stage .match-tool {
  width:43px;height:43px;flex:0 0 43px;display:grid;place-items:center;padding:6px;
  border-radius:14px;border:1px solid #e4ba91a8;background:linear-gradient(#674b6b,#45334e);
  box-shadow:inset 0 1px #ffe9b83b;
}
#stage .match-tool>[data-icon],#stage .match-tool svg {display:block;width:100%;height:100%;max-width:30px;max-height:30px;}
#stage .match-title {display:grid;min-width:0;flex:1;gap:0;}
#stage #level-tag,#stage .match-moves>span,#stage .match-targets>span {
  color:var(--match-gold);font:800 clamp(.58rem,1.15vw,.72rem)/1.15 'Nunito',sans-serif;letter-spacing:.09em;text-transform:uppercase;
}
#stage #level-name {color:var(--match-cream);font:800 clamp(1rem,2.3vw,1.5rem)/1.05 'Nunito',sans-serif;letter-spacing:-.025em;text-align:left;margin:0;overflow-wrap:anywhere;text-shadow:none; -webkit-text-stroke:0;}
#stage .match-score {position:relative;display:grid;grid-template-columns:24px auto;align-items:center;column-gap:4px;min-width:55px; }
#stage .match-score>[data-icon],#stage .match-score svg {display:block;width:24px;height:24px;}
#stage #score {font:900 1.08rem/1 'Nunito',sans-serif;color:var(--match-cream);text-align:right;}
#stage .match-score .score-meter {grid-column:1/-1;width:100%;height:4px;min-height:0;min-width:0;margin:3px 0 0;}
#stage .match-score .score-meter i {display:none;}
#stage .match-status {min-width:0;display:grid;gap:4px;}
#stage .match-ribbon {display:grid;grid-template-columns:minmax(140px,1fr) minmax(60px,.47fr) minmax(110px,1fr);align-items:center;border-radius:17px;padding:5px 10px;gap:8px;}
#stage .match-guardian {display:flex;align-items:center;gap:5px;min-width:0;}
#stage #guardian-portrait {position:relative;flex:0 0 clamp(46px,7.8vw,70px);width:clamp(46px,7.8vw,70px);height:auto;aspect-ratio:1;inset:auto;align-self:center;}
#stage .match-ability {min-width:0;flex:1;display:grid;gap:3px;align-content:center;}
#stage .match-guardian-title {display:flex;align-items:baseline;gap:5px;min-width:0;flex-wrap:wrap;}
#stage #guardian-label {font:900 .94rem/1.07 'Nunito',sans-serif;color:var(--match-cream);}
#stage #guardian-skill {font-size:.64rem;line-height:1.1;color:#edcfe9;}
#stage .power-track {position:relative;box-sizing:border-box;height:12px;width:100%;min-width:0;margin:0;background:#1d1428;border:1px solid #a486a7;border-radius:8px;overflow:hidden;}
#stage #guardian-charge {position:absolute;inset:0;text-align:center;font:800 9px/10px 'Nunito',sans-serif;color:white;text-shadow:0 1px 2px #18021b;}
#stage #guardian-use {position:static;display:flex;align-items:center;justify-content:center;gap:4px;font:800 .73rem/1 'Nunito',sans-serif;min-height:26px;width:100%;padding:3px 5px;margin:0;border-radius:9px;}
#stage #guardian-use>[data-icon],#stage #guardian-use svg {width:13px;height:13px;}
#stage .match-moves {display:grid;align-content:center;justify-items:center;align-self:stretch;gap:1px;border-inline:1px solid #cfb0bd50;}
#stage #moves {font:1000 clamp(1.5rem,3.8vw,2.1rem)/1 'Nunito',sans-serif;color:var(--match-gold);text-shadow:0 2px #553249;}
#stage .match-targets {display:grid;gap:3px;justify-content:center;min-width:0;}
#stage #goals {display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:2px 7px;padding:0;margin:0;}
#stage .goal-token {display:inline-flex;flex-direction:row;align-items:center;gap:1px;min-width:0;padding:0;}
#stage .goal-token>img,#stage .goal-token>svg {width:clamp(20px,3.5vw,31px);height:clamp(20px,3.5vw,31px);object-fit:contain;}
#stage .goal-token strong {position:static;min-width:0;padding:0;background:none;box-shadow:none;border:0;font:900 .93rem/1 'Nunito',sans-serif;}
#stage .battle-tools {display:none;}
#stage .battle-tools:has(> :not([hidden])) {display:flex;flex-wrap:wrap;align-items:center;justify-content:center;border-radius:12px;gap:5px;padding:3px 6px;}
#stage .sb-gift-bag {display:flex;flex:0 1 auto;align-items:center;gap:5px;padding:0;margin:0;min-width:0; }
#stage .sb-gift-bag[hidden],#stage .move-gift[hidden] {display:none;}
#stage .sb-gift-bag strong,#stage .sb-gift-bag small {font-size:.65rem;line-height:1.1;max-width:78px;margin:0;}
#stage .sb-bag-choices {display:flex;margin:0;gap:3px;}
#stage .sb-bag-choices button {width:36px;height:32px;}
#stage .move-gift {width:auto;margin:0;min-height:32px;}
#stage .match-board-space {min-height:0; min-width:0;display:grid;place-items:center;container-type:size;}
#stage .board-frame {box-sizing:border-box;width:min(100cqw,calc((100cqh - 18px)*var(--ratio,1) + 14px),595px);padding:4px;}
#stage .frame-rim {padding:2px;background:#271d37ac;}
#stage .instruction-bar {justify-self:center;align-self:end;max-width:100%;min-width:0;text-align:center;margin:0;padding:2px 8px;box-sizing:border-box;gap:5px;font-size:.77rem;line-height:1.15;}
#stage .instruction-bar>button {flex-shrink:0;}
@media(max-width:520px) {
  #stage .match-heading {gap:4px;padding:4px 5px;}
  #stage .match-tool {width:38px;height:38px;flex-basis:38px;padding:7px;border-radius:12px;}
  #stage .match-ribbon {grid-template-columns:minmax(117px,.95fr) minmax(46px,.36fr) minmax(93px,.83fr);gap:4px;padding:4px 5px;}
  #stage #guardian-skill {display:none;}
  #stage #guardian-portrait {width:46px;flex-basis:46px;}
  #stage .match-score {grid-template-columns:17px auto;min-width:37px;column-gap:1px;}
  #stage .match-score>[data-icon],#stage .match-score svg {width:17px;height:17px;}
  #stage #score {font-size:.85rem;}
  #stage #goals {gap:1px 4px;}
}
@media(orientation:landscape) and (max-height:560px) {
  #stage.battle {gap:2px;padding-top:calc(2px + env(safe-area-inset-top));padding-bottom:calc(2px + env(safe-area-inset-bottom));grid-template-columns:minmax(0,min(100%,760px));}
  #stage .match-heading {border-radius:10px;padding:0 5px;gap:5px;}
  #stage .match-title {display:flex;align-items:baseline;gap:6px;}
  #stage .match-tool {width:33px;height:33px;flex-basis:33px;padding:6px;border-radius:9px;}
  #stage .match-ribbon {border-radius:10px;grid-template-columns:minmax(160px,1fr) minmax(60px,.32fr) minmax(160px,1fr);gap:5px;padding:1px 7px;}
  #stage #guardian-portrait {width:40px;flex-basis:40px;}
  #stage .match-ability {grid-template-columns:minmax(58px,1fr) minmax(76px,.85fr);align-items:center;gap:2px 5px;}
  #stage .match-guardian-title {grid-column:1;grid-row:1;}
  #stage .power-track {grid-column:1;grid-row:2;}
  #stage #guardian-skill {display:none;}
  #stage #guardian-use {grid-column:2;grid-row:1/3;min-height:32px;}
  #stage .match-targets,#stage .match-moves {display:flex;align-items:center;justify-content:center;gap:5px;}
  #stage #moves {font-size:1.4rem;}
  #stage .instruction-bar {font-size:.66rem;min-height:0;padding:0 5px;}
  #stage .instruction-bar>svg {width:18px;height:18px;}
  #stage .instruction-bar>button {width:26px;height:23px;}
}
#stage .match-board-space { align-self: stretch; }
@media(max-width:520px) {
  #stage .sb-bag-choices {flex-wrap:nowrap;}
  #stage .sb-gift-bag strong,#stage .sb-gift-bag small {max-width:62px;}
  #stage .sb-gift-bag {flex:0 1 auto;gap:4px;}
  #stage .sb-bag-choices button {width:32px;min-width:32px;height:32px;}
  #stage .match-board-space {align-items:start;}
}
#stage #guardian-use {min-width:0;overflow-wrap:anywhere;}
@media (orientation:portrait),(min-height:561px) {
  #stage .match-ability {grid-template-columns:minmax(0,1fr);}
}
@media (max-width:365px) {
  #stage #guardian-use>[data-icon] {display:none;}
  #stage .sb-gift-bag {flex-wrap:wrap;justify-content:center;}
  #stage .sb-gift-bag strong,#stage .sb-gift-bag small {max-width:76px;}
}
#home-play[data-entry="new"]::after {
  content:"1";display:inline-flex;align-items:center;justify-content:flex-end;flex:0 0 auto;
  box-sizing:border-box;height:23px;min-width:33px;padding:0 5px 0 18px;border-radius:13px;
  background:#662b46 url("assets/navmark-life.webp") 3px center/15px 15px no-repeat;color:#fff0d7;
  font:900 13px/1 system-ui;text-shadow:none;box-shadow:inset 0 0 0 1px #ffe8c17d;
}
.match-entry-note {color:inherit;text-align:center;font:700 .85rem/1.32 system-ui;margin:10px 0;}
@media(max-height:420px),(max-width:365px){#home-play[data-entry="new"]::after{height:20px;min-width:28px;padding:0 4px 0 15px;background-position:2px center;background-size:13px 13px;font-size:11px;}}
