/* Keep native wheel, touch and keyboard scrolling, without visible scrollbars. */
html:has(body[data-game="battleground"]),
body[data-game="battleground"],
body[data-game="battleground"] * {
  scrollbar-width: none !important;
  -ms-overflow-style: none;
}
html:has(body[data-game="battleground"])::-webkit-scrollbar,
body[data-game="battleground"]::-webkit-scrollbar,
body[data-game="battleground"] *::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body[data-game="battleground"] { --hero-panel-width: clamp(312px, 17vw, 400px); }
.game-shell { margin-inline: auto; max-width: 3200px; }
.play-layout, .arena-column, .shop-area, .result-content { min-width: 0; }
.round-banner strong { white-space: nowrap; }
.bench { justify-content: safe center; }
.panel-heading .eyebrow, .inventory-panel > small, .encounter-hint,
.pending-loot > small, .hero-equipment > small { font-size: 12px; line-height: 1.55; }
.inventory-panel h3 { font-size: clamp(14px, .9vw, 18px); }
.inventory-panel h3 b { font-size: clamp(12px, .8vw, 16px); }
.item-sell-button { font-size: 13px; min-height: 38px; }
.pending-loot, .pending-loot button { font-size: 12px; }
.item-tip-top .eyebrow { font-size: 11px; letter-spacing: 1px; }
.item-tip-top small, .item-tip-effect, .item-tip-bottom { font-size: 12px; }
.item-tip-stats > div { font-size: 14px; }
.item-tip-stats b { font-size: 15px; }
.item-tip-bottom small { font-size: 11px; }
.item-tip-bottom > b small { font-size: 10px; letter-spacing: .2px; }
.tactics-item-tooltip { width: 380px; }

/* All outcome typography uses the actual arena size, including its height. */
#result-overlay.tactics-result {
  container-type: size;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(14px, min(2vw, 2dvh), 32px);
}
.result-content {
  flex: 0 0 auto;
  width: min(900px, 100%);
  margin: auto;
}
.result-intro > .eyebrow {
  font-size: clamp(12px, min(1.4cqw, 2.5cqh), 18px);
  letter-spacing: 1.6px;
  line-height: 1.5;
}
.result-emblem { height: clamp(108px, min(17cqw, 23cqh), 198px); }
.result-crest {
  width: clamp(128px, min(20cqw, 27cqh), 228px);
  height: auto;
  max-height: 110%;
}
#result-overlay .result-content h2 {
  font-size: clamp(34px, min(5.5cqw, 10.5cqh), 76px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
#result-overlay .result-intro > p {
  font-size: clamp(14px, min(1.8cqw, 3cqh), 21px);
  max-width: 620px;
  color: #c5cddd;
  line-height: 1.6;
  margin: 0 auto;
}
#result-overlay .result-rewards {
  max-width: 720px;
  margin: 20px auto 18px;
}
#result-overlay .result-rewards > div { padding: 14px 8px; }
#result-overlay .result-rewards strong { font-size: clamp(28px, min(4cqw, 6cqh), 48px); }
#result-overlay .result-rewards .arena-icon {
  width: clamp(18px, 2.5cqw, 28px);
  height: clamp(18px, 2.5cqw, 28px);
}
#result-overlay .result-rewards span {
  font-size: clamp(12px, min(1.4cqw, 2.5cqh), 17px);
  letter-spacing: .6px;
  line-height: 1.4;
}
#result-overlay .result-rewards small {
  font-size: clamp(12px, min(1.3cqw, 2.4cqh), 16px);
  line-height: 1.4;
  color: #aab8cb;
}
.result-loot > .eyebrow { font-size: clamp(12px, 1.3cqw, 16px); letter-spacing: 1.2px; }
.result-loot .loot-summary { margin-top: 12px; gap: 10px; }
.reward-card { flex: 1 1 190px; min-width: 0; max-width: 300px; gap: 10px; padding: 12px; }
.reward-card > div { min-width: 0; }
.reward-card strong { font-size: clamp(14px, 1.7cqw, 19px); line-height: 1.4; overflow-wrap: anywhere; }
.reward-card small { font-size: clamp(12px, 1.3cqw, 16px); letter-spacing: .5px; line-height: 1.4; }
.reward-icon { width: 46px; height: 46px; }
.loot-summary .reward-icon img { width: 40px; height: 40px; }
#result-overlay .result-continue {
  min-width: min(280px, 100%);
  max-width: 100%;
  min-height: 48px;
  font-size: clamp(15px, 1.7cqw, 21px);
}
.result-next { max-width: 600px; font-size: clamp(12px, 1.2cqw, 16px); line-height: 1.5; color: #a6b6ca; }
/* This decorative layer must never contribute to the scrollable dimensions. */
.result-orbits { inset: auto 0 0; height: 50%; overflow: clip; contain: paint; }
.result-orbits .orbit-art { overflow: hidden; }

.hero-info-panel { width: var(--hero-panel-width); }
.hero-panel-name h2 { font-size: clamp(23px, 1.5vw, 30px); }
.hero-attack-profile strong { font-size: 14px; }
.hero-attack-profile span, .hero-info-panel .hero-stat-grid span,
.hero-info-panel .hero-spell .eyebrow, .hero-panel-context { font-size: 12px; }
.hero-info-panel .hero-stat-grid b { font-size: 16px; }
.hero-info-panel .hero-spell p, .hero-info-panel .hero-spell > small,
.hero-info-panel .hero-spell > div > span { font-size: 13px; line-height: 1.6; }
.hero-spell-heading strong { font-size: 18px; }
.hero-spell-levels { font-size: 12px; }
.hero-spell-levels caption, .hero-spell-levels th:first-child { font-size: 12px; }
.hero-panel-sell { font-size: 14px; min-height: 40px; flex-shrink: 0; }

.carousel-dialog { width: min(1280px, calc(100vw - 32px)); max-width: 1280px; overflow-x: hidden; }
.carousel-header .eyebrow { font-size: 12px; letter-spacing: 1.6px; }
.carousel-header p, .draft-status p, .draft-focus > span { font-size: 14px; }
#draft-pair-label, .draft-footer b, .draft-footer p { font-size: 12px; line-height: 1.5; letter-spacing: .4px; }
.draft-focus { min-width: 260px; }
.draft-focus strong { font-size: 26px; }
.draft-navigation button { width: 40px; height: 40px; }
.draft-footer { gap: 26px; }
.draft-footer > span { font-size: 20px; }
.draft-footer b { max-width: 200px; white-space: normal; margin-top: 4px; }
.draft-dots button { width: 11px; height: 11px; }
.draft-dots { gap: 17px; }
.draft-card-info small { font-size: 12px; letter-spacing: .3px; }
.carousel-card .draft-cost { font-size: 13px; }
.carousel-card .draft-choose { font-size: 10px; letter-spacing: 1px; }
.draft-claim-seal b { font-size: 13px; }
.draft-claim-seal small { font-size: 11px; letter-spacing: .3px; }

@media (min-width: 1101px) {
  body[data-game="battleground"] {
    --rail: clamp(204px, 11.8vw, 300px);
    --right-rail: clamp(180px, 10vw, 260px);
    --shop-height: clamp(164px, 16dvh, 236px);
  }
  .game-shell {
    height: 100dvh;
    min-height: 920px;
    padding: clamp(8px, .6vw, 16px);
    gap: clamp(8px, .6vw, 14px);
    grid-template-rows: clamp(60px, 5.2dvh, 88px) minmax(0, 1fr) max-content;
  }
  .topbar { min-height: 60px; }
  .round-banner {
    height: 100%; width: clamp(264px, 16vw, 380px);
    grid-template-columns: max-content minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 4px 22px 6px; gap: 4px 10px;
  }
  .round-banner strong { font-size: clamp(23px, 1.4vw, 36px); }
  .round-banner #phase-label { font-size: clamp(11px, .7vw, 16px); }
  .commander strong, .rival-commander strong { font-size: clamp(13px, .85vw, 21px); }
  .icon-button { width: clamp(32px, 2vw, 44px); height: clamp(32px, 2vw, 44px); }
  .arena-column { grid-template-rows: minmax(0, 1fr) 28px clamp(84px, 6dvh, 110px); }
  .arena { min-height: 480px; --unit-height: clamp(88px, calc((100dvh - 650px)/4), 176px); }
  .battle-character .character-name strong { font-size: clamp(13px, .85vw, 20px); }
  .bench-heading, .arena-team-count, .side-label { font-size: clamp(12px, .75vw, 18px); }
  .bench { grid-template-columns: repeat(10, clamp(64px, 4.5dvh, 88px)); }
  .bench-slot { width: 100%; height: auto; max-width: 88px; max-height: 88px; }
  .shop-dock { min-height: 226px; padding: 12px; }
  .shop-card .shop-details { height: 38px; padding: 0 8px; }
  .shop-card > img { height: calc(100% - 38px); }
  .shop-card .shop-details > strong, .shop-card .shop-price { font-size: clamp(15px, 1vw, 24px); }
  .shop-heading, #lock-button, .economy-button, .wallet small, .speed-button, .battle-controls > span { font-size: clamp(12px, .8vw, 18px); }
  .economy-button > b { font-size: inherit; }
  .trait-meta strong { font-size: clamp(13px, .9vw, 20px); }
  .trait-levels { font-size: clamp(12px, .75vw, 17px); }
  .rival-detail > strong { font-size: clamp(13px, .85vw, 20px); }
  .rival-life b { font-size: clamp(17px, 1.15vw, 26px); }
  .rival-life i, .rival-avatar small { font-size: clamp(11px, .65vw, 15px); }
  .rival-life { flex-wrap: wrap; }
  .rival-row { min-height: clamp(68px, 5.2dvh, 112px); }
  .play-layout:has(#hero-info-panel:not([hidden])) { grid-template-columns: var(--rail) minmax(0, 1fr) var(--hero-panel-width); }
}

@media (min-width: 751px) and (max-width: 1100px) {
  .game-shell { grid-template-rows: 60px 720px auto; }
  .round-banner { height: 59px; }
  .round-banner #phase-label, .rival-life i { font-size: 11px; }
  .trait-meta strong { font-size: 13px; }
  .trait-levels { font-size: 12px; }
}

@media (max-width: 750px) {
  .hero-info-panel { width: min(340px, calc(100vw - 16px)); }
  .hero-panel-body { max-height: none; }
  .inventory-panel > small, .encounter-hint, .hero-equipment > small { font-size: 12px; }
  .trait-meta strong, .trait-levels { font-size: 12px; }
  .shop-card .shop-details > strong, .shop-card .shop-price { font-size: 15px; }
  .xp-caption, .wallet small, .economy-button, .economy-button > b,
  #lock-button, .speed-button, .battle-controls > span { font-size: 12px; }
  .battle-controls { grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr); gap: 6px; }
  .battle-controls > span { overflow-wrap: anywhere; }
  #result-overlay.tactics-result { padding: 14px 10px; }
  #result-overlay .result-content h2 { font-size: 34px; }
  #result-overlay .result-intro > p { font-size: 14px; }
  #result-overlay .result-rewards > div { padding: 12px 3px; }
  #result-overlay .result-rewards strong { font-size: 27px; }
  #result-overlay .result-rewards .arena-icon { width: 16px; height: 16px; margin-right: 2px; }
  #result-overlay .result-rewards span, #result-overlay .result-rewards small { font-size: 12px; letter-spacing: 0; }
  .result-intro > .eyebrow, .result-loot > .eyebrow { font-size: 12px; letter-spacing: .8px; }
  .reward-card { flex-basis: 125px; padding: 8px; gap: 6px; }
  .reward-card strong { font-size: 13px; }
  .reward-card small { font-size: 11px; letter-spacing: 0; }
  .reward-icon { width: 32px; height: 32px; }
  .loot-summary .reward-icon img { width: 28px; height: 28px; }
  .result-next { font-size: 12px; }
  .tactics-item-tooltip { width: 340px; max-width: calc(100vw - 16px); }
  .carousel-dialog { width: calc(100vw - 18px); padding: 20px 14px 16px; }
  .carousel-header .eyebrow { font-size: 11px; letter-spacing: .7px; }
  .carousel-header h2 { font-size: 27px; }
  .carousel-header p, .draft-status p, .draft-focus > span { font-size: 12px; }
  .draft-status { flex-wrap: wrap; }
  .draft-status p { max-width: calc(100% - 20px); }
  #draft-pair-label { font-size: 11px; width: 100%; padding-left: 14px; }
  .draft-focus { min-width: 0; flex: 1; }
  .draft-focus strong { font-size: 23px; }
  .draft-focus > span { max-width: none; overflow-wrap: anywhere; }
  .draft-navigation { padding-right: 37px; gap: 6px; }
  .draft-navigation button { width: 34px; height: 34px; flex-shrink: 0; }
  .draft-navigation #draft-motion { width: 32px; height: 32px; }
  .draft-card-info strong { font-size: 16px; }
  .draft-card-info small { font-size: 11px; }
  .carousel-card .draft-cost { font-size: 12px; }
  .carousel-card .draft-choose { font-size: 9px; }
  .draft-footer { gap: 12px; align-items: start; }
  .draft-footer > span { font-size: 16px; white-space: normal; flex: 0 0 83px; }
  .draft-footer b { font-size: 10px; line-height: 1.45; letter-spacing: 0; }
  .draft-footer p { font-size: 12px; line-height: 1.5; }
}

@media (max-height: 650px) {
  .carousel-dialog { max-height: calc(100dvh - 16px); }
  .hero-info-panel { position: fixed; top: 8px; right: 8px; bottom: 8px; max-height: none; }
  .hero-panel-banner { flex-basis: 86px; }
  .hero-panel-body { max-height: none; }
  .tactics-item-tooltip { max-height: calc(100dvh - 16px); overflow-y: auto; pointer-events: auto; }
}

/* A wide, shallow arena has room beside the crest instead of below it. */
@container (min-width: 700px) and (max-height: 650px) {
  .result-content {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.25fr);
    gap: 14px 30px;
    align-items: center;
  }
  .result-intro { grid-column: 1; grid-row: 1; }
  .result-details { grid-column: 2; grid-row: 1; min-width: 0; }
  #result-overlay .result-rewards { margin: 0 auto 14px; }
  #result-overlay .result-rewards > div { padding: 10px 4px; }
  .result-emblem { height: 132px; }
  .result-crest { width: 158px; }
  .reward-card { flex-basis: 160px; padding: 10px; }
  .reward-card strong { font-size: clamp(14px, 1.2cqw, 18px); }
  .reward-card small { font-size: 12px; }
  .result-loot .loot-summary { gap: 8px; }
  #result-overlay .result-continue { grid-column: 1 / -1; margin-top: 0; }
  .result-next { grid-column: 1 / -1; margin-top: 0; }
}
