/* CP2: compact existing Hero markup. State, actions and preview handlers stay in arena.html. */
@media (min-width:1000px) {
  html body.battleMode.rpgArena #youPanel,
  html body.battleMode.rpgArena #pcPanel { width:320px!important; }
  html body.battleMode.rpgArena #pcPanel { left:992px!important; }
  html body.battleMode.rpgArena #rpgBattlefield { left:450px; width:530px; }
  html body.battleMode.rpgArena :is(#topPanel, #handPanel) { width:1192px!important; }
  html body.battleMode.rpgArena :is(#logPanel, #battleInfoPanel, .footerActions) {
    left:1324px!important; width:260px!important;
  }

  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) {
    gap:6px!important; padding:2px 5px 3px 2px!important;
    scroll-padding-block:8px; overscroll-behavior:contain;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) > .hero {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1.15fr)!important;
    grid-template-areas:'identity identity' 'stats actions' 'health health' 'status status' 'mastery mastery';
    align-content:start!important; align-items:center!important;
    gap:3px 6px!important; min-height:0!important; height:auto!important;
    padding:7px!important; border-radius:5px!important;
    border-left:3px solid #50865d!important;
  }
  html body.battleMode.rpgArena #pcHeroes > .hero { border-left-color:#ac6762!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) > .hero.dead {
    opacity:1!important; filter:none!important; border-color:#8b7770!important;
    background:#d5d0c4!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) > .hero.dead .heroPortrait {
    filter:grayscale(1)!important; opacity:.55!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) > .hero.dead .heroName::after {
    content:' · DEFEATED'; font:800 10px/1.3 var(--ca-sans); color:#833c37;
  }

  /* Flatten only structural wrappers; every focusable preview/control node remains intact. */
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroTop {
    grid-area:identity; display:grid!important;
    grid-template-columns:36px minmax(0,1fr) auto!important;
    align-items:center!important; gap:2px 6px!important; margin:0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) :is(.heroIdentity, .heroTopAside) {
    display:contents!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroPortrait {
    grid-column:1; grid-row:1 / 3; width:36px!important; height:36px!important;
    align-self:start; border-radius:4px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroName {
    grid-column:2; grid-row:1; font-size:20px!important; line-height:1.05!important;
    white-space:normal!important; overflow:visible!important; overflow-wrap:anywhere;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroMeta {
    grid-column:2; grid-row:2; margin:0!important; font-size:11px!important;
    line-height:1.15!important; min-width:0; overflow-wrap:anywhere;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .readyBadge {
    grid-column:3; grid-row:1 / 3; align-self:start; padding:4px 6px!important;
    font-size:10px!important; letter-spacing:.02em!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroTraitRow {
    grid-column:1 / -1; grid-row:3; display:flex!important; flex-wrap:wrap!important;
    align-items:start!important; gap:3px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) :is(.passiveBadge, .pathBadge) {
    min-width:0!important; max-width:100%!important; padding:2px 4px!important;
    font-size:11px!important; line-height:1.2!important; white-space:normal!important;
    overflow:visible!important; overflow-wrap:anywhere; border-radius:3px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .badgeLabel {
    font-size:9px!important; flex-shrink:0;
  }

  /* Linked markers wrap onto their own row, never across the name/Ready badge. */
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .linkedEffectsTop {
    grid-column:1 / -1; grid-row:4; position:static!important; display:flex!important;
    flex-wrap:wrap!important; align-items:center!important; gap:3px!important;
    width:auto!important; min-width:0!important; max-width:none!important;
    height:auto!important; min-height:0!important; max-height:none!important;
    overflow:visible!important; margin:1px 0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .linkedEffectsTop::before {
    font:800 9px/1.3 var(--ca-sans)!important; letter-spacing:.04em!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .linkedEffectMarker {
    height:auto!important; min-height:20px!important; max-width:100%!important;
    font-size:10px!important; line-height:1.2!important; padding:3px 5px!important;
    white-space:normal!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .linkedEffectMarker .markerLabel {
    max-width:none!important; white-space:normal!important; overflow:visible!important;
    overflow-wrap:anywhere; line-height:1.2!important;
  }

  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .combatStats {
    grid-area:stats; display:flex!important; justify-content:space-between!important;
    align-items:baseline!important; gap:5px!important; margin:0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .hpReadout strong {
    font-size:22px!important; line-height:1!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .defReadout strong { font-size:17px!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) :is(.hpReadout, .defReadout) {
    gap:3px!important; white-space:nowrap;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) :is(.statMax, .defBonus) { font-size:11px!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .statLabel { font-size:9px!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .hpbar {
    grid-area:health; height:4px!important; min-height:4px!important; margin:0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroActions {
    grid-area:actions; position:static!important; width:auto!important; margin:0!important;
    display:flex!important; flex-wrap:wrap!important; justify-content:flex-end!important;
    align-items:center!important; gap:3px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .basicActionTip { max-width:100%; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .heroActions .btn {
    min-height:25px!important; height:auto!important; max-width:100%; padding:4px 6px!important;
    font-size:11px!important; line-height:1.2!important; white-space:normal!important;
    overflow:visible!important; overflow-wrap:anywhere;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .statusChips {
    grid-area:status; display:flex!important; flex-wrap:wrap!important; gap:3px!important;
    min-height:0!important; max-height:none!important; height:auto!important; margin:0!important;
    overflow:visible!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .statusPill {
    font-size:10px!important; line-height:1.2!important; padding:2px 4px!important;
    white-space:normal!important; overflow-wrap:anywhere;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .statusPill.neutral { padding:0!important; }

  /* Keep every skill name, ready/spent label, AP amount and info button visible. */
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryArea {
    grid-area:mastery; position:static!important; display:flex!important; gap:3px!important;
    height:auto!important; min-height:0!important; max-height:none!important;
    margin:0!important; padding:0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryLabel {
    display:flex!important; flex-wrap:wrap!important; gap:2px 5px!important;
    flex:0 0 auto!important; min-height:0!important; max-height:none!important;
    height:auto!important; margin:0!important; padding:0!important; line-height:1.2!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryLabel span { font-size:9px!important; letter-spacing:.04em!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryLabel small {
    font-size:10px!important; line-height:1.2!important; white-space:normal!important;
    color:#4e5538!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteries {
    display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-template-rows:auto!important; grid-auto-rows:auto!important; align-items:stretch!important;
    gap:3px!important; flex:0 0 auto!important; height:auto!important; min-height:0!important;
    max-height:none!important; margin:0!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masterySlot {
    height:auto!important; min-height:46px!important; max-height:none!important; overflow:visible!important;
    border-radius:3px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .mastery {
    display:flex!important; height:100%!important; min-height:46px!important; max-height:none!important;
    padding:4px 4px 23px!important; gap:3px!important; overflow:visible!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryTop { padding:0!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryName {
    font-size:11px!important; line-height:1.15!important; font-weight:750!important;
    white-space:normal!important; overflow-wrap:anywhere; max-height:none!important;
    margin:0!important; padding-right:12px; overflow:visible!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryType { font-size:9px!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masterySlotNo {
    position:static!important; display:none!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryHint {
    display:block!important; margin-top:auto!important; font-size:9px!important;
    line-height:1.2!important; padding:1px 2px!important; white-space:normal!important;
    max-width:100%; border-radius:3px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryInfo {
    width:21px!important; height:21px!important; min-height:21px!important;
    bottom:1px!important; right:1px!important; top:auto!important; font-size:12px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .masteryPhysicalFace { border-radius:3px; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .emptyMastery {
    min-height:0!important; margin:0!important; padding:0!important; gap:4px!important;
  }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) .emptyMastery small { font-size:10px!important; }
  html body.battleMode.rpgArena :is(#youHeroes, #pcHeroes) :is(button, [tabindex]):focus-visible {
    outline:2px solid #936723!important; outline-offset:2px;
  }
  /* Growth remains intentional for long names, several statuses or linked effects.
     The existing column scrollbar keeps all controls reachable without truncation. */
}
