/* All layout overrides are confined to setup; battle and opening hand styles are untouched. */
body.preBattleMode #setup.hasHeroRoster{gap:14px!important;padding:22px 26px!important}
#setup.hasHeroRoster .preBattleHeader{padding-bottom:12px;gap:16px}
#setup.hasHeroRoster .preBattleHeader .title{font-size:30px}
#setup.hasHeroRoster .preBattleKicker{margin-bottom:5px}
body.preBattleMode #setup.hasHeroRoster .preBattleIntro{margin-top:7px;line-height:1.4}
#setup .rosterOriginalControls{display:none!important}
#setup .rosterTeam{min-width:0}
#setup .rosterTeamHeading{display:flex;align-items:baseline;gap:14px;margin-bottom:8px}
body.preBattleMode #setup .rosterTeamHeading .sectionTitle{margin:0!important;font-family:var(--ca-sans);font-size:14px!important;font-weight:650;letter-spacing:.12em;text-transform:uppercase;color:#f1dfb7}
#setup .rosterTeamHeading>span{font-size:13px;color:#c4c5b0}
#setup .rosterTeam[data-team="pc"]{border-top:1px solid #b7a57740;padding-top:12px}
:where(#setup,.rosterPicker) .rosterRoles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
:where(#setup,.rosterPicker) .rosterRole{min-width:0}
:where(#setup,.rosterPicker) .rosterRoleLabel{font:550 14px var(--ca-sans);color:#d4d4bd;margin:0 0 6px;display:flex;align-items:center;gap:8px}
:where(#setup,.rosterPicker) .rosterRoleLabel:after{content:"";flex:1;height:1px;background:#b7a57733}
:where(#setup,.rosterPicker) .rosterChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
:where(#setup,.rosterPicker) .rosterTile{position:relative;border:1px solid #858268;border-radius:3px;background:#151c16;min-width:0;transition:border-color .15s,box-shadow .15s}
:where(#setup,.rosterPicker) .rosterPick{appearance:none;display:block;position:relative;width:100%;padding:0;border:0;border-radius:2px;background:transparent;color:#eee6cf;text-align:left;cursor:pointer;touch-action:manipulation;overflow:hidden;min-height:142px}
:where(#setup,.rosterPicker) .rosterPortrait{display:block;height:82px;overflow:hidden;background:#151912}
:where(#setup,.rosterPicker) .rosterPortrait img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 4%;transition:transform .2s}
:where(#setup,.rosterPicker) .rosterIdentity{display:grid;gap:1px;padding:6px 8px 8px;min-height:59px;border-top:1px solid #b7a57735}
:where(#setup,.rosterPicker) .rosterIdentity strong{font:550 18px/1.15 var(--ca-serif);overflow-wrap:anywhere}
:where(#setup,.rosterPicker) .rosterIdentity>span{font:400 12px/1.25 var(--ca-sans);color:#c9cbb7}
:where(#setup,.rosterPicker) .rosterSelected{position:absolute;top:6px;left:6px;padding:3px 6px;border:1px solid #e6ca8d;background:#dfc58f;color:#24271b;font:700 12px/1.2 var(--ca-sans);visibility:hidden;border-radius:2px}
:where(#setup,.rosterPicker) .rosterTile.isSelected{border-color:#f1d394;box-shadow:0 0 0 1px #e4c27f,0 0 14px #d9b77120}
:where(#setup,.rosterPicker) .rosterTile.isSelected .rosterIdentity{background:linear-gradient(110deg,#62513765,#243122);border-color:#d1b77466}
:where(#setup,.rosterPicker) .rosterTile.isSelected .rosterSelected{visibility:visible}
:where(#setup,.rosterPicker) .rosterTile:hover{border-color:#e8d3a5}
:where(#setup,.rosterPicker) .rosterPick:hover .rosterPortrait img{transform:scale(1.04)}
:where(#setup,.rosterPicker) .rosterInfo{position:absolute;right:0;top:0;width:44px;height:44px;display:grid;place-items:center;padding:0;border:0;background:transparent;color:#f4e8c6;cursor:pointer;touch-action:manipulation;border-radius:2px}
:where(#setup,.rosterPicker) .rosterInfo span{display:grid;place-items:center;width:24px;height:24px;border:1px solid #d7c596;background:#151b17ed;border-radius:50%;font:600 16px Georgia,serif}
:where(#setup,.rosterPicker) .rosterInfo:hover span{background:#dfc58f;color:#24271b}
#setup .rosterSettings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px 18px;border-top:1px solid #b7a57740;padding-top:10px}
body.preBattleMode #setup .rosterSettings select{min-height:44px!important;font-size:14px!important;margin-top:3px}
#setup.hasHeroRoster .preBattleActions{padding-top:0}
body.theme-candlelit :where(#setup,.rosterPicker) .rosterTile{background:#10202a;border-color:#6e8184}
body.theme-candlelit :where(#setup,.rosterPicker) .rosterTile.isSelected{border-color:#f1d394}
body.theme-candlelit :where(#setup,.rosterPicker) .rosterTile.isSelected .rosterIdentity{background:linear-gradient(110deg,#62513765,#173440)}
body.theme-candlelit :where(#setup,.rosterPicker) .rosterIdentity>span{color:#c2d1d3}
.rosterPreview{color:#eee6cf;background:#20291f;border:1px solid #bdab7f;border-radius:5px;padding:30px;width:min(860px,calc(100% - 32px));max-height:calc(100dvh - 40px);overflow:auto;box-shadow:0 24px 90px #0009;font:400 16px/1.5 var(--ca-sans)}
.rosterPreview::backdrop{background:#080e0bdd;backdrop-filter:blur(4px)}
.rosterPreviewOpen{overflow:hidden!important}
.rosterPreview .rosterClose{position:sticky;float:right;top:0;z-index:2;margin:-19px -19px -25px 0;width:44px;height:44px;border:1px solid #b7a577;background:#172017;color:#f1dfb7;font-size:28px;cursor:pointer;border-radius:3px}
.rosterProfile{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:28px;align-items:start}
.rosterArtwork{width:100%;height:auto;border:1px solid #b7a57766;border-radius:2px}
.rosterBiography{min-width:0;padding-top:6px}
.rosterPreview .rosterEyebrow{font-size:12px;letter-spacing:.15em;color:#d4bf91;margin:0 0 6px}
.rosterPreview h2{font:500 34px/1.1 var(--ca-serif);color:#f1dfb7;margin:0}
.rosterPreview .rosterEpithet{font:400 20px/1.3 var(--ca-serif);margin:5px 0 20px;color:#d9d1ba}
.rosterFacts{display:flex;gap:32px;margin:0 0 20px;padding:12px 0;border-block:1px solid #b7a57744}
.rosterFacts dt{font-size:12px;color:#c2c5af}
.rosterFacts dd{margin:0;font-weight:600}
.rosterPreview h3{font:600 16px/1.3 var(--ca-sans);color:#f1dfb7;margin:18px 0 6px}
.rosterPreview p{margin:0;color:#d9dccd}
.rosterCardToggle{display:block;width:100%;min-height:48px;margin-top:20px;padding:10px 16px;border:1px solid #c0a66c;border-radius:3px;color:#f1dfb7;background:#303b29;font:600 16px var(--ca-sans);cursor:pointer}
.rosterPreview #rosterTechniques{margin-top:22px;scroll-margin-top:44px}
.rosterPreview [hidden]{display:none!important}
.rosterPreview.rosterShowingTechniques #rosterTechniques{margin-top:0}
.rosterPreview.rosterShowingTechniques .rosterTechniqueHeading{padding-right:36px}
.rosterTechniqueHeading{display:flex;align-items:center;justify-content:space-between;gap:14px;padding-block:8px 16px;border-bottom:1px solid #b7a57755}
.rosterPreview .rosterTechniqueHeading h3{font:500 25px/1.2 var(--ca-serif);margin:0}
.rosterTechniquesBack{flex-shrink:0;min-height:44px;padding:8px 12px;border:1px solid #b7a577;background:#172017;color:#f1dfb7;border-radius:3px;font:500 14px var(--ca-sans);cursor:pointer}
.rosterTechniqueGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px 16px}
.rosterTechnique{min-width:0;background:#b7a57708;border:1px solid #b7a57744;border-radius:3px;padding:10px}
.rosterTechnique img{display:block;width:100%;height:auto;border-radius:3px}
.rosterPreview .rosterTechnique h4{font:550 20px/1.2 var(--ca-serif);color:#f1dfb7;margin:12px 0 4px}
.rosterPreview .rosterTechnique p{font-size:14px;line-height:1.5;margin:8px 0}
.rosterPreview .rosterTechnique .rosterTechniqueMeta{color:#e6ce9e;font-weight:600}
.rosterPreview .rosterTechnique .rosterTechniqueAccess{color:#c0c6b6;border-top:1px solid #b7a57733;padding-top:8px;margin-bottom:0}
.rosterTechniqueLevel{font:600 16px var(--ca-sans);margin:18px 0 12px;color:#f1dfb7}
.rosterTechniquePath{border-top:1px solid #b7a57755;margin-top:20px;padding-top:8px}
.rosterPreview .rosterTechniquePath summary{display:list-item;min-height:44px;padding:8px 0;font:550 16px/1.5 var(--ca-sans);cursor:pointer;color:#f1dfb7}
.rosterTechniquePath[open] summary{margin-bottom:12px}
@media(max-width:760px){.rosterTechniqueGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.rosterTechniqueHeading{align-items:flex-start;flex-direction:column}}
@media(max-width:520px){.rosterTechniqueGrid{grid-template-columns:1fr}.rosterTechnique{padding:12px}.rosterPreview .rosterTechnique p{font-size:16px}.rosterPreview .rosterTechnique h4{font-size:23px}}
body.theme-candlelit .rosterPreview{background:#15252f}
body.theme-candlelit .rosterCardToggle,body.theme-candlelit .rosterClose{background:#253b44}
@media(min-width:1000px) and (max-height:800px){
  body.preBattleMode #setup.hasHeroRoster{padding:16px 24px!important;gap:10px!important}
  :where(#setup,.rosterPicker) .rosterPortrait{height:72px}
  :where(#setup,.rosterPicker) .rosterPick{min-height:132px}
  #setup.hasHeroRoster .preBattleHeader .title{font-size:28px}
}
@media(max-width:760px){
  body.preBattleMode #setup.hasHeroRoster{padding:18px 16px!important;gap:18px!important}
  :where(#setup,.rosterPicker) .rosterRoles{grid-template-columns:1fr;gap:14px}
  :where(#setup,.rosterPicker) .rosterPortrait{height:110px}
  :where(#setup,.rosterPicker) .rosterPick{min-height:170px}
  :where(#setup,.rosterPicker) .rosterIdentity strong{font-size:20px}
  :where(#setup,.rosterPicker) .rosterIdentity>span{font-size:13px}
  #setup .rosterTeamHeading{gap:8px;flex-wrap:wrap}
  #setup .rosterSettings{grid-template-columns:1fr 1fr;gap:12px}
  #setup .rosterSettings .label:has(#pcPolicy){grid-column:1/-1}
  #setup.hasHeroRoster .preBattleActions{display:grid;grid-template-columns:1fr 1fr}
  #setup.hasHeroRoster #deal{grid-column:1/-1}
  #setup.hasHeroRoster .preBattleActions a{justify-content:center;padding:8px;font-size:14px!important}
  .rosterPreview{width:calc(100% - 16px);max-height:calc(100dvh - 16px);padding:20px;border-radius:8px}
  .rosterProfile{grid-template-columns:1fr;gap:18px}
  .rosterArtwork{max-height:280px;object-fit:contain;background:#111a15}
  .rosterPreview .rosterClose{margin:-13px -13px -25px 0}
  .rosterBiography{padding:0}
}
@media(max-width:359px){
  body.preBattleMode #setup.hasHeroRoster{padding:14px 10px!important}
  :where(#setup,.rosterPicker) .rosterChoices{gap:8px}
  :where(#setup,.rosterPicker) .rosterSelected{font-size:11px;left:4px}
  #setup .rosterSettings{grid-template-columns:1fr}
}
@media(prefers-reduced-motion:reduce){:where(#setup,.rosterPicker) .rosterPick:hover .rosterPortrait img{transform:none}}

/* Class-first setup. The roster is generated from each original select's options,
   and its auto-filling grid and bounded dialog support additional Heroes. */
#setup .rosterClassSlot{display:block;min-width:0;width:100%;padding:0;border:1px solid #ad9868;border-radius:3px;background:#192218;color:#eee6cf;text-align:left;cursor:pointer;overflow:hidden}
#setup .rosterSlotRole{display:flex;align-items:center;justify-content:space-between;padding:9px 12px;font:600 14px var(--ca-sans);letter-spacing:.06em;color:#f1dfb7;border-bottom:1px solid #b7a57755;background:#b7a5770a}
#setup .rosterSlotHero{display:flex;align-items:stretch;min-height:115px}
#setup .rosterSlotHero>img{width:34%;height:115px;max-width:130px;object-fit:cover;object-position:center 6%;border-right:1px solid #b7a57755}
#setup .rosterSlotIdentity{display:flex;flex:1;flex-direction:column;align-items:flex-start;justify-content:center;min-width:0;padding:12px;gap:3px}
#setup .rosterSlotIdentity>strong{font:500 22px/1.1 var(--ca-serif);overflow-wrap:anywhere;color:#f2dfb5}
#setup .rosterSlotIdentity>span{font:400 13px/1.3 var(--ca-sans);color:#d0d2c0}
#setup .rosterSlotRole .rosterSlotBrowse{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:400;letter-spacing:0;color:#dbc28c}
#setup .rosterSlotBrowse>span{font-size:19px;line-height:1;flex-shrink:0}
#setup .rosterClassSlot:hover{background:#2a3424;border-color:#f1d394;box-shadow:0 0 0 1px #d6b67a}
body.theme-candlelit #setup .rosterClassSlot{background:#142832}
body.theme-candlelit #setup .rosterClassSlot:hover{background:#243c46}
.rosterPicker{width:min(820px,calc(100% - 32px));max-height:calc(100dvh - 40px);padding:0;border:1px solid #bdab7f;border-radius:5px;background:#20291f;color:#eee6cf;font:400 16px/1.5 var(--ca-sans);box-shadow:0 24px 90px #0009;overflow:hidden}
.rosterPicker[open]{display:flex;flex-direction:column}
.rosterPicker::backdrop{background:#080e0bdd;backdrop-filter:blur(4px)}
.rosterPickerHeader{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:22px 26px 16px;border-bottom:1px solid #b7a57755}
.rosterPicker .rosterEyebrow{font-size:12px;letter-spacing:.15em;text-transform:uppercase;color:#d4bf91;margin:0 0 5px}
.rosterPicker h2{font:500 30px/1.2 var(--ca-serif);color:#f1dfb7;margin:0}
.rosterPickerHint{margin:6px 0 0;color:#d0d2c0;font-size:16px}
.rosterPickerClose{flex-shrink:0;width:44px;height:44px;border:1px solid #b7a577;background:#172017;color:#f1dfb7;font-size:28px;cursor:pointer;border-radius:3px}
.rosterPickerBody{overflow-y:auto;overscroll-behavior:contain;min-height:0;padding:24px 26px}
.rosterPicker .rosterRoleLabel{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
.rosterPicker .rosterChoices{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:16px}
.rosterPicker .rosterPortrait{height:240px}
.rosterPicker .rosterPortrait img{object-position:center 8%}
.rosterPicker .rosterIdentity{min-height:76px;padding:10px 12px}
.rosterPicker .rosterIdentity strong{font-size:22px}
.rosterPicker .rosterIdentity>span{font-size:14px}
.rosterPicker .rosterSelected{font-size:12px}
.rosterPicker .rosterTile.isSelected{border-color:#f1d394}
.rosterPickerFooter{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 26px;border-top:1px solid #b7a57755;background:#182117}
.rosterPickerSummary{font-size:16px;color:#ecdfbd}
.rosterDone{min-width:130px;min-height:44px;border:1px solid #f1d394;border-radius:3px;padding:8px 22px;background:#d3bd8c;color:#24281d;font:600 16px var(--ca-sans);cursor:pointer}
body.theme-candlelit .rosterPicker{background:#15252f}
body.theme-candlelit .rosterPickerFooter{background:#11212b}
@media(max-width:760px){
  #setup .rosterRoles{gap:10px}
  #setup .rosterSlotHero{min-height:100px}
  #setup .rosterSlotHero>img{width:32%;height:100px;max-width:115px;max-height:120px}
  #setup .rosterSlotIdentity>strong{font-size:22px}
  .rosterPicker{width:calc(100% - 16px);max-height:calc(100dvh - 16px);border-radius:8px}
  .rosterPickerHeader{padding:16px;gap:12px}
  .rosterPicker h2{font-size:28px}
  .rosterPickerBody{padding:16px}
  .rosterPicker .rosterChoices{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .rosterPicker .rosterPortrait{height:160px}
  .rosterPicker .rosterIdentity{padding:8px;min-height:80px}
  .rosterPicker .rosterIdentity strong{font-size:20px}
  .rosterPickerFooter{padding:12px 16px}
  .rosterDone{min-width:88px}
}
@media(max-width:359px){.rosterPickerBody{padding:14px 10px}.rosterPicker .rosterPortrait{height:130px}.rosterPicker .rosterSelected{font-size:11px}}
