.heroes-page .hero-main{padding:12px;min-width:0}
.hero-tools{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
.hero-layout{display:grid;grid-template-columns:210px minmax(0,1fr);gap:12px;align-items:start}
.hero-roster{position:sticky;top:58px;height:calc(100dvh - 75px);overflow:auto;border:1px solid var(--line);background:var(--surface)}
.roster-filters{display:grid;grid-template-columns:minmax(0,1fr);gap:5px;padding:8px;position:sticky;top:0;background:#08080b;z-index:1}
.roster-filters input,.roster-filters select{width:100%;min-width:0}
.hero-roster-card{display:grid;grid-template-columns:38px minmax(0,1fr);gap:7px;width:100%;text-align:left;border:0;border-top:1px solid var(--line)!important;padding:8px!important;align-items:center}
.hero-roster-card img{width:38px;height:44px;object-fit:cover}
.hero-roster-card[aria-pressed=true]{background:#0b221b;border-left:3px solid var(--accent)!important}
.hero-roster-card strong,.hero-roster-card small{display:block;overflow-wrap:anywhere}
.hero-roster-card small{font-size:9px;line-height:1.5;color:var(--muted)}
.hero-workspace{min-width:0;display:grid;gap:12px}
.hero-identity{position:sticky;top:46px;z-index:2;background:#08080b;border:1px solid var(--line);padding:10px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.hero-identity>div{flex:1;min-width:0}
.hero-identity img{width:52px;height:64px;object-fit:cover}
.hero-identity h2{font-size:18px;margin:0 0 5px}
.identity-badges{display:flex;flex-wrap:wrap;gap:6px;line-height:1.8}
.hero-sections{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.mechanism{position:relative;border:1px solid var(--line);padding:10px;background:var(--surface);min-width:0}
.mechanism h3{font:700 12px 'Segoe UI',sans-serif;margin:0 0 8px}
.mechanism.skills{grid-column:1/-1}
.hero-axis{padding:7px 0;border-top:1px solid #20232c;min-width:0}
.axis-heading{display:flex;justify-content:space-between;gap:8px;align-items:center}
.axis-controls{display:flex;flex-wrap:wrap;gap:7px;align-items:end;margin:7px 0}
.axis-controls label{font-size:9px;color:var(--muted);display:grid;gap:3px}
.axis-controls input{width:58px;max-width:100%}
.axis-controls .target-input{border-color:#17668c;color:var(--cyan)}
.axis-costs,.axis-gates{display:flex;flex-wrap:wrap;gap:5px 12px;font-size:10px;line-height:1.7}
.axis-gates{margin-top:5px}
.axis-costs span{overflow-wrap:anywhere}
.skills-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.hero-gear{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.gear-card{padding:10px;border:1px solid var(--line);min-width:0}
.gear-heading{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.gear-heading img{height:44px;width:44px;object-fit:contain}
.gear-heading h3{font-size:12px;margin:0}
.gear-actions{display:flex;gap:5px;flex-wrap:wrap}
.gear-card select{max-width:100%;width:100%}
.plan-item{padding:9px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.plan-item button{margin-top:5px}
.plan-item .plan-actions{display:flex;gap:5px}
.heroes-page #warehouseFields{container-type:inline-size;margin-bottom:13px}
.hero-warehouse-group+.hero-warehouse-group{margin-top:10px;padding-top:8px;border-top:1px solid var(--line)}
.warehouse-fields-heroes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 8px}
.warehouse-field{display:grid;grid-template-rows:subgrid;grid-row:span 2;row-gap:3px;min-width:0}
.warehouse-fields-heroes label{margin:0;overflow-wrap:anywhere}
.warehouse-fields-heroes input{width:100%;min-width:0}
.warehouse-quantity{display:flex;gap:4px;min-width:0}
.warehouse-quantity select{flex:0 0 48px;min-width:0}
.warehouse-box-hint{margin:6px 0 0;font-size:10px}
.hero-box-redemption{margin:4px 0}
@container (max-width:220px){.warehouse-fields-heroes{grid-template-columns:minmax(0,1fr)}}
.consumption-options{display:grid;gap:8px;margin:8px}
.consumption-options label{display:flex;align-items:center;gap:8px;font-size:10px}
.hero-reports{display:grid;gap:12px;margin-top:14px}
.hero-reports[hidden]{display:none}
.report-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.report-stat{border:1px solid var(--line);padding:8px;line-height:1.8;min-width:0;overflow-wrap:anywhere}
.progression-resources{display:grid;gap:8px;margin-top:12px;border-top:1px solid var(--line);padding-top:10px}
.progression-resources .report-stat{background:var(--bg);padding:7px}
.bonus-table td.skill-effect{white-space:pre-line;min-width:180px;vertical-align:top;text-align:left;line-height:1.6}
.stats-row{display:flex;justify-content:space-between;gap:12px;font-size:10px;line-height:1.8}
.inventory-drawer{width:860px;max-width:calc(100vw - 24px)}
.inventory-toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:end;margin:12px 0}
.inventory-toolbar label{display:grid;gap:4px}
.inventory-toolbar select{max-width:100%}
#inventoryList{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#formationEditor{display:grid;gap:14px}
.formation-row{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:7px}
.formation-row label{font-size:10px;display:grid;gap:4px}
.formation-row select{min-width:0;width:100%}
#appearanceEditor img{height:220px;max-width:100%;object-fit:contain;display:block;margin:10px auto}
#appearanceEditor select{width:100%}
.empty-slot{min-height:100px;display:grid;place-content:center;gap:8px;text-align:center}
#pickHero{display:none}
.heroes-page .hero-reports details summary{cursor:pointer;padding:6px}
.heroes-page dialog h3{font-size:12px}
.heroes-page .error-banner{overflow-wrap:anywhere}
.heroes-page .hero-axis input[type=checkbox]{width:15px}
.heroes-page #loadError[hidden]{display:none}
.heroes-page .equipment-uncertain{color:var(--amber)}
.mechanism-identity{display:flex;align-items:center;gap:8px;min-width:0}
.hero-mechanism-icon{width:40px;height:40px;flex:0 0 40px;object-fit:contain}
.automatic-skill{display:flex;align-items:center;gap:8px}
.fragment-entry{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 0}
.fragment-entry input{width:90px;min-width:0}
.exclusive-progress,.star-progress,.promotion-progress{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:6px 0}
.progress-ranks{display:flex;gap:5px}
.rank-shape{display:block;width:26px;height:26px;background:#616573;padding:2px}
.pentagon{clip-path:polygon(50% 3%,94.7% 35.5%,77.6% 88%,22.4% 88%,5.3% 35.5%)}
.hexagon{clip-path:polygon(50% 0%,93.3% 25%,93.3% 75%,50% 100%,6.7% 75%,6.7% 25%)}
.star{clip-path:polygon(50% 0%,61.225% 34.549%,97.55% 34.549%,68.164% 55.902%,79.39% 90.451%,50% 69.1%,20.61% 90.451%,31.836% 55.902%,2.45% 34.549%,38.775% 34.549%)}
/* Game pieces fill counterclockwise from the top, beginning on the left. */
.rank-shape>span{display:block;width:100%;height:100%;background:conic-gradient(from var(--rank-start,0deg),var(--rank-empty,#161920) calc(360deg - var(--target-fill,var(--fill))),var(--cyan) 0 calc(360deg - var(--fill)),var(--rank-color,var(--amber)) 0);clip-path:inherit}
/* Star pieces fill counterclockwise, with the first point centered at the top. */
.star{--rank-start:36deg}
.star.awakened{background:#ef5a62}
.star.awakened{--rank-empty:var(--amber);--rank-color:#ed3549}
.star-state{max-width:160px;line-height:1.5;color:var(--amber);overflow-wrap:anywhere}
.axis-options{margin-top:7px}
.axis-options>summary,.gear-editor>summary{cursor:pointer;color:var(--muted);font-size:10px;line-height:1.8}
.gear-editor>summary{padding:5px 0}
.gear-summary{display:inline-flex;align-items:center;flex-wrap:wrap;gap:8px;vertical-align:middle}
.gear-summary>span{white-space:nowrap}
.gear-summary .rank-progress-compact{display:inline-flex;margin:0}
.rank-progress-compact .progress-ranks{gap:3px}
.rank-progress-compact .rank-shape{width:18px;height:18px;padding:1px}
.axis-gates:empty,.axis-costs:empty{display:none}
.activation-control{font-size:10px}
.axis-single{border-top:0;padding-top:0}
.axis-single>.axis-heading{position:absolute;top:10px;right:10px}
.mechanism:has(.axis-single)>h3{padding-right:52px}
@media(max-width:850px){.axis-options>summary,.gear-editor>summary{min-height:44px;display:flex;align-items:center}.fragment-entry input{min-height:44px}}
.heroes-page #bonusDialog .hero-reports{margin-top:10px}

/* HQ's desktop table owns its scroll; Heroes needs the whole page to scroll. */
@media(min-width:1001px){
  body.hq-page.heroes-page{height:auto;overflow-y:auto}
  .hq-page.heroes-page .matrix-shell{height:auto;min-height:calc(100dvh - 46px);overflow:visible}
  .heroes-page .hero-main{height:auto;display:block}
  .heroes-page .planning-sidebar{position:sticky;top:46px;height:auto;max-height:calc(100dvh - 46px);overflow-y:auto}
}
@media(max-width:1150px){.heroes-page .matrix-shell{grid-template-columns:270px minmax(0,1fr)}.hero-layout{grid-template-columns:175px minmax(0,1fr)}.hero-sections,.hero-gear{grid-template-columns:1fr}.skills-list{grid-template-columns:1fr}.report-grid{grid-template-columns:1fr 1fr}}
@media(max-width:850px){.heroes-page .matrix-shell{display:block}.heroes-page .planning-sidebar{display:flex;position:static;max-height:none;border-right:0;padding:10px}.heroes-page #planPanel{width:100%}.hero-layout{display:block}.hero-roster{position:static;height:auto;max-height:55dvh;margin-bottom:10px;display:none}.hero-roster.is-open{display:block}#pickHero{display:block}.hero-identity{top:90px;position:static}.hero-sections{grid-template-columns:repeat(2,minmax(0,1fr))}.heroes-page .app-header nav{flex-wrap:wrap;gap:2px}.heroes-page .app-header{gap:6px;padding:6px 10px}.heroes-page .app-header nav small{display:none}.heroes-page .hero-tools button,.heroes-page .axis-controls button,.heroes-page .gear-actions button{min-height:44px}.heroes-page .hero-axis input,.heroes-page .hero-roster select,.heroes-page .hero-roster input,.heroes-page .warehouse input,.heroes-page dialog input,.heroes-page dialog select{min-height:44px}.heroes-page dialog{padding:12px}.formation-row{grid-template-columns:1fr 1fr}.hero-main{padding:10px!important}}
@media(max-width:520px){.hero-sections,.hero-gear,#inventoryList,.report-grid{grid-template-columns:1fr}.hero-tools{gap:5px}.hero-tools button{flex:1 1 120px}.heroes-page .page-heading{gap:8px}.heroes-page .planning-sidebar{gap:8px}.inventory-toolbar select{min-width:0}.axis-controls{gap:6px}.heroes-page .axis-controls button{font-size:10px}.hero-identity{gap:8px}.hero-identity img{width:40px;height:50px}.heroes-page .app-header nav a{font-size:10px;padding:5px}.formation-row{grid-template-columns:1fr}.heroes-page dialog{max-width:calc(100vw - 16px)}}

.heroes-page .plan-coverage.partial{color:#ffb450}
.hero-workspace .upgrade-ready{outline:1px solid var(--accent);outline-offset:-1px}

.heroes-page .plan-item .building-link{font-size:11px;line-height:1.5}
.heroes-page .plan-item .plan-range{font-size:9px;line-height:1.5;margin:8px 0}
.heroes-page .plan-coverage-hint{display:block;margin-top:6px}
.heroes-page .plan-coverage-hint>span{display:block;margin-top:5px}

.heroes-page .planning-sidebar{display:flex;flex-direction:column}
.heroes-page #planPanel{display:flex;flex-direction:column;gap:12px;min-width:0}
.heroes-page .planning-sidebar>.sidebar-footer{justify-content:flex-end;padding:0}

.target-awakening-preview{display:flex;align-items:center;gap:8px;flex-wrap:wrap;width:100%}
