/* Production palace battlefield. Existing controls and saved decks stay authoritative. */
html.rebel-battle { --rebel-ivory:#f5ecd8; --rebel-red:#b71930; --rebel-ink:#101012; }
html.rebel-battle .game-shell.battle-layout {
  position:relative;isolation:isolate;width:100%;max-width:none;height:100dvh;min-height:0;padding:0;overflow:hidden;
  background:#141313 url('./assets/ui/rebel-arena-test.webp') center/100% 100% no-repeat;border:0;
}
html.rebel-battle .game-shell.battle-layout::before,html.rebel-battle .game-shell.battle-layout::after {content:none;}
/* Scene artwork replaces the arena at full opacity; only the separate tint may be translucent. */
html.rebel-battle .game-shell #sceneBackdrop {opacity:1;}
html.rebel-battle .rebel-test-badge {position:fixed;left:18px;top:18px;z-index:21;color:#eee3cd;text-decoration:none;border-left:1px solid #b6986e;padding:0 12px;font-family:'Songti SC',serif;}
html.rebel-battle .rebel-test-badge b{display:block;font-size:18px;font-weight:400;font-style:italic;letter-spacing:2px;}
html.rebel-battle .rebel-test-badge span{display:block;margin-top:5px;font:9px system-ui;color:#c4b6a6;letter-spacing:1px;}
html.rebel-battle:has(#introOverlay:not(.hidden)) .rebel-test-badge{top:auto;bottom:12px;background:#141214e8;padding:8px 12px;}
html.rebel-battle .rebel-match-signature{position:absolute;right:26px;top:12px;pointer-events:none;font:28px 'Songti SC',serif;color:#eee3d4;letter-spacing:4px;z-index:1;}
html.rebel-battle .rebel-match-signature small{display:block;text-align:center;font:8px Georgia;margin-top:5px;letter-spacing:3px;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout,
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout:has(#mulliganPanel:not(.hidden)) {
  --leader-width:clamp(150px,22vw,280px);--leader-height:22dvh;--hand-card-height:22dvh;
  display:grid;grid-template-columns:13% 1fr var(--leader-width) 1fr 13%;
  grid-template-rows:22dvh 24dvh 3dvh 24dvh 27dvh;grid-template-areas:none;gap:0;
}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout > .player-panel,
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.center-board,.target-zone){display:contents;}
html.rebel-battle .theme-feijin.phase-one .battle-layout > .topbar {position:absolute;inset:76px 24px auto auto;grid-area:auto;display:flex;padding:0;background:none;border:0;min-height:0;z-index:20;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-status-strip{position:absolute!important;left:18px;top:28%;width:11%;display:flex;flex-direction:column;align-items:stretch;gap:6px;grid-area:auto;z-index:4;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.turn-counter,.trait-status){background:#0d0c0ccd;border:0;border-left:2px solid #932337;border-radius:0;color:#dfd4be;font:12px/1.5 system-ui;white-space:normal;min-height:0;padding:6px 9px;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .log-panel{position:absolute!important;inset:54% auto auto 18px;width:11%;max-height:18%;padding:8px;background:#100e0ac9;border:0;border-left:1px solid #7c664a;grid-area:auto;z-index:4;overflow:hidden;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .log-panel h2{font-size:11px;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-log{font:10px/1.5 system-ui;max-height:80px;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.battle-details,.battle-emote-area){display:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #turnNotice{position:relative;grid-area:3/2/4/5;inset:auto;height:auto;padding:1px 10px;margin:0;align-self:center;text-align:center;font:12px/1.5 system-ui;z-index:5;border:0;background:#0b0a0ac7;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #turnNotice:not(.is-action-notice){visibility:hidden;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader {
  position:relative;isolation:isolate;width:var(--leader-width);height:var(--leader-height);max-height:none;min-height:0;padding:0;justify-self:center;align-self:start;transform:none;
  border:0;border-radius:0;background:none;box-shadow:none;z-index:5;overflow:visible;
}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.enemy.has-deck-leader{grid-area:1/3;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.player.has-deck-leader{grid-area:5/3;align-self:end;height:25dvh;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader::before{content:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-portrait {
  position:absolute;display:block;inset:0;width:100%;height:100%;overflow:hidden;border:2px solid #9b8059;border-bottom:3px solid #c4a66f;
  border-radius:46% 46% 12% 12%;background:radial-gradient(ellipse,#716044,#16120f 72%);box-shadow:0 0 0 3px #151211,0 0 0 4px #665139,0 4px 18px #0008;
}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-art {
  position:absolute;inset:-3% auto auto -24%;width:148%;height:auto;max-width:none;object-fit:cover;object-position:center top;mask-image:none;filter:none;border:0;transform:none;
}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-name{display:block;position:absolute;inset:auto 12px 0;width:auto;height:23px;line-height:23px;background:#131012dd;text-align:center;font-size:12px;z-index:2;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader > div {
  position:absolute;inset:auto -25px 21px auto;display:grid;place-items:center;width:56px;height:64px;min-width:0;padding:0;
  color:#fff0dd;background:linear-gradient(135deg,#a4323c,#53121e);border:2px solid #bd9b63;border-radius:0;
  clip-path:polygon(0 0,50% 9%,100% 0,100% 77%,50% 100%,0 77%);box-shadow:none;z-index:4;
}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader .health-line {display:flex;flex-direction:column;gap:0;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line strong{font:700 34px/1 Georgia;color:#fff1da;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hero.has-deck-leader :is(.role,.ping-badge){display:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-max-health{display:block;font:9px/1.1 system-ui;color:#d7b5a4;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-level,
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .evo{position:absolute;inset:auto auto 7px -58px;min-width:45px;width:auto;height:auto;border:1px solid #8c7451;border-radius:0;background:#141110ec;color:#e9d6ac;padding:4px;font:11px/1.2 system-ui;text-align:center;z-index:4;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .evo{bottom:34px;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-economy{position:absolute;inset:auto auto 6px calc(100% + 44px);width:185px;transform:none;padding:7px 13px;gap:4px;background:#100f10ed;border:0;border-top:1px solid #77644a;z-index:3;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-balance{display:block;white-space:nowrap;height:auto;padding:0;border:0;border-radius:0;background:none;box-shadow:none;font:17px/1.3 'Songti SC',serif;color:#f0ddba;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .phase1-balance::before,html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .phase1-balance::after{content:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-next{display:block;white-space:normal;font:10px/1.4 system-ui;color:#b3a58c;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-upgrades{position:absolute;inset:5px auto auto -51px;width:34px;height:40px;z-index:4;padding:0;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .phase1-upgrades img{width:23px;height:34px;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.player .phase1-skills,
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.player .chess-skills{position:absolute;inset:auto auto 72px -60px;display:flex;flex-direction:column;gap:7px;width:auto;transform:none;pointer-events:auto;z-index:5;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero .phase1-skills[hidden],html.rebel-battle .theme-feijin.phase-one .battle-layout .hero .chess-skills[hidden]{display:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .phase1-skills button{display:grid;place-items:center;min-height:0;width:40px;height:40px;flex:0 0 40px;padding:0;border:1px solid #b2986b;border-radius:50%;background:#19171a;color:#f1dec3;font:24px Georgia;box-shadow:inset 0 0 0 3px #262126;}
html.rebel-battle .theme-feijin.phase-one .battle-layout [data-leader-skill='dominion']{background:#65172a;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #enemyBoard{grid-area:2/2/3/5;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #playerBoard{grid-area:4/2/5/5;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .board-row{position:relative;display:flex;container-type:size;align-items:center;justify-content:center;gap:12px;padding:6px 10px;width:100%;height:100%;min-height:0;background:none;border:0;overflow:visible;z-index:3;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-row .empty-slot{display:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .board-row .board-card{width:min(135px,calc(100cqh * 2 / 3 - 8px),calc((100cqw - 96px) / 7));height:auto;min-height:0;max-height:none;min-width:0;aspect-ratio:2/3;flex:0 0 auto;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.hand-row,.board-row) .card.ready {filter:drop-shadow(0 0 3px #d9b387);}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .card.selected{outline:2px solid #f0e6ca;outline-offset:3px;box-shadow:5px 5px 0 #ad1c32;}
html.rebel-battle .theme-feijin.phase-one .battle-layout > .hand-panel,
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)){position:absolute;inset:auto auto 0 14px;width:calc(50% - var(--leader-width)/2 - 85px);height:24dvh;min-height:0;grid-area:auto;padding:0;border:0;background:none;overflow:visible;z-index:6;display:block;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel #playerHand{position:relative;inset:auto;display:flex;width:100%;height:100%;max-height:none;min-height:0;flex:auto;align-items:end;justify-content:start;padding:8px 4px 3px;gap:0;overflow:visible;container-type:inline-size;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel #playerHand .card{width:calc(var(--hand-card-height)*2/3);height:var(--hand-card-height);min-height:0;max-height:none;flex:0 0 calc(var(--hand-card-height)*2/3);aspect-ratio:2/3;padding:0;margin-left:min(0px,calc((100cqw - var(--hand-card-height)*2/3) / max(1,var(--hand-count) - 1) - var(--hand-card-height)*2/3));transform:none;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel #playerHand .card:first-child{margin-left:0;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-card-face{rotate:var(--fan-angle,0deg);transform-origin:center bottom;transition:rotate 160ms,transform 160ms;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #playerHand .card:is(:hover,:focus-visible) .hand-card-face{rotate:0deg;transform:translateY(-12px) scale(1.08);}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel.hand-spread-open #playerHand,
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand{position:fixed;left:50%;top:43%;bottom:auto;transform:translate(-50%,-50%);width:calc(100vw - 120px);height:calc(42dvh + 24px);--hand-card-height:42dvh;padding:12px;display:flex;gap:12px;justify-content:safe center;overflow-x:auto;overflow-y:hidden;pointer-events:auto;background:#121013df;border-block:1px solid #8d7250;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel.hand-spread-open #playerHand .card,
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand .card{margin:0;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-spread-open .hand-card-face,html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :has(#mulliganPanel:not(.hidden)) .hand-card-face{rotate:0deg;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-spread-backdrop{position:fixed;inset:0;z-index:12;border:0;background:transparent;}
html.rebel-battle .theme-feijin.phase-one .battle-layout > .hand-panel:is(.hand-spread-open,.hand-spread-moving){z-index:13;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-pick-actions{position:fixed;inset:calc(64% + 22px) auto auto 50%;transform:translateX(-50%);width:auto;display:flex;gap:12px;pointer-events:auto;z-index:14;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .mulligan-panel{position:fixed;inset:68% auto auto 50%;transform:translateX(-50%);width:min(520px,70vw);height:auto;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 22px;background:#171316;border:1px solid #a17c50;border-left:4px solid #b72035;z-index:14;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .mulligan-panel.hidden{display:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .mulligan-panel :is(strong,p,span){font-size:12px;}
html.rebel-battle .theme-feijin.phase-one .battle-layout > .deck-dock{position:absolute;grid-area:auto;inset:27% 18px auto auto;width:11%;max-width:155px;display:flex;flex-direction:column;gap:8px;padding:0;z-index:6;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton{order:3;width:clamp(72px,10vw,138px);height:clamp(72px,10vw,138px);min-height:0;padding:0 0 .45em;margin:10px 0;position:relative;isolation:isolate;border:0;border-radius:50%;background:transparent;box-shadow:none;color:#f3e8cf;font:500 clamp(12px,1.3vw,20px) 'Songti SC',serif;white-space:nowrap;}
html.rebel-battle .theme-feijin.phase-one .battle-layout :is(.deck-pack,#phase1SpecialPileButton){width:70px;height:92px;min-height:0;margin:0;padding:8px 3px;border:1px solid #9d8259;border-radius:2px;background:#18141a;box-shadow:inset 0 0 0 4px #191617,inset 0 0 0 5px #6a523a;color:#e3d5b5;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack-back{display:none;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack:before,html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack:after{background:#151214;border-color:#65513a;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack strong{font-size:15px;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #phase1DiscardButton{font-size:11px;background:#171317;border:1px solid #765b41;color:#deceb1;}
html.rebel-battle .phase-one .battle-menu .top-actions{width:144px;background:#161318;border:1px solid #8e7452;}
html.rebel-battle .phase-one .battle-menu .top-actions button{min-height:36px;white-space:nowrap;}
html.rebel-battle #previewSurrender{color:#ff8090;border-top:1px solid #77303c;}
html.rebel-battle #phase1DrawPrompt{background:#141214f5;border:1px solid #ad8360;border-top:3px solid #ac1a30;}
html.rebel-battle :is(#phase1DrawPrompt,.mulligan-panel,.hand-pick-actions,.battle-menu) button{background:#201b20;color:#f6e8d0;border:1px solid #8c715b;border-radius:0;}
html.rebel-battle .theme-feijin.phase-one :is(.game-shell,#phase1DrawPrompt) button:not(:disabled):not(.hand-spread-backdrop):not(.card):not(#endTurnButton):is(:hover,:focus-visible),
html.rebel-battle #rebelSurrenderDialog button:not(:disabled):not(.hand-spread-backdrop):not(.card):not(#endTurnButton):is(:hover,:focus-visible){background:#fff4dc;color:#100f12;box-shadow:3px 3px 0 #a31c30;border-color:#fff1d2;text-shadow:none;}
html.rebel-battle #cardPlayEffects .play-fx-group{--fx-color:#d6384f;}
html.rebel-battle #cardPlayEffects .play-fx-card{border-radius:0;border:2px solid #fff0d0;box-shadow:6px 5px 0 #a41932;}
html.rebel-battle #cardPlayEffects .play-fx-impact{border-radius:0;border:2px solid #f7dfb4;clip-path:polygon(10% 0,100% 15%,85% 100%,0 80%);background:#ac193133;}
html.rebel-battle #cardPlayEffects .play-fx-label{background:#aa1830;color:#fff2d5;border:0;clip-path:polygon(5% 0,100% 5%,95% 100%,0 90%);font:16px 'Songti SC',serif;padding:9px 24px;}
html.rebel-battle #rebelSurrenderDialog{position:fixed;inset:0;margin:auto;width:min(770px,76vw);height:auto;aspect-ratio:1.8;max-width:none;max-height:85dvh;overflow:auto;padding:0;border:1px solid #51292d;border-radius:0;background:#121214 url('./assets/ui/rebel-surrender-test.webp') center/100% 100%;color:#f3e6cf;box-shadow:0 12px 42px #0009;}
html.rebel-battle #rebelSurrenderDialog::backdrop{background:#05040770;}
html.rebel-battle #rebelSurrenderDialog h2{position:relative;margin:7% 8% 0;height:25%;font:italic clamp(30px,4.9vw,70px)/1.2 'Songti SC','STSong',serif;letter-spacing:2px;color:#fff0d4;transform:rotate(-3deg);}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-close{position:absolute;right:2%;top:2%;z-index:1;border:0;background:none;color:#f8eedf;font:34px/1 system-ui;width:36px;height:36px;cursor:pointer;}
html.rebel-battle .rebel-dialog-body{padding:2% 7% 3%;text-align:center;}
html.rebel-battle .rebel-divider{font-size:22px;color:#c9b9a3;line-height:1.1;}
html.rebel-battle .rebel-dialog-body p{margin:3% 0 6%;font:clamp(14px,1.65vw,24px)/1.7 'Songti SC',serif;}
html.rebel-battle .rebel-dialog-actions{display:flex;gap:5%;}
html.rebel-battle .rebel-dialog-actions button{flex:1;min-width:0;min-height:44px;padding:12px 10px;background:#111013;border:1px solid #d9c8ac;border-radius:0;color:#f3e7d0;clip-path:polygon(4% 0,92% 0,100% 50%,96% 100%,4% 100%,0 50%);font:clamp(16px,2vw,28px) 'Songti SC',serif;cursor:pointer;box-shadow:inset 0 0 0 4px #161318;}
html.rebel-battle .rebel-dialog-actions .rebel-confirm{background:#a41c30;border-color:#dc4652;box-shadow:inset 0 0 0 4px #811a29;}
html.rebel-battle .rebel-dialog-actions button:disabled{opacity:.45;cursor:not-allowed;}
html.rebel-battle .rebel-dialog-body small{display:block;margin-top:4%;font:11px 'Songti SC',serif;color:#867a73;}
@media(max-width:999px){
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout{--leader-width:140px;--leader-height:21dvh;--hand-card-height:22dvh;}
 html.rebel-battle .rebel-test-badge{top:7px;left:8px;padding-left:6px;}html.rebel-battle .rebel-test-badge b{font-size:12px;}html.rebel-battle .rebel-test-badge span{font-size:7px;letter-spacing:0;}
 html.rebel-battle .rebel-match-signature{right:10px;top:5px;font-size:18px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout > .topbar{top:42px;right:8px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader>div{right:-9px;bottom:14px;width:30px;height:38px;border-width:1px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line strong{font-size:23px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-max-health{font-size:7px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-name{font-size:8px;line-height:13px;height:13px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader :is(.phase1-level,.evo){left:-33px;font-size:8px;min-width:28px;padding:2px;bottom:3px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .evo{bottom:22px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-economy{left:calc(100% + 15px);width:109px;padding:4px 6px;bottom:2px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-balance{font-size:12px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-next{font-size:8px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.player .phase1-skills{left:-32px;bottom:43px;gap:3px;flex-direction:row;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .phase1-skills button{width:26px;height:26px;flex-basis:26px;font-size:17px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .phase1-upgrades{left:-33px;top:0;width:25px;height:24px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout > .hand-panel{left:7px;width:calc(50% - var(--leader-width)/2 - 40px);}
 html.rebel-battle .theme-feijin.phase-one .battle-layout > .deck-dock{right:7px;top:30%;gap:3px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout :is(.deck-pack,#phase1SpecialPileButton){width:45px;height:48px;padding:2px;}
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack strong{font-size:11px;}
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .deck-pack span{font-size:9px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton{width:62px;height:62px;min-height:0;margin-top:5px;font-size:11px;}
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-status-strip{left:6px;top:28%;width:12%;gap:2px;}
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.turn-counter,.trait-status){font-size:9px;padding:2px 5px;}
 html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .log-panel{display:none;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .board-row{gap:5px;padding:3px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .board-row .board-card{width:min(calc(100cqh * 2 / 3 - 4px),calc((100cqw - 40px) / 7));}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .mulligan-panel{width:70vw;padding:6px 10px;gap:5px;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .mulligan-panel :is(strong,p,span){font-size:10px;}
 html.rebel-battle #rebelSurrenderDialog{width:min(650px,80vw);max-height:91dvh;}
 html.rebel-battle .rebel-dialog-actions button{padding:8px;min-height:36px;}
 html.rebel-battle .rebel-dialog-body small{font-size:8px;margin-top:2%;}
}
@media(prefers-reduced-motion:reduce){html.rebel-battle .hand-card-face{transition:none;}}
html.rebel-battle .salon-reduced-motion .hand-card-face{transition:none;}

html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-status-strip{position:absolute!important;background:none;box-shadow:none;border:0;flex-wrap:nowrap;justify-content:start;align-content:start;min-height:0;max-height:24dvh;overflow:hidden;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-status-strip > *{display:block;width:100%;max-width:100%;flex:none;box-sizing:border-box;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .log-panel{position:absolute!important;display:block;box-sizing:border-box;}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:not(.hand-spread-open) .hand-pick-actions{display:none;}
/* Illustrated polygon strokes remain intact instead of clipping a rectangular border. */
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button{position:relative;isolation:isolate;overflow:visible;clip-path:none;border:0;background:transparent;box-shadow:none;letter-spacing:2px;font-weight:400;padding:16px 12px;transition:transform 140ms,color 140ms;}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button::before{content:'';position:absolute;inset:-5px -9px;z-index:-1;pointer-events:none;background:url('./assets/ui/rebel-button-continue.svg') center/100% 100% no-repeat;transition:filter 140ms;}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions .rebel-confirm::before{background-image:url('./assets/ui/rebel-button-surrender.svg');}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button:not(:disabled):is(:hover,:focus-visible){background:transparent;color:#101012;box-shadow:none;transform:translateY(-2px);}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button:not(:disabled):is(:hover,:focus-visible)::before{filter:brightness(0) invert(1);}
html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button:active{transform:translateY(1px);}
@media(prefers-reduced-motion:reduce){html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button,html.rebel-battle #rebelSurrenderDialog .rebel-dialog-actions button::before{transition:none;}}

/* feijin.css groups these panels with an ID in :is(); keep their positioning explicit here. */
@media(min-width:1000px){html.rebel-battle .hand-pick-actions :is(.hand-pick-play,.hand-pick-inspect){display:none;}}
@media(max-width:999px){html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .log-panel{display:none;}}

html.rebel-battle .game-shell #playerHand .hand-card-face{container-type:inline-size;}
html.rebel-battle .game-shell #playerHand .ornate-card .card-name{font-size:min(8cqw,calc(145cqw / var(--title-length,8)));line-height:1.2;text-align:center;}
html.rebel-battle .game-shell #playerHand .cost{width:14cqw;height:14cqw;min-width:0;font-size:9cqw;line-height:1;display:grid;place-items:center;}

/* Layered leader: each visual part can be replaced and positioned independently. */
html.rebel-battle .hero{--leader-frame-inset:-10% -13% -7%;--leader-metal-opacity:.92;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader::after{content:none;}
html.rebel-battle .hero [data-leader-layer]{position:absolute;pointer-events:none;}
html.rebel-battle .hero .rebel-leader-backplate{inset:0;z-index:0;border-radius:49% 49% 28% 28%;background:radial-gradient(ellipse at 50% 35%,#44382c,#100e0d 78%);box-shadow:0 4px 12px #000a;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-portrait{z-index:1;border:0;border-radius:49% 49% 28% 28%;box-shadow:none;background:transparent;}
html.rebel-battle .hero .rebel-leader-ornament{inset:var(--leader-frame-inset);z-index:3;background:url('./assets/ui/rebel-leader-ornament-v2.png') center/100% 100% no-repeat;opacity:var(--leader-metal-opacity);filter:drop-shadow(0 2px 2px #000b);}
html.rebel-battle .hero .rebel-leader-sheen{inset:2% 3%;z-index:2;border-radius:49% 49% 28% 28%;box-shadow:inset 1px 1px 1px #efd2a33d;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader>div{border:0;clip-path:none;background:url('./assets/ui/rebel-health-shield.svg') center/100% 100% no-repeat;box-shadow:none;right:-21px;bottom:17px;width:61px;height:74px;padding-top:7px;filter:drop-shadow(0 3px 3px #000b);z-index:5;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line strong{font-weight:400;font-size:37px;text-shadow:0 2px 2px #1c0808;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.player.has-deck-leader>div{top:12%;bottom:auto;}
html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .battle-leader-name{z-index:4;background:linear-gradient(90deg,transparent,#100e0de8 22%,#100e0de8 78%,transparent);}
@media(max-width:999px){html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader>div{width:37px;height:46px;right:-12px;bottom:7px;padding-top:4px;}html.rebel-battle .theme-feijin.phase-one .battle-layout .hero.has-deck-leader .health-line strong{font-size:25px;}}
/* Restore desktop bottom-row spread; only the hovered card grows. Mulligan stays separate. */
@media(min-width:1000px){
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-panel.hand-spread-open:not(:has(#mulliganPanel:not(.hidden))) #playerHand{--hand-card-height:min(24dvh,240px,calc((100vw - 120px - (var(--hand-count) - 1) * 8px) / var(--hand-count) * 1.5));inset:auto auto 8px 50%;transform:translateX(-50%);width:min(calc(100vw - 48px),calc(var(--hand-count) * var(--hand-card-height) * 2 / 3 + (var(--hand-count) - 1) * 8px + 24px));height:calc(var(--hand-card-height) + 64px);align-items:end;background:transparent;border:0;box-shadow:none;gap:8px;padding:52px 12px 8px;overflow:visible;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-spread-backdrop{background:transparent;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-pick-actions{display:flex;inset:auto 24px 18px auto;transform:none;}
 html.rebel-battle .theme-feijin.phase-one .battle-layout .hand-spread-open #playerHand .card:is(:hover,:focus-visible) .hand-card-face{transform:translateY(-18px) scale(1.2);}
}

/* Turn control: transparent metal artwork beneath the live label and state. */
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton::before{content:"";position:absolute;inset:-17%;z-index:-1;pointer-events:none;background:url('./assets/ui/rebel-end-turn-v2.png') center/contain no-repeat;transition:filter 150ms;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:is(:hover,:focus-visible){background:transparent;box-shadow:none;border:0;color:#fff0d0;text-shadow:0 1px 3px #000;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:not(:disabled):is(:hover,:focus-visible)::before{filter:brightness(1.25);}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:disabled::before{filter:brightness(.65) saturate(.6);}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:active:not(:disabled){transform:translateY(1px);}

/* Keep the enamel opaque even while the action is disabled. */
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton{opacity:1;filter:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton::after{content:"";position:absolute;inset:2% 5% 12%;border-radius:50%;background:#0b1013;z-index:-2;pointer-events:none;}
html.rebel-battle .theme-feijin.phase-one .battle-layout #endTurnButton:disabled{opacity:1;filter:none;color:#958c7d;}

/* Keep hit boxes stationary. Painted hand faces may grow, but cannot steal hover. */
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.board-row, #playerHand) > .card,
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(.board-row, #playerHand) > .card:is(:hover, :focus-visible, :active) {
  transform: none; rotate: none; scale: none;
  transition: border-color 140ms, box-shadow 140ms, opacity 140ms;
}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .board-card.dragging { animation: none; }
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(#playerHand, #merchantHand) .hand-card-face,
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(#playerHand, #merchantHand) .hand-card-face * { pointer-events: none; }
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-spread-moving :is(#playerHand, #merchantHand) .hand-card-face {
  transform: none; rotate: 0deg; transition: none;
}
@media (hover: none) {
  html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout :is(#playerHand, #merchantHand) .card:is(:hover, :focus-visible) .hand-card-face { transform: none; }
}
@media (orientation: landscape) and (max-width: 999px) and (max-height: 550px) {
  html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .hand-panel:has(#mulliganPanel:not(.hidden)) #playerHand {
    height: 128px; max-height: 128px; align-items: center;
  }
  html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout #playerHand .cost {
    width: clamp(22px, 22cqw, 30px); height: clamp(22px, 22cqw, 30px);
    min-width: 22px; min-height: 22px; padding: 0;
    font-size: clamp(14px, 15cqw, 20px); line-height: 1;
  }
}
html.rebel-battle .theme-feijin.phase-one .game-shell.battle-layout .battle-menu .battle-emote-area { display: block; position: relative; inset: auto; }
html.rebel-battle .battle-menu .emote-panel { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
html.rebel-battle .battle-menu .emote-frame { display: block; position: relative; max-height: 32dvh; overflow: auto; width: 100%; }
html.rebel-battle .game-shell > #emoteBubble { position: absolute; inset: 48% auto auto 50%; transform: translate(-50%, -50%); z-index: 22; pointer-events: none; }
