:root {
  color-scheme: dark;
  --bg: #050908;
  --panel: rgba(18, 22, 21, 0.86);
  --panel-solid: #111714;
  --panel-2: rgba(26, 34, 29, 0.88);
  --line: rgba(209, 180, 101, 0.18);
  --text: #fff8e8;
  --muted: #b8c3ad;
  --muted-2: #778874;
  --gold: #d7a94a;
  --green: #61d596;
  --red: #ff736a;
  --blue: #6dbfe8;
  --violet: #a98cff;
  --cyan: #62ead0;
  --steel: #26342e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --glow: 0 0 34px rgba(98, 234, 208, 0.18);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.augment-overlay {
  background: rgba(1, 5, 4, 0.54);
  backdrop-filter: blur(5px);
}

body.augment-choice-active .game-loader {
  pointer-events: none;
}

.augment-panel,
.augment-book-panel {
  width: min(920px, calc(100vw - 28px));
  border: 1px solid rgba(255, 240, 190, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 24, 18, 0.98), rgba(5, 9, 7, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  color: #fff8e8;
  padding: 22px;
}

.augment-choice-grid,
.augment-book-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.augment-card,
.augment-book-entry {
  min-height: 220px;
  border: 1px solid color-mix(in srgb, var(--augment-color, #d7a94a) 52%, rgba(255, 240, 190, 0.16));
  border-radius: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--augment-color, #d7a94a) 14%, transparent), transparent 62%), rgba(7, 12, 9, 0.88);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.augment-card--bronze { --augment-color: #c9824b; }
.augment-card--silver { --augment-color: #bcc8d4; }
.augment-card--gold { --augment-color: #f2b84b; }
.augment-card--prismatic { --augment-color: #9ff7ff; }

.augment-rarity {
  align-self: flex-start;
  border: 1px solid color-mix(in srgb, var(--augment-color) 58%, rgba(255, 255, 255, 0.22));
  border-radius: 999px;
  color: color-mix(in srgb, var(--augment-color) 72%, #fff8e8);
  background: color-mix(in srgb, var(--augment-color) 12%, rgba(0, 0, 0, 0.36));
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.augment-card h3,
.augment-book-entry h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #fff8e8;
}

.augment-card p,
.augment-book-entry p,
.augment-book-empty {
  margin: 0;
  color: rgba(255, 248, 232, 0.78);
  line-height: 1.45;
}

.augment-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.augment-actions > button {
  flex: 1;
}

.augment-actions > .augment-reroll-button {
  flex: 0 0 44px;
  min-width: 44px;
  min-height: 40px;
  padding-inline: 0;
  border-color: color-mix(in srgb, var(--augment-color, #d7a94a) 54%, rgba(255, 240, 190, 0.22));
  color: color-mix(in srgb, var(--augment-color, #d7a94a) 74%, #fff8e8);
}

.augment-reroll-button > span:first-child {
  font-size: 1.08rem;
}

.augment-book-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.augment-book-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: min(620px, 66vh);
  overflow: auto;
}

.augment-book-entry {
  min-height: 150px;
}

.end-overlay.traits-overlay {
  background: rgba(1, 5, 4, 0.54);
  z-index: 92;
}

.traits-panel {
  width: min(1060px, calc(100vw - 44px));
  max-height: min(780px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 240, 190, 0.22);
  border-radius: 8px;
  background: rgba(9, 14, 11, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  color: #fff8e8;
  padding: 18px;
  contain: layout paint;
}

.traits-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.traits-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.traits-panel-actions .mode-button {
  min-height: 34px;
  padding-inline: 10px;
  white-space: nowrap;
}

.traits-panel-content {
  display: grid;
  gap: 16px;
  max-height: calc(min(780px, 100dvh - 28px) - 96px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.traits-section {
  display: grid;
  gap: 10px;
}

.traits-section h3 {
  margin: 0;
  color: #efe0ad;
  font-size: 0.92rem;
  text-transform: uppercase;
}

.traits-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
}

.trait-card {
  align-self: start;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 52%, rgba(255, 240, 190, 0.12));
  border-radius: 8px;
  background: rgba(7, 12, 9, 0.9);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--trait-color, #d7a94a) 62%, transparent);
  contain: layout paint style;
  content-visibility: auto;
  contain-intrinsic-size: 86px;
  overflow: hidden;
}

.trait-card--inactive {
  opacity: 0.78;
}

.trait-card.is-open {
  content-visibility: visible;
}

.trait-card-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.trait-toggle-indicator {
  display: inline-grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 248, 232, 0.16);
  border-radius: 999px;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
}

.trait-card-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.trait-card-main strong,
.trait-card-main em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-card-main em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
}

.trait-summary-preview {
  display: block;
  max-width: min(520px, 58vw);
  margin-top: 3px;
  overflow: hidden;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 62%, #fff8e8);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-icon {
  display: inline-grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 58%, rgba(255, 255, 255, 0.18));
  border-radius: 8px;
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 15%, rgba(0, 0, 0, 0.42));
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
  font-weight: 950;
}

.trait-icon svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.trait-icon-img,
.trait-chip-icon,
.element-resistance-icon {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.trait-icon-img {
  width: 24px;
  height: 24px;
}

.trait-chip-icon {
  width: 14px;
  height: 14px;
  margin-inline-end: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reference-trait-head {
  justify-content: flex-start;
}

.reference-trait-icon {
  flex-basis: 42px;
  width: 42px;
  height: 42px;
  border-radius: 9px;
}

.reference-trait-icon svg {
  width: 25px;
  height: 25px;
}

.trait-tier {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 240, 190, 0.18);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-align: center;
}

.trait-tier--active {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 70%, rgba(255, 255, 255, 0.22));
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 76%, #fff8e8);
}

.trait-card-detail {
  display: grid;
  gap: 9px;
  padding: 0 12px 12px;
}

.trait-card-detail p,
.traits-empty {
  margin: 0;
  color: rgba(255, 248, 232, 0.76);
  line-height: 1.42;
}

.trait-progress,
.trait-requirement,
.trait-tower-list {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(151, 184, 211, 0.12);
  border-radius: 6px;
  background: rgba(4, 8, 6, 0.46);
}

.trait-bonus-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.trait-bonus-block--inline {
  align-items: flex-start;
}

.trait-bonus-block h4 {
  flex: 0 0 100%;
  margin: 0;
  color: #efe0ad;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.trait-bonus-block > span,
.tower-trait-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 44%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 12%, rgba(0, 0, 0, 0.34));
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 70%, #fff8e8);
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1;
}

.trait-requirements,
.trait-tower-list {
  display: grid;
  gap: 6px;
}

.trait-tier-roadmap {
  display: grid;
  gap: 7px;
  margin-top: 2px;
}

.trait-tier-roadmap h4 {
  margin: 0;
  color: #efe0ad;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.trait-tier-row {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(151, 184, 211, 0.14);
  border-radius: 7px;
  background: rgba(4, 8, 6, 0.36);
}

.trait-tier-row.is-active {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 48%, rgba(98, 234, 208, 0.22));
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 10%, rgba(4, 8, 6, 0.44));
}

.trait-tier-row.is-next {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
}

.trait-tier-row-head,
.trait-tier-row-body {
  display: grid;
  grid-template-columns: minmax(0, 0.48fr) minmax(0, 1fr);
  gap: 8px;
}

.trait-tier-row-head {
  align-items: center;
}

.trait-tier-row-head strong {
  color: #fff8e8;
  font-size: 0.74rem;
}

.trait-tier-row-head span,
.trait-tier-row-body em {
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.trait-tier-row-body > div {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.trait-requirement--complete {
  border-color: rgba(98, 234, 208, 0.35);
  color: #9ff7ff;
}

.trait-requirement--missing {
  color: rgba(255, 248, 232, 0.75);
}

.trait-tower-list {
  color: var(--muted);
  font-size: 0.72rem;
}

.tower-trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.tower-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}

.tower-trait-list--compact {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
}

.tower-trait-chip--compact {
  max-width: 86px;
  min-height: 17px;
  padding: 2px 5px;
  overflow: hidden;
  font-size: 0.54rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-trait-chip--compact .trait-chip-icon {
  width: 13px;
  height: 13px;
  margin-inline-end: 3px;
}

.tower-trait-chip--icon-only {
  width: 22px;
  justify-content: center;
  padding-inline: 3px;
}

.tower-trait-chip--icon-only .trait-chip-icon {
  width: 15px;
  height: 15px;
  margin-inline-end: 0;
}

.tower-trait-chip--more {
  flex: 0 0 auto;
  border-color: rgba(255, 248, 232, 0.18);
  background: rgba(255, 248, 232, 0.06);
  color: var(--muted);
}

@media (max-width: 760px) {
  .augment-choice-grid,
  .augment-book-list,
  .traits-card-grid {
    grid-template-columns: 1fr;
  }

  .trait-summary-preview {
    max-width: 62vw;
  }

  .traits-element-tools {
    grid-template-columns: 1fr;
  }

  .element-matchup-board {
    min-height: 280px;
  }

  .element-matchup-node {
    width: 108px;
    min-height: 58px;
    padding-inline: 6px;
  }

  .element-matchup-main {
    grid-template-columns: 20px minmax(0, 1fr) 31px;
  }

  .element-matchup-node strong {
    font-size: 0.66rem;
  }

  .element-matchup-node em {
    min-width: 30px;
    font-size: 0.66rem;
  }

  .element-matchup-target {
    max-width: 36px;
    font-size: 0.52rem;
  }

  .trait-tier-row-head,
  .trait-tier-row-body {
    grid-template-columns: 1fr;
  }

  .traits-panel-header {
    display: grid;
  }

  .traits-panel-actions {
    justify-content: stretch;
  }

  .traits-panel-actions .mode-button {
    flex: 1 1 120px;
  }

  .reference-rarity-grid,
  .reference-trait-grid,
  .reference-tier {
    grid-template-columns: 1fr;
  }

  .augment-panel,
  .augment-book-panel,
  .traits-panel {
    padding: 16px;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(5, 9, 8, 0.1), rgba(5, 9, 8, 0.58) 42%, rgba(5, 9, 8, 0.86)),
    radial-gradient(circle at 18% 16%, rgba(98, 234, 208, 0.11), transparent 30%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.03), transparent 42%),
    url("assets/menu-anime-arena-bg.jpg?v=20260519-menu-refresh1") center top / cover no-repeat,
    #050908;
  color: var(--text);
}

body.page-auth .account-panel,
body.page-auth .game-only,
body.page-auth .game-area,
body.page-menu .auth-panel,
body.page-menu .game-only,
body.page-menu .game-area {
  display: none !important;
}

body.page-game .auth-panel,
body.page-game .account-panel {
  display: none !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 20%, rgba(98, 234, 208, 0.12), transparent 18%),
    radial-gradient(circle at 72% 64%, rgba(215, 169, 74, 0.08), transparent 22%),
    linear-gradient(115deg, transparent 0 48%, rgba(215, 169, 74, 0.04) 49%, transparent 50% 100%);
  background-size: auto, auto, 220px 220px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 74%);
}

button {
  font: inherit;
}

.text-input {
  width: 100%;
  min-height: 40px;
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.035), rgba(0, 0, 0, 0)),
    rgba(7, 11, 9, 0.78);
  color: var(--text);
  outline: none;
}

.text-input:focus {
  border-color: rgba(102, 242, 230, 0.72);
  box-shadow: var(--glow);
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(290px, 330px) 1fr;
  min-height: 100vh;
}

body.match-active {
  overflow: hidden;
}

body.match-active .shell {
  grid-template-columns: minmax(250px, 292px) minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

body:not(.is-authenticated) .shell {
  display: grid;
  grid-template-columns: minmax(720px, 1080px);
  justify-content: center;
  align-content: center;
  padding: 32px;
}

body:not(.is-authenticated) .sidebar {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(430px, 1.08fr);
  align-items: center;
  gap: clamp(20px, 3vw, 34px);
  max-height: none;
  padding: clamp(24px, 3.2vw, 40px);
  border: 1px solid rgba(95, 197, 225, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(2, 14, 24, 0.5), rgba(5, 31, 45, 0.32) 52%, rgba(1, 8, 15, 0.54)),
    radial-gradient(circle at 18% 18%, rgba(80, 205, 232, 0.12), transparent 36%),
    rgba(2, 12, 19, 0.34);
  box-shadow: 0 28px 84px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(139, 222, 242, 0.1);
  backdrop-filter: blur(8px) saturate(1.05);
}

body.is-authenticated:not(.match-active) .shell {
  grid-template-columns: minmax(0, 1180px);
  justify-content: center;
  padding: 28px;
}

body.is-authenticated:not(.match-active) .sidebar {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  align-content: start;
  gap: 20px;
  min-height: calc(100vh - 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

body.is-authenticated:not(.match-active) .brand {
  align-self: start;
}

body.is-authenticated:not(.match-active) .account-panel {
  min-height: calc(100vh - 96px);
}

body.is-authenticated:not(.match-active) .tab-pane.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body.is-authenticated:not(.match-active) #matchmakingTab.active,
body.is-authenticated:not(.match-active) #adminTab.active,
body.is-authenticated:not(.match-active) #notificationsTab.active {
  grid-template-columns: 1fr;
}

body.is-authenticated:not(.match-active) #saveSettingsButton {
  width: auto;
  min-width: 190px;
  padding: 0 22px;
  justify-self: start;
  align-self: start;
}

body.is-authenticated:not(.match-active) .admin-output {
  max-height: none;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(33, 38, 31, 0.92), rgba(8, 13, 10, 0.9)),
    linear-gradient(90deg, rgba(215, 169, 74, 0.12), transparent 22%),
    rgba(10, 14, 12, 0.9);
  border-right: 1px solid var(--line);
  overflow: auto;
}

body.match-active .sidebar {
  max-height: 100vh;
  gap: 10px;
  padding: 12px;
}

body.match-active .brand {
  padding-bottom: 6px;
}

body.match-active .brand h1 {
  max-width: 11ch;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
}

body.match-active .subtitle {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
}

body.match-active .panel {
  padding: 10px;
}

body.match-active .choice-button {
  min-height: 46px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 7px 9px;
}

body.match-active .choice-icon {
  width: 34px;
  height: 34px;
}

body.match-active .choice-desc {
  font-size: 0.72rem;
}

.tutorial-coach {
  position: fixed;
  top: 112px;
  right: 28px;
  z-index: 110;
  width: min(460px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid rgba(242, 184, 75, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(31, 34, 24, 0.99), rgba(8, 13, 10, 0.99)),
    rgba(10, 14, 12, 0.96);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(255, 255, 255, 0.07) inset, 0 0 48px rgba(242, 184, 75, 0.18);
  color: var(--text);
}

body.tutorial-active::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.24), transparent 34%, rgba(0, 0, 0, 0.16)),
    rgba(0, 0, 0, 0.2);
}

.tutorial-coach-header,
.tutorial-coach-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tutorial-coach-header span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tutorial-coach h2 {
  margin: 12px 0 8px;
  font-size: 1.42rem;
}

.tutorial-coach p {
  margin: 0;
  color: #f2ead4;
  line-height: 1.5;
}

.tutorial-requirement {
  min-height: 22px;
  margin-top: 12px !important;
  color: #f2b84b !important;
  font-weight: 800;
}

.tutorial-requirement.is-done {
  color: #6ee7a8 !important;
}

.tutorial-coach-actions {
  margin-top: 16px;
}

.tutorial-focus {
  position: relative;
  z-index: 95;
  outline: 3px solid rgba(242, 184, 75, 0.98);
  outline-offset: 6px;
  box-shadow: 0 0 0 9px rgba(242, 184, 75, 0.16), 0 0 46px rgba(242, 184, 75, 0.38);
  filter: saturate(1.14) brightness(1.08);
}

body.tutorial-active .tutorial-focus {
  animation: tutorialFocusPulse 1.6s ease-in-out infinite;
}

@keyframes tutorialFocusPulse {
  0%,
  100% {
    outline-color: rgba(242, 184, 75, 0.78);
    box-shadow: 0 0 0 8px rgba(242, 184, 75, 0.12), 0 0 34px rgba(242, 184, 75, 0.24);
  }
  50% {
    outline-color: rgba(255, 230, 151, 1);
    box-shadow: 0 0 0 12px rgba(242, 184, 75, 0.2), 0 0 58px rgba(242, 184, 75, 0.46);
  }
}

@media (max-width: 980px) {
  .tutorial-coach {
    top: auto;
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

body.mobile-ui.tutorial-active .tutorial-coach {
  top: calc(env(safe-area-inset-top) + 146px);
  right: 10px;
  bottom: auto;
  left: 10px;
  width: auto;
  max-height: min(238px, 34dvh);
  padding: 12px;
  overflow: auto;
  border-radius: 10px;
}

body.mobile-ui.tutorial-active #gameCanvas {
  margin-top: 230px;
}

body.mobile-ui.tutorial-active .dynamic-game-canvas,
body.mobile-ui.tutorial-active .placement-preview-canvas {
  top: 230px;
}

body.mobile-ui.tutorial-active[data-tutorial-coach="bottom"] .tutorial-coach {
  top: auto;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 10px);
  max-height: min(260px, 36dvh);
}

body.mobile-ui.tutorial-active[data-tutorial-coach="augment"] .tutorial-coach {
  z-index: 132;
}

body.mobile-ui.tutorial-active[data-tutorial-coach="augment"].augment-choice-active .tutorial-coach {
  top: calc(env(safe-area-inset-top) + 8px);
  bottom: auto;
  max-height: 132px;
  pointer-events: none;
}

body.mobile-ui.tutorial-active[data-tutorial-coach="augment"]:not(.augment-choice-active) .tutorial-coach {
  top: auto;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 10px);
  max-height: min(260px, 36dvh);
}

body.mobile-ui.tutorial-active[data-tutorial-coach="augment"] .augment-overlay {
  z-index: 124;
  place-items: center;
  align-content: center;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 150px) 10px calc(env(safe-area-inset-bottom) + 10px);
  overflow: auto;
}

body.mobile-ui.tutorial-active[data-tutorial-coach="augment"] .augment-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 48px));
  max-height: min(50dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 210px));
  overflow: auto;
}

body.mobile-ui.tutorial-active .tutorial-coach-header {
  gap: 8px;
}

body.mobile-ui.tutorial-active .tutorial-coach-header span {
  font-size: 0.64rem;
}

body.mobile-ui.tutorial-active .tutorial-coach h2 {
  margin: 8px 0 5px;
  font-size: 1rem;
  line-height: 1.1;
}

body.mobile-ui.tutorial-active .tutorial-coach p {
  font-size: 0.72rem;
  line-height: 1.32;
}

body.mobile-ui.tutorial-active .tutorial-requirement {
  min-height: 16px;
  margin-top: 7px !important;
}

body.mobile-ui.tutorial-active .tutorial-coach-actions {
  gap: 8px;
  margin-top: 9px;
}

body.mobile-ui.tutorial-active .tutorial-coach-actions .mode-button,
body.mobile-ui.tutorial-active .tutorial-coach-actions .primary-button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.72rem;
}

body.mobile-ui.tutorial-active .tutorial-focus {
  outline-width: 2px;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(242, 184, 75, 0.14), 0 0 28px rgba(242, 184, 75, 0.34);
}

.brand {
  padding: 4px 0 12px;
}

.brand h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  max-width: 12ch;
  color: #fff4d5;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.68), 0 0 24px rgba(215, 169, 74, 0.18);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 0.96;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.075), rgba(0, 0, 0, 0)),
    radial-gradient(circle at 100% 0, rgba(98, 234, 208, 0.08), transparent 34%),
    linear-gradient(90deg, rgba(215, 169, 74, 0.055), transparent 18% 82%, rgba(98, 234, 208, 0.035)),
    var(--panel);
  border: 1px solid rgba(215, 169, 74, 0.24);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.42), var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-panel {
  display: grid;
  gap: 12px;
  padding: clamp(18px, 2.2vw, 26px);
  background:
    radial-gradient(circle at 18% 0, rgba(84, 211, 242, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(17, 76, 101, 0.22), rgba(215, 169, 74, 0.06) 46%, rgba(2, 10, 17, 0.28)),
    rgba(2, 14, 22, 0.36);
  border-color: rgba(95, 197, 225, 0.38);
  box-shadow: inset 0 1px 0 rgba(180, 238, 252, 0.14), 0 18px 54px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px) saturate(1.04);
}

.auth-panel .panel-title {
  margin-bottom: 0;
}

.auth-intro,
.auth-help {
  margin: 0;
  color: #d6e8e9;
  line-height: 1.42;
}

.auth-intro {
  padding: 10px 11px;
  border: 1px solid rgba(95, 197, 225, 0.2);
  border-radius: 8px;
  background: rgba(2, 20, 31, 0.26);
  font-weight: 720;
}

.auth-help {
  color: rgba(216, 232, 233, 0.78);
  font-size: 0.82rem;
}

.auth-field {
  display: grid;
  gap: 5px;
}

.auth-field > span {
  color: #f1dba4;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-field .text-input {
  margin-bottom: 0;
}

.auth-requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-requirements li {
  position: relative;
  min-height: 24px;
  padding: 5px 8px 5px 28px;
  border: 1px solid rgba(255, 240, 190, 0.12);
  border-radius: 7px;
  background: rgba(2, 13, 19, 0.3);
  color: rgba(255, 248, 232, 0.72);
  font-size: 0.78rem;
  font-weight: 760;
}

.auth-requirements li::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.auth-requirements li.is-valid {
  border-color: rgba(98, 234, 208, 0.34);
  background: rgba(10, 48, 42, 0.48);
  color: #9ff7df;
}

.auth-requirements li.is-valid::before {
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.mini-log[data-tone="warning"] {
  color: #ffd37a;
}

body.page-auth .brand {
  align-self: stretch;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 4px clamp(18px, 3vw, 28px) 4px 0;
  border-right: 1px solid rgba(95, 197, 225, 0.18);
  border-bottom: 0;
}

body.page-auth .brand h1 {
  max-width: 11ch;
  color: #f7fbff;
  text-shadow: 0 14px 42px rgba(0, 0, 0, 0.74), 0 0 26px rgba(80, 205, 232, 0.2);
}

body.page-auth .subtitle {
  color: #c8d8d8;
}

.game-only {
  display: none;
}

body.match-active .game-only {
  display: block;
}

body.desktop-ui.match-active .mobile-top-bar,
body.desktop-ui.match-active .mobile-bottom-nav,
body.desktop-ui.match-active .mobile-bottom-sheet-header,
body.desktop-ui.match-active .mobile-placement-toolbar,
body.desktop-ui.match-active .mobile-augments-panel,
body.desktop-ui.match-active .mobile-players-panel {
  display: none !important;
}

.game-only[hidden] {
  display: none !important;
}

.panel h2 {
  font-size: 1rem;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.class-grid,
.tower-list,
.barracks,
.bench-list {
  display: grid;
  gap: 8px;
}

.tower-list,
.barracks {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.class-grid {
  grid-template-columns: 1fr;
}

.choice-button {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.06), rgba(0, 0, 0, 0)),
    linear-gradient(135deg, rgba(98, 234, 208, 0.075), rgba(215, 169, 74, 0.05)),
    rgba(8, 13, 10, 0.82);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.choice-button::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 7px;
  background:
    linear-gradient(90deg, rgba(215, 169, 74, 0.24), transparent 28% 68%, rgba(98, 234, 208, 0.16)),
    radial-gradient(circle at 16% 26%, rgba(255, 248, 220, 0.18), transparent 24%);
  opacity: 0;
  transition: opacity 150ms ease;
}

.choice-button:hover,
.choice-button.active {
  border-color: rgba(215, 169, 74, 0.72);
  background:
    linear-gradient(135deg, rgba(215, 169, 74, 0.14), rgba(98, 234, 208, 0.08)),
    rgba(18, 29, 22, 0.94);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(215, 169, 74, 0.28), 0 0 22px rgba(98, 234, 208, 0.08), 0 12px 30px rgba(0, 0, 0, 0.26);
}

.choice-button:hover::after,
.choice-button.active::after {
  opacity: 1;
}

body.match-active .shop-card:hover {
  transform: none;
}

.choice-button:disabled {
  color: #697488;
  cursor: not-allowed;
  opacity: 0.6;
}

.choice-button.is-pending {
  border-color: rgba(255, 218, 126, 0.88);
  opacity: 1;
  transform: translateY(-1px) scale(0.985);
  box-shadow:
    0 0 0 1px rgba(255, 218, 126, 0.34),
    0 0 24px rgba(255, 188, 76, 0.22),
    inset 0 0 22px rgba(98, 234, 208, 0.08);
}

.unit-shop-card.is-pending {
  cursor: wait;
}

.shop-card.is-pending {
  cursor: wait;
}

.shop-card.is-pending::after {
  opacity: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 126, 0.3), transparent 22%),
    radial-gradient(circle at 50% 48%, rgba(98, 234, 208, 0.18), transparent 38%),
    linear-gradient(120deg, transparent 12%, rgba(255, 248, 232, 0.1) 42%, transparent 64%);
  animation: shopPurchaseWash 720ms ease-in-out infinite;
}

.shop-card.is-pending .choice-icon,
.unit-shop-card.is-pending .choice-icon {
  animation: shopPurchaseIcon 720ms ease-in-out infinite;
}

.shop-card.is-pending .choice-main,
.shop-card.is-pending .choice-cost {
  opacity: 0.28;
  transform: translateY(4px) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease;
}

.shop-card.is-replacing,
.unit-shop-card.is-replacing {
  animation: shopCardDealIn 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.shop-card-loader {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.shop-card-loader::before {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 230, 160, 0.58);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 248, 232, 0.28) 0 10%, transparent 11% 100%),
    conic-gradient(from 0deg, transparent, rgba(98, 234, 208, 0.82), rgba(255, 208, 93, 0.92), transparent 74%);
  box-shadow:
    0 0 24px rgba(255, 204, 84, 0.28),
    inset 0 0 18px rgba(98, 234, 208, 0.2);
  animation: shopPurchasePortal 760ms cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

.shop-card-loader::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff4c8;
  box-shadow:
    -22px -15px 0 -1px rgba(98, 234, 208, 0.9),
    21px -12px 0 -1px rgba(255, 202, 87, 0.92),
    -16px 17px 0 -1px rgba(255, 248, 232, 0.78),
    18px 18px 0 -2px rgba(98, 184, 255, 0.86);
  animation: shopPurchaseSparks 760ms ease-in-out infinite;
}

.shop-card.is-pending .shop-card-loader,
.unit-shop-card.is-pending .shop-card-loader {
  opacity: 1;
}

@keyframes shopPurchaseWash {
  0% {
    transform: translateX(-18%) skewX(-10deg);
    opacity: 0.55;
  }

  50% {
    transform: translateX(14%) skewX(-10deg);
    opacity: 0.95;
  }

  100% {
    transform: translateX(28%) skewX(-10deg);
    opacity: 0.55;
  }
}

@keyframes shopPurchasePortal {
  0% {
    opacity: 0.65;
    transform: rotate(0deg) scale(0.72);
  }

  50% {
    opacity: 1;
    transform: rotate(180deg) scale(1);
  }

  100% {
    opacity: 0.65;
    transform: rotate(360deg) scale(0.72);
  }
}

@keyframes shopPurchaseSparks {
  0%,
  100% {
    opacity: 0;
    transform: rotate(0deg) scale(0.72);
  }

  45% {
    opacity: 1;
    transform: rotate(22deg) scale(1);
  }

  70% {
    opacity: 0.62;
    transform: rotate(44deg) scale(1.18);
  }
}

@keyframes shopPurchaseIcon {
  0%,
  100% {
    filter: brightness(0.78) saturate(0.9);
    transform: translateY(0) scale(0.96);
  }

  50% {
    filter: brightness(1.28) saturate(1.18);
    transform: translateY(-4px) scale(1.04);
  }
}

@keyframes shopCardDealIn {
  0% {
    opacity: 0;
    filter: brightness(1.35) saturate(1.2);
    transform: translateY(12px) scale(0.94) rotateX(10deg);
  }

  58% {
    opacity: 1;
    filter: brightness(1.18) saturate(1.08);
    transform: translateY(-2px) scale(1.018) rotateX(0deg);
  }

  100% {
    opacity: 1;
    filter: brightness(1) saturate(1);
    transform: translateY(0) scale(1) rotateX(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shop-card.is-pending .choice-icon,
  .unit-shop-card.is-pending .choice-icon,
  .shop-card.is-replacing,
  .unit-shop-card.is-replacing,
  .shop-card-loader::before,
  .shop-card-loader::after {
    animation: none;
  }
}

.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -2px 0 10px;
}

.shop-action {
  min-height: 32px;
  padding-inline: 12px;
  white-space: nowrap;
}

.shop-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.tower-shop-header {
  align-items: center;
}

.tower-shop-header .odds-preview {
  justify-content: flex-start;
}

.tower-shop-header .shop-actions {
  margin-top: 0;
}

.shop-lock-button {
  min-width: 34px;
  padding-inline: 8px;
}

.shop-lock-button .shop-lock-icon::before {
  content: "\1F513";
}

.shop-lock-button.is-locked {
  border-color: rgba(242, 184, 75, 0.7);
  color: var(--gold);
  box-shadow: 0 0 0 1px rgba(242, 184, 75, 0.18);
}

.shop-lock-button.is-locked .shop-lock-icon::before {
  content: "\1F512";
}

.tower-shop-header .odds-pill span {
  color: inherit;
  font-size: inherit;
  white-space: nowrap;
}

.icon-action {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 48px;
  padding-inline: 9px;
  font-size: 0.82rem;
}

.icon-action > span:first-child {
  font-size: 1rem;
  line-height: 1;
}

.action-cost {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.shop-toolbar-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.odds-preview {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--muted);
}

.odds-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, var(--gold)) 44%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--rarity-color, var(--gold)) 12%, rgba(5, 9, 7, 0.7));
  color: color-mix(in srgb, var(--rarity-color, var(--gold)) 72%, #fff8e8);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.odds-pill strong {
  color: #fff8e8;
  font-size: 0.7rem;
}

.odds-pill.is-low-odds {
  border-style: dashed;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rarity-color, var(--gold)) 24%, transparent);
}

.shop-card {
  border-color: color-mix(in srgb, var(--rarity-color, var(--line)) 56%, var(--line));
  box-shadow:
    inset 4px 0 0 var(--rarity-color),
    inset 0 1px 0 color-mix(in srgb, var(--rarity-color) 28%, transparent);
}

.shop-match-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  max-width: calc(100% - 12px);
  padding: 2px 6px;
  border: 1px solid rgba(115, 191, 255, 0.38);
  border-radius: 999px;
  background: rgba(4, 8, 8, 0.84);
  color: #bde6ff;
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(115, 191, 255, 0.16);
  pointer-events: none;
}

.shop-match-badge.is-levelup {
  border-color: rgba(98, 234, 208, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.14), transparent),
    rgba(6, 20, 17, 0.94);
  color: #eafff7;
  box-shadow: 0 0 16px rgba(98, 234, 208, 0.34);
}

.shop-decision-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.shop-decision-row--plan {
  align-items: center;
}

.tower-shop-floating-badges {
  display: contents;
}

.shop-decision-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid rgba(255, 240, 190, 0.16);
  border-radius: 999px;
  background: rgba(4, 8, 7, 0.44);
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-decision-badge .income-icon,
.shop-decision-icon {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.shop-decision-badge .income-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shop-decision-symbol {
  display: inline-grid;
  place-items: center;
  color: currentColor;
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
}

.shop-decision-symbol svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shop-decision-badge--power {
  border-color: rgba(98, 234, 208, 0.58);
  background: rgba(5, 35, 28, 0.66);
  color: #cffff4;
}

.shop-decision-badge--income {
  border-color: rgba(112, 224, 126, 0.52);
  background: rgba(6, 38, 14, 0.58);
  color: #c9ffd0;
}

.shop-decision-badge--progress,
.shop-decision-badge--trait {
  border-color: rgba(242, 184, 75, 0.5);
  background: rgba(55, 35, 6, 0.56);
  color: #ffe6a0;
}

.shop-decision-badge--trait {
  border-color: color-mix(in srgb, var(--shop-tag-color, #d7a94a) 52%, rgba(255, 240, 190, 0.14));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--shop-tag-color, #d7a94a) 14%, transparent), transparent 72%),
    color-mix(in srgb, var(--shop-tag-color, #d7a94a) 12%, rgba(18, 11, 3, 0.68));
  color: color-mix(in srgb, var(--shop-tag-color, #d7a94a) 72%, #fff8e8);
}

.shop-decision-badge--info {
  border-color: rgba(98, 184, 255, 0.46);
  background: rgba(4, 25, 44, 0.58);
  color: #bde6ff;
}

.shop-decision-badge--fusion {
  border-color: rgba(98, 234, 208, 0.68);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.12), transparent 68%),
    rgba(5, 35, 28, 0.68);
  color: #d9fff7;
  box-shadow: 0 0 12px rgba(98, 234, 208, 0.14);
}

.shop-decision-badge--transition {
  border-color: rgba(115, 191, 255, 0.48);
  background: rgba(4, 26, 44, 0.6);
  color: #c5e7ff;
}

.shop-decision-badge--budget {
  border-color: rgba(159, 180, 166, 0.5);
  background: rgba(22, 32, 25, 0.64);
  color: #d9eadf;
}

.shop-decision-badge--element {
  gap: 3px;
  padding-inline: 5px;
  border-color: color-mix(in srgb, var(--shop-tag-color, #78efff) 58%, rgba(255, 240, 190, 0.14));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--shop-tag-color, #78efff) 18%, transparent), transparent 72%),
    color-mix(in srgb, var(--shop-tag-color, #78efff) 15%, rgba(3, 12, 13, 0.72));
  color: color-mix(in srgb, var(--shop-tag-color, #78efff) 72%, #fff8e8);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--shop-tag-color, #78efff) 24%, transparent);
}

.shop-decision-badge--icon-only {
  flex: 0 0 auto;
  justify-content: center;
  width: 20px;
  min-width: 20px;
  padding-inline: 3px;
}

.shop-decision-count {
  display: inline-grid;
  min-width: 14px;
  height: 14px;
  margin-left: 0;
  place-items: center;
  padding: 0 3px;
  border: 1px solid color-mix(in srgb, var(--shop-tag-color, #78efff) 54%, rgba(255, 248, 232, 0.18));
  border-radius: 999px;
  background: rgba(2, 6, 5, 0.54);
  color: #fff8e8;
  font-size: 0.56rem;
  line-height: 1;
}

.shop-decision-badge--locked {
  border-color: rgba(255, 111, 111, 0.42);
  background: rgba(60, 12, 18, 0.58);
  color: #ffb7b7;
}

.rarity-common {
  --rarity-color: #9fb4a6;
}

.rarity-uncommon {
  --rarity-color: #58d68d;
}

.rarity-rare {
  --rarity-color: #66b7ff;
}

.rarity-epic {
  --rarity-color: #bd8dff;
}

.rarity-legendary {
  --rarity-color: #f2b84b;
}

.rarity-mythic {
  --rarity-color: #ff3b30;
}

.choice-button[class*="rarity-"]::before,
.bench-slot[class*="rarity-"]::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--rarity-color);
  box-shadow: 0 0 18px color-mix(in srgb, var(--rarity-color) 70%, transparent);
}

.bench-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bench-slot {
  position: relative;
  display: grid;
  min-height: 72px;
  padding: 7px;
  border: 1px solid rgba(215, 169, 74, 0.22);
  border-radius: 8px;
  background: rgba(7, 12, 9, 0.78);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
}

.bench-slot.empty {
  cursor: default;
  opacity: 0.42;
}

.bench-slot.active {
  border-color: rgba(98, 234, 208, 0.92);
  box-shadow: 0 0 0 1px rgba(98, 234, 208, 0.36), 0 0 22px rgba(98, 234, 208, 0.18);
}

.bench-slot.level-2 {
  border-color: rgba(207, 216, 220, 0.86);
  box-shadow: inset 0 0 0 1px rgba(232, 238, 240, 0.38), 0 0 16px rgba(207, 216, 220, 0.14);
}

.bench-slot.level-3 {
  border-color: rgba(242, 184, 75, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 170, 0.5), 0 0 20px rgba(242, 184, 75, 0.22);
}

.bench-slot .choice-icon {
  width: 100%;
  height: 38px;
}

.bench-slot span,
.bench-slot strong {
  overflow: hidden;
  font-size: 0.66rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bench-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.choice-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(215, 169, 74, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(215, 169, 74, 0.22), rgba(14, 21, 16, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 248, 220, 0.14), inset 0 -8px 16px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(0, 0, 0, 0.36);
  font-size: 0.74rem;
  font-weight: 950;
}

.sprite-icon {
  position: relative;
  overflow: hidden;
  background-color: rgba(10, 15, 12, 0.9);
  background-repeat: no-repeat;
  background-position: var(--sprite-x) var(--sprite-y);
  background-size: calc(var(--sprite-cols) * 100%) calc(var(--sprite-rows) * 100%);
}

.tower-sprite {
  background-image: none;
}

.sprite-icon span {
  opacity: 0;
}

.tower-rendered-icon {
  position: relative;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 40% 24%, rgba(255, 248, 220, 0.16), transparent 32%),
    linear-gradient(145deg, rgba(215, 169, 74, 0.16), rgba(7, 11, 9, 0.96)) !important;
  background-position: center !important;
  background-size: auto !important;
}

.tower-rendered-icon img {
  display: block;
  width: 122%;
  height: 122%;
  object-fit: contain;
  transform: translateY(-2%);
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.tower-premium-icon img {
  position: absolute;
  inset: 2px;
  display: block;
  box-sizing: border-box;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  padding: 0;
  transform: none;
}

.unit-premium-icon {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 42% 24%, rgba(98, 234, 208, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(19, 44, 37, 0.82), rgba(7, 11, 9, 0.96)) !important;
  background-position: center !important;
  background-size: auto !important;
}

.unit-premium-icon img {
  position: absolute;
  inset: 2px;
  display: block;
  box-sizing: border-box;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  padding: 0;
  transform: none;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.choice-main {
  min-width: 0;
}

.choice-name {
  display: block;
  font-weight: 800;
}

.choice-desc {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-card .choice-desc {
  display: -webkit-box;
  line-height: 1.24;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.choice-cost {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 800;
}

.icon-value {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  line-height: 1;
  white-space: nowrap;
}

.icon-value > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coin-icon {
  position: relative;
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
  border: 1px solid rgba(255, 239, 158, 0.82);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.62), transparent 18%),
    radial-gradient(circle at 50% 56%, #f8cf58 0 34%, #c58d1b 66%, #7a4d0b 100%);
  box-shadow: inset 0 -2px 2px rgba(83, 48, 0, 0.55), 0 0 8px rgba(215, 169, 74, 0.28);
}

.coin-icon::after {
  content: "";
  position: absolute;
  inset: 24%;
  border: 1px solid rgba(105, 69, 8, 0.55);
  border-radius: 50%;
}

.income-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.1em;
  background: url("assets/icons/income-economy.png") center / contain no-repeat;
  vertical-align: -0.16em;
  filter: drop-shadow(0 0 5px rgba(115, 228, 154, 0.24));
}

.income-icon svg {
  display: none;
}

.defense-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 1.08em;
  height: 1.08em;
  place-items: center;
  color: #73bfff;
  filter: drop-shadow(0 0 5px rgba(115, 191, 255, 0.26));
}

.defense-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.heart-icon {
  position: relative;
  flex: 0 0 auto;
  width: 0.66em;
  height: 0.66em;
  margin: 0.1em 0.16em 0 0.04em;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #ff8b84, #d33845 78%);
  box-shadow: 0 0 8px rgba(255, 115, 106, 0.24);
}

.heart-icon::before,
.heart-icon::after {
  content: "";
  position: absolute;
  width: 0.66em;
  height: 0.66em;
  border-radius: 50%;
  background: inherit;
}

.heart-icon::before {
  top: -0.33em;
  left: 0;
}

.heart-icon::after {
  top: 0;
  left: 0.33em;
}

.heart-icon svg {
  display: none;
}

.stat-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.income-detail {
  color: var(--muted);
  font-size: 0.82em;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(215, 169, 74, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(215, 169, 74, 0.28), rgba(98, 234, 208, 0.13)),
    #1b2a1f;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.primary-button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  filter: grayscale(0.24);
  transform: none;
}

.primary-button.is-ready,
.mode-button.is-ready {
  border-color: rgba(93, 230, 155, 0.88);
  background:
    linear-gradient(180deg, rgba(127, 255, 186, 0.24), rgba(14, 101, 65, 0.34)),
    #103525;
  color: #dfffee;
  box-shadow: 0 0 0 1px rgba(127, 255, 186, 0.2), 0 12px 34px rgba(0, 0, 0, 0.34), 0 0 24px rgba(93, 230, 155, 0.18);
}

.mode-button,
.danger-button {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.035), transparent),
    rgba(9, 14, 11, 0.76);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.mode-button:hover {
  border-color: rgba(215, 169, 74, 0.58);
  background: rgba(24, 33, 24, 0.94);
  transform: translateY(-1px);
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.mode-button.active {
  border-color: rgba(242, 184, 75, 0.75);
  background: rgba(55, 43, 20, 0.9);
  color: var(--gold);
}

.mode-button.icon-action {
  width: auto;
  min-height: 34px;
  margin-top: 0;
  padding-inline: 9px;
}

.danger-button {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(54, 19, 25, 0.84);
  color: #ffd8d8;
}

.danger-button:hover {
  background: #3b1d22;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.batch-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.batch-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 11, 0.76);
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.batch-button.active {
  border-color: rgba(215, 169, 74, 0.68);
  background: #2a2515;
  color: var(--text);
}

.barracks-panel .panel-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.barracks-panel .panel-title .batch-controls {
  display: flex;
  justify-content: end;
  gap: 4px;
  margin: 0;
}

.barracks-panel .panel-title .batch-button {
  min-width: 34px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.72;
}

.barracks-panel .panel-title .batch-button:hover,
.barracks-panel .panel-title .batch-button.active {
  opacity: 1;
}

.selected-panel strong {
  display: block;
  color: var(--text);
}

.selected-tower-stats {
  display: grid;
  gap: 5px;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.selected-stat-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.selected-stat-row > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-stat-row--traits {
  align-items: flex-start;
}

.selected-stat-row--traits > span:last-child {
  white-space: normal;
}

.selected-stat-row--resistances {
  align-items: flex-start;
}

.selected-stat-row--resistances > span:last-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  white-space: normal;
}

.selected-trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.selected-trait-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 44%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 12%, rgba(0, 0, 0, 0.34));
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
}

.selected-trait-chip .trait-chip-icon {
  width: 15px;
  height: 15px;
  margin-inline-end: 0;
}

.element-resistance-list {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.element-resistance-chip {
  display: inline-grid;
  grid-template-columns: 14px minmax(3.25em, max-content);
  align-items: center;
  justify-items: center;
  gap: 4px;
  min-height: 18px;
  min-width: 58px;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--resistance-color, rgba(255, 248, 232, 0.32)) 58%, rgba(255, 248, 232, 0.12));
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--resistance-color, #fff8e8) 17%, transparent), transparent 70%),
    rgba(0, 0, 0, 0.22);
  color: color-mix(in srgb, var(--resistance-color, #fff8e8) 72%, #fff8e8);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--resistance-color, #fff8e8) 22%, transparent);
  white-space: nowrap;
}

.element-resistance-chip--neutral {
  --resistance-color: #aab7b0;
}

.element-resistance-chip--positive-low {
  --resistance-color: #cde85c;
}

.element-resistance-chip--positive-mid {
  --resistance-color: #7ee35e;
}

.element-resistance-chip--positive-high {
  --resistance-color: #2f8a46;
}

.element-resistance-chip--positive-max {
  --resistance-color: #39ff74;
}

.element-resistance-chip--negative-low {
  --resistance-color: #ffd05c;
}

.element-resistance-chip--negative-mid {
  --resistance-color: #ff9138;
}

.element-resistance-chip--negative-high {
  --resistance-color: #ff4d45;
}

.element-resistance-chip--negative-max {
  --resistance-color: #ff174d;
}

.element-resistance-chip strong {
  min-width: 3.25em;
  margin-bottom: 0;
  color: inherit;
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.selected-panel .element-resistance-chip strong,
body.match-active .selected-panel .element-resistance-chip strong {
  margin-bottom: 0;
  color: inherit;
}

.element-resistance-icon {
  width: 14px;
  height: 14px;
}

.element-resistance-overview {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 248, 232, 0.1);
  border-radius: 8px;
  background: rgba(4, 8, 6, 0.34);
}

.traits-element-resistance-summary {
  grid-column: 1 / -1;
}

.traits-element-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.28fr);
  gap: 10px;
  align-items: stretch;
}

.traits-element-tools > .traits-element-resistance-summary {
  grid-column: auto;
}

.traits-element-tools .element-resistance-overview {
  height: 100%;
  align-content: start;
}

.traits-element-tools .element-resistance-overview-grid {
  grid-template-columns: 1fr;
}

.element-resonance-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 7px;
  min-width: 0;
}

.element-resonance-column {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 248, 232, 0.1);
  border-radius: 8px;
  background: rgba(4, 8, 6, 0.34);
}

.element-resonance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.element-resonance-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-resonance-head span {
  flex: 0 0 auto;
  color: rgba(255, 248, 232, 0.58);
}

.element-power-overview,
.element-resonance-list {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.element-power-row {
  display: grid;
  grid-template-columns: 20px 4.2em minmax(58px, 1fr) 2.2em;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 26px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 38%, rgba(255, 240, 190, 0.12));
  border-radius: 7px;
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 9%, rgba(0, 0, 0, 0.32));
}

.element-power-icon,
.element-resonance-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.element-power-row strong {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-power-row em {
  color: #fff8e8;
  font-size: 0.7rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  text-align: right;
}

.element-power-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 248, 232, 0.08);
}

.element-power-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--trait-color, #d7a94a) 75%, #fff8e8), color-mix(in srgb, var(--trait-color, #d7a94a) 45%, #62ead0));
}

.element-resonance-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 248, 232, 0.1);
  border-radius: 8px;
  background: rgba(1, 8, 10, 0.5);
}

.element-resonance-card.is-active {
  border-color: rgba(98, 234, 208, 0.28);
  background:
    linear-gradient(135deg, rgba(98, 234, 208, 0.08), transparent 52%),
    rgba(1, 8, 10, 0.56);
}

.element-resonance-card-head,
.element-resonance-effect,
.element-resonance-targets {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  min-width: 0;
}

.element-resonance-card-head strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-resonance-card-head > span {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid rgba(255, 248, 232, 0.12);
  border-radius: 999px;
  color: #efe0ad;
  font-size: 0.62rem;
  font-weight: 950;
  white-space: nowrap;
}

.element-resonance-pair,
.element-resonance-coverage {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.element-resonance-element {
  display: inline-grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-width: 78px;
  max-width: 110px;
  min-height: 26px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 44%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background: color-mix(in srgb, var(--trait-color, #d7a94a) 12%, rgba(0, 0, 0, 0.34));
}

.element-resonance-element strong {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, #fff8e8);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-resonance-element em {
  color: #fff8e8;
  font-size: 0.66rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.element-resonance-effect {
  justify-content: flex-start;
  padding: 5px 6px;
  border: 1px solid rgba(98, 234, 208, 0.12);
  border-radius: 7px;
  background: rgba(98, 234, 208, 0.055);
}

.element-resonance-effect strong {
  color: #9ff7ff;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.element-resonance-effect--resist {
  border-color: rgba(255, 191, 92, 0.14);
  background: rgba(255, 191, 92, 0.05);
}

.element-resonance-effect--resist strong {
  color: #ffe0aa;
}

.element-resonance-effect span {
  min-width: 0;
  color: rgba(255, 248, 232, 0.74);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.25;
}

.element-resonance-targets {
  align-items: flex-start;
  justify-content: flex-start;
}

.element-resonance-targets em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 950;
  line-height: 1.5;
  text-transform: uppercase;
}

.element-resonance-coverage span {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 191, 92, 0.3);
  border-radius: 999px;
  background: rgba(255, 191, 92, 0.075);
  color: #ffe0aa;
  font-size: 0.6rem;
  font-weight: 950;
  line-height: 1;
}

.element-resonance-coverage span.is-major {
  border-color: rgba(255, 91, 83, 0.42);
  background: rgba(255, 91, 83, 0.075);
  color: #ffd7cd;
}

.element-matchup-graph {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 248, 232, 0.1);
  border-radius: 8px;
  background: rgba(4, 8, 6, 0.34);
}

.element-matchup-head,
.element-matchup-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.element-matchup-head strong {
  color: var(--text);
}

.element-matchup-board {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid rgba(151, 184, 211, 0.1);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 248, 232, 0.055), transparent 42%),
    rgba(1, 7, 8, 0.44);
}

.element-matchup-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.element-matchup-edge {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.element-matchup-edge--hard {
  stroke: rgba(255, 91, 83, 0.82);
  stroke-width: 2.1;
  marker-end: url(#elementMatchupArrowHard);
}

#elementMatchupArrowHard path {
  fill: rgba(255, 91, 83, 0.88);
}

.element-matchup-center {
  fill: rgba(255, 248, 232, 0.66);
  font: 900 6px Inter, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.element-matchup-center--sub {
  fill: rgba(196, 210, 205, 0.62);
  font-size: 4.2px;
}

.element-matchup-node {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  z-index: 1;
  display: grid;
  gap: 5px;
  width: 126px;
  min-height: 62px;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 48%, rgba(255, 240, 190, 0.16));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 14%, transparent), transparent 76%),
    rgba(2, 10, 12, 0.9);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  color: #fff8e8;
  transform: translate(-50%, -50%);
}

.element-matchup-main {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.element-matchup-node.has-power {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 72%, rgba(255, 255, 255, 0.2));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--trait-color, #d7a94a) 22%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.32);
}

.element-matchup-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.element-matchup-node strong {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 66%, #fff8e8);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-matchup-node em {
  display: inline-grid;
  min-width: 34px;
  min-height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 248, 232, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #fff8e8;
  font-size: 0.76rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.element-matchup-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.element-matchup-target {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  max-width: 42px;
  padding: 1px 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 232, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.052);
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-matchup-target--major {
  border-color: rgba(255, 91, 83, 0.48);
  color: #ffd7cd;
}

.element-matchup-target--minor {
  border-color: rgba(255, 191, 92, 0.38);
  color: #ffe0aa;
}

.element-matchup-target--more {
  max-width: 28px;
  color: var(--muted);
}

.element-matchup-legend {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.element-matchup-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.element-matchup-swatch {
  display: inline-block;
  width: 18px;
  height: 2px;
  border-radius: 99px;
}

.element-matchup-swatch--hard {
  background: rgba(255, 91, 83, 0.88);
}

.element-matchup-swatch--soft {
  height: 14px;
  width: 28px;
  border: 1px solid rgba(255, 191, 92, 0.38);
  border-radius: 999px;
  background: rgba(255, 191, 92, 0.11);
}

@media (max-width: 760px) {
  .traits-element-tools {
    grid-template-columns: 1fr;
  }

  .traits-element-tools > .traits-element-resistance-summary {
    grid-column: auto;
  }

  .element-resonance-panel {
    grid-template-columns: 1fr;
  }

  .element-resonance-head {
    align-items: flex-start;
  }

  .element-resonance-head span {
    white-space: normal;
    text-align: right;
  }

  .element-matchup-board {
    min-height: 280px;
  }

  .element-matchup-node {
    width: 108px;
    min-height: 58px;
    padding-inline: 6px;
  }

  .element-matchup-main {
    grid-template-columns: 20px minmax(0, 1fr) 31px;
  }

  .element-matchup-node strong {
    font-size: 0.66rem;
  }

  .element-matchup-node em {
    min-width: 30px;
    font-size: 0.66rem;
  }

  .element-matchup-target {
    max-width: 36px;
    font-size: 0.52rem;
  }
}

.element-resistance-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.element-resistance-overview-head strong {
  color: var(--text);
}

.element-resistance-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.element-resistance-overview-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2ch;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.element-resistance-overview-cell .element-resistance-chip {
  min-width: 0;
  width: 100%;
  padding-inline: 4px;
  font-size: 0.62rem;
}

.element-resistance-overview-cell em {
  color: var(--muted);
  font-size: 0.62rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.selected-trait-chip.is-active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--trait-color, #d7a94a) 30%, transparent), 0 0 14px color-mix(in srgb, var(--trait-color, #d7a94a) 18%, transparent);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 12px 0 16px;
}

.tab-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 11, 0.68);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.tab-button.active {
  border-color: var(--gold);
  color: var(--text);
  background: rgba(36, 38, 25, 0.92);
}

.tab-button:hover {
  color: var(--text);
  border-color: rgba(102, 242, 230, 0.45);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
}

.volume-row {
  justify-content: space-between;
}

.volume-row span {
  flex: 0 0 auto;
  font-weight: 800;
}

.volume-row strong {
  flex: 0 0 42px;
  color: var(--text);
  font-size: 0.78rem;
  text-align: right;
}

.volume-slider {
  flex: 1 1 auto;
  min-width: 92px;
  accent-color: var(--gold);
}

.mini-log {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 170px;
  overflow: auto;
}

body.is-authenticated:not(.match-active) .history-list {
  max-height: 520px;
}

.history-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 240, 190, 0.04), transparent),
    rgba(9, 14, 11, 0.72);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.history-item:hover {
  border-color: rgba(115, 191, 255, 0.36);
}

.history-item strong {
  color: var(--text);
}

.lobby-room-card {
  display: grid;
  gap: 10px;
}

.lobby-room-head,
.lobby-ready-summary,
.lobby-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lobby-room-head span {
  padding: 4px 8px;
  border: 1px solid rgba(215, 169, 74, 0.38);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lobby-ready-summary {
  padding: 8px 10px;
  border: 1px solid rgba(93, 230, 155, 0.24);
  border-radius: 8px;
  background: rgba(9, 31, 23, 0.58);
  color: #bfead4;
}

.lobby-player-list {
  display: grid;
  gap: 6px;
}

.lobby-player {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(3, 14, 18, 0.68);
}

.lobby-player-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.lobby-player-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.lobby-player-actions .mode-button {
  min-width: 64px;
  min-height: 30px;
  margin: 0;
  padding: 0 10px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.lobby-player.is-you {
  border-color: rgba(115, 191, 255, 0.42);
}

.lobby-player.is-ready {
  border-color: rgba(93, 230, 155, 0.48);
  background: rgba(13, 55, 37, 0.74);
}

.lobby-player.is-offline {
  opacity: 0.62;
}

.lobby-player-name {
  min-width: 0;
  color: var(--text);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.lobby-ready-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lobby-player.is-ready .lobby-ready-badge {
  border-color: rgba(93, 230, 155, 0.42);
  color: #9effc9;
}

.lobby-ready-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

body.is-authenticated:not(.match-active) .shell {
  grid-template-columns: minmax(0, 1fr);
  width: min(calc(100vw - 44px), calc((100vh - 34px) * 16 / 9), 1760px);
  height: min(calc(100vh - 48px), calc((100vw - 72px) * 9 / 16));
  aspect-ratio: 16 / 9;
  align-self: center;
  margin-inline: auto;
  min-height: 0;
  padding: 0;
}

body.is-authenticated:not(.match-active) .sidebar {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.is-authenticated:not(.match-active) .sidebar > .brand {
  display: none;
}

body.is-authenticated:not(.match-active) .launcher-panel {
  --launcher-left-x: 10.4%;
  --launcher-left-y: 16.2%;
  --launcher-left-w: 22.2%;
  --launcher-left-bottom: 9.6%;
  --launcher-main-x: 35.8%;
  --launcher-main-y: 16%;
  --launcher-main-right: 8.4%;
  --launcher-main-bottom: 9.8%;
  --launcher-frame-bleed-x: 34px;
  --launcher-frame-bleed-top: 30px;
  --launcher-frame-bleed-bottom: 22px;
  position: relative;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.is-authenticated:not(.match-active) .launcher-panel::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--launcher-frame-bleed-top)) calc(-1 * var(--launcher-frame-bleed-x)) calc(-1 * var(--launcher-frame-bleed-bottom));
  z-index: 1;
  pointer-events: none;
  background: url("assets/menu-arena-entrance-frame-slim.png?v=20260520-arena-frame2") center / 100% 100% no-repeat;
  opacity: 1;
}

body.is-authenticated:not(.match-active) .launcher-panel::after {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--launcher-frame-bleed-top)) calc(-1 * var(--launcher-frame-bleed-x)) calc(-1 * var(--launcher-frame-bleed-bottom));
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(144, 219, 232, 0.12);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(2, 13, 18, 0.24), rgba(2, 13, 18, 0.08) 34%, rgba(2, 13, 18, 0.2)),
    radial-gradient(circle at 10% 92%, rgba(33, 199, 255, 0.08), transparent 16%),
    radial-gradient(circle at 92% 90%, rgba(255, 82, 45, 0.07), transparent 18%);
}

.launcher-frame {
  position: relative;
  z-index: 2;
  display: block;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.launcher-nav {
  position: absolute;
  top: var(--launcher-left-y);
  bottom: var(--launcher-left-bottom);
  left: var(--launcher-left-x);
  width: var(--launcher-left-w);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.2vw, 16px);
  min-height: 0;
  padding: 0;
  border-right: 0;
  background: transparent;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.launcher-nav > * {
  width: min(100%, 286px);
  justify-self: center;
}

.launcher-mark {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 240, 190, 0.08);
  border-radius: 8px;
  background: rgba(1, 12, 18, 0.2);
  backdrop-filter: blur(2px);
}

.launcher-mark-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(220, 170, 77, 0.76);
  border-radius: 8px;
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 248, 220, 0.28), transparent 30%),
    linear-gradient(145deg, rgba(190, 133, 33, 0.48), rgba(34, 205, 231, 0.08)),
    rgba(3, 22, 29, 0.94);
  color: #fff1c5;
  font-size: 0.7rem;
  font-weight: 950;
}

.launcher-mark strong {
  display: block;
  color: #fff4d5;
  font-size: 0.96rem;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.launcher-mark .eyebrow {
  margin-bottom: 2px;
  font-size: 0.66rem;
}

.profile-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(241, 193, 93, 0.5);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 10%, rgba(31, 202, 229, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(247, 198, 83, 0.12), rgba(0, 0, 0, 0)),
    rgba(3, 18, 24, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 245, 199, 0.08), inset 0 0 28px rgba(14, 207, 255, 0.05);
}

.profile-avatar {
  display: grid;
  grid-row: 1 / span 2;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid rgba(220, 170, 77, 0.86);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 28%, rgba(255, 255, 255, 0.2), transparent 24%),
    radial-gradient(circle at 50% 70%, rgba(31, 202, 229, 0.3), transparent 42%),
    #061b25;
  color: #fff4d5;
  font-weight: 950;
  box-shadow: 0 0 22px rgba(215, 169, 74, 0.16);
}

.profile-meta {
  min-width: 0;
}

.profile-meta h2 {
  overflow: hidden;
  color: #fff8e8;
  font-size: 1rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta span {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-status {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 0;
  border-top: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.profile-status strong {
  position: relative;
  color: var(--green);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.profile-status strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.profile-live-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.profile-live-stats span {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid rgba(255, 240, 190, 0.1);
  border-radius: 6px;
  background: rgba(2, 13, 18, 0.28);
}

.profile-live-stats strong {
  color: #fff4d5;
  font-size: 0.92rem;
  line-height: 1;
}

.profile-live-stats small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.launcher-tabs {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: clamp(5px, 0.7vw, 8px);
  min-height: 0;
  margin: 0;
  overflow: visible;
  padding-right: 4px;
}

.launcher-tabs .tab-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: clamp(42px, 4.2vh, 50px);
  padding: 0 28px 0 40px;
  border: 2px solid rgba(226, 178, 82, 0.52);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(236, 188, 88, 0.18), rgba(5, 24, 31, 0.58) 34%, rgba(1, 10, 14, 0.72)),
    rgba(2, 14, 20, 0.58);
  color: rgba(255, 242, 205, 0.92);
  font-size: 0.84rem;
  text-align: left;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.86);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.56),
    0 8px 18px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.launcher-tabs .tab-button[hidden] {
  display: none !important;
}

.launcher-tabs .tab-button::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(250, 212, 120, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 245, 199, 0.5), transparent 28%),
    linear-gradient(135deg, #23c9e8, #0b5064);
  box-shadow: 0 0 14px rgba(35, 201, 232, 0.18);
  transform: translateY(-50%) rotate(45deg);
}

.launcher-tabs .tab-button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 9px;
  height: 9px;
  border-top: 2px solid rgba(255, 222, 127, 0.78);
  border-right: 2px solid rgba(255, 222, 127, 0.78);
  box-shadow: 4px -4px 12px rgba(255, 222, 127, 0.22);
  transform: translateY(-50%) rotate(45deg);
}

.launcher-tabs .tab-button:hover {
  border-color: rgba(62, 218, 244, 0.68);
  background:
    linear-gradient(90deg, rgba(62, 218, 244, 0.16), rgba(9, 42, 51, 0.56) 42%, rgba(2, 15, 21, 0.66)),
    rgba(3, 28, 37, 0.54);
}

.launcher-tabs .tab-button.active {
  border-color: rgba(255, 216, 118, 0.92);
  background:
    linear-gradient(90deg, rgba(247, 198, 83, 0.42), rgba(34, 205, 231, 0.12) 48%, rgba(2, 16, 22, 0.62)),
    rgba(5, 25, 31, 0.58);
  color: #fff8e8;
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.48),
    0 0 18px rgba(220, 170, 77, 0.22);
}

.launcher-tabs .tab-button.active::before {
  background:
    linear-gradient(135deg, rgba(255, 245, 199, 0.62), transparent 28%),
    linear-gradient(135deg, #ffd36d, #b05a14);
  box-shadow: 0 0 18px rgba(255, 211, 109, 0.34);
}

.launcher-audio {
  display: grid;
  gap: 5px;
  padding: 8px 4px 0;
  border-top: 1px solid rgba(196, 145, 61, 0.18);
}

.launcher-audio .mode-button {
  min-height: 30px;
  margin-top: 0;
  font-size: 0.78rem;
}

.launcher-audio .setting-row {
  min-height: 20px;
  margin: 0;
  font-size: 0.8rem;
}

.launcher-audio .volume-row {
  gap: 6px;
}

.launcher-audio .volume-slider {
  min-width: 72px;
}

.launcher-workspace {
  position: absolute;
  top: var(--launcher-main-y);
  right: var(--launcher-main-right);
  bottom: var(--launcher-main-bottom);
  left: var(--launcher-main-x);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.launcher-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-height: clamp(54px, 7vh, 74px);
  padding: 0 8px clamp(8px, 1.2vh, 12px);
  border-bottom: 0;
  background: transparent;
}

.launcher-page-header > div {
  display: inline-grid;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 240, 190, 0.08);
  border-radius: 8px;
  background: rgba(2, 13, 18, 0.24);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(2px);
}

.launcher-page-header h2 {
  margin: 0;
  color: #fff4d5;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.86), 0 0 18px rgba(36, 207, 237, 0.12);
}

.launcher-page-header h2:not(#launcherPageTitle) {
  display: none;
}

.launcher-page-header .eyebrow {
  margin-bottom: 6px;
}

.launcher-page-header .launcher-hero-tags {
  display: none;
}

.launcher-hero {
  position: relative;
  display: grid;
  align-items: end;
  min-height: 172px;
  padding: 20px 26px 26px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(1, 12, 18, 0.42), rgba(2, 18, 25, 0.08) 58%, rgba(1, 10, 16, 0.42)),
    linear-gradient(180deg, rgba(2, 19, 27, 0.02), rgba(1, 10, 16, 0.36));
}

.launcher-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220, 170, 77, 0.72), transparent);
}

.launcher-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(680px, 100%);
}

.launcher-hero h2 {
  margin: 0;
  color: #fff4d5;
  font-size: clamp(1.9rem, 4vw, 3.25rem);
  line-height: 0.98;
  text-shadow: 0 16px 34px rgba(0, 0, 0, 0.7);
}

.launcher-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.launcher-hero-tags span {
  padding: 6px 10px;
  border: 1px solid rgba(220, 170, 77, 0.42);
  border-radius: 999px;
  background: rgba(1, 13, 18, 0.72);
  color: #efe0ad;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.launcher-content {
  align-self: stretch;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1vw, 14px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}

body.is-authenticated:not(.match-active) .launcher-content .tab-pane.active,
body.is-authenticated:not(.match-active) .launcher-content #profileTab.active {
  display: block;
}

.launcher-section {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-title h3 {
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 240, 190, 0.08);
  border-radius: 8px;
  background: rgba(2, 13, 18, 0.22);
  color: #fff4d5;
  font-size: 1.25rem;
  backdrop-filter: blur(2px);
}

.section-title span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 240, 190, 0.08);
  border-radius: 8px;
  background: rgba(2, 13, 18, 0.2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  backdrop-filter: blur(2px);
}

.play-section {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: start;
}

.play-section .section-title,
.play-section .mini-log {
  grid-column: 1 / -1;
}

.play-section .mini-log {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255, 240, 190, 0.08);
  border-radius: 8px;
  background: rgba(2, 13, 18, 0.2);
  backdrop-filter: blur(2px);
}

.lobby-list {
  min-height: 156px;
  margin-top: 0;
}

.play-actions {
  display: grid;
  gap: 10px;
}

.profile-progression {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.profile-progression > div:not(.profile-xp-bar) {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(215, 169, 74, 0.18);
  border-radius: 8px;
  background: rgba(8, 13, 10, 0.72);
}

.profile-progression span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-progression strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-profile-viewer {
  margin-bottom: 12px;
}

.player-profile-viewer[hidden] {
  display: none;
}

.player-profile-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(115, 191, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(115, 191, 255, 0.1), transparent 42%),
    rgba(2, 18, 24, 0.82);
}

.player-profile-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(215, 169, 74, 0.35);
  border-radius: 8px;
  background: rgba(215, 169, 74, 0.12);
  color: #fff8e8;
  font-size: 1.15rem;
  font-weight: 950;
}

.player-profile-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.player-profile-eyebrow,
.player-profile-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.player-profile-eyebrow {
  font-weight: 900;
  text-transform: uppercase;
}

.player-profile-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.player-profile-meta span {
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.player-profile-xp {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 240, 190, 0.08);
}

.player-profile-xp > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #62ead0, #d7a94a);
}

.player-profile-actions {
  display: flex;
  justify-content: end;
}

.player-profile-actions .mode-button {
  min-width: 76px;
  min-height: 34px;
  margin: 0;
  padding: 0 14px;
  white-space: nowrap;
}

.profile-xp-bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 240, 190, 0.08);
}

.profile-xp-bar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #62ead0, #d7a94a);
}

.profile-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.profile-insight-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(115, 191, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(98, 234, 208, 0.06), transparent 46%),
    rgba(3, 14, 18, 0.42);
}

.profile-insight-card--highlight {
  border-color: rgba(242, 184, 75, 0.28);
  background:
    linear-gradient(135deg, rgba(242, 184, 75, 0.1), transparent 48%),
    rgba(18, 13, 4, 0.42);
}

.profile-insight-card span {
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.profile-insight-card strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-insight-card p {
  margin: 0;
  color: rgba(239, 224, 173, 0.72);
  font-size: 0.72rem;
  line-height: 1.3;
}

.reference-section {
  gap: 16px;
}

.reference-list,
.reference-group {
  display: grid;
  gap: 14px;
}

.reference-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(220, 170, 77, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--reference-color, #dca643) 9%, transparent), transparent 58%),
    rgba(2, 15, 20, 0.76);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--reference-color, #dca643) 62%, transparent);
  content-visibility: auto;
  contain-intrinsic-size: 150px;
}

.reference-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.reference-card-head.reference-trait-head {
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.reference-trait-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reference-card-head h4 {
  margin: 2px 0 0;
  color: #fff4d5;
  font-size: 1rem;
}

.reference-card-head span,
.reference-card-head em,
.reference-tier em,
.reference-towers {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 850;
  text-transform: uppercase;
}

.reference-rarity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.reference-rarity,
.reference-tier {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 9px;
  border: 1px solid color-mix(in srgb, var(--reference-color, #dca643) 42%, rgba(255, 240, 190, 0.12));
  border-radius: 7px;
  background: rgba(1, 10, 14, 0.48);
}

.reference-rarity strong,
.reference-tier strong {
  color: color-mix(in srgb, var(--reference-color, #dca643) 72%, #fff8e8);
}

.reference-rarity small {
  color: #fff8e8;
  font-size: 0.72rem;
}

.reference-rarity b {
  color: #fff8e8;
  font-size: 0.82rem;
}

.reference-rarity span,
.reference-tier span,
.reference-card p {
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.78rem;
  line-height: 1.35;
}

.reference-trait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reference-tier-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.reference-tier {
  grid-template-columns: minmax(74px, 0.32fr) repeat(2, minmax(0, 1fr));
  align-items: start;
}

.reference-tier div {
  display: grid;
  gap: 4px;
}

.reference-towers {
  margin: 10px 0 0;
  text-transform: none;
}

.reference-towers strong,
.trait-bonus-block > h4 + .reference-tower-list {
  flex: 0 0 100%;
}

.reference-tower-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  width: 100%;
}

.reference-tower-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 52px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, #9fb4a6) 46%, rgba(255, 240, 190, 0.12));
  border-radius: 7px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, #9fb4a6) 12%, transparent), transparent 70%),
    rgba(1, 10, 14, 0.5);
}

.reference-tower-card .choice-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.reference-tower-card span:not(.choice-icon) {
  display: flex;
  align-items: center;
  min-width: 0;
}

.reference-tower-card .reference-tower-body {
  display: grid !important;
  align-content: center;
  gap: 3px;
  min-width: 0;
}

.reference-tower-summary {
  display: inline-flex !important;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, #9fb4a6) 34%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.reference-tower-hover {
  position: absolute;
  z-index: 20;
  right: auto;
  bottom: calc(100% + 8px);
  left: 0;
  display: none !important;
  gap: 6px;
  width: min(230px, max(100%, 190px));
  min-width: 0;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, #9fb4a6) 48%, rgba(255, 240, 190, 0.16));
  border-radius: 7px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, #9fb4a6) 12%, transparent), transparent 72%),
    rgba(1, 10, 14, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  pointer-events: none;
}

.reference-tower-card:hover .reference-tower-hover,
.reference-tower-card:focus-within .reference-tower-hover {
  display: grid !important;
}

.reference-tower-card .reference-tower-stats,
.tower-stat-block .reference-tower-stats {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 5px;
  min-width: 0;
}

.tower-stat-block .reference-tower-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.reference-tower-stats .stat-pill {
  justify-content: center;
  min-width: 0;
  min-height: 25px;
  padding: 3px 5px;
  border: 1px solid rgba(151, 184, 211, 0.14);
  background: rgba(4, 8, 6, 0.42);
  color: #d7e3d1;
}

.reference-tower-stats .stat-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  place-items: center;
}

.reference-tower-stats .stat-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.reference-tower-stats .stat-pill strong {
  font-size: 0.68rem;
  white-space: nowrap;
}

.reference-tower-effects {
  display: flex !important;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.reference-tower-effects > span {
  display: inline-flex !important;
  align-items: center;
  min-height: 22px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 240, 190, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
}

.reference-tower-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-tower-card strong {
  color: #fff8e8;
  font-size: 0.78rem;
}

.reference-tower-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.reference-card--tower {
  display: grid;
  gap: 12px;
  border-color: color-mix(in srgb, var(--rarity-color, #9fb4a6) 42%, rgba(255, 240, 190, 0.14));
  contain-intrinsic-size: 210px;
}

.reference-tower-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.reference-tower-head .choice-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.reference-tower-head span,
.tower-trait-block > strong,
.trait-chip small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reference-tower-head h4 {
  min-width: 0;
  margin: 2px 0 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-trait-block {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.tower-stat-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.trait-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trait-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 46%, rgba(255, 240, 190, 0.14));
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 16%, transparent), transparent 76%),
    rgba(1, 10, 14, 0.48);
  color: #fff8e8;
}

.trait-chip strong {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 70%, #fff8e8);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-chip--empty {
  --trait-color: #78868b;
  opacity: 0.72;
}

.play-actions .primary-button {
  min-height: 64px;
  border-color: rgba(247, 198, 83, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 238, 160, 0.34), rgba(145, 92, 18, 0.2) 52%, rgba(79, 48, 10, 0.32)),
    linear-gradient(90deg, #8c5c15, #d39a31 48%, #8a5a16);
  color: #fff5d6;
  font-size: 1rem;
  box-shadow: 0 0 0 1px rgba(255, 227, 139, 0.22), 0 12px 36px rgba(0, 0, 0, 0.34), 0 0 26px rgba(220, 170, 77, 0.18);
  text-transform: uppercase;
}

.play-actions .primary-button.is-ready {
  border-color: rgba(93, 230, 155, 0.92);
  background:
    linear-gradient(180deg, rgba(127, 255, 186, 0.32), rgba(14, 101, 65, 0.42)),
    linear-gradient(90deg, #12623f, #2bbd74 48%, #0e5536);
  color: #edfff6;
  box-shadow: 0 0 0 1px rgba(127, 255, 186, 0.24), 0 12px 36px rgba(0, 0, 0, 0.34), 0 0 28px rgba(93, 230, 155, 0.26);
}

@media (min-width: 981px) and (max-height: 820px) {
  .launcher-nav {
    gap: 7px;
    padding: 0;
  }

  .launcher-mark {
    grid-template-columns: 40px minmax(0, 1fr);
    min-height: 44px;
    gap: 8px;
  }

  .launcher-mark-icon {
    width: 40px;
    height: 40px;
    font-size: 0.68rem;
  }

  .launcher-mark strong {
    font-size: 0.92rem;
    line-height: 1.05;
  }

  .profile-card {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
  }

  .profile-avatar {
    width: 46px;
    height: 46px;
  }

  .profile-meta h2 {
    font-size: 1rem;
  }

  .profile-status {
    padding-top: 6px;
    font-size: 0.74rem;
  }

  .launcher-tabs {
    gap: 6px;
  }

  .launcher-tabs .tab-button {
    min-height: 38px;
    padding-left: 38px;
    padding-right: 28px;
    font-size: 0.8rem;
  }

  .launcher-tabs .tab-button::before {
    left: 12px;
    width: 12px;
    height: 12px;
  }

  .launcher-audio {
    padding-top: 6px;
  }

  .launcher-audio .setting-row {
    margin: 5px 0;
    font-size: 0.8rem;
  }

  .launcher-audio .mode-button {
    min-height: 30px;
    margin-top: 5px;
    font-size: 0.78rem;
  }

  .launcher-workspace {
    padding: 0;
  }

  .launcher-page-header {
    min-height: 58px;
    padding-bottom: 8px;
  }

  .launcher-page-header h2 {
    font-size: clamp(1.35rem, 2.25vw, 1.9rem);
  }

  .launcher-content {
    padding: 8px 10px;
  }
}

@media (min-width: 981px) and (max-height: 920px) {
  .launcher-nav {
    gap: 6px;
  }

  .launcher-mark {
    min-height: 40px;
  }

  .launcher-mark-icon {
    width: 38px;
    height: 38px;
  }

  .profile-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 6px 8px;
    padding: 7px 8px;
  }

  .profile-avatar {
    width: 40px;
    height: 40px;
  }

  .profile-meta h2 {
    font-size: 0.92rem;
  }

  .profile-meta span,
  .profile-status,
  .profile-status strong {
    font-size: 0.68rem;
  }

  .launcher-tabs {
    gap: 5px;
  }

  .launcher-tabs .tab-button {
    min-height: 36px;
    font-size: 0.8rem;
  }

  .launcher-audio {
    gap: 4px;
    padding-top: 5px;
  }

  .launcher-audio .setting-row {
    min-height: 18px;
    font-size: 0.76rem;
  }

  .launcher-audio .mode-button {
    min-height: 28px;
    font-size: 0.74rem;
  }
}

body.is-authenticated:not(.match-active) .shell {
  width: min(calc(100vw - 28px), calc((100vh - 24px) * 16 / 9), 1840px);
  height: min(calc(100vh - 30px), calc((100vw - 48px) * 9 / 16));
}

body.is-authenticated:not(.match-active) .launcher-panel {
  --launcher-left-x: 11.2%;
  --launcher-left-y: 17%;
  --launcher-left-w: 23.8%;
  --launcher-left-bottom: 6.2%;
  --launcher-main-x: 36%;
  --launcher-main-y: 17%;
  --launcher-main-right: 7.5%;
  --launcher-main-bottom: 6.2%;
  --launcher-frame-bleed-x: 42px;
  --launcher-frame-bleed-top: 36px;
  --launcher-frame-bleed-bottom: 30px;
}

body.is-authenticated:not(.match-active) .launcher-panel::after {
  background:
    linear-gradient(180deg, rgba(2, 13, 18, 0.12), rgba(2, 13, 18, 0.03) 34%, rgba(2, 13, 18, 0.14)),
    radial-gradient(circle at 11% 87%, rgba(33, 199, 255, 0.14), transparent 18%),
    radial-gradient(circle at 91% 84%, rgba(255, 82, 45, 0.12), transparent 20%),
    radial-gradient(circle at 52% 6%, rgba(255, 216, 118, 0.1), transparent 24%);
}

body.is-authenticated:not(.match-active) .launcher-nav {
  gap: clamp(8px, 1.1vh, 14px);
}

body.is-authenticated:not(.match-active) .launcher-nav > * {
  width: min(100%, 318px);
}

body.is-authenticated:not(.match-active) .launcher-mark,
body.is-authenticated:not(.match-active) .profile-card,
body.is-authenticated:not(.match-active) .launcher-page-header > div,
body.is-authenticated:not(.match-active) .section-title h3,
body.is-authenticated:not(.match-active) .section-title span,
body.is-authenticated:not(.match-active) .play-section .mini-log {
  border-color: rgba(255, 225, 142, 0.18);
  background:
    linear-gradient(135deg, rgba(43, 218, 242, 0.08), transparent 48%),
    rgba(2, 14, 20, 0.26);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.1),
    0 10px 26px rgba(0, 0, 0, 0.16);
}

body.is-authenticated:not(.match-active) .launcher-mark-icon {
  border-color: rgba(255, 220, 116, 0.92);
  background:
    radial-gradient(circle at 38% 24%, rgba(255, 248, 220, 0.38), transparent 30%),
    linear-gradient(145deg, rgba(226, 157, 38, 0.66), rgba(34, 205, 231, 0.22)),
    rgba(3, 22, 29, 0.94);
  box-shadow: 0 0 18px rgba(255, 211, 109, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body.is-authenticated:not(.match-active) .profile-card {
  border-color: rgba(255, 216, 118, 0.62);
  background:
    radial-gradient(circle at 18% 6%, rgba(44, 222, 247, 0.3), transparent 36%),
    linear-gradient(115deg, rgba(247, 198, 83, 0.16), rgba(5, 33, 42, 0.4) 52%, rgba(2, 11, 16, 0.52)),
    rgba(3, 18, 24, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.14),
    inset 0 0 30px rgba(14, 207, 255, 0.08),
    0 0 24px rgba(34, 205, 231, 0.08);
}

body.is-authenticated:not(.match-active) .launcher-tabs {
  gap: clamp(7px, 0.95vh, 11px);
  padding-right: 2px;
}

body.is-authenticated:not(.match-active) .launcher-tabs .tab-button {
  min-height: clamp(44px, 4.6vh, 56px);
  border-color: rgba(238, 188, 86, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 196, 74, 0.34), rgba(9, 69, 80, 0.5) 36%, rgba(2, 17, 24, 0.7)),
    radial-gradient(circle at 8% 50%, rgba(255, 221, 119, 0.18), transparent 32%),
    rgba(2, 14, 20, 0.58);
  color: #fff5d6;
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.22),
    0 0 18px rgba(34, 205, 231, 0.06);
}

body.is-authenticated:not(.match-active) .launcher-tabs .tab-button::before {
  border-color: rgba(255, 238, 172, 0.88);
  background:
    linear-gradient(135deg, rgba(255, 245, 199, 0.7), transparent 28%),
    linear-gradient(135deg, #45f0ff, #0b6b85);
  box-shadow: 0 0 18px rgba(69, 240, 255, 0.34);
}

body.is-authenticated:not(.match-active) .launcher-tabs .tab-button::after {
  right: 13px;
  border-color: rgba(255, 231, 150, 0.95);
  box-shadow: 4px -4px 14px rgba(255, 222, 127, 0.36);
}

body.is-authenticated:not(.match-active) .launcher-tabs .tab-button:hover {
  border-color: rgba(70, 231, 255, 0.9);
  background:
    linear-gradient(90deg, rgba(70, 231, 255, 0.28), rgba(12, 76, 88, 0.58) 42%, rgba(2, 19, 27, 0.72)),
    radial-gradient(circle at 8% 50%, rgba(255, 221, 119, 0.2), transparent 34%),
    rgba(3, 28, 37, 0.56);
  color: #effcff;
}

body.is-authenticated:not(.match-active) .launcher-tabs .tab-button.active {
  border-color: rgba(255, 224, 126, 0.98);
  background:
    linear-gradient(90deg, rgba(255, 202, 76, 0.7), rgba(40, 219, 244, 0.26) 48%, rgba(3, 28, 37, 0.66)),
    radial-gradient(circle at 8% 50%, rgba(255, 244, 196, 0.28), transparent 32%),
    rgba(6, 36, 44, 0.58);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 218, 0.26),
    inset 0 -1px 0 rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(255, 224, 126, 0.12),
    0 0 24px rgba(255, 211, 109, 0.26),
    0 0 26px rgba(34, 205, 231, 0.12);
}

body.is-authenticated:not(.match-active) .launcher-audio {
  position: relative;
  z-index: 2;
  padding-top: clamp(8px, 1vh, 14px);
  background:
    linear-gradient(180deg, rgba(1, 11, 16, 0.42), rgba(1, 11, 16, 0.06) 38%, transparent);
}

body.is-authenticated:not(.match-active) .launcher-workspace {
  padding: 0 4px 2px 0;
}

body.is-authenticated:not(.match-active) .launcher-page-header {
  min-height: clamp(62px, 8vh, 92px);
  padding-bottom: clamp(10px, 1.4vh, 16px);
}

body.is-authenticated:not(.match-active) .launcher-page-header > div {
  padding: 10px 14px;
  background:
    linear-gradient(90deg, rgba(255, 206, 91, 0.1), rgba(34, 205, 231, 0.08) 48%, transparent),
    rgba(2, 13, 18, 0.22);
}

body.is-authenticated:not(.match-active) .launcher-page-header h2 {
  color: #fff7dc;
  font-size: clamp(1.75rem, 2.7vw, 2.65rem);
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.84), 0 0 20px rgba(255, 211, 109, 0.14), 0 0 22px rgba(36, 207, 237, 0.14);
}

body.is-authenticated:not(.match-active) .launcher-content {
  padding: clamp(10px, 1.1vw, 16px);
}

body.is-authenticated:not(.match-active) .play-actions .primary-button {
  min-height: clamp(70px, 7.3vh, 92px);
  border-width: 2px;
  border-color: rgba(255, 224, 126, 0.98);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 246, 194, 0.34), transparent 42%),
    linear-gradient(180deg, rgba(255, 219, 120, 0.5), rgba(196, 119, 19, 0.34) 54%, rgba(111, 61, 10, 0.52)),
    linear-gradient(90deg, #a86716, #e3a93a 48%, #9d6518);
  color: #fff8e8;
  font-size: clamp(1.02rem, 1vw, 1.2rem);
  box-shadow:
    0 0 0 1px rgba(255, 227, 139, 0.32),
    0 16px 38px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(220, 170, 77, 0.34);
}

body.is-authenticated:not(.match-active) .play-actions .mode-button {
  min-height: clamp(46px, 5vh, 58px);
  border-color: rgba(255, 216, 118, 0.28);
  background:
    linear-gradient(90deg, rgba(34, 205, 231, 0.08), rgba(255, 216, 118, 0.04)),
    rgba(3, 18, 24, 0.42);
  color: #fff1c5;
}

body.is-authenticated:not(.match-active) .play-actions #tutorialButton.is-recommended {
  position: relative;
  min-height: clamp(58px, 6.2vh, 78px);
  border-color: rgba(86, 238, 255, 0.84);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 247, 205, 0.18), transparent 34%),
    linear-gradient(90deg, rgba(42, 221, 247, 0.38), rgba(16, 73, 86, 0.62) 52%, rgba(4, 26, 34, 0.76)),
    rgba(3, 22, 29, 0.74);
  color: #effcff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 1px rgba(86, 238, 255, 0.14),
    0 12px 32px rgba(0, 0, 0, 0.3),
    0 0 28px rgba(42, 221, 247, 0.22);
}

body.is-authenticated:not(.match-active) .play-actions #tutorialButton.is-recommended::after {
  content: "Recommandé";
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 231, 150, 0.84);
  border-radius: 999px;
  background: rgba(95, 57, 5, 0.94);
  color: #ffe79c;
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 0 16px rgba(255, 211, 109, 0.26);
}

body.is-authenticated:not(.match-active).fresh-account-onboarding .play-actions #tutorialButton.is-recommended {
  order: -1;
  min-height: clamp(72px, 7.5vh, 96px);
  border-color: rgba(255, 231, 150, 0.98);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 250, 217, 0.28), transparent 42%),
    linear-gradient(90deg, rgba(255, 207, 82, 0.54), rgba(40, 221, 247, 0.34) 52%, rgba(4, 28, 36, 0.76)),
    rgba(4, 28, 36, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(255, 231, 150, 0.18),
    0 16px 42px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(255, 211, 109, 0.28),
    0 0 32px rgba(42, 221, 247, 0.18);
}

body.is-authenticated:not(.match-active).fresh-account-onboarding .play-actions #tutorialButton.is-recommended::after {
  content: "Nouveau joueur";
}

@media (min-width: 981px) and (max-height: 820px) {
  body.is-authenticated:not(.match-active) .launcher-panel {
    --launcher-left-y: 15.2%;
    --launcher-left-bottom: 5.8%;
    --launcher-main-y: 15.2%;
    --launcher-main-bottom: 5.8%;
  }

  body.is-authenticated:not(.match-active) .launcher-nav {
    gap: 5px;
  }

  body.is-authenticated:not(.match-active) .launcher-mark {
    min-height: 38px;
  }

  body.is-authenticated:not(.match-active) .profile-card {
    padding-block: 6px;
  }

  body.is-authenticated:not(.match-active) .profile-avatar {
    width: 38px;
    height: 38px;
  }

  body.is-authenticated:not(.match-active) .launcher-audio {
    gap: 3px;
    padding-top: 7px;
  }

  body.is-authenticated:not(.match-active) .launcher-audio .setting-row {
    min-height: 16px;
    font-size: 0.72rem;
  }

  body.is-authenticated:not(.match-active) .launcher-audio .mode-button {
    min-height: 25px;
    font-size: 0.7rem;
  }

  body.is-authenticated:not(.match-active) .launcher-tabs {
    gap: 5px;
  }

  body.is-authenticated:not(.match-active) .launcher-tabs .tab-button {
    min-height: 36px;
  }
}

@media (min-width: 981px) and (max-height: 700px) {
  body.is-authenticated:not(.match-active) .launcher-panel {
    --launcher-left-y: 14.4%;
    --launcher-left-bottom: 5.2%;
    --launcher-main-y: 14.4%;
    --launcher-main-bottom: 5.2%;
  }
}

.logout-button {
  border-color: rgba(220, 170, 77, 0.34);
  color: #dbc9aa;
}

.play-actions .mode-button,
.play-actions .danger-button {
  margin-top: 0;
}

.profile-history-grid,
.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 0;
}

.friend-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
  gap: 10px;
}

.friend-form .text-input,
.friend-form .mode-button {
  margin: 0;
}

body.is-authenticated:not(.match-active) .launcher-content .history-list {
  max-height: min(48vh, 520px);
  margin-top: 0;
}

.launcher-content .history-item {
  border-color: rgba(196, 145, 61, 0.28);
  background:
    linear-gradient(90deg, rgba(196, 145, 61, 0.08), transparent 34%),
    rgba(1, 18, 24, 0.82);
}

body.is-authenticated:not(.match-active) .launcher-panel .reference-card,
body.is-authenticated:not(.match-active) .launcher-panel .history-item,
body.is-authenticated:not(.match-active) .launcher-panel .profile-progression > div:not(.profile-xp-bar),
body.is-authenticated:not(.match-active) .launcher-panel .player-profile-card,
body.is-authenticated:not(.match-active) .launcher-panel .lobby-player,
body.is-authenticated:not(.match-active) .launcher-panel .notification-item {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--reference-color, #dca643) 8%, transparent), transparent 62%),
    rgba(2, 15, 20, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 245, 199, 0.06), inset 0 0 24px rgba(34, 205, 231, 0.025);
}

body.is-authenticated:not(.match-active) .launcher-panel .reference-rarity,
body.is-authenticated:not(.match-active) .launcher-panel .reference-tier,
body.is-authenticated:not(.match-active) .launcher-panel .reference-tower-card,
body.is-authenticated:not(.match-active) .launcher-panel .trait-chip,
body.is-authenticated:not(.match-active) .launcher-panel .stat-pill,
body.is-authenticated:not(.match-active) .launcher-panel .reference-tower-summary,
body.is-authenticated:not(.match-active) .launcher-panel .text-input {
  background-color: rgba(1, 10, 14, 0.38);
}

body.is-authenticated:not(.match-active) .launcher-panel .reference-card--tower {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, #9fb4a6) 10%, transparent), transparent 62%),
    rgba(2, 15, 20, 0.48);
}

body.is-authenticated:not(.match-active) .play-actions {
  gap: clamp(10px, 1.25vh, 14px);
}

body.is-authenticated:not(.match-active) .play-actions .primary-button,
body.is-authenticated:not(.match-active) .play-actions .mode-button,
body.is-authenticated:not(.match-active) .play-actions .danger-button {
  position: relative;
  overflow: visible;
  letter-spacing: 0;
}

body.is-authenticated:not(.match-active) .play-actions .primary-button::before,
body.is-authenticated:not(.match-active) .play-actions #tutorialButton.is-recommended::before,
body.is-authenticated:not(.match-active) .play-actions #createLobbyButton::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34%);
  opacity: 0.7;
}

body.is-authenticated:not(.match-active) .play-actions #createLobbyButton {
  border-color: rgba(75, 224, 245, 0.42);
  background:
    radial-gradient(circle at 18% 0, rgba(94, 239, 255, 0.2), transparent 38%),
    linear-gradient(90deg, rgba(25, 150, 174, 0.38), rgba(4, 30, 39, 0.72)),
    rgba(3, 18, 24, 0.7);
  color: #dffaff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 26px rgba(0, 0, 0, 0.22);
}

body.is-authenticated:not(.match-active) .play-actions #createLobbyButton.is-group-cta {
  border-color: rgba(94, 239, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 0 0 1px rgba(94, 239, 255, 0.1),
    0 12px 30px rgba(0, 0, 0, 0.26),
    0 0 24px rgba(42, 221, 247, 0.14);
}

body.is-authenticated:not(.match-active) .play-actions #queueRankedButton:disabled {
  border-color: rgba(255, 240, 190, 0.1);
  background: rgba(3, 12, 16, 0.3);
  color: rgba(255, 240, 190, 0.42);
  box-shadow: none;
}

body.is-authenticated:not(.match-active) .play-actions #leaveQueueButton {
  min-height: 42px;
  border-color: rgba(255, 110, 110, 0.32);
  background:
    linear-gradient(90deg, rgba(140, 31, 45, 0.52), rgba(42, 8, 14, 0.62)),
    rgba(24, 5, 9, 0.54);
  color: #ffd6d6;
  opacity: 0.42;
}

body.is-authenticated:not(.match-active) .play-actions #leaveQueueButton.is-relevant {
  opacity: 1;
  box-shadow: 0 0 20px rgba(255, 82, 82, 0.12);
}

body.is-authenticated:not(.match-active) .play-actions #leaveQueueButton:disabled {
  pointer-events: none;
}

body.is-authenticated:not(.match-active).has-active-lobby .play-actions #queueNormalButton {
  border-color: rgba(94, 239, 255, 0.9);
  background:
    radial-gradient(circle at 50% 0, rgba(242, 255, 247, 0.2), transparent 42%),
    linear-gradient(90deg, rgba(34, 205, 231, 0.44), rgba(12, 76, 88, 0.7)),
    rgba(3, 28, 37, 0.72);
  color: #effcff;
  box-shadow:
    0 0 0 1px rgba(94, 239, 255, 0.18),
    0 14px 38px rgba(0, 0, 0, 0.32),
    0 0 30px rgba(42, 221, 247, 0.22);
}

body.is-authenticated:not(.match-active).has-ready-lobby .play-actions #queueNormalButton {
  border-color: rgba(93, 230, 155, 0.92);
  background:
    radial-gradient(circle at 50% 0, rgba(230, 255, 241, 0.2), transparent 42%),
    linear-gradient(90deg, rgba(23, 143, 86, 0.62), rgba(9, 71, 48, 0.78)),
    rgba(7, 42, 30, 0.74);
  color: #effff6;
  box-shadow:
    0 0 0 1px rgba(93, 230, 155, 0.18),
    0 14px 38px rgba(0, 0, 0, 0.32),
    0 0 30px rgba(93, 230, 155, 0.22);
}

body.is-authenticated:not(.match-active) .lobby-empty-state {
  display: grid;
  min-height: 156px;
  align-content: center;
  justify-items: start;
  gap: 8px;
  border-color: rgba(94, 239, 255, 0.18);
  background:
    radial-gradient(circle at 12% 16%, rgba(94, 239, 255, 0.12), transparent 34%),
    linear-gradient(120deg, rgba(255, 216, 118, 0.08), transparent 42%),
    rgba(2, 15, 20, 0.42);
}

body.is-authenticated:not(.match-active) .lobby-empty-state span {
  display: block;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

body.is-authenticated:not(.match-active) .lobby-empty-state strong {
  display: block;
  color: #fff7dc;
  font-size: 1.08rem;
}

body.is-authenticated:not(.match-active) .lobby-empty-state p {
  max-width: 56ch;
  margin: 0;
  color: rgba(239, 224, 173, 0.78);
  line-height: 1.38;
}

body.is-authenticated:not(.match-active) .lobby-room-card {
  border-color: rgba(94, 239, 255, 0.28);
  background:
    radial-gradient(circle at 12% 8%, rgba(94, 239, 255, 0.16), transparent 34%),
    linear-gradient(120deg, rgba(255, 216, 118, 0.1), transparent 46%),
    rgba(2, 15, 20, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.08),
    0 16px 34px rgba(0, 0, 0, 0.2);
}

body.is-authenticated:not(.match-active) .lobby-room-card.is-self-ready {
  border-color: rgba(93, 230, 155, 0.36);
}

body.is-authenticated:not(.match-active) .lobby-room-card.is-all-ready {
  border-color: rgba(255, 231, 150, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 199, 0.12),
    0 16px 36px rgba(0, 0, 0, 0.24),
    0 0 28px rgba(255, 211, 109, 0.16);
}

body.is-authenticated:not(.match-active) .lobby-room-head > div {
  display: grid;
  gap: 3px;
}

body.is-authenticated:not(.match-active) .lobby-room-head > div > span {
  width: fit-content;
  padding: 0;
  border: 0;
  color: rgba(94, 239, 255, 0.82);
  font-size: 0.64rem;
  letter-spacing: 0;
}

body.is-authenticated:not(.match-active) .lobby-room-head > span {
  border-color: rgba(255, 231, 150, 0.5);
  background: rgba(95, 57, 5, 0.34);
}

body.is-authenticated:not(.match-active) .lobby-ready-summary {
  border-color: rgba(93, 230, 155, 0.36);
  background:
    linear-gradient(90deg, rgba(93, 230, 155, 0.14), transparent 62%),
    rgba(9, 31, 23, 0.52);
}

body.is-authenticated:not(.match-active) .lobby-player {
  border-color: rgba(255, 240, 190, 0.1);
  background: rgba(3, 14, 18, 0.48);
}

body.is-authenticated:not(.match-active) .lobby-player.is-you {
  border-color: rgba(94, 239, 255, 0.46);
  box-shadow: inset 3px 0 0 rgba(94, 239, 255, 0.62);
}

body.is-authenticated:not(.match-active) .lobby-player.is-ready {
  border-color: rgba(93, 230, 155, 0.56);
  background:
    linear-gradient(90deg, rgba(93, 230, 155, 0.14), transparent 54%),
    rgba(13, 55, 37, 0.56);
}

body.is-authenticated:not(.match-active) .lobby-leave-button {
  min-height: 38px;
}

.match-history-item {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  overflow: hidden;
}

.match-history-item::before,
.match-detail-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--result-color, rgba(220, 170, 77, 0.7));
  box-shadow: 0 0 18px color-mix(in srgb, var(--result-color, #dca643) 62%, transparent);
}

.history-result {
  color: var(--result-color, #dca643);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.history-mode,
.history-date {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-room-item,
.social-item,
.request-item,
.notification-item {
  display: grid;
  gap: 10px;
}

.open-room-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.open-room-item div,
.social-meta {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.open-room-item span,
.social-meta span,
.notification-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.open-room-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.social-item,
.request-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.social-item.is-online .social-meta span {
  color: var(--green);
}

.social-item.is-offline {
  opacity: 0.72;
}

.item-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: end;
  gap: 8px;
}

.request-item .item-actions,
.notification-item .item-actions {
  min-width: min(260px, 42%);
}

.item-actions .mode-button,
.item-actions .primary-button,
.item-actions .danger-button {
  min-width: 64px;
  min-height: 34px;
  margin: 0;
  padding: 0 14px;
  white-space: nowrap;
}

.history-score {
  color: #fff8e8;
  font-size: 1rem;
}

.history-points,
.history-defense {
  color: var(--result-color, #dca643);
  font-weight: 900;
  white-space: nowrap;
}

.history-defense {
  color: #9fd7ff;
}

.history-date {
  grid-column: 2 / -1;
}

.match-detail-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding-left: 14px;
}

.match-detail-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.history-rank {
  color: var(--result-color, #dca643) !important;
  font-weight: 950;
}

.is-win {
  --result-color: #79e35e;
  border-color: rgba(121, 227, 94, 0.34) !important;
}

.is-neutral {
  --result-color: #dca643;
}

.is-loss {
  --result-color: #ff4f58;
  border-color: rgba(255, 79, 88, 0.34) !important;
}

.admin-output h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 8px;
  color: #e6bd69;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.admin-output h3 span {
  color: var(--muted);
  font-size: 0.74rem;
}

.admin-list-item {
  max-height: 92px;
  overflow: hidden;
}

.admin-output {
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border-radius: 8px;
  background: rgba(7, 11, 9, 0.64);
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.barracks {
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.locked-class strong {
  display: block;
  margin-top: 10px;
  color: var(--cyan);
  font-size: 1.1rem;
}

.stats-panel {
  margin-top: auto;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  min-width: 0;
  padding: 9px 0;
  border-bottom: 1px solid rgba(151, 184, 211, 0.12);
  color: var(--muted);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.stat-row--bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  grid-column: 1 / -1;
}

.stat-row--bar .resource-bar {
  grid-column: 1 / -1;
}

.resource-bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 240, 190, 0.16);
  border-radius: 999px;
  background: rgba(3, 7, 5, 0.74);
}

.resource-bar > span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease;
}

.resource-bar--life > span {
  background: linear-gradient(90deg, #d93d4c, #ff8b84);
}

.resource-bar--xp > span {
  background: linear-gradient(90deg, #58d68d, #9ff7ff);
}

.game-area {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  gap: 14px;
}

body.match-active .game-area {
  height: 100vh;
  padding: 10px;
  gap: 8px;
  overflow: hidden;
}

.game-area[hidden] {
  display: none;
}

.desktop-trait-rail {
  display: none;
}

body.match-active:not(.mobile-ui) .desktop-trait-rail {
  position: absolute;
  top: 110px;
  left: 10px;
  z-index: 34;
  display: grid;
  gap: 6px;
  width: 148px;
  max-height: calc(100vh - 168px);
  padding: 4px;
  overflow: visible;
  pointer-events: none;
}

body.match-active:not(.mobile-ui) .desktop-trait-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 136px;
  height: 34px;
  padding: 4px 18px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 54%, rgba(255, 240, 190, 0.14));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 16%, transparent), transparent 70%),
    rgba(1, 10, 14, 0.58);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  opacity: 0.72;
  pointer-events: auto;
  transition: opacity 120ms ease, transform 120ms ease, border-color 120ms ease;
}

body.match-active:not(.mobile-ui) .desktop-trait-item.is-active {
  opacity: 0.9;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--trait-color, #d7a94a) 18%, transparent), 0 8px 18px rgba(0, 0, 0, 0.26);
}

body.match-active:not(.mobile-ui) .desktop-trait-item:hover,
body.match-active:not(.mobile-ui) .desktop-trait-item:focus-visible {
  z-index: 2;
  opacity: 1;
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 74%, rgba(255, 248, 232, 0.28));
  outline: none;
}

body.match-active:not(.mobile-ui) .desktop-trait-item > .trait-icon {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  justify-self: center;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 76%, #fff8e8);
}

body.match-active:not(.mobile-ui) .desktop-trait-item > .trait-icon svg {
  width: 18px;
  height: 18px;
}

body.match-active:not(.mobile-ui) .desktop-trait-name {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 248, 232, 0.82);
  font-size: 0.66rem;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.match-active:not(.mobile-ui) .desktop-trait-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 62%, rgba(255, 248, 232, 0.18));
  border-radius: 999px;
  background: rgba(3, 7, 5, 0.92);
  color: #fff8e8;
  font-size: 0.56rem;
  font-weight: 950;
  line-height: 1;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover {
  position: absolute;
  top: 0;
  left: calc(100% + 10px);
  display: none;
  width: min(380px, calc(100vw - 420px));
  max-height: min(70vh, 620px);
  padding: 12px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 56%, rgba(255, 240, 190, 0.16));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 12%, transparent), transparent 42%),
    rgba(1, 10, 14, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  cursor: default;
}

body.match-active:not(.mobile-ui) .desktop-trait-page-button {
  width: 48px;
  height: 28px;
  justify-self: start;
  border: 1px solid rgba(255, 240, 190, 0.16);
  border-radius: 999px;
  background: rgba(1, 10, 14, 0.62);
  color: rgba(255, 248, 232, 0.76);
  cursor: pointer;
  font-size: 0.66rem;
  font-weight: 950;
  pointer-events: auto;
  transition: border-color 120ms ease, color 120ms ease, transform 120ms ease;
}

body.match-active:not(.mobile-ui) .desktop-trait-page-button:hover,
body.match-active:not(.mobile-ui) .desktop-trait-page-button:focus-visible {
  color: #fff8e8;
  border-color: rgba(255, 248, 232, 0.34);
  outline: none;
  transform: translateX(2px);
}

body.match-active:not(.mobile-ui) .desktop-trait-item:hover .desktop-trait-popover,
body.match-active:not(.mobile-ui) .desktop-trait-item:focus-visible .desktop-trait-popover,
body.match-active:not(.mobile-ui) .desktop-trait-popover:hover {
  display: grid;
  gap: 10px;
}

.desktop-trait-damage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.desktop-trait-damage span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.desktop-trait-damage strong {
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 950;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover header {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover header .trait-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover h3,
body.match-active:not(.mobile-ui) .desktop-trait-popover h4,
body.match-active:not(.mobile-ui) .desktop-trait-popover p {
  margin: 0;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover header span,
body.match-active:not(.mobile-ui) .desktop-trait-popover header em,
body.match-active:not(.mobile-ui) .desktop-trait-popover h4 {
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover h3 {
  color: #fff8e8;
  font-size: 1rem;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover p {
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.78rem;
  line-height: 1.35;
}

body.match-active:not(.mobile-ui) .desktop-trait-popover section {
  display: grid;
  gap: 6px;
}

body.match-active:not(.mobile-ui) .desktop-trait-tiers {
  display: grid;
  gap: 6px;
}

body.match-active:not(.mobile-ui) .desktop-trait-next,
body.match-active:not(.mobile-ui) .desktop-trait-requirements {
  display: grid;
  gap: 6px;
}

body.match-active:not(.mobile-ui) .desktop-trait-requirements .trait-requirement {
  padding: 6px 7px;
  border-color: rgba(255, 240, 190, 0.12);
  background: rgba(2, 9, 12, 0.54);
  font-size: 0.68rem;
}

body.match-active:not(.mobile-ui) .desktop-trait-requirements .trait-requirement--complete {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 42%, rgba(98, 234, 208, 0.28));
  color: #9ff7ff;
}

body.match-active:not(.mobile-ui) .desktop-trait-tier {
  display: grid;
  grid-template-columns: 64px 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 240, 190, 0.1);
  border-radius: 7px;
  background: rgba(2, 9, 12, 0.5);
  opacity: 0.56;
}

body.match-active:not(.mobile-ui) .desktop-trait-tier.is-active {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 48%, rgba(98, 234, 208, 0.24));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--trait-color, #d7a94a) 16%, transparent), transparent 58%),
    rgba(2, 9, 12, 0.68);
  opacity: 1;
}

body.match-active:not(.mobile-ui) .desktop-trait-tier.is-next {
  opacity: 0.82;
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--trait-color, #d7a94a) 64%, #fff8e8);
}

body.match-active:not(.mobile-ui) .desktop-trait-tier span,
body.match-active:not(.mobile-ui) .desktop-trait-tier strong {
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 64%, #fff8e8);
  font-size: 0.7rem;
  font-weight: 950;
}

body.match-active:not(.mobile-ui) .desktop-trait-tier em {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 248, 232, 0.76);
  font-size: 0.68rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.match-active:not(.mobile-ui) .desktop-trait-towers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.match-active:not(.mobile-ui) .desktop-trait-tower {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, #9fb4a6) 42%, rgba(255, 240, 190, 0.12));
  border-radius: 7px;
  background: rgba(4, 10, 12, 0.56);
}

body.match-active:not(.mobile-ui) .desktop-trait-tower .choice-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

body.match-active:not(.mobile-ui) .desktop-trait-tower strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.match-active:not(.mobile-ui) .desktop-trait-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

body.mobile-ui.match-active .desktop-trait-rail {
  display: none !important;
}

.topbar,
.hintbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.045), transparent),
    var(--panel);
  backdrop-filter: blur(12px);
}

body.match-active .chat-panel {
  flex: 0 0 auto;
  padding: 8px 10px;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 110px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border-radius: 8px;
  background: rgba(7, 11, 9, 0.78);
  color: var(--muted);
  font-size: 0.86rem;
}

body.match-active .chat-log {
  min-height: 54px;
  max-height: 76px;
  padding: 7px;
  font-size: 0.8rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
  margin-top: 8px;
}

body.match-active .chat-form {
  grid-template-columns: 1fr 96px;
  gap: 7px;
  margin-top: 7px;
}

body.match-active .chat-form .text-input {
  min-height: 36px;
  margin-bottom: 0;
}

body.match-active #chatSendButton {
  min-height: 36px;
  margin-top: 0;
}

.chat-panel .danger-button {
  margin-top: 8px;
}

body.match-active .chat-panel .danger-button {
  min-height: 36px;
  margin-top: 7px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  width: 100%;
}

body.match-active .scoreboard {
  grid-template-columns: repeat(6, minmax(170px, 1fr));
  gap: 8px;
}

.score-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 169, 74, 0.25);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.1), transparent 56%),
    linear-gradient(90deg, rgba(215, 169, 74, 0.11), transparent 40%),
    radial-gradient(circle at 10% 32%, rgba(98, 234, 208, 0.1), transparent 38%),
    rgba(9, 14, 11, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.55), 0 12px 34px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  cursor: pointer;
}

.score-card:hover,
.score-card:focus-visible {
  border-color: color-mix(in srgb, var(--player-color, var(--gold)) 68%, rgba(255, 240, 190, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.55), 0 0 0 2px color-mix(in srgb, var(--player-color, var(--gold)) 24%, transparent), 0 14px 34px rgba(0, 0, 0, 0.26);
}

.score-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 3px solid rgba(215, 169, 74, 0.5);
  opacity: 0.72;
  pointer-events: none;
}

body.match-active .score-card {
  min-height: 58px;
  padding: 7px 10px;
}

body.match-active .score-name {
  font-size: 0.72rem;
}

body.match-active .score-values {
  gap: 8px;
  margin-top: 4px;
  font-size: 0.92rem;
}

.score-card.is-human {
  border-color: rgba(98, 234, 208, 0.32);
}

.score-card.is-local {
  border-color: rgba(215, 169, 74, 0.64);
  box-shadow: 0 0 0 1px rgba(98, 234, 208, 0.14), 0 0 24px rgba(215, 169, 74, 0.12), 0 12px 34px rgba(0, 0, 0, 0.22);
}

.score-card.is-dead {
  filter: grayscale(1);
  opacity: 0.58;
}

.score-avatar {
  display: grid;
  grid-template-rows: auto auto;
  gap: 1px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 240, 190, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.24), transparent 24%),
    radial-gradient(circle at 50% 62%, color-mix(in srgb, var(--player-color) 38%, transparent), transparent 48%),
    linear-gradient(145deg, rgba(34, 25, 13, 0.96), rgba(6, 10, 8, 0.98));
  color: #fff4d5;
  font-weight: 950;
  line-height: 1;
  box-shadow: inset 0 -8px 14px rgba(0, 0, 0, 0.35), 0 0 12px color-mix(in srgb, var(--player-color) 25%, transparent);
}

.score-avatar > span {
  color: rgba(255, 248, 232, 0.58);
  font-size: 0.46rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.score-avatar > strong {
  color: #fff4d5;
  font-size: 0.82rem;
}

.score-main {
  min-width: 0;
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.score-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.78rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-game-level {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(98, 234, 208, 0.32);
  border-radius: 999px;
  background: rgba(16, 50, 46, 0.48);
  color: #9ff7ff;
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.score-values {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-weight: 800;
  flex-wrap: wrap;
}

.score-values > span:first-child {
  color: var(--red);
}

.score-values > span:last-child {
  color: #73bfff;
}

.score-values > span:nth-child(2) {
  color: var(--gold);
}

.score-values > span:nth-child(3) {
  color: var(--green);
}

.round-widget {
  flex: 0 0 104px;
  align-self: stretch;
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 6px 10px;
  border: 1px solid rgba(215, 169, 74, 0.48);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 12%, rgba(98, 234, 208, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.11), transparent 54%),
    rgba(9, 14, 11, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.12), 0 12px 34px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.round-widget span,
.round-widget em {
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.round-widget strong {
  color: var(--gold);
  font-size: 1.45rem;
  line-height: 1;
  text-shadow: 0 0 18px rgba(215, 169, 74, 0.18);
}

.toolbar {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.tool-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.055), transparent),
    rgba(12, 18, 14, 0.88);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

body.match-active .tool-button {
  width: 38px;
  height: 38px;
}

#gameMenuButton {
  width: auto;
  min-width: 58px;
  padding: 0 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.game-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 270px;
  max-height: min(620px, calc(100vh - 72px));
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(215, 169, 74, 0.38);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0, rgba(98, 234, 208, 0.13), transparent 36%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.06), transparent 58%),
    rgba(6, 14, 18, 0.72);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(14px) saturate(1.08);
}

.game-menu strong {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.game-menu .menu-action {
  min-height: 38px;
  margin-top: 8px;
}

.game-menu .volume-row {
  margin: 10px 0 2px;
  padding: 8px 0 4px;
  border-top: 1px solid rgba(215, 169, 74, 0.18);
}

.keybind-settings {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(215, 169, 74, 0.18);
}

.keybind-settings summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.keybind-settings summary::-webkit-details-marker {
  display: none;
}

.keybind-settings summary::after {
  content: "+";
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(215, 169, 74, 0.32);
  border-radius: 6px;
  color: #efe0ad;
  font-size: 0.9rem;
}

.keybind-settings[open] summary::after {
  content: "-";
}

.keybind-list {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.keybind-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 5px 4px 8px;
  border: 1px solid rgba(255, 240, 190, 0.12);
  border-radius: 7px;
  background: rgba(5, 9, 7, 0.58);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.keybind-row:hover,
.keybind-row:focus-visible,
.keybind-row.is-capturing {
  border-color: rgba(98, 234, 208, 0.52);
  background: rgba(13, 34, 31, 0.72);
}

.keybind-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keybind-row kbd {
  display: grid;
  min-width: 34px;
  min-height: 22px;
  place-items: center;
  padding: 1px 7px;
  border: 1px solid rgba(215, 169, 74, 0.42);
  border-radius: 6px;
  background: rgba(31, 28, 16, 0.9);
  color: #fff0bd;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 950;
}

.tool-button:hover {
  border-color: var(--cyan);
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.canvas-wrap {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  place-items: start;
  padding: 0 0 12px;
  background:
    radial-gradient(circle at 32% 14%, rgba(98, 234, 208, 0.07), transparent 36%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.38));
  scrollbar-color: rgba(215, 169, 74, 0.42) rgba(9, 14, 11, 0.72);
}

canvas {
  display: block;
  width: clamp(1040px, calc(100vw - 332px), 1520px);
  height: auto;
  max-height: none;
  aspect-ratio: 3600 / 5400;
  border: 1px solid rgba(215, 169, 74, 0.2);
  border-radius: 8px;
  background: #070d0a;
  box-shadow: var(--shadow);
}

body.match-active canvas {
  width: clamp(980px, calc(100vw - 326px), 1460px);
}

body.match-active #gameCanvas {
  cursor: url("assets/cursors/fantasy-pointer.png") 3 2, auto;
}

body.match-active #gameCanvas.build-cursor {
  cursor: url("assets/cursors/fantasy-build.png") 3 2, crosshair;
}

body.match-active #gameCanvas.panning {
  cursor: grabbing;
}

.placement-preview-canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.dynamic-game-canvas {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  pointer-events: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.round-countdown {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(420px, calc(100vw - 48px));
  margin: 0;
  padding: 18px 24px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(242, 184, 75, 0.78);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 28%, rgba(242, 184, 75, 0.24), transparent 46%),
    rgba(8, 12, 10, 0.92);
  box-shadow: 0 18px 64px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 240, 190, 0.18);
  color: #fff8e8;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
  font-weight: 950;
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
}

.round-countdown[hidden] {
  display: none;
}

.tactical-coach {
  display: none !important;
}

/*
 * Legacy tactical coach styles are intentionally left inert: the in-game help
 * overlay has been removed in favor of the dedicated tutorial.
 */
.tactical-coach--legacy {
  position: fixed;
  top: clamp(214px, 24vh, 260px);
  left: clamp(206px, 15vw, 260px);
  z-index: 24;
  display: grid;
  gap: 5px;
  width: min(340px, calc(100vw - 560px));
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 240, 190, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 240, 190, 0.055), transparent 42%),
    rgba(3, 9, 10, 0.42);
  color: rgba(255, 248, 232, 0.86);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.tactical-coach[hidden] {
  display: none;
}

.tactical-coach-label {
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.tactical-coach strong {
  color: #fff8e8;
  font-size: 0.92rem;
  line-height: 1.08;
}

.tactical-coach p {
  margin: 0;
  color: rgba(239, 224, 173, 0.78);
  font-size: 0.76rem;
  line-height: 1.28;
}

.tactical-coach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.tactical-coach-chips em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 3px 6px;
  border: 1px solid rgba(255, 240, 190, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.65rem;
  font-style: normal;
  line-height: 1;
}

.tactical-coach-chips b {
  color: #fff8e8;
}

.tactical-coach[data-tone="power"] {
  border-color: rgba(98, 234, 208, 0.32);
  background:
    radial-gradient(circle at 10% 12%, rgba(98, 234, 208, 0.16), transparent 42%),
    rgba(3, 14, 13, 0.48);
}

.tactical-coach[data-tone="info"] {
  border-color: rgba(98, 184, 255, 0.28);
}

.tactical-coach[data-tone="warning"] {
  border-color: rgba(255, 202, 87, 0.36);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 202, 87, 0.14), transparent 42%),
    rgba(18, 11, 3, 0.42);
}

.tactical-coach[data-tone="danger"] {
  border-color: rgba(255, 94, 94, 0.34);
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 94, 94, 0.14), transparent 42%),
    rgba(18, 4, 5, 0.44);
}

.damage-meter {
  position: fixed;
  top: clamp(184px, 28vh, 318px);
  left: clamp(172px, 13vw, 228px);
  z-index: 25;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 620px));
  min-width: 250px;
  padding: 10px 12px;
  border: 1px solid rgba(98, 234, 208, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 10%, rgba(98, 234, 208, 0.12), transparent 40%),
    linear-gradient(135deg, rgba(255, 240, 190, 0.04), transparent 46%),
    rgba(3, 9, 10, 0.46);
  color: rgba(255, 248, 232, 0.86);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  pointer-events: auto;
}

.damage-meter[hidden] {
  display: none;
}

.damage-meter-toggle {
  position: fixed;
  top: clamp(146px, 22vh, 258px);
  left: clamp(172px, 13vw, 228px);
  z-index: 25;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(98, 234, 208, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(98, 234, 208, 0.12), transparent 70%),
    rgba(3, 9, 10, 0.66);
  color: rgba(255, 248, 232, 0.86);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.damage-meter-toggle[hidden] {
  display: none;
}

.damage-meter-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 3px 10px;
  align-items: end;
}

.damage-meter-head span {
  color: var(--gold);
  font-size: 0.64rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.damage-meter-head strong {
  color: #fff8e8;
  font-size: 1rem;
  line-height: 1;
}

.damage-meter-head em {
  grid-column: 1 / -1;
  color: rgba(239, 224, 173, 0.72);
  font-size: 0.68rem;
  font-style: normal;
}

.damage-meter-close {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 240, 190, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: rgba(255, 248, 232, 0.78);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.damage-meter-close:hover,
.damage-meter-close:focus-visible,
.damage-meter-toggle:hover,
.damage-meter-toggle:focus-visible {
  border-color: rgba(98, 234, 208, 0.52);
  color: #fff8e8;
  outline: none;
}

.damage-meter-list {
  display: grid;
  gap: 5px;
}

.damage-meter-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.78fr) minmax(68px, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 0.7rem;
}

.damage-meter-name {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 248, 232, 0.9);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.damage-meter-bar {
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 240, 190, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
}

.damage-meter-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--meter-color, #62ead0) 72%, #fff8e8), var(--meter-color, #62ead0));
  box-shadow: 0 0 12px color-mix(in srgb, var(--meter-color, #62ead0) 48%, transparent);
}

.damage-meter-row strong {
  color: #fff8e8;
  font-size: 0.72rem;
  font-weight: 950;
}

.hintbar {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(215, 169, 74, 0.055), transparent),
    rgba(10, 15, 12, 0.8);
  border: 1px solid rgba(151, 184, 211, 0.12);
  color: var(--muted);
  font-size: 0.9rem;
}

.minimap-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 12;
  width: min(380px, calc(100vw - 40px));
  padding: 10px;
  border: 1px solid rgba(215, 169, 74, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(215, 169, 74, 0.1), rgba(98, 234, 208, 0.05)),
    rgba(7, 11, 9, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 240, 190, 0.1), 0 18px 55px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
}

body.match-active .minimap-panel {
  top: 84px;
  bottom: auto;
  right: 18px;
  width: min(300px, calc(100vw - 40px));
}

.minimap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.82rem;
}

.minimap-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.minimap-head > div > span {
  color: var(--muted);
  font-size: 0.74rem;
}

.minimap-content[hidden] {
  display: none !important;
}

.minimap-toggle-button {
  width: 28px;
  height: 28px;
}

#minimapCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 210;
  border: 1px solid rgba(151, 184, 211, 0.2);
  border-radius: 6px;
  background: #07100b;
  box-shadow: none;
  cursor: crosshair;
}

.end-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 8, 6, 0.78);
  backdrop-filter: blur(4px);
  z-index: 20;
}

.end-overlay,
.end-overlay * {
  cursor: auto;
}

.end-overlay button,
.augment-card [data-augment-choice],
.augment-card [data-augment-reroll],
.trait-card-toggle {
  cursor: pointer;
  touch-action: manipulation;
}

.end-overlay button *,
.augment-card [data-augment-choice] *,
.augment-card [data-augment-reroll] *,
.trait-card-toggle * {
  cursor: inherit;
}

.end-overlay.augment-overlay {
  z-index: 90;
}

.end-overlay.augment-book-overlay {
  z-index: 91;
}

.end-overlay[hidden] {
  display: none;
}

.end-modal {
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(215, 169, 74, 0.1), rgba(98, 234, 208, 0.06)),
    var(--panel-solid);
  box-shadow: var(--shadow);
}

.end-overlay[data-result="victory"] .end-modal {
  border-color: rgba(242, 184, 75, 0.7);
  background:
    radial-gradient(circle at 50% 0%, rgba(242, 184, 75, 0.18), transparent 42%),
    linear-gradient(145deg, rgba(215, 169, 74, 0.14), rgba(98, 234, 208, 0.06)),
    var(--panel-solid);
}

.end-modal h2 {
  margin: 0;
  font-size: 2rem;
}

.end-modal p {
  color: var(--muted);
  line-height: 1.5;
}

.end-actions {
  display: grid;
  gap: 10px;
}

.end-recap {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.end-recap-label {
  margin: 0;
  color: #efe0ad;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.end-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.end-stat {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(215, 169, 74, 0.18);
  border-radius: 6px;
  background: rgba(4, 8, 6, 0.42);
}

.end-stat span,
.end-standing span {
  color: var(--muted);
  font-size: 0.72rem;
}

.end-stat strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.end-standings {
  display: grid;
  gap: 5px;
}

.end-standing {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(151, 184, 211, 0.12);
  border-radius: 6px;
  background: rgba(7, 12, 9, 0.58);
}

.end-standing-defense {
  color: #9fd7ff !important;
  white-space: nowrap;
}

.end-standing strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.end-standing.is-local {
  border-color: rgba(98, 234, 208, 0.54);
  box-shadow: inset 3px 0 0 rgba(98, 234, 208, 0.82);
}

.end-standing.is-alive {
  color: #fff8e8;
}

.game-loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(98, 234, 208, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(4, 7, 6, 0.78), rgba(4, 7, 6, 0.96));
  backdrop-filter: blur(8px);
}

.game-loader[hidden] {
  display: none;
}

.game-loader-card {
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid rgba(215, 169, 74, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(215, 169, 74, 0.12), rgba(98, 234, 208, 0.07)),
    rgba(12, 17, 14, 0.94);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 240, 190, 0.1);
}

.game-loader-card h2 {
  margin: 0;
  font-size: 1.8rem;
}

.game-loader-card p {
  color: var(--muted);
  line-height: 1.5;
}

.loader-bar {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(215, 169, 74, 0.28);
  border-radius: 999px;
  background: rgba(5, 8, 6, 0.8);
}

.loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(215, 169, 74, 0.95), rgba(98, 234, 208, 0.95));
  animation: loader-sweep 1.05s ease-in-out infinite;
}

@keyframes loader-sweep {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

@media (max-width: 980px) {
  .tactical-coach {
    display: none;
  }

  .damage-meter {
    display: none;
  }

  .damage-meter-toggle {
    display: none;
  }

  body.match-active {
    overflow: auto;
  }

  body.match-active .minimap-panel {
    display: none;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  body.match-active .shell {
    grid-template-columns: 1fr;
    grid-template-rows: 100vh auto;
    height: auto;
    min-height: 100vh;
  }

  body.match-active .game-area {
    grid-row: 1;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  body.match-active .sidebar {
    grid-row: 2;
    max-height: none;
    overflow: visible;
  }

  body.match-active .topbar {
    align-items: start;
    flex-direction: row;
  }

  body.match-active .scoreboard {
    display: flex;
    grid-template-columns: none;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  body.match-active .score-card {
    flex: 0 0 156px;
    padding: 7px 8px;
  }

  body.match-active .toolbar {
    flex-direction: column;
  }

  body.match-active .round-widget {
    flex-basis: 76px;
    min-height: 66px;
  }

  body.match-active .canvas-wrap {
    flex: 1;
    min-height: 0;
    padding-bottom: 0;
  }

  body.is-authenticated:not(.match-active) .shell,
  body:not(.is-authenticated) .shell {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    padding: 16px;
  }

  body.is-authenticated:not(.match-active) .sidebar {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 32px);
  }

  body:not(.is-authenticated) .sidebar {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  body.page-auth .brand {
    padding: 0 0 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(95, 197, 225, 0.18);
  }

  body.is-authenticated:not(.match-active) .brand h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 11vw, 3rem);
  }

  body.is-authenticated:not(.match-active) .tab-pane.active,
  body.is-authenticated:not(.match-active) #profileTab.active {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.is-authenticated:not(.match-active) .sidebar {
    overflow: visible;
  }

  body.is-authenticated:not(.match-active) .launcher-panel {
    min-height: auto;
    overflow: visible;
  }

  .launcher-frame {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .launcher-nav {
    position: static;
    width: auto;
    grid-template-rows: auto;
    gap: 10px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(215, 169, 74, 0.22);
  }

  .launcher-mark {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .launcher-mark-icon {
    width: 42px;
    height: 42px;
    font-size: 0.7rem;
  }

  .profile-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .profile-avatar {
    width: 48px;
    height: 48px;
  }

  .profile-status {
    padding-top: 7px;
  }

  .launcher-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .launcher-tabs .tab-button {
    justify-content: center;
    min-height: 38px;
    border-left: 1px solid transparent;
    text-align: center;
  }

  .launcher-audio {
    padding-top: 8px;
  }

  .launcher-audio .setting-row {
    margin: 6px 0;
  }

  .launcher-audio .mode-button {
    min-height: 34px;
  }

  .launcher-page-header {
    min-height: 62px;
    padding: 14px 16px;
  }

  .launcher-page-header h2 {
    font-size: clamp(1.35rem, 7vw, 1.9rem);
  }

  .launcher-workspace {
    position: static;
    height: auto;
    overflow: visible;
  }

  .launcher-content {
    overflow: visible;
    padding: 16px;
  }

  .play-section,
  .profile-insights,
  .profile-history-grid,
  .social-grid,
  .friend-form {
    grid-template-columns: 1fr;
  }

  .player-profile-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .player-profile-avatar {
    width: 38px;
    height: 38px;
  }

  .player-profile-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .player-profile-actions .mode-button {
    flex: 1 1 auto;
  }

  .match-history-item {
    grid-template-columns: 88px minmax(0, 1fr) auto;
  }

  .match-history-item .history-points {
    grid-column: 3;
  }

  .match-history-item .history-date {
    grid-column: 2 / -1;
  }

  .play-section .section-title {
    order: 1;
  }

  .lobby-list {
    order: 2;
    min-height: 120px;
  }

  .play-actions {
    order: 3;
  }

  .play-section .mini-log {
    order: 4;
  }

  .social-item,
  .request-item,
  .open-room-item {
    grid-template-columns: 1fr;
  }

  .lobby-player {
    align-items: stretch;
    flex-direction: column;
  }

  .lobby-player-meta,
  .lobby-player-actions {
    width: 100%;
  }

  .lobby-player-actions {
    flex-wrap: wrap;
  }

  .lobby-player-actions .mode-button {
    flex: 1 1 104px;
  }

  .item-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .item-actions .mode-button,
  .item-actions .primary-button,
  .item-actions .danger-button {
    flex: 1 1 120px;
  }

  .sidebar {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scoreboard {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  canvas {
    width: min(1220px, 132vw);
  }

  body.match-active canvas {
    width: min(2300px, 410vw);
  }

  body.match-active .hintbar {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 0.76rem;
  }

  body.match-active .minimap-panel {
    top: 82px;
    right: 8px;
    bottom: auto;
    width: min(190px, calc(100vw - 16px));
    padding: 8px;
  }

  body.match-active .chat-panel {
    margin-top: 8px;
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 9px;
  }

  body.match-active .choice-button {
    min-height: 62px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 8px 10px;
  }

  body.match-active .choice-icon {
    width: 46px;
    height: 46px;
  }

  body.match-active .choice-desc {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  body:not(.is-authenticated) .shell {
    align-content: center;
    padding: 14px;
  }

  body:not(.is-authenticated) .sidebar,
  body.is-authenticated:not(.match-active) .sidebar {
    padding: 16px;
  }

  .brand h1 {
    max-width: 10ch;
    font-size: clamp(2rem, 12vw, 2.8rem);
  }

  .panel {
    padding: 12px;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.is-authenticated:not(.match-active) #saveSettingsButton {
    width: 100%;
  }

  body.match-active .score-card {
    flex-basis: 166px;
    min-height: 66px;
    padding: 6px 8px;
  }

  body.match-active .score-avatar {
    width: 34px;
    height: 34px;
  }

  body.match-active .score-name {
    font-size: 0.66rem;
  }

  body.match-active .score-values {
    flex-wrap: nowrap;
    gap: 7px;
    font-size: 0.82rem;
  }

  body.match-active .round-widget {
    flex-basis: 66px;
    min-height: 66px;
    padding: 5px;
  }

  .round-widget strong {
    font-size: 1.25rem;
  }

  .minimap-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    width: min(176px, calc(100vw - 24px));
    padding: 8px;
  }

  .minimap-head {
    margin-bottom: 6px;
    font-size: 0.76rem;
  }

  .minimap-head > div > span {
    display: none;
  }

  body.match-active .minimap-panel {
    top: 106px;
    right: 8px;
    bottom: auto;
    width: min(132px, calc(100vw - 16px));
  }

  body.match-active .minimap-head {
    font-size: 0.72rem;
  }

  body.match-active .chat-log {
    min-height: 46px;
    max-height: 70px;
  }
}

@media (min-width: 981px) {
  body.match-active .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(230px, 30vh);
    height: 100vh;
    min-height: 0;
  }

  body.match-active .game-area {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    padding: 8px 10px 6px;
    overflow: hidden;
  }

  body.match-active .sidebar {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(190px, 0.42fr) minmax(440px, 1.1fr) minmax(560px, 1.55fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    height: 100%;
    max-height: none;
    padding: 8px;
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  body.match-active .brand,
  body.match-active .account-panel {
    display: none !important;
  }

  body.match-active .setup-panel {
    grid-column: 1;
    min-height: 0;
    overflow: hidden;
  }

  body.match-active .locked-class {
    display: none !important;
  }

  body.match-active .class-panel,
  body.match-active .locked-class {
    grid-row: 1;
  }

  body.match-active .start-panel {
    grid-row: 2;
  }

  body.match-active .locked-class {
    grid-row: 1 / span 2;
  }

  body.match-active .tower-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 0;
  }

  body.match-active .barracks-panel {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-height: 0;
  }

  body.match-active .selected-panel {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
  }

  body.match-active .stats-panel {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    margin-top: 0;
  }

  body.match-active .sidebar:not(:has(#selectedTowerPanel:not([hidden]))) .stats-panel {
    grid-row: 1 / span 2;
  }

  body.match-active .panel-title {
    margin-bottom: 7px;
  }

  body.match-active .panel h2 {
    font-size: 0.94rem;
  }

  body.match-active .resource-grid {
    grid-template-columns: 1fr;
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    grid-auto-rows: minmax(56px, auto);
    gap: 8px;
    max-height: calc(100% - 34px);
    overflow: auto;
    padding-right: 3px;
  }

  body.match-active .choice-button {
    min-height: 56px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 7px 9px;
  }

  body.match-active .choice-icon {
    width: 40px;
    height: 40px;
  }

  body.match-active .choice-name {
    font-size: 0.82rem;
    line-height: 1.08;
  }

  body.match-active .choice-cost {
    font-size: 0.76rem;
  }

  body.match-active .choice-desc {
    display: -webkit-box;
    font-size: 0.66rem;
    line-height: 1.14;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  body.match-active .batch-controls {
    margin-bottom: 7px;
  }

  body.match-active .stat-row {
    display: grid;
    gap: 3px;
    padding: 8px;
    border: 1px solid rgba(215, 169, 74, 0.12);
    border-radius: 8px;
    background: rgba(5, 9, 7, 0.44);
    font-size: 0.72rem;
  }

  body.match-active .stat-row strong {
    font-size: 0.96rem;
  }

  body.match-active .selected-panel strong {
    margin-bottom: 7px;
  }

  body.match-active .primary-button,
  body.match-active .mode-button,
  body.match-active .danger-button {
    min-height: 36px;
  }

  body.match-active .canvas-wrap {
    justify-content: start;
    padding: 0;
  }

  body.match-active canvas {
    width: clamp(2600px, 168vw, 3400px);
  }

  body.match-active .chat-panel {
    position: absolute;
    right: 10px;
    top: clamp(286px, 38vh, 380px);
    bottom: auto;
    z-index: 9;
    width: min(286px, calc(100vw - 40px));
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.045), transparent),
      rgba(13, 18, 15, 0.9);
  }

  body.match-active .chat-panel .panel-title {
    margin-bottom: 5px;
  }

  body.match-active .chat-form {
    grid-template-columns: 1fr;
  }

  body.match-active .chat-log {
    min-height: 156px;
    max-height: 228px;
  }

  body.match-active .minimap-panel {
    top: 74px;
    width: min(270px, calc(100vw - 40px));
  }
}

@media (min-width: 1700px) {
  body.match-active .shell {
    grid-template-rows: minmax(0, 1fr) minmax(292px, 29vh);
  }

  body.match-active .sidebar {
    grid-template-columns: minmax(220px, 0.42fr) minmax(620px, 0.95fr) minmax(980px, 1.55fr);
    gap: 10px;
    padding: 10px;
  }

  body.match-active .panel {
    padding: 12px;
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-rows: minmax(72px, auto);
    gap: 9px;
    max-height: calc(100% - 42px);
  }

  body.match-active .barracks {
    max-height: calc(100% - 96px);
  }

  body.match-active .choice-button {
    min-height: 72px;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 10px 12px;
  }

  body.match-active .choice-icon {
    width: 56px;
    height: 56px;
  }

  body.match-active .choice-name {
    font-size: 0.92rem;
    line-height: 1.1;
  }

  body.match-active .choice-desc {
    font-size: 0.76rem;
    line-height: 1.2;
  }

  body.match-active .choice-cost {
    font-size: 0.82rem;
  }

  body.match-active .batch-controls {
    margin-bottom: 10px;
  }

  body.match-active .panel h2 {
    font-size: 1.05rem;
  }

  body.match-active .stat-row {
    padding: 9px;
    font-size: 0.96rem;
  }

  body.match-active .chat-panel {
    width: min(304px, calc(100vw - 40px));
  }

  body.match-active .chat-log {
    min-height: 178px;
    max-height: 252px;
  }
}

/* Horizontal arena experiment */
body.match-active {
  background:
    radial-gradient(circle at 50% 16%, rgba(215, 169, 74, 0.035), transparent 22%),
    linear-gradient(180deg, rgba(5, 8, 6, 0.92), rgba(5, 8, 6, 0.98)),
    #050908;
}

body.match-active .game-area {
  padding: 6px 8px 5px;
  gap: 6px;
}

body.match-active .topbar {
  position: relative;
  z-index: 14;
  min-height: 78px;
  padding: 0 64px 0 0;
  align-items: stretch;
}

body.match-active .scoreboard {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(132px, 1fr))
    minmax(112px, clamp(118px, 10vw, 174px))
    repeat(3, minmax(132px, 1fr));
  gap: clamp(5px, 0.5vw, 8px);
  width: 100%;
}

body.match-active .score-card {
  min-height: 72px;
  grid-template-columns: clamp(36px, 3vw, 54px) minmax(0, 1fr);
  gap: clamp(6px, 0.6vw, 10px);
  padding: 8px clamp(8px, 0.8vw, 12px) 8px 10px;
  border-color: color-mix(in srgb, var(--player-color, var(--gold)) 42%, rgba(215, 169, 74, 0.32));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--player-color, var(--gold)) 16%, transparent), transparent 40%),
    radial-gradient(circle at 20% 28%, color-mix(in srgb, var(--player-color, var(--gold)) 20%, transparent), transparent 38%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.11), rgba(0, 0, 0, 0.06)),
    rgba(9, 13, 11, 0.9);
}

body.match-active .score-card:nth-child(4) {
  grid-column: 5;
}

body.match-active .score-card:nth-child(5) {
  grid-column: 6;
}

body.match-active .score-card:nth-child(6) {
  grid-column: 7;
}

body.match-active .score-card::before {
  border-left-color: color-mix(in srgb, var(--player-color, var(--gold)) 78%, transparent);
}

body.match-active .score-avatar {
  width: clamp(36px, 3vw, 54px);
  height: clamp(36px, 3vw, 54px);
  border-width: 2px;
  border-color: color-mix(in srgb, var(--player-color, var(--gold)) 60%, rgba(255, 240, 190, 0.28));
  font-size: clamp(0.72rem, 0.7vw, 0.86rem);
}

.score-index {
  position: absolute;
  left: 5px;
  bottom: 5px;
  z-index: 1;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(215, 169, 74, 0.72);
  border-radius: 50%;
  background: rgba(6, 9, 7, 0.9);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 950;
}

body.match-active .score-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--player-color, var(--gold)) 72%, #fff8e8);
  font-size: clamp(0.66rem, 0.64vw, 0.78rem);
  font-weight: 950;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

body.match-active .score-name span:first-child {
  color: color-mix(in srgb, var(--player-color, var(--gold)) 72%, #fff8e8);
  font-size: clamp(0.72rem, 0.72vw, 0.86rem);
  font-weight: 950;
  text-transform: uppercase;
}

body.match-active .score-name span:last-child {
  max-width: none;
  color: #fff8e8;
  font-weight: 800;
}

body.match-active .score-game-level {
  min-height: 18px;
  padding-inline: 5px;
  font-size: clamp(0.55rem, 0.52vw, 0.64rem);
}

body.match-active .score-values {
  display: flex;
  flex-wrap: wrap;
  column-gap: clamp(6px, 0.6vw, 12px);
  row-gap: 4px;
  margin-top: 5px;
  font-size: clamp(0.74rem, 0.72vw, 0.88rem);
  line-height: 1.05;
}

body.match-active .score-values > span,
body.match-active .score-values .icon-value {
  min-width: max-content;
}

body.match-active .score-values .icon-value {
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

body.match-active .score-values .icon-value > span:last-child {
  overflow: visible;
}

body.match-active .round-widget {
  position: absolute;
  top: -8px;
  left: calc(50vw - 8px);
  z-index: 16;
  width: 182px;
  height: 112px;
  min-height: 0;
  transform: translateX(-50%);
  border-radius: 0 0 92px 92px;
  border-color: rgba(215, 169, 74, 0.78);
  background:
    radial-gradient(circle at 50% 30%, rgba(215, 169, 74, 0.28), transparent 42%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.16), rgba(8, 12, 10, 0.96) 64%),
    rgba(8, 12, 10, 0.96);
  box-shadow:
    inset 0 2px 0 rgba(255, 240, 190, 0.18),
    inset 0 -8px 28px rgba(0, 0, 0, 0.58),
    0 16px 42px rgba(0, 0, 0, 0.48);
}

body.match-active .round-widget::before,
body.match-active .round-widget::after {
  content: "";
  position: absolute;
  top: 34px;
  width: 32px;
  height: 32px;
  border: 2px solid rgba(98, 234, 208, 0.38);
  border-radius: 50%;
  background: rgba(9, 14, 11, 0.9);
}

body.match-active .round-widget::before {
  left: -19px;
}

body.match-active .round-widget::after {
  right: -19px;
}

body.match-active .round-widget span {
  color: #efe0ad;
  font-size: 0.74rem;
}

body.match-active .round-widget strong {
  font-size: 3.1rem;
  line-height: 0.9;
}

body.match-active .round-widget em {
  font-size: 1rem;
}

body.match-active .toolbar {
  position: absolute;
  top: 8px;
  right: 0;
  z-index: 18;
}

body.match-active .tool-button {
  width: 46px;
  height: 46px;
  border-color: rgba(215, 169, 74, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.12), transparent 58%),
    rgba(11, 16, 13, 0.92);
}

@media (max-width: 1500px) {
  body.match-active .topbar {
    padding-right: 56px;
  }

  body.match-active .scoreboard {
    grid-template-columns:
      repeat(3, minmax(118px, 1fr))
      minmax(148px, 12vw)
      repeat(3, minmax(118px, 1fr));
  }

  body.match-active .score-card {
    min-height: 66px;
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 7px 8px;
  }

  body.match-active .score-avatar {
    width: 34px;
    height: 34px;
  }

  body.match-active .score-name span:last-child {
    display: none;
  }

  body.match-active .round-widget {
    width: 148px;
    height: 94px;
    border-radius: 0 0 76px 76px;
  }

  body.match-active .round-widget::before,
  body.match-active .round-widget::after {
    display: none;
  }

  body.match-active .round-widget strong {
    font-size: 2.55rem;
  }
}

@media (min-width: 981px) and (max-width: 1180px) {
  body.match-active .topbar {
    min-height: 132px;
    padding-right: 142px;
  }

  body.match-active .scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(58px, auto);
    align-content: start;
  }

  body.match-active .score-card:nth-child(4),
  body.match-active .score-card:nth-child(5),
  body.match-active .score-card:nth-child(6) {
    grid-column: auto;
  }

  body.match-active .round-widget {
    top: 0;
    right: 52px;
    left: auto;
    width: 82px;
    height: 128px;
    transform: none;
    border-radius: 8px;
  }

  body.match-active .round-widget::before,
  body.match-active .round-widget::after {
    display: none;
  }
}

@media (max-width: 980px) {
  body.match-active .topbar {
    min-height: auto;
    padding: 0;
    align-items: stretch;
  }

  body.match-active .scoreboard {
    display: flex;
    grid-template-columns: none;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  body.match-active .score-card,
  body.match-active .score-card:nth-child(4),
  body.match-active .score-card:nth-child(5),
  body.match-active .score-card:nth-child(6) {
    flex: 0 0 clamp(184px, 48vw, 236px);
    grid-column: auto;
    min-height: 64px;
  }

  body.match-active .round-widget {
    position: static;
    grid-template-columns: auto auto auto;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: auto;
    min-height: 48px;
    transform: none;
    border-radius: 8px;
  }

  body.match-active .round-widget::before,
  body.match-active .round-widget::after {
    display: none;
  }

  body.match-active .round-widget strong {
    font-size: 1.7rem;
  }
}

body.match-active .canvas-wrap {
  flex: 1;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(215, 169, 74, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.44));
}

canvas {
  aspect-ratio: 5400 / 3600;
}

body.match-active canvas {
  width: clamp(4700px, 330vw, 6200px);
  aspect-ratio: 5400 / 3600;
}

body.match-active .hintbar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 10px;
  z-index: 15;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 6px;
  pointer-events: none;
  font-size: 0.8rem;
  background: rgba(6, 10, 8, 0.78);
}

.battle-feed {
  position: fixed;
  top: 50vh;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 29;
  display: grid;
  width: min(540px, calc(100vw - 36px));
  gap: 6px;
  margin: 0 auto;
  pointer-events: none;
}

.battle-feed-item {
  justify-self: center;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(215, 169, 74, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.12), transparent 58%),
    rgba(7, 11, 9, 0.9);
  color: #fff8e8;
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
  animation: battle-feed-in 180ms ease-out;
}

.battle-feed-item.danger {
  border-color: rgba(255, 115, 106, 0.54);
  color: #ffd8d8;
}

.battle-feed-item.warning {
  border-color: rgba(242, 184, 75, 0.58);
  color: #ffe6ad;
}

.battle-feed-item.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 420ms ease, transform 420ms ease;
}

@keyframes battle-feed-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.match-active .minimap-panel,
body.match-active .chat-panel {
  right: 10px;
  width: min(318px, calc(100vw - 36px));
  border-color: rgba(215, 169, 74, 0.54);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.08), transparent 56%),
    rgba(10, 15, 12, 0.9);
}

body.match-active .minimap-panel {
  top: 104px;
  padding: 10px;
  opacity: 0.95;
}

body.match-active .minimap-panel.is-collapsed {
  width: min(168px, calc(100vw - 36px));
  padding: 7px;
  opacity: 0.72;
}

body.match-active .minimap-panel.is-collapsed .minimap-head {
  margin-bottom: 5px;
}

body.match-active .minimap-panel.is-collapsed .minimap-head > div > span {
  display: none;
}

body.match-active #minimapCanvas {
  aspect-ratio: 360 / 240;
  border-radius: 4px;
}

body.match-active .chat-panel {
  top: 390px;
  padding: 10px;
}

body.match-active .chat-panel .panel-title h2,
body.match-active .minimap-head strong {
  color: #efe0ad;
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

body.match-active .chat-log {
  min-height: 164px;
  max-height: 212px;
  background: rgba(5, 9, 7, 0.78);
}

body.match-active .chat-form {
  grid-template-columns: 1fr 42px;
}

body.match-active #chatSendButton {
  min-width: 42px;
  padding: 0;
  overflow: hidden;
  color: transparent;
}

body.match-active #chatSendButton::before {
  content: ">";
  color: #efe0ad;
  font-size: 1.3rem;
}

@media (min-width: 981px) {
  body.match-active .shell {
    grid-template-rows: minmax(0, 1fr) 252px;
  }

  body.match-active .sidebar {
    grid-template-columns: 172px minmax(460px, 0.92fr) minmax(620px, 1.2fr);
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 8px 10px;
    background:
      linear-gradient(180deg, rgba(38, 39, 25, 0.92), rgba(7, 11, 9, 0.96)),
      rgba(7, 11, 9, 0.94);
  }

  body.match-active .stats-panel {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    align-content: stretch;
  }

  body.match-active .tower-panel {
    grid-column: 2;
    grid-row: 1;
  }

  body.match-active .barracks-panel {
    grid-column: 3;
    grid-row: 1;
  }

  body.match-active .selected-panel,
  body.match-active .setup-panel,
  body.match-active .locked-class {
    display: none !important;
  }

  body.match-active .resource-grid {
    grid-template-columns: 1fr;
    height: 100%;
  }

  body.match-active .stats-panel h2 {
    display: none;
  }

  body.match-active .stat-row {
    align-content: center;
    min-height: 54px;
    padding: 12px;
    border-color: rgba(215, 169, 74, 0.2);
    background:
      radial-gradient(circle at 20% 30%, rgba(215, 169, 74, 0.1), transparent 34%),
      rgba(5, 9, 7, 0.72);
  }

  body.match-active .stat-row:first-child strong {
    color: var(--gold);
    font-size: 2rem;
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(132px, 148px);
    grid-template-columns: none;
    grid-auto-rows: 1fr;
    max-height: none;
    height: calc(100% - 34px);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px;
  }

  body.match-active .choice-button {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(88px, 1fr) auto auto;
    justify-items: center;
    align-content: stretch;
    min-height: 196px;
    padding: 8px;
    text-align: center;
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.1), transparent 54%),
      radial-gradient(circle at 50% 20%, rgba(98, 234, 208, 0.12), transparent 38%),
      rgba(9, 14, 11, 0.86);
  }

  body.match-active .choice-icon {
    width: 100%;
    height: 92px;
    border-radius: 4px;
    background-size: calc(var(--sprite-cols) * 105%) calc(var(--sprite-rows) * 105%);
  }

  body.match-active .choice-main {
    display: grid;
    gap: 5px;
    justify-items: center;
  }

  body.match-active .choice-name {
    font-size: 0.84rem;
    text-transform: uppercase;
  }

  body.match-active .choice-desc {
    -webkit-line-clamp: 1;
    max-width: 100%;
    min-height: 0;
    font-size: 0.68rem;
  }

  body.match-active .choice-cost {
    align-self: end;
    font-size: 0.8rem;
  }
}

@media (min-width: 1700px) {
  body.match-active .shell {
    grid-template-rows: minmax(0, 1fr) 282px;
  }

  body.match-active .sidebar {
    grid-template-columns: 190px minmax(600px, 0.95fr) minmax(760px, 1.25fr);
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    grid-auto-columns: minmax(150px, 172px);
  }

  body.match-active .choice-button {
    min-height: 222px;
  }

  body.match-active .choice-icon {
    height: 116px;
  }
}

@media (min-width: 981px) {
  body.match-active .sidebar {
    grid-template-columns: minmax(170px, 0.34fr) minmax(420px, 0.9fr) minmax(220px, 0.45fr) minmax(560px, 1.25fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 0.78fr);
  }

  body.match-active .stats-panel {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  body.match-active .tower-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  body.match-active .bench-panel {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-height: 0;
    overflow: hidden;
  }

  body.match-active .barracks-panel {
    grid-column: 4;
    grid-row: 1 / span 2;
  }

  body.match-active .tower-list,
  body.match-active .barracks {
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.match-active .tower-list {
    grid-auto-rows: minmax(78px, auto);
    height: calc(100% - 76px);
  }

  body.match-active .barracks {
    grid-auto-rows: minmax(78px, auto);
    height: calc(100% - 86px);
  }

  body.match-active .bench-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: calc(100% - 32px);
  }

  body.match-active .choice-button {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    grid-template-rows: none;
    justify-items: stretch;
    min-height: 78px;
    text-align: left;
  }

  body.match-active .choice-icon {
    width: 54px;
    height: 54px;
  }
}

@media (min-width: 1700px) {
  body.match-active .sidebar {
    grid-template-columns: minmax(190px, 0.32fr) minmax(560px, 0.95fr) minmax(260px, 0.46fr) minmax(780px, 1.3fr);
  }

  body.match-active .choice-button {
    min-height: 84px;
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  body.match-active .choice-icon {
    width: 60px;
    height: 60px;
  }
}

@media (min-width: 981px) {
  body.match-active .stats-panel {
    grid-template-rows: auto 1fr auto;
    align-content: stretch;
    overflow: hidden;
  }

  body.match-active .resource-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    height: auto;
    min-height: 0;
  }

  body.match-active .stat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 0;
    padding: 6px 10px;
    gap: 8px;
  }

  body.match-active .stat-row > span {
    min-width: 0;
    overflow: hidden;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.match-active .stat-row strong {
    min-width: 0;
    justify-self: end;
    font-size: 0.9rem;
    line-height: 1;
  }

  body.match-active .stat-row:first-child strong {
    font-size: 1.05rem;
  }

  body.match-active .stat-row .icon-value {
    justify-content: end;
    gap: 4px;
  }

  body.match-active #buyXpButton {
    width: 100%;
    min-height: 34px;
    margin-top: 6px;
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  body.match-active .selected-panel:not([hidden]) {
    position: fixed;
    left: 12px;
    bottom: 300px;
    z-index: 38;
    display: grid !important;
    width: min(340px, calc(100vw - 24px));
    gap: 8px;
  }

  body.match-active .selected-panel .mode-button,
  body.match-active .selected-panel .danger-button {
    min-height: 34px;
    font-size: 0.78rem;
  }

  body.match-active .selected-tower-stats {
    margin: 0;
    font-size: 0.72rem;
  }

  body.match-active .selected-trait-chip {
    min-height: 19px;
    padding: 2px 6px;
    font-size: 0.58rem;
  }

  body.match-active .selected-stat-row--bonuses > span:last-child {
    line-height: 1.25;
  }

  body.match-active .unit-shop-card {
    min-height: 68px;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.055), transparent),
      rgba(8, 13, 10, 0.82);
  }

  body.match-active .unit-shop-card .choice-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
  }

  body.match-active .unit-shop-card .choice-cost {
    color: var(--gold);
    font-size: 0.72rem;
  }

  body.match-active .monster-shop-desc {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (min-width: 981px) and (max-height: 900px) {
  body.match-active .shell {
    grid-template-rows: minmax(0, 1fr) 236px;
  }

  body.match-active .selected-panel:not([hidden]) {
    bottom: 252px;
  }

  body.match-active .choice-button {
    min-height: 62px;
  }

  body.match-active .choice-icon {
    width: 46px;
    height: 46px;
  }

  body.match-active .bench-slot {
    min-height: 50px;
  }

  body.match-active .bench-slot .choice-icon {
    height: 28px;
  }
}

@media (max-width: 980px) {
  body.match-active .shell {
    grid-template-rows: auto auto;
  }

  body.match-active .game-area {
    height: auto;
    min-height: 0;
  }

  body.match-active .canvas-wrap {
    flex: 0 0 min(560px, 62vh);
  }

  body.match-active .minimap-panel {
    display: none;
  }
}

@media (min-width: 981px) {
  body.match-active .shell {
    grid-template-rows: minmax(0, 1fr) 310px;
  }

  body.match-active .sidebar {
    grid-template-columns: minmax(132px, 0.22fr) minmax(550px, 0.9fr) minmax(360px, 0.58fr) minmax(330px, 0.52fr);
    grid-template-rows: 1fr;
  }

  body.match-active .stats-panel,
  body.match-active .tower-panel,
  body.match-active .bench-panel,
  body.match-active .barracks-panel {
    min-height: 0;
  }

  body.match-active .tower-panel {
    overflow: hidden;
  }

  body.match-active .tower-panel .tower-list {
    grid-template-columns: repeat(5, minmax(100px, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: initial;
    grid-auto-rows: minmax(0, 1fr);
    height: calc(100% - 58px);
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  body.match-active .tower-panel .shop-action {
    flex: 1 1 auto;
    width: auto;
    margin-top: 0;
  }

  body.match-active .tower-panel .shop-action.icon-action {
    flex: 0 0 auto;
    width: auto;
  }

  body.match-active .tower-panel .odds-preview {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.match-active .tower-panel .choice-button {
    position: relative;
    min-height: 0;
    height: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: 58px minmax(0, 1fr);
    justify-items: stretch;
    align-content: stretch;
    gap: 6px;
    padding: 8px;
    text-align: left;
  }

  body.match-active .tower-panel .choice-icon {
    justify-self: center;
    width: 58px;
    height: 58px;
  }

  body.match-active .tower-panel .choice-main {
    display: grid;
    align-content: start;
    gap: 5px;
    min-width: 0;
  }

  body.match-active .tower-panel .choice-name {
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  body.match-active .tower-panel .choice-cost {
    position: absolute;
    right: 8px;
    top: 8px;
    left: auto;
    display: flex;
    justify-content: center;
    padding: 3px 5px;
    border: 1px solid rgba(242, 184, 75, 0.32);
    border-radius: 999px;
    background: rgba(4, 7, 5, 0.84);
    font-size: 0.76rem;
  }

  body.match-active .tower-panel .choice-button::before,
  body.match-active .bench-slot::before {
    display: none;
  }

  body.match-active .rarity-common .choice-icon {
    border-color: #9fb4a6;
  }

  body.match-active .rarity-uncommon .choice-icon {
    border-color: #58d68d;
    box-shadow: inset 0 0 0 1px rgba(88, 214, 141, 0.28), 0 0 14px rgba(88, 214, 141, 0.2);
  }

  body.match-active .rarity-rare .choice-icon {
    border-color: #66b7ff;
    box-shadow: inset 0 0 0 1px rgba(102, 183, 255, 0.3), 0 0 14px rgba(102, 183, 255, 0.2);
  }

  body.match-active .rarity-epic .choice-icon {
    border-color: #bd8dff;
    box-shadow: inset 0 0 0 1px rgba(189, 141, 255, 0.32), 0 0 16px rgba(189, 141, 255, 0.22);
  }

  body.match-active .rarity-legendary .choice-icon {
    border-color: #f2b84b;
    box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.36), 0 0 18px rgba(242, 184, 75, 0.24);
  }

  body.match-active .rarity-mythic .choice-icon {
    border-color: #ff3b30;
    box-shadow: inset 0 0 0 1px rgba(255, 59, 48, 0.42), 0 0 20px rgba(255, 59, 48, 0.28);
  }

  body.match-active .tower-stat-grid,
  body.match-active .unit-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    min-width: 0;
  }

  body.match-active .tower-stat-grid > .stat-pill,
  body.match-active .unit-stat-grid > .stat-pill,
  body.match-active .selected-tower-stats .stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
    padding: 2px 4px;
    border: 1px solid rgba(151, 184, 211, 0.14);
    border-radius: 4px;
    background: rgba(4, 8, 6, 0.42);
    color: #cfd9c8;
    font-size: 0.58rem;
    line-height: 1.05;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.match-active .stat-icon {
    display: inline-grid;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    place-items: center;
  }

  body.match-active .stat-pill > .income-icon,
  body.match-active .unit-shop-pill > .income-icon {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
  }

  body.match-active .stat-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  body.match-active .stat-pill strong {
    min-width: 0;
    overflow: hidden;
    color: inherit;
    font: inherit;
    text-overflow: ellipsis;
  }

  body.match-active .selected-stat-icon {
    flex: 0 0 24px;
    width: 24px;
    height: 22px;
    padding: 3px;
  }

  body.match-active .selected-stat-icon .stat-icon {
    width: 14px;
    height: 14px;
  }

  body.match-active .stat-ground,
  body.match-active .stat-air,
  body.match-active .stat-both,
  body.match-active .stat-income {
    color: #efe0ad;
  }

  body.match-active .stat-damage {
    color: #ffd28a;
  }

  body.match-active .stat-range {
    color: #9fd6ff;
  }

  body.match-active .stat-speed {
    color: #c6f6d5;
  }

  body.match-active .stat-hp {
    color: #ff9aa2;
  }

  body.match-active .tower-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
    min-height: 16px;
  }

  body.match-active .tower-tags > span {
    display: inline-grid;
    width: 18px;
    height: 16px;
    place-items: center;
    padding: 2px;
    border: 1px solid color-mix(in srgb, var(--rarity-color, var(--gold)) 44%, rgba(255, 240, 190, 0.14));
    border-radius: 999px;
    color: color-mix(in srgb, var(--rarity-color, var(--gold)) 72%, #fff8e8);
    font-size: 0.55rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
  }

  body.match-active .tower-meta-row {
    width: 100%;
    min-height: 17px;
  }

  body.match-active .tower-trait-list--compact {
    gap: 3px;
    min-width: 0;
  }

  body.match-active .tower-trait-chip--compact {
    max-width: 68px;
    min-height: 15px;
    padding: 1px 4px;
    font-size: 0.48rem;
  }

  body.match-active .tower-panel .tower-meta-row {
    justify-content: center;
  }

  body.match-active .tower-panel .tower-trait-list--compact {
    flex: 0 1 auto;
    justify-content: center;
    max-width: 100%;
  }

  body.match-active .tower-panel .tower-tags {
    display: none;
  }

  body.match-active .bench-panel {
    overflow: hidden;
  }

  body.match-active .barracks-panel .panel-title {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  body.match-active .barracks-panel .panel-title h2 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.match-active .barracks-panel .panel-title > span {
    display: none;
  }

  body.match-active .bench-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 6px;
    height: calc(100% - 32px);
    min-height: 0;
    overflow: hidden;
  }

  body.match-active .bench-slot {
    min-height: 0;
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    padding: 4px 6px;
  }

  body.match-active .bench-slot .choice-icon {
    width: 42px;
    height: 42px;
  }

  body.match-active .bench-main {
    display: grid;
    gap: 4px;
    min-width: 0;
  }

  body.match-active .bench-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
  }

  body.match-active .bench-title span {
    min-width: 0;
    overflow: hidden;
    font-size: 0.68rem;
    font-weight: 900;
    text-align: left;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  body.match-active .bench-title strong {
    flex: 0 0 auto;
    color: #efe0ad;
    font-size: 0.62rem;
  }

  body.match-active .bench-tags {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
  }

  body.match-active .bench-tags .shop-decision-badge {
    min-height: 17px;
    max-width: 74px;
    padding: 2px 5px;
    font-size: 0.52rem;
  }

  body.match-active .bench-tags .shop-decision-icon {
    width: 11px;
    height: 11px;
  }

  body.match-active .bench-empty {
    grid-column: 1 / -1;
  }
}

@media (min-width: 981px) {
  body.match-active .barracks-panel .panel-title {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  body.match-active .barracks-panel .panel-title > span {
    display: none;
  }

  body.match-active .barracks {
    gap: 10px;
    height: calc(100% - 44px);
  }

  body.match-active .unit-shop-card {
    min-height: 116px;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: 10px 12px;
    border-color: color-mix(in srgb, var(--rarity-color, var(--gold)) 34%, rgba(255, 240, 190, 0.14));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, var(--gold)) 14%, transparent), transparent 58%),
      radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--rarity-color, var(--gold)) 20%, transparent), transparent 34%),
      rgba(8, 13, 10, 0.9);
    text-align: left;
  }

  body.match-active .unit-shop-card:hover {
    border-color: color-mix(in srgb, var(--rarity-color, var(--gold)) 68%, #fff8e8);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--rarity-color, var(--gold)) 30%, transparent), 0 14px 28px rgba(0, 0, 0, 0.28);
  }

  body.match-active .unit-shop-card:disabled {
    border-color: rgba(255, 240, 190, 0.08);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 58%),
      rgba(4, 6, 5, 0.88);
    color: rgba(180, 188, 174, 0.42);
    cursor: not-allowed;
    filter: grayscale(0.88) saturate(0.42);
    opacity: 1;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.42);
  }

  body.match-active .unit-shop-card:disabled::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    background:
      linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.16)),
      repeating-linear-gradient(-45deg, rgba(255, 240, 190, 0.035) 0 5px, transparent 5px 11px);
    pointer-events: none;
  }

  body.match-active .unit-shop-card:disabled .choice-icon {
    filter: grayscale(1) brightness(0.48) contrast(0.85);
    opacity: 0.52;
  }

  body.match-active .unit-shop-card:disabled .choice-name,
  body.match-active .unit-shop-card:disabled .unit-shop-pill,
  body.match-active .unit-shop-card:disabled .unit-shop-details > span {
    color: rgba(214, 220, 202, 0.42);
  }

  body.match-active .unit-shop-card:disabled .unit-shop-pill,
  body.match-active .unit-shop-card:disabled .unit-shop-details > span {
    border-color: rgba(255, 240, 190, 0.08);
    background: rgba(0, 0, 0, 0.28);
  }

  body.match-active .unit-shop-card:disabled .choice-cost {
    border-color: color-mix(in srgb, var(--gold) 58%, rgba(255, 255, 255, 0.18));
    background: rgba(34, 24, 5, 0.9);
    color: var(--gold);
    filter: none;
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 14px rgba(242, 184, 75, 0.2);
  }

  body.match-active .unit-shop-card:disabled.is-too-expensive .choice-cost {
    border-color: rgba(255, 170, 74, 0.7);
    background: rgba(42, 24, 3, 0.94);
    color: #ffd36b;
  }

  body.match-active .unit-shop-card:disabled .choice-main,
  body.match-active .unit-shop-card:disabled .choice-cost,
  body.match-active .unit-shop-card:disabled .choice-icon {
    position: relative;
    z-index: 3;
  }

  body.match-active .unit-shop-card:disabled:hover {
    box-shadow: none;
    transform: none;
  }

  body.match-active .unit-shop-card.is-pending {
    border-color: rgba(98, 234, 208, 0.8);
    background:
      linear-gradient(180deg, rgba(98, 234, 208, 0.14), transparent 58%),
      rgba(5, 16, 15, 0.92);
    filter: none;
    cursor: wait;
    box-shadow: inset 0 0 0 1px rgba(98, 234, 208, 0.22), 0 0 22px rgba(98, 234, 208, 0.16);
  }

  body.match-active .unit-shop-card .choice-icon {
    align-self: center;
    width: 88px;
    height: 88px;
    border-radius: 8px;
  }

  body.match-active .unit-shop-card .choice-main {
    display: grid;
    align-content: center;
    justify-items: stretch;
    gap: 7px;
    min-width: 0;
  }

  body.match-active .unit-shop-card .choice-name {
    min-width: 0;
    overflow: hidden;
    padding-right: 64px;
    color: #fff8e8;
    font-size: 0.84rem;
    line-height: 1.08;
    text-align: left;
    text-transform: uppercase;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.match-active .unit-shop-card .choice-cost {
    position: absolute;
    top: 9px;
    right: 9px;
    align-self: auto;
    justify-self: auto;
    padding: 5px 7px;
    border: 1px solid rgba(242, 184, 75, 0.34);
    border-radius: 999px;
    background: rgba(4, 7, 5, 0.86);
    color: var(--gold);
    font-size: 0.86rem;
  }

  body.match-active .unit-shop-primary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  body.match-active .unit-shop-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 30px;
    padding: 5px 7px;
    border: 1px solid rgba(207, 217, 200, 0.16);
    border-radius: 6px;
    background: rgba(4, 8, 6, 0.62);
    color: #efe0ad;
    font-size: 0.76rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
  }

  body.match-active .unit-shop-pill .selected-stat-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    padding: 2px;
    border-radius: 4px;
  }

  body.match-active .unit-shop-pill .selected-stat-icon .stat-icon {
    width: 12px;
    height: 12px;
  }

  body.match-active .unit-shop-income {
    color: #dff4ba;
  }

  body.match-active .unit-shop-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    opacity: 0.72;
    transition: opacity 150ms ease;
  }

  body.match-active .unit-shop-card:hover .unit-shop-details,
  body.match-active .unit-shop-card:focus-visible .unit-shop-details {
    opacity: 1;
  }

  body.match-active .unit-shop-details > span {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 4px 5px;
    border-radius: 5px;
    background: rgba(4, 8, 6, 0.38);
    color: #cfd9c8;
    font-size: 0.62rem;
    line-height: 1.05;
  }

  body.match-active .unit-shop-details > span > span,
  body.match-active .unit-shop-details > span > strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.match-active .unit-shop-details > span > span {
    color: rgba(207, 217, 200, 0.72);
    font-weight: 700;
  }

  body.match-active .unit-shop-details > span > strong {
    color: #fff8e8;
    font-size: 0.68rem;
  }

  body.match-active .unit-shop-card .stat-icon {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
  }
}

@media (min-width: 1500px) {
  body.match-active .sidebar {
    grid-template-columns: minmax(132px, 0.2fr) minmax(500px, 0.78fr) minmax(300px, 0.42fr) minmax(620px, 0.92fr);
  }

  body.match-active .barracks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(178px, 1fr);
    overflow-y: hidden;
  }

  body.match-active .unit-shop-card {
    min-height: 178px;
    grid-template-columns: 1fr;
    grid-template-rows: 96px auto auto;
    justify-items: stretch;
    gap: 9px;
    text-align: center;
  }

  body.match-active .unit-shop-card .choice-icon {
    justify-self: center;
    width: 118px;
    height: 96px;
  }

  body.match-active .unit-shop-card .choice-name {
    text-align: center;
  }

  body.match-active .unit-shop-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .tower-panel .choice-button,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    border-color: color-mix(in srgb, var(--rarity-color, var(--gold)) 52%, rgba(255, 240, 190, 0.14));
    border-radius: 8px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, var(--gold)) 18%, transparent), transparent 46%),
      radial-gradient(circle at 50% 24%, color-mix(in srgb, var(--rarity-color, var(--gold)) 24%, transparent), transparent 42%),
      rgba(4, 8, 7, 0.94);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.035),
      inset 0 -34px 52px rgba(0, 0, 0, 0.34);
    overflow: hidden;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button:hover,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-card:hover {
    border-color: color-mix(in srgb, var(--rarity-color, var(--gold)) 78%, #fff8e8);
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, var(--gold)) 24%, transparent), transparent 48%),
      radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--rarity-color, var(--gold)) 34%, transparent), transparent 44%),
      rgba(7, 13, 10, 0.98);
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--rarity-color, var(--gold)) 34%, transparent),
      0 16px 28px rgba(0, 0, 0, 0.34),
      inset 0 -34px 52px rgba(0, 0, 0, 0.28);
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button::before,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    display: block;
    border-radius: inherit;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 24%),
      linear-gradient(90deg, var(--rarity-color, var(--gold)) 0 4px, transparent 4px);
    opacity: 0.9;
    pointer-events: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card:disabled {
    border-color: rgba(255, 240, 190, 0.08);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 58%),
      rgba(4, 6, 5, 0.88);
    color: rgba(180, 188, 174, 0.42);
    cursor: not-allowed;
    filter: none;
    opacity: 1;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.42);
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card:disabled::before {
    z-index: 2;
    background:
      linear-gradient(135deg, rgba(0, 0, 0, 0.44), rgba(0, 0, 0, 0.18)),
      repeating-linear-gradient(-45deg, rgba(255, 240, 190, 0.035) 0 5px, transparent 5px 11px);
  }

  body.match-active:not(.mobile-ui) .tower-panel .mobile-shop-rarity,
  body.match-active:not(.mobile-ui) .barracks .mobile-shop-rarity {
    display: none;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-cost,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-cost {
    z-index: 7;
    border: 1px solid rgba(255, 210, 117, 0.54);
    background: rgba(7, 8, 5, 0.86);
    color: #ffd978;
    font-weight: 950;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28), 0 0 12px rgba(242, 184, 75, 0.18);
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button {
    grid-template-rows: minmax(118px, 1fr) auto;
    gap: 0;
    padding: 6px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-icon {
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    height: 100%;
    min-height: 114px;
    border: 0;
    border-radius: 7px 7px 3px 3px;
    background:
      radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--rarity-color, var(--gold)) 20%, transparent), transparent 46%),
      rgba(2, 5, 5, 0.32) !important;
    box-shadow: inset 0 -28px 38px rgba(0, 0, 0, 0.4);
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-premium-icon img,
  body.match-active:not(.mobile-ui) .tower-panel .tower-rendered-icon img,
  body.match-active:not(.mobile-ui) .barracks .unit-premium-icon img,
  body.match-active:not(.mobile-ui) .barracks .unit-sheet-sprite {
    filter: none;
    transform: scale(1.12);
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-main {
    position: relative;
    z-index: 4;
    display: grid;
    align-content: center;
    gap: 5px;
    min-height: 74px;
    margin-top: -14px;
    padding: 18px 7px 7px;
    border-radius: 0 0 7px 7px;
    background: linear-gradient(180deg, transparent, rgba(1, 4, 4, 0.82) 16%, rgba(1, 4, 4, 0.94));
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-name {
    color: #fff8e8;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.75);
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid {
    display: none;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid > .stat-pill {
    min-height: 20px;
    padding: 2px 3px;
    background: rgba(0, 0, 0, 0.34);
    font-size: 0.54rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-meta-row {
    display: none;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 28px;
    margin-bottom: 6px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header h2 {
    white-space: nowrap;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header .odds-preview {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow: hidden;
    gap: 4px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header .odds-pill {
    min-height: 18px;
    padding: 2px 5px;
    font-size: 0.56rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header .odds-pill strong {
    font-size: 0.58rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-header .shop-action {
    min-height: 28px;
    padding-inline: 8px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-list {
    height: calc(100% - 34px);
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row,
  body.match-active:not(.mobile-ui) .barracks .shop-decision-row {
    justify-content: center;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row {
    align-content: start;
    max-height: 38px;
    overflow: hidden;
    gap: 3px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badges {
    position: absolute;
    top: -56px;
    left: 7px;
    right: 7px;
    z-index: 7;
    display: block;
    pointer-events: none;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge {
    position: absolute;
    top: 0;
    display: inline-flex;
    max-width: 72px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge--element {
    left: 0;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge--target {
    right: 0;
    top: 10px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge .shop-decision-badge {
    min-height: 21px;
    padding: 3px 7px;
    border-width: 1px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.11), transparent 62%),
      rgba(1, 7, 7, 0.78);
    box-shadow: 0 5px 13px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 248, 232, 0.14);
    font-size: 0.58rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge .shop-decision-badge--element {
    min-height: 25px;
    padding: 4px 6px;
    gap: 5px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge--element .shop-decision-icon {
    width: 17px;
    height: 17px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-shop-floating-badge--element .shop-decision-count {
    min-width: 15px;
    height: 15px;
    font-size: 0.56rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row--synergies {
    justify-content: center;
    align-content: center;
    max-height: 39px;
    margin-top: 1px;
    padding-inline: 1px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row--plan {
    justify-content: center;
    max-height: 20px;
    margin-top: 1px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-badge,
  body.match-active:not(.mobile-ui) .barracks .shop-decision-badge {
    min-height: 18px;
    max-width: 100%;
    padding: 2px 6px;
    font-size: 0.56rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-badge {
    min-height: 17px;
    max-width: 82px;
    padding: 2px 5px;
    font-size: 0.52rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row--synergies .shop-decision-badge {
    max-width: 88px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-row--synergies .shop-decision-badge > span:not(.shop-decision-icon):not(.shop-decision-symbol) {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-icon,
  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-badge .income-icon {
    width: 11px;
    height: 11px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-count {
    min-width: 13px;
    height: 13px;
    padding: 0 3px;
    font-size: 0.5rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .shop-decision-badge--icon-only {
    width: 17px;
    min-width: 17px;
    padding-inline: 2px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-trait-chip--compact {
    max-width: 96px;
    border-color: color-mix(in srgb, var(--rarity-color, var(--gold)) 36%, rgba(255, 240, 190, 0.12));
    background: rgba(0, 0, 0, 0.28);
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    grid-template-columns: minmax(118px, 0.42fr) minmax(0, 1fr);
    min-height: 136px;
    gap: 10px;
    padding: 8px 10px 8px 8px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-icon {
    align-self: stretch;
    justify-self: stretch;
    width: 100%;
    height: 100%;
    min-height: 118px;
    border: 0;
    border-radius: 7px;
    background:
      radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--rarity-color, var(--gold)) 20%, transparent), transparent 46%),
      rgba(2, 5, 5, 0.32) !important;
    box-shadow: inset 0 -28px 38px rgba(0, 0, 0, 0.4);
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-main {
    position: relative;
    z-index: 4;
    align-content: center;
    gap: 8px;
    padding-top: 0;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-name {
    display: -webkit-box;
    max-height: 2.1em;
    padding-right: 54px;
    overflow: hidden;
    font-size: 0.86rem;
    font-weight: 950;
    line-height: 1.05;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.72);
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-primary {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-pill {
    min-height: 26px;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.32);
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-details {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-decision-row {
    margin-top: 0;
    justify-content: flex-start;
  }
}

@media (min-width: 981px) and (max-width: 1280px) {
  body.match-active:not(.mobile-ui) .sidebar {
    grid-template-columns: minmax(112px, 0.18fr) minmax(400px, 0.82fr) minmax(230px, 0.42fr) minmax(270px, 0.56fr);
    gap: 8px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-list {
    grid-template-columns: repeat(5, minmax(72px, 1fr));
    gap: 6px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button {
    grid-template-rows: minmax(84px, 1fr) auto;
    padding: 5px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-icon {
    min-height: 82px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-main {
    min-height: 58px;
    gap: 5px;
    margin-top: -11px;
    padding: 14px 5px 5px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-name {
    font-size: 0.62rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-cost {
    top: 6px;
    right: 6px;
    padding: 2px 5px;
    font-size: 0.66rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid {
    display: none;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid > .stat-pill {
    min-height: 18px;
    padding: 1px 2px;
    font-size: 0.48rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid .stat-icon {
    width: 10px;
    height: 10px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-meta-row {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks {
    gap: 7px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 88px;
    gap: 6px;
    padding: 5px 6px 5px 5px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-icon {
    min-height: 78px;
  }

  body.match-active:not(.mobile-ui) .barracks .mobile-shop-rarity {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-main {
    align-content: center;
    gap: 4px;
    padding-top: 0;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-name {
    padding-right: 42px;
    font-size: 0.66rem;
    line-height: 1.02;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-cost {
    top: 5px;
    right: 5px;
    padding: 2px 5px;
    font-size: 0.66rem;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-primary {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-pill {
    min-height: 18px;
    padding: 2px 3px;
    gap: 3px;
    font-size: 0.54rem;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-pill .selected-stat-icon {
    flex-basis: 13px;
    width: 13px;
    height: 13px;
    padding: 1px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-pill .stat-icon,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-pill .income-icon {
    width: 9px;
    height: 9px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-details {
    display: none;
  }
}

@media (min-width: 1281px) and (max-width: 1499px) {
  body.match-active:not(.mobile-ui) .sidebar {
    grid-template-columns: minmax(124px, 0.2fr) minmax(470px, 0.84fr) minmax(280px, 0.48fr) minmax(330px, 0.62fr);
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button {
    grid-template-rows: minmax(104px, 1fr) auto;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-icon {
    min-height: 100px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-main {
    min-height: 66px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    grid-template-columns: minmax(104px, 0.4fr) minmax(0, 1fr);
    min-height: 126px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-icon {
    min-height: 108px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-main {
    align-content: center;
    gap: 5px;
    padding-top: 0;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-details {
    display: none;
  }
}

@media (min-width: 981px) and (max-height: 820px) {
  body.match-active:not(.mobile-ui) .shell {
    grid-template-rows: minmax(0, 1fr) 242px;
  }

  body.match-active:not(.mobile-ui) .selected-panel:not([hidden]) {
    bottom: 258px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-list {
    height: calc(100% - 34px);
    padding-bottom: 4px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-button {
    grid-template-rows: minmax(78px, 1fr) auto;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-icon {
    min-height: 76px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-main {
    min-height: 54px;
    gap: 4px;
    margin-top: -10px;
    padding-top: 13px;
  }

  body.match-active:not(.mobile-ui) .tower-panel .choice-name {
    font-size: 0.6rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-stat-grid > .stat-pill {
    min-height: 16px;
    font-size: 0.46rem;
  }

  body.match-active:not(.mobile-ui) .tower-panel .tower-meta-row,
  body.match-active:not(.mobile-ui) .barracks .unit-shop-details {
    display: none;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    min-height: 86px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-icon {
    min-height: 76px;
  }
}

@media (min-width: 1500px) {
  body.match-active:not(.mobile-ui) .barracks .unit-shop-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(126px, 1fr) auto;
    gap: 0;
    padding: 7px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-icon {
    min-height: 126px;
    border-radius: 7px 7px 3px 3px;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-main {
    margin-top: -18px;
    padding: 16px 7px 7px;
    border-radius: 0 0 7px 7px;
    background: linear-gradient(180deg, transparent, rgba(1, 4, 4, 0.84) 16%, rgba(1, 4, 4, 0.94));
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-card .choice-name {
    padding-right: 0;
    text-align: center;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-details > span {
    padding: 3px 4px;
    font-size: 0.56rem;
  }

  body.match-active:not(.mobile-ui) .barracks .unit-shop-details > span > strong {
    font-size: 0.62rem;
  }
}

@media (max-width: 980px) {
  body.match-active .unit-shop-card {
    min-height: 102px;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 9px;
    padding: 9px 10px;
  }

  body.match-active .unit-shop-card .choice-icon {
    width: 70px;
    height: 70px;
  }

  body.match-active .unit-shop-card .choice-main {
    justify-items: stretch;
  }

  body.match-active .unit-shop-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.match-active .unit-shop-pill {
    min-height: 26px;
    padding: 4px 5px;
    font-size: 0.68rem;
  }

  body.match-active .unit-shop-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.match-active .unit-shop-details > span {
    padding: 3px 4px;
    font-size: 0.58rem;
  }
}

/* Responsive game HUD refinements */
body.match-active .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(78px, 7vw, 104px) 48px;
  align-items: stretch;
  gap: 8px;
  min-height: 60px;
  padding: 0;
}

body.match-active .scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 150px));
  align-items: stretch;
  align-content: start;
  justify-content: start;
  gap: 6px;
  width: 100%;
  overflow: visible;
}

body.match-active .score-card,
body.match-active .score-card:nth-child(4),
body.match-active .score-card:nth-child(5),
body.match-active .score-card:nth-child(6) {
  grid-column: auto;
}

body.match-active .score-card {
  min-height: 56px;
  grid-template-columns: clamp(30px, 2.3vw, 40px) minmax(0, 1fr);
  gap: 6px;
  padding: 6px 7px;
}

body.match-active .score-avatar {
  width: clamp(30px, 2.3vw, 40px);
  height: clamp(30px, 2.3vw, 40px);
}

  body.match-active .score-name span:last-child {
    display: none;
  }

  body.match-active .score-values {
    display: flex;
    flex-wrap: wrap;
  gap: 3px 7px;
  margin-top: 3px;
  font-size: clamp(0.68rem, 0.62vw, 0.78rem);
}

body.match-active .round-widget {
  position: relative;
  inset: auto;
  z-index: 1;
  width: auto;
  height: auto;
  min-height: 56px;
  transform: none;
  border-radius: 8px;
}

body.match-active .round-widget::before,
body.match-active .round-widget::after {
  display: none;
}

body.match-active .round-widget span {
  font-size: 0.62rem;
}

body.match-active .round-widget strong {
  font-size: clamp(1.65rem, 2.1vw, 2.25rem);
  line-height: 0.9;
}

body.match-active .round-widget em {
  font-size: 0.72rem;
}

body.match-active .toolbar {
  position: relative;
  top: auto;
  right: auto;
  z-index: 2;
  justify-self: end;
}

body.match-active .tool-button {
  width: 46px;
  height: 46px;
}

body.match-active .stat-row--bar {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
}

body.match-active .resource-bar {
  height: 12px;
}

@media (max-width: 1180px) {
  body.match-active .topbar {
    min-height: 118px;
    grid-template-columns: minmax(0, 1fr) 82px 46px;
    padding: 0;
  }

  body.match-active .scoreboard {
    grid-template-columns: repeat(3, minmax(96px, 138px));
  }

  body.match-active .score-card {
    min-height: 52px;
    padding: 5px 7px;
  }

  body.match-active .score-values {
    font-size: 0.72rem;
  }
}

@media (max-width: 720px) {
  body.match-active .topbar {
    min-height: 168px;
    grid-template-columns: minmax(0, 1fr) 72px 42px;
    padding: 0;
  }

  body.match-active .scoreboard {
    grid-template-columns: repeat(2, minmax(104px, 1fr));
  }

  body.match-active .round-widget {
    min-height: 52px;
  }
}

/* Compact top HUD and collapsible chat */
body.match-active .topbar {
  grid-template-columns: clamp(128px, 12vw, 174px) minmax(0, 1fr) 58px;
  align-items: start;
  gap: 6px;
  min-height: 76px;
  overflow: visible;
}

body.match-active .scoreboard {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(6, minmax(82px, 1fr));
  gap: 5px;
  min-width: 0;
  overflow: visible;
}

body.match-active .score-card {
  min-height: 50px;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 5px;
  padding: 5px 6px;
}

body.match-active .score-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.66rem;
}

body.match-active .score-index {
  width: 17px;
  height: 17px;
  font-size: 0.58rem;
}

body.match-active .score-name span:first-child {
  font-size: clamp(0.62rem, 0.56vw, 0.74rem);
}

body.match-active .score-values {
  gap: 2px 5px;
  font-size: clamp(0.62rem, 0.56vw, 0.72rem);
}

body.match-active .round-widget {
  grid-column: 1;
  grid-row: 1;
  width: auto;
  min-width: 0;
  min-height: 74px;
  padding: 8px 10px;
  border-color: rgba(215, 169, 74, 0.68);
  background:
    radial-gradient(circle at 48% 18%, rgba(98, 234, 208, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.16), rgba(8, 12, 10, 0.92) 64%),
    rgba(8, 12, 10, 0.94);
}

body.match-active .round-widget strong {
  font-size: clamp(2rem, 2.65vw, 3rem);
}

body.match-active .round-widget span {
  font-size: 0.72rem;
}

body.match-active .round-widget em {
  font-size: 0.9rem;
}

body.match-active .toolbar {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
}

body.match-active .tool-button {
  width: 42px;
  height: 42px;
}

.chat-content {
  display: grid;
}

.chat-toggle-button {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(215, 169, 74, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.1), transparent),
    rgba(9, 14, 11, 0.88);
  color: #efe0ad;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 950;
}

.chat-toggle-button:hover,
.chat-toggle-button:focus-visible {
  border-color: rgba(98, 234, 208, 0.58);
  color: #f6fff4;
}

body.match-active .chat-panel .panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.match-active .chat-panel .panel-title > div {
  min-width: 0;
}

body.match-active .chat-panel .panel-title h2 {
  margin: 0;
}

body.match-active .chat-panel .panel-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.match-active .chat-panel {
  top: auto;
  right: 10px;
  bottom: 48px;
  z-index: 38;
  width: min(340px, calc(100vw - 36px));
  padding: 10px;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.34);
}

body.match-active .chat-panel.has-unread {
  border-color: rgba(255, 139, 132, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 139, 132, 0.18), transparent 54%),
    linear-gradient(180deg, rgba(255, 240, 190, 0.08), transparent 56%),
    rgba(15, 13, 11, 0.94);
}

body.match-active .chat-panel.has-unread .panel-title h2::after {
  content: "Nouveau";
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 139, 132, 0.22);
  color: #ffd8d8;
  font-size: 0.58rem;
  font-weight: 950;
  vertical-align: middle;
}

.chat-content[hidden] {
  display: none !important;
}

body.match-active .chat-panel.is-collapsed {
  width: min(220px, calc(100vw - 36px));
  padding: 8px 10px;
}

body.match-active .chat-panel.is-collapsed .panel-title {
  margin-bottom: 0;
}

body.match-active .chat-panel.has-unread .chat-toggle-button::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff8b84;
  box-shadow: 0 0 10px rgba(255, 139, 132, 0.7);
}

@media (max-width: 1180px) {
  body.match-active .topbar {
    grid-template-columns: 116px minmax(0, 1fr) 58px;
    min-height: 116px;
  }

  body.match-active .scoreboard {
    grid-template-columns: repeat(3, minmax(92px, 1fr));
  }

  body.match-active .round-widget {
    min-height: 86px;
  }

  body.match-active .round-widget strong {
    font-size: 2.15rem;
  }
}

@media (max-width: 720px) {
  body.match-active .topbar {
    grid-template-columns: minmax(0, 1fr) 58px;
    min-height: 208px;
  }

  body.match-active .scoreboard {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(92px, 1fr));
  }

  body.match-active .round-widget {
    grid-column: 1;
    grid-row: 1;
    min-height: 58px;
    grid-template-columns: auto auto auto;
    justify-content: start;
    gap: 8px;
  }

  body.match-active .toolbar {
    grid-column: 2;
    grid-row: 1;
  }

  body.match-active .score-card {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  body.match-active .score-avatar {
    width: 24px;
    height: 24px;
  }

  body.match-active .round-widget span {
    font-size: 0.62rem;
  }

  body.match-active .round-widget strong {
    font-size: 1.8rem;
  }

  body.match-active .tool-button {
    width: 38px;
    height: 38px;
  }

  body.match-active .chat-panel {
    right: 8px;
    bottom: 46px;
    width: min(312px, calc(100vw - 24px));
  }
}

/* Mobile game UI */
:root {
  --mobile-hud-height: 76px;
  --mobile-bottom-nav-height: 64px;
  --mobile-panel-radius: 14px;
  --mobile-safe-padding: max(10px, env(safe-area-inset-left));
  --touch-target-size: 46px;
}

.mobile-top-bar,
.mobile-bottom-nav,
.mobile-bottom-sheet-header,
.mobile-placement-toolbar,
.mobile-augments-panel,
.mobile-players-panel {
  display: none;
}

.mobile-shop-rarity {
  display: none;
}

body.mobile-ui.match-active {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.mobile-ui.match-active .shell {
  display: block;
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

body.mobile-ui.match-active .game-area {
  display: flex;
  height: 100dvh;
  min-height: 0;
  padding: calc(env(safe-area-inset-top) + 6px) 8px calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  gap: 6px;
  overflow: hidden;
}

body.mobile-ui.match-active .mobile-top-bar {
  position: relative;
  z-index: 44;
  display: grid;
  grid-template-columns: minmax(132px, 0.95fr) minmax(0, 2.05fr) auto;
  align-items: center;
  gap: 6px;
  min-height: var(--mobile-hud-height);
  padding: 6px;
  border: 1px solid rgba(215, 169, 74, 0.32);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.11), transparent 58%),
    rgba(7, 12, 9, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

body.mobile-ui.match-active .mobile-player-chip {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

body.mobile-ui.match-active .mobile-status-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

body.mobile-ui.match-active .mobile-player-chip strong,
body.mobile-ui.match-active .mobile-player-chip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-player-chip strong {
  color: #fff8e8;
  font-size: 0.82rem;
}

body.mobile-ui.match-active .mobile-player-chip span {
  color: #9fd7ff;
  font-size: 0.72rem;
  font-weight: 900;
}

body.mobile-ui.match-active .mobile-player-book-button,
body.mobile-ui.match-active .mobile-player-traits-button,
body.mobile-ui.match-active .mobile-menu-button,
body.mobile-ui.match-active .mobile-close-button,
body.mobile-ui.match-active .mobile-action-button {
  min-width: var(--touch-target-size);
  min-height: var(--touch-target-size);
  border: 1px solid rgba(215, 169, 74, 0.38);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.12), transparent 58%),
    rgba(10, 15, 12, 0.94);
  color: #fff8e8;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
}

body.mobile-ui.match-active .mobile-player-book-button {
  font-size: 0.82rem;
  color: #efe0ad;
}

body.mobile-ui.match-active .mobile-player-traits-button {
  min-width: 40px;
  color: #f0dcff;
  font-size: 0.7rem;
}

body.mobile-ui.match-active .mobile-status-buttons .mobile-player-book-button,
body.mobile-ui.match-active .mobile-status-buttons .mobile-player-traits-button {
  min-width: 40px;
  min-height: 40px;
  padding-inline: 0;
}

body.mobile-ui.match-active .mobile-hud-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
}

body.mobile-ui.match-active .mobile-stat {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 4px;
  border: 1px solid rgba(151, 184, 211, 0.12);
  border-radius: 8px;
  background: rgba(3, 7, 5, 0.58);
  text-align: center;
}

body.mobile-ui.match-active .mobile-stat-button {
  width: 100%;
  border-color: rgba(98, 234, 208, 0.34);
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

body.mobile-ui.match-active .mobile-stat-button:not(:disabled) {
  box-shadow: inset 0 0 0 1px rgba(98, 234, 208, 0.12), 0 0 14px rgba(98, 234, 208, 0.08);
}

body.mobile-ui.match-active .mobile-stat-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

body.mobile-ui.match-active .mobile-stat span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
}

body.mobile-ui.match-active .mobile-stat strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-stat--life strong { color: #ff8b84; }
body.mobile-ui.match-active .mobile-stat--gold strong { color: var(--gold); }
body.mobile-ui.match-active .mobile-stat--income strong { color: #dff4ba; }
body.mobile-ui.match-active .mobile-stat--defense strong { color: #aee7ff; }
body.mobile-ui.match-active .mobile-stat--level strong { color: #9ff7ff; }
body.mobile-ui.match-active .mobile-stat--xp strong { color: #9ff7ff; }
body.mobile-ui.match-active .mobile-stat--round strong { color: #9ff7ff; }

body.mobile-ui.match-active .topbar {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 4px);
  right: 8px;
  z-index: 70;
  display: block;
  width: 0;
  height: 0;
  min-height: 0;
  padding: 0;
  overflow: visible;
  pointer-events: none;
}

body.mobile-ui.match-active .topbar > .scoreboard,
body.mobile-ui.match-active .topbar > .round-widget,
body.mobile-ui.match-active .topbar .tool-button {
  display: none;
}

body.mobile-ui.match-active .topbar .toolbar,
body.mobile-ui.match-active .topbar .game-menu {
  pointer-events: auto;
}

body.mobile-ui.match-active .game-menu {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 70px);
  right: 8px;
  width: min(310px, calc(100vw - 16px));
  max-height: min(70dvh, 560px);
  overflow: auto;
}

body.mobile-ui.match-active .canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 10px;
  border: 1px solid rgba(215, 169, 74, 0.18);
  touch-action: none;
  -webkit-overflow-scrolling: touch;
}

body.mobile-ui.match-active canvas {
  width: clamp(2500px, 720vw, 4300px);
  max-width: none;
  aspect-ratio: 3 / 2;
}

body.mobile-ui.match-active .hintbar {
  left: 10px;
  right: 10px;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  z-index: 42;
  font-size: 0.72rem;
}

body.mobile-ui.match-active .mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 58;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  min-height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(215, 169, 74, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.08), transparent 44%),
    rgba(5, 9, 7, 0.96);
  box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.38);
}

body.mobile-ui.match-active .mobile-action-button {
  width: 100%;
  padding: 0 5px;
}

body.mobile-ui.match-active .mobile-action-button.is-active {
  border-color: rgba(98, 234, 208, 0.7);
  color: #9ff7ff;
  box-shadow: inset 0 0 0 1px rgba(98, 234, 208, 0.18), 0 0 18px rgba(98, 234, 208, 0.12);
}

body.mobile-ui.match-active .mobile-action-button--danger {
  border-color: rgba(255, 115, 106, 0.5);
  color: #ffd8d8;
}

body.mobile-ui.match-active .sidebar {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 6px);
  z-index: 56;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  height: min(54dvh, 520px);
  max-height: min(54dvh, 520px);
  min-height: 0;
  padding: 8px;
  border: 1px solid rgba(215, 169, 74, 0.32);
  border-radius: var(--mobile-panel-radius) var(--mobile-panel-radius) 10px 10px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.08), transparent 54%),
    rgba(6, 10, 8, 0.97);
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.48);
  overflow: hidden;
  transform: translateY(calc(100% + var(--mobile-bottom-nav-height) + 24px));
  transition: transform 180ms ease, max-height 180ms ease;
}

body.mobile-ui.match-active.mobile-sheet-open .sidebar {
  transform: translateY(0);
}

body.mobile-ui.match-active.mobile-sheet-expanded .sidebar {
  height: calc(100dvh - var(--mobile-hud-height) - var(--mobile-bottom-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 22px);
  max-height: calc(100dvh - var(--mobile-hud-height) - var(--mobile-bottom-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 22px);
}

body.mobile-ui.match-active .mobile-bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 4px 2px 8px;
}

body.mobile-ui.match-active .mobile-bottom-sheet-header span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

body.mobile-ui.match-active .mobile-bottom-sheet-header strong {
  color: #fff8e8;
  font-size: 1rem;
}

body.mobile-ui.match-active .mobile-sheet-actions {
  display: flex;
  gap: 6px;
}

body.mobile-ui.match-active .mobile-close-button {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 1.1rem;
}

body.mobile-ui.match-active .sidebar > :not(.mobile-bottom-sheet-header) {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel,
body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks-panel,
body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-panel:not([hidden]),
body.mobile-ui.match-active[data-mobile-panel="upgrades"] .stats-panel,
body.mobile-ui.match-active[data-mobile-panel="augments"] .mobile-augments-panel,
body.mobile-ui.match-active[data-mobile-panel="players"] .mobile-players-panel {
  display: grid !important;
}

body.mobile-ui.match-active .sidebar .panel {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 10px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar {
  grid-template-rows: auto minmax(0, 1.2fr) minmax(112px, 0.7fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel,
body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel {
  overflow: hidden;
}

body.mobile-ui.match-active .tower-list,
body.mobile-ui.match-active .barracks,
body.mobile-ui.match-active .bench-list,
body.mobile-ui.match-active .mobile-player-list {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile-ui.match-active .tower-list,
body.mobile-ui.match-active .barracks {
  grid-template-columns: 1fr;
  grid-auto-flow: row;
  grid-auto-columns: initial;
  gap: 8px;
  padding-right: 2px;
}

body.mobile-ui.match-active .choice-button,
body.mobile-ui.match-active .bench-slot,
body.mobile-ui.match-active .mode-button,
body.mobile-ui.match-active .primary-button,
body.mobile-ui.match-active .danger-button {
  min-height: var(--touch-target-size);
}

body.mobile-ui.match-active .shop-card,
body.mobile-ui.match-active .unit-shop-card {
  position: relative;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 9px;
}

body.mobile-ui.match-active .tower-panel .choice-button,
body.mobile-ui.match-active .barracks .choice-button {
  height: auto;
  min-height: 116px;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  grid-template-rows: none;
  align-items: start;
  justify-items: stretch;
  align-content: start;
  text-align: left;
}

body.mobile-ui.match-active .choice-icon {
  width: 52px;
  height: 52px;
}

body.mobile-ui.match-active .tower-panel .choice-icon,
body.mobile-ui.match-active .barracks .choice-icon {
  justify-self: stretch;
}

body.mobile-ui.match-active .shop-card .choice-main,
body.mobile-ui.match-active .unit-shop-card .choice-main {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding-right: 0;
}

body.mobile-ui.match-active .shop-card .choice-name,
body.mobile-ui.match-active .unit-shop-card .choice-name {
  padding-right: 0;
  color: #fff8e8;
  font-size: 0.78rem;
  line-height: 1.08;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.mobile-ui.match-active .mobile-shop-rarity {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: inline-flex;
  max-width: 76px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 248, 232, 0.18);
  border-radius: 999px;
  background: rgba(3, 7, 5, 0.82);
  color: #efe0ad;
  font-size: 0.52rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

body.mobile-ui.match-active .shop-match-badge + .mobile-shop-rarity {
  top: 24px;
}

body.mobile-ui.match-active .tower-stat-grid,
body.mobile-ui.match-active .unit-shop-primary,
body.mobile-ui.match-active .unit-shop-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

body.mobile-ui.match-active .tower-stat-grid > .stat-pill,
body.mobile-ui.match-active .unit-shop-pill,
body.mobile-ui.match-active .unit-shop-details > span {
  min-width: 0;
  min-height: 24px;
  padding: 3px 5px;
  border: 1px solid rgba(151, 184, 211, 0.14);
  border-radius: 5px;
  background: rgba(4, 8, 6, 0.48);
  font-size: 0.64rem;
  line-height: 1.05;
}

body.mobile-ui.match-active .tower-stat-grid > .stat-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #cfd9c8;
}

body.mobile-ui.match-active .tower-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 18px;
}

body.mobile-ui.match-active .tower-tags > span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(151, 184, 211, 0.14);
  border-radius: 5px;
  background: rgba(4, 8, 6, 0.5);
}

body.mobile-ui.match-active .unit-shop-details {
  opacity: 0.92;
}

body.mobile-ui.match-active .unit-shop-details > span {
  display: grid;
  gap: 1px;
}

body.mobile-ui.match-active .unit-shop-details > span > span {
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 900;
  text-transform: uppercase;
}

body.mobile-ui.match-active .unit-shop-details > span > strong,
body.mobile-ui.match-active .unit-shop-pill strong {
  color: #fff8e8;
  font-weight: 950;
}

body.mobile-ui.match-active .shop-card .choice-cost,
body.mobile-ui.match-active .unit-shop-card .choice-cost {
  position: static;
  align-self: start;
  min-width: 42px;
  padding: 5px 6px;
  border: 1px solid rgba(242, 184, 75, 0.34);
  border-radius: 999px;
  background: rgba(4, 7, 5, 0.86);
  color: var(--gold);
  font-size: 0.78rem;
  text-align: center;
}

body.mobile-ui.match-active .choice-desc,
body.mobile-ui.match-active .unit-shop-details {
  font-size: 0.72rem;
}

body.mobile-ui.match-active .bench-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-ui.match-active .selected-panel {
  gap: 8px;
}

body.mobile-ui.match-active .selected-panel .mode-button,
body.mobile-ui.match-active .selected-panel .danger-button,
body.mobile-ui.match-active #buyXpButton {
  width: 100%;
}

body.mobile-ui.match-active .resource-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.mobile-ui.match-active .mobile-player-list {
  display: grid;
  gap: 7px;
}

body.mobile-ui.match-active .mobile-player-row {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) repeat(4, minmax(38px, auto)) 68px;
  align-items: center;
  gap: 7px;
  min-height: 54px;
  padding: 7px 8px;
  border: 1px solid rgba(151, 184, 211, 0.14);
  border-radius: 9px;
  background: rgba(7, 12, 9, 0.72);
  color: #fff8e8;
  text-align: left;
}

body.mobile-ui.match-active .mobile-player-main {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
}

body.mobile-ui.match-active .mobile-player-row.is-local {
  border-color: rgba(98, 234, 208, 0.52);
}

body.mobile-ui.match-active .mobile-player-row.is-dead {
  opacity: 0.56;
  filter: grayscale(1);
}

body.mobile-ui.match-active .mobile-player-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-player-stat {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 3px 4px;
  border: 1px solid rgba(151, 184, 211, 0.1);
  border-radius: 6px;
  background: rgba(3, 7, 5, 0.42);
  text-align: center;
}

body.mobile-ui.match-active .mobile-player-stat small {
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

body.mobile-ui.match-active .mobile-player-stat b {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.66rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-player-stat--gold b { color: var(--gold); }
body.mobile-ui.match-active .mobile-player-stat--income b { color: #dff4ba; }
body.mobile-ui.match-active .mobile-player-stat--defense b { color: #aee7ff; }

body.mobile-ui.match-active .mobile-player-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--player-color, var(--gold));
  box-shadow: 0 0 12px color-mix(in srgb, var(--player-color, var(--gold)) 55%, transparent);
}

body.mobile-ui.match-active .mobile-player-actions {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 4px;
  justify-content: end;
}

body.mobile-ui.match-active .mobile-player-actions button {
  min-width: 32px;
  min-height: 32px;
  border: 1px solid rgba(215, 169, 74, 0.28);
  border-radius: 8px;
  background: rgba(4, 8, 6, 0.58);
  color: #efe0ad;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 950;
}

body.mobile-ui.match-active .mobile-placement-toolbar {
  position: fixed;
  left: 10px;
  right: 10px;
  top: calc(var(--mobile-hud-height) + env(safe-area-inset-top) + 14px);
  bottom: auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid rgba(98, 234, 208, 0.48);
  border-radius: 10px;
  background: rgba(5, 12, 10, 0.94);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
}

body.mobile-ui.match-active .mobile-placement-toolbar[hidden] {
  display: none !important;
}

body.mobile-ui.match-active .mobile-placement-toolbar span {
  min-width: 0;
  overflow: hidden;
  color: #9ff7ff;
  font-size: 0.8rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .augment-panel,
body.mobile-ui.match-active .augment-book-panel,
body.mobile-ui.match-active .traits-panel {
  width: min(calc(100vw - 44px), 560px);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 18px);
  padding: 14px;
  overflow: auto;
}

body.mobile-ui.match-active .augment-overlay {
  background: rgba(1, 5, 4, 0.18);
  backdrop-filter: blur(1px);
}

body.mobile-ui.match-active .augment-panel {
  width: min(calc(100vw - 72px), 420px);
  max-height: min(58dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 112px));
  padding: 10px;
  border-color: rgba(255, 240, 190, 0.18);
  background:
    linear-gradient(180deg, rgba(17, 24, 18, 0.78), rgba(5, 9, 7, 0.76)),
    rgba(5, 9, 7, 0.72);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

body.mobile-ui.match-active .augment-choice-grid,
body.mobile-ui.match-active .augment-book-list {
  grid-template-columns: 1fr;
}

body.mobile-ui.match-active .augment-choice-grid {
  gap: 8px;
}

body.mobile-ui.match-active .augment-card {
  min-height: 0;
  gap: 7px;
  padding: 9px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--augment-color, #d7a94a) 13%, transparent), transparent 64%),
    rgba(7, 12, 9, 0.72);
}

body.mobile-ui.match-active .augment-card h3 {
  font-size: 0.92rem;
  line-height: 1.1;
}

body.mobile-ui.match-active .augment-card p {
  font-size: 0.72rem;
  line-height: 1.25;
}

body.mobile-ui.match-active .augment-card .augment-rarity {
  padding: 2px 7px;
  font-size: 0.62rem;
}

body.mobile-ui.match-active .augment-actions > button {
  min-height: 36px;
}

body.mobile-ui.match-active .chat-panel {
  right: 8px;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  z-index: 54;
  width: min(342px, calc(100vw - 16px));
}

body.mobile-ui.match-active .minimap-panel {
  display: none !important;
}

@media (max-width: 480px) {
  :root {
    --mobile-hud-height: 84px;
    --mobile-bottom-nav-height: 60px;
    --touch-target-size: 44px;
  }

  body.mobile-ui.match-active .mobile-top-bar {
    grid-template-columns: minmax(128px, 0.95fr) minmax(0, 2fr) 46px;
    gap: 4px;
    padding: 5px;
  }

  body.mobile-ui.match-active .mobile-hud-stats {
    gap: 3px;
  }

  body.mobile-ui.match-active .mobile-stat {
    padding: 4px 2px;
  }

  body.mobile-ui.match-active .mobile-stat span {
    font-size: 0.52rem;
  }

  body.mobile-ui.match-active .mobile-stat strong {
    font-size: 0.68rem;
  }

  body.mobile-ui.match-active .mobile-player-chip {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  body.mobile-ui.match-active .mobile-menu-button,
  body.mobile-ui.match-active .mobile-action-button {
    font-size: 0.68rem;
  }

  body.mobile-ui.match-active .sidebar {
    left: 6px;
    right: 6px;
  }

  body.mobile-ui.match-active .mobile-player-row {
    grid-template-columns: minmax(76px, 1fr) repeat(3, minmax(36px, auto)) 68px;
  }

  body.mobile-ui.match-active .mobile-player-stat--score {
    display: none;
  }
}

@media (orientation: landscape) and (max-width: 980px) {
  body.mobile-ui.match-active {
    --mobile-hud-height: 52px;
    --mobile-bottom-nav-height: 56px;
  }

  body.mobile-ui.match-active .game-area {
    padding-top: calc(env(safe-area-inset-top) + 4px);
  }

  body.mobile-ui.match-active .mobile-top-bar {
    grid-template-columns: minmax(120px, 0.8fr) minmax(260px, 1.7fr) 58px;
    min-height: var(--mobile-hud-height);
  }

  body.mobile-ui.match-active .mobile-hud-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  body.mobile-ui.match-active .sidebar {
    top: calc(var(--mobile-hud-height) + env(safe-area-inset-top) + 10px);
    left: auto;
    right: calc(env(safe-area-inset-right) + 8px);
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 10px);
    width: min(430px, 46vw);
    height: auto;
    max-height: none;
  }

  body.mobile-ui.match-active .mobile-bottom-nav {
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    justify-content: center;
    left: 50%;
    transform: translateX(-50%);
    width: min(620px, 100vw);
  }

  body.mobile-ui.match-active canvas {
    width: clamp(2600px, 520vw, 4000px);
  }
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar {
  height: min(38dvh, 350px);
  max-height: min(38dvh, 350px);
  padding: 6px;
  gap: 6px;
  grid-template-rows: 34px minmax(142px, 1.25fr) minmax(74px, 0.55fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .sidebar {
  height: min(56dvh, 520px);
  max-height: min(56dvh, 520px);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header {
  min-height: 34px;
  padding: 0 0 4px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header strong {
  font-size: 0.88rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header span {
  font-size: 0.54rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-close-button {
  min-width: 34px;
  min-height: 34px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar .panel {
  padding: 7px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel,
body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel {
  gap: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .panel-title {
  min-height: 22px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .panel-title h2 {
  font-size: 0.72rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-toolbar {
  gap: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .odds-preview {
  overflow-x: auto;
  white-space: nowrap;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(164px, 58vw);
  grid-template-columns: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px 3px 0;
  scroll-snap-type: x proximity;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-button {
  min-height: 72px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 7px;
  scroll-snap-align: start;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-icon {
  width: 40px;
  height: 40px;
}

/* In-game backdrop continuity: keep one arena backdrop behind top HUD and shops. */
body.match-active {
  background:
    linear-gradient(180deg, rgba(5, 8, 6, 0.16), rgba(5, 8, 6, 0.7)),
    url("assets/arena-sky-islands-calm-bg.jpg?v=20260519-cache-fix1") center center / cover no-repeat,
    #050908;
  background-attachment: scroll;
}

@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .game-area {
    background: transparent;
  }

  body.match-active:not(.mobile-ui) .topbar,
  body.match-active:not(.mobile-ui) .sidebar {
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.04), rgba(0, 0, 0, 0.02)),
      rgba(5, 9, 7, 0.34);
    backdrop-filter: none;
  }

  body.match-active:not(.mobile-ui) .topbar {
    border: 1px solid rgba(255, 240, 190, 0.06);
    border-radius: 8px;
  }

  body.match-active:not(.mobile-ui) .sidebar {
    border-color: rgba(215, 169, 74, 0.2);
    box-shadow: 0 -12px 38px rgba(0, 0, 0, 0.22);
  }
}

/* Desktop in-game HUD transparency: avoid heavy dark patches over the board. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .canvas-wrap {
    background:
      radial-gradient(circle at 50% 18%, rgba(215, 169, 74, 0.035), transparent 26%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.015), rgba(0, 0, 0, 0.08));
    scrollbar-color: rgba(215, 169, 74, 0.38) rgba(6, 10, 8, 0.24);
  }

  body.match-active:not(.mobile-ui) .hintbar {
    background:
      linear-gradient(90deg, rgba(215, 169, 74, 0.035), transparent 58%),
      rgba(5, 9, 7, 0.26);
    border-color: rgba(255, 240, 190, 0.08);
    box-shadow: none;
    color: rgba(238, 232, 210, 0.72);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.78);
  }

  body.match-active:not(.mobile-ui) .score-card {
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--player-color, var(--gold)) 12%, transparent), transparent 44%),
      radial-gradient(circle at 20% 28%, color-mix(in srgb, var(--player-color, var(--gold)) 13%, transparent), transparent 36%),
      linear-gradient(180deg, rgba(255, 240, 190, 0.045), rgba(0, 0, 0, 0.025)),
      rgba(7, 11, 9, 0.58);
    box-shadow:
      inset 0 1px 0 rgba(255, 240, 190, 0.08),
      inset 0 -1px 0 rgba(0, 0, 0, 0.28),
      0 8px 24px rgba(0, 0, 0, 0.18);
  }

  body.match-active:not(.mobile-ui) .round-widget,
  body.match-active:not(.mobile-ui) .minimap-panel,
  body.match-active:not(.mobile-ui) .chat-panel {
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.055), transparent 58%),
      rgba(7, 11, 9, 0.58);
    box-shadow:
      inset 0 1px 0 rgba(255, 240, 190, 0.08),
      0 12px 34px rgba(0, 0, 0, 0.24);
    backdrop-filter: none;
  }

  body.match-active:not(.mobile-ui) .minimap-panel {
    top: clamp(158px, 24vh, 224px);
    width: min(318px, calc(100vw - 36px));
    opacity: 0.88;
    transform-origin: top right;
    transition:
      width 160ms ease,
      padding 160ms ease,
      opacity 160ms ease,
      box-shadow 160ms ease,
      border-color 160ms ease;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed {
    width: min(164px, calc(100vw - 36px));
    padding: 7px;
    border-color: rgba(215, 169, 74, 0.34);
    opacity: 0.7;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:hover,
  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:focus-within {
    width: min(318px, calc(100vw - 36px));
    padding: 10px;
    border-color: rgba(215, 169, 74, 0.58);
    opacity: 0.98;
    box-shadow:
      inset 0 1px 0 rgba(255, 240, 190, 0.1),
      0 16px 46px rgba(0, 0, 0, 0.34);
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed .minimap-head {
    margin-bottom: 5px;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:hover .minimap-head,
  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:focus-within .minimap-head {
    margin-bottom: 8px;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed .minimap-head > div > span {
    display: none;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:hover .minimap-head > div > span,
  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:focus-within .minimap-head > div > span {
    display: block;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed #minimapCanvas {
    aspect-ratio: 360 / 170;
    opacity: 0.84;
  }

  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:hover #minimapCanvas,
  body.match-active:not(.mobile-ui) .minimap-panel.is-collapsed:focus-within #minimapCanvas {
    aspect-ratio: 360 / 240;
    opacity: 1;
  }
}

/* Desktop scoreboard resilience: the game area can be much narrower than the
   viewport when the sidebar is open, so player cards must wrap before their
   values collapse into ellipses. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .topbar {
    grid-template-columns: minmax(88px, 116px) minmax(0, 1fr) 48px;
    grid-template-rows: auto auto;
    align-items: stretch;
    min-height: 0;
    gap: 7px;
  }

  body.match-active:not(.mobile-ui) .round-widget {
    grid-column: 1;
    grid-row: 1;
    min-height: 64px;
  }

  body.match-active:not(.mobile-ui) .toolbar {
    grid-column: 3;
    grid-row: 1;
    align-self: stretch;
  }

  body.match-active:not(.mobile-ui) .scoreboard {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(166px, 100%), 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  body.match-active:not(.mobile-ui) .score-card,
  body.match-active:not(.mobile-ui) .score-card:nth-child(4),
  body.match-active:not(.mobile-ui) .score-card:nth-child(5),
  body.match-active:not(.mobile-ui) .score-card:nth-child(6) {
    grid-column: auto;
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-card {
    min-height: 72px;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 7px;
    padding: 7px 8px;
  }

  body.match-active:not(.mobile-ui) .score-avatar {
    width: 34px;
    height: 34px;
  }

  body.match-active:not(.mobile-ui) .score-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  body.match-active:not(.mobile-ui) .score-name {
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-game-level {
    padding-inline: 5px;
  }

  body.match-active:not(.mobile-ui) .score-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-values > span {
    min-width: 0;
    padding-inline: 5px;
  }

  body.match-active:not(.mobile-ui) .score-values .icon-value {
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
    font-size: clamp(0.68rem, 0.64vw, 0.82rem);
  }

  body.match-active:not(.mobile-ui) .score-values .icon-value > span:last-child {
    min-width: max-content;
    overflow: visible;
    text-overflow: clip;
  }
}

@media (min-width: 1550px) {
  body.match-active:not(.mobile-ui) .topbar {
    grid-template-columns: clamp(134px, 9vw, 168px) minmax(0, 1fr) 54px;
    grid-template-rows: auto;
    min-height: 82px;
  }

  body.match-active:not(.mobile-ui) .round-widget {
    grid-column: 1;
    grid-row: 1;
    min-height: 78px;
  }

  body.match-active:not(.mobile-ui) .scoreboard {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(auto-fit, minmax(min(158px, 100%), 1fr));
    align-content: stretch;
  }

  body.match-active:not(.mobile-ui) .toolbar {
    grid-column: 3;
    grid-row: 1;
  }
}

@media (min-width: 2200px) {
  body.match-active:not(.mobile-ui) .score-values {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* True in-game underlay: the scrollable canvas runs beneath the HUD and shop. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .shell {
    grid-template-rows: minmax(0, 1fr) clamp(242px, 29vh, 310px);
  }

  body.match-active:not(.mobile-ui) .game-area {
    grid-row: 1 / 3;
    position: relative;
    display: block;
    height: 100vh;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: transparent;
  }

  body.match-active:not(.mobile-ui) .canvas-wrap {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }

  body.match-active:not(.mobile-ui) .topbar {
    position: absolute;
    top: 8px;
    right: 8px;
    left: 8px;
    z-index: 30;
    width: auto;
    pointer-events: none;
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.025), rgba(0, 0, 0, 0.01)),
      rgba(5, 9, 7, 0.18);
    backdrop-filter: none;
  }

  body.match-active:not(.mobile-ui) .topbar > *,
  body.match-active:not(.mobile-ui) .game-menu {
    pointer-events: auto;
  }

  body.match-active:not(.mobile-ui) .sidebar {
    grid-row: 2;
    z-index: 24;
    background:
      linear-gradient(180deg, rgba(255, 240, 190, 0.03), transparent 44%),
      rgba(5, 9, 7, 0.24);
    backdrop-filter: none;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  }

  body.match-active:not(.mobile-ui) .hintbar,
  body.match-active:not(.mobile-ui) .minimap-panel,
  body.match-active:not(.mobile-ui) .chat-panel,
  body.match-active:not(.mobile-ui) .desktop-trait-rail {
    z-index: 26;
  }

  body.match-active:not(.mobile-ui) .minimap-panel {
    z-index: 28;
  }

  body.match-active:not(.mobile-ui) .chat-panel {
    z-index: 25;
  }
}

/* Desktop match polish: keep utility panels away from the bottom shop. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .hintbar {
    display: none;
  }

  body.match-active:not(.mobile-ui).perf-debug-active .hintbar {
    display: flex;
    top: 76px;
    right: auto;
    bottom: auto;
    left: 12px;
    width: min(560px, calc(100vw - 380px));
    min-height: 26px;
    opacity: 0.78;
    pointer-events: none;
  }

  body.match-active:not(.mobile-ui) .chat-panel {
    top: auto;
    right: 10px;
    bottom: 322px;
    z-index: 25;
    width: min(320px, calc(100vw - 40px));
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  }

  body.match-active:not(.mobile-ui) .chat-panel.is-collapsed {
    top: auto;
    bottom: 322px;
  }

  body.match-active:not(.mobile-ui) .chat-log {
    min-height: 92px;
    max-height: min(148px, 22vh);
  }

  body.match-active:not(.mobile-ui) .score-avatar {
    position: relative;
    display: grid;
    grid-template-rows: 1fr;
    place-items: center;
    overflow: visible;
    border: 2px solid color-mix(in srgb, var(--player-color, var(--gold)) 70%, rgba(255, 240, 190, 0.36));
    background:
      radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.16), transparent 26%),
      color-mix(in srgb, var(--player-color, var(--gold)) 28%, rgba(4, 10, 12, 0.96));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      0 0 0 1px rgba(0, 0, 0, 0.34),
      0 0 14px color-mix(in srgb, var(--player-color, var(--gold)) 18%, transparent);
    filter: none;
  }

  body.match-active:not(.mobile-ui) .score-avatar-initial {
    color: #fff8e8;
    font-size: clamp(0.78rem, 0.72vw, 1rem);
    font-weight: 950;
    line-height: 1;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.72);
  }

  body.match-active:not(.mobile-ui) .score-avatar-level {
    position: absolute;
    right: -5px;
    bottom: -5px;
    display: grid;
    min-width: 18px;
    height: 18px;
    place-items: center;
    padding: 0 4px;
    border: 1px solid rgba(255, 228, 150, 0.88);
    border-radius: 999px;
    background: rgba(6, 9, 7, 0.96);
    color: #ffd978;
    font-size: 0.58rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
  }

  body.match-active:not(.mobile-ui) .score-index {
    display: none;
  }
}

@media (min-width: 981px) and (max-height: 820px) {
  body.match-active:not(.mobile-ui) .chat-panel,
  body.match-active:not(.mobile-ui) .chat-panel.is-collapsed {
    bottom: 254px;
  }

  body.match-active:not(.mobile-ui) .chat-log {
    min-height: 48px;
    max-height: min(72px, 14vh);
  }
}

.perf-debug-overlay {
  position: fixed;
  top: 78px;
  right: 14px;
  z-index: 1400;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(111, 231, 199, 0.45);
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.88);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.36);
  color: #e9fff8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.perf-debug-title {
  margin-bottom: 6px;
  color: #6fe7c7;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.perf-debug-body {
  white-space: pre;
  font-size: 0.68rem;
  line-height: 1.45;
}

body.mobile-ui .perf-debug-overlay {
  top: calc(var(--mobile-hud-height, 74px) + 8px);
  right: 8px;
  min-width: 198px;
  padding: 8px 9px;
}

body.match-active .unit-shop-card:disabled.is-too-expensive {
  border-color: rgba(255, 183, 77, 0.42) !important;
  background:
    linear-gradient(180deg, rgba(255, 183, 77, 0.08), rgba(0, 0, 0, 0.12) 58%),
    rgba(5, 6, 5, 0.92) !important;
  filter: none !important;
  opacity: 1 !important;
}

body.match-active .unit-shop-card:disabled.is-too-expensive::before {
  z-index: 4 !important;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.52), rgba(0, 0, 0, 0.26)),
    repeating-linear-gradient(-45deg, rgba(255, 240, 190, 0.045) 0 5px, transparent 5px 11px) !important;
  opacity: 1 !important;
}

body.match-active .unit-shop-card:disabled.is-too-expensive::after {
  content: attr(data-cost) !important;
  position: absolute !important;
  inset: auto 8px auto auto !important;
  top: 8px !important;
  z-index: 30 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 54px !important;
  min-height: 28px !important;
  padding: 5px 9px !important;
  border: 2px solid rgba(255, 202, 103, 0.96) !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, rgba(86, 48, 7, 0.98), rgba(40, 22, 3, 0.98)) !important;
  color: #ffe08a !important;
  font-size: 0.9rem !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.56), 0 0 22px rgba(242, 184, 75, 0.36) !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

body.match-active .unit-shop-card:disabled.is-too-expensive .choice-icon,
body.match-active .unit-shop-card:disabled.is-too-expensive .choice-main {
  filter: grayscale(1) brightness(0.42) contrast(0.82) !important;
  opacity: 0.42 !important;
}

body.match-active .unit-shop-card:disabled.is-too-expensive .choice-cost {
  opacity: 0 !important;
  visibility: hidden !important;
}

body.match-active .unit-shop-card.is-pending:disabled,
body.match-active .unit-shop-card.is-pending:disabled.is-too-expensive {
  cursor: wait !important;
  filter: none !important;
}

body.match-active .unit-shop-card.is-pending:disabled.is-too-expensive::after {
  content: "" !important;
  inset: 0 !important;
  z-index: 5 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: inherit !important;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 220, 126, 0.3), transparent 22%),
    radial-gradient(circle at 50% 48%, rgba(98, 234, 208, 0.18), transparent 38%),
    linear-gradient(120deg, transparent 12%, rgba(255, 248, 232, 0.1) 42%, transparent 64%) !important;
  box-shadow: none !important;
  animation: shopPurchaseWash 720ms ease-in-out infinite !important;
}

body.match-active .unit-shop-card.is-pending:disabled.is-too-expensive .choice-cost {
  opacity: 0.28 !important;
  visibility: visible !important;
}

/* Mobile compact tower shop: TFT-like strip. Desktop is untouched by body.mobile-ui. */
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .sidebar {
  left: 6px;
  right: 6px;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 7px);
  height: 132px;
  max-height: 132px;
  grid-template-rows: 76px 44px;
  gap: 4px;
  padding: 4px;
  border-color: rgba(215, 169, 74, 0.14);
  border-radius: 10px;
  background: rgba(4, 8, 7, 0.2);
  box-shadow: 0 -8px 26px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(5px);
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .mobile-bottom-sheet-header {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 3;
  min-height: 32px;
  padding: 0;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .mobile-bottom-sheet-header > div:first-child,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .mobileSheetTitle,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) #mobileSheetTitle,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) #mobileSheetEyebrow,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) #mobileSheetCloseButton {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) #mobileSheetExpandButton {
  min-width: 24px;
  min-height: 24px;
  border-color: rgba(215, 169, 74, 0.42);
  border-radius: 7px;
  background: rgba(4, 8, 7, 0.72);
  font-size: 0.74rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-panel {
  min-height: 0;
  padding: 4px;
  border-color: rgba(98, 234, 208, 0.14);
  border-radius: 9px;
  background: rgba(4, 8, 7, 0.46);
  box-shadow: none;
  overflow: hidden;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel {
  position: relative;
  grid-template-rows: minmax(0, 1fr);
  padding-right: 48px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel .panel-title,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-panel .panel-title,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .odds-preview {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-toolbar {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  display: block;
  width: 40px;
  height: 64px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel .shop-action {
  width: 40px;
  min-width: 40px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  border-radius: 8px;
  font-size: 0.62rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel .shop-action .action-cost {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-list {
  display: grid;
  width: calc(100% - 48px);
  height: 64px;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 16px) / 5);
  grid-template-columns: none;
  gap: 4px;
  overflow: hidden;
  padding: 0;
  scrollbar-width: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-list::-webkit-scrollbar,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-list::-webkit-scrollbar {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel .choice-button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 34px 20px;
  align-items: center;
  justify-items: center;
  min-width: 0;
  min-height: 0;
  height: 64px;
  gap: 2px;
  padding: 4px 3px 3px;
  border-color: color-mix(in srgb, var(--rarity-color, #9fb4a6) 78%, rgba(255, 240, 190, 0.08));
  border-left-width: 3px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, #9fb4a6) 18%, transparent), transparent 68%),
    rgba(4, 8, 7, 0.76);
  text-align: center;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-panel .choice-icon {
  grid-row: 1;
  width: 32px;
  height: 32px;
  border-color: color-mix(in srgb, var(--rarity-color, #9fb4a6) 82%, rgba(255, 255, 255, 0.12));
  border-radius: 7px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-card .choice-main {
  display: contents;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-card .choice-name,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-meta-row,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-trait-list,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-tags,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .mobile-shop-rarity,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-match-badge {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-stat-grid {
  position: absolute;
  right: 2px;
  top: 2px;
  display: block;
  width: auto;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-stat-grid > .stat-pill:not(:first-child) {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-stat-grid > .stat-pill:first-child {
  min-height: 14px;
  max-width: 32px;
  padding: 1px 3px;
  border-color: color-mix(in srgb, var(--rarity-color, #9fb4a6) 48%, rgba(255, 240, 190, 0.12));
  border-radius: 999px;
  background: rgba(2, 5, 4, 0.72);
  color: #fff8e8;
  font-size: 0.45rem;
  line-height: 1;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-stat-grid > .stat-pill:first-child .stat-icon {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .tower-stat-grid > .stat-pill:first-child strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-card .choice-cost {
  grid-row: 2;
  justify-self: center;
  min-width: 34px;
  min-height: 18px;
  padding: 2px 4px;
  border-radius: 999px;
  font-size: 0.56rem;
  line-height: 1;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .shop-card .choice-cost .coin-icon {
  width: 11px;
  height: 11px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-panel {
  grid-template-rows: minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-list {
  display: grid;
  height: 36px;
  grid-auto-flow: column;
  grid-auto-columns: 64px;
  grid-template-columns: none;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  scrollbar-width: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-slot {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-height: 0;
  height: 36px;
  padding: 3px 4px;
  border-radius: 7px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-slot .choice-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-main {
  display: block;
  min-width: 0;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-title {
  display: grid;
  gap: 0;
  min-width: 0;
  font-size: 0.5rem;
  line-height: 1;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-title span,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-title strong {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-title strong {
  color: #efe0ad;
  font-size: 0.54rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-slot .tower-stat-grid,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-slot .tower-meta-row,
body.mobile-ui.match-active[data-mobile-panel="towers"]:not(.mobile-sheet-expanded) .bench-empty {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .mobile-bottom-sheet-header {
  position: static;
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .mobile-bottom-sheet-header > div:first-child,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded #mobileSheetTitle,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded #mobileSheetEyebrow,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded #mobileSheetCloseButton {
  display: block !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .tower-panel .panel-title,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .bench-panel .panel-title,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .odds-preview,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .shop-card .choice-name,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .tower-meta-row,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .tower-trait-list,
body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .tower-tags {
  display: revert !important;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .sidebar {
  left: 8px;
  right: 8px;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  border-color: rgba(215, 169, 74, 0.4);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.08), transparent 48%),
    rgba(5, 9, 8, 0.88);
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(10px);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar {
  height: clamp(232px, 31dvh, 292px);
  max-height: clamp(232px, 31dvh, 292px);
  grid-template-rows: 30px minmax(128px, 1fr) minmax(56px, 0.48fr);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .sidebar {
  height: clamp(170px, 23dvh, 230px);
  max-height: clamp(170px, 23dvh, 230px);
  grid-template-rows: 30px minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .sidebar {
  height: clamp(310px, 42dvh, 390px);
  max-height: clamp(310px, 42dvh, 390px);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"].mobile-sheet-expanded .sidebar {
  height: clamp(240px, 34dvh, 330px);
  max-height: clamp(240px, 34dvh, 330px);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-bottom-sheet-header {
  min-height: 30px;
  padding: 0 0 3px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header strong,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-bottom-sheet-header strong {
  font-size: 0.84rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-bottom-sheet-header span,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-bottom-sheet-header span {
  font-size: 0.5rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-close-button,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-close-button {
  min-width: 32px;
  min-height: 32px;
  border-radius: 9px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar .panel,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .sidebar .panel {
  padding: 7px;
  border-color: rgba(98, 234, 208, 0.18);
  background:
    linear-gradient(180deg, rgba(122, 197, 162, 0.08), transparent 60%),
    rgba(9, 14, 11, 0.8);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel {
  grid-template-rows: 20px 36px minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks-panel {
  grid-template-rows: 28px minmax(0, 1fr) 0;
  overflow: hidden;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .panel-title,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .panel-title {
  min-height: 20px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .panel-title h2,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .panel-title h2 {
  font-size: 0.68rem;
  letter-spacing: 0;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-toolbar {
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-action,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .shop-action {
  min-height: 34px;
  border-radius: 9px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-list,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 2px 3px 0;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-list {
  grid-auto-columns: minmax(124px, 32vw);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks {
  grid-auto-columns: minmax(142px, 38vw);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-button,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button {
  scroll-snap-align: start;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px minmax(0, 1fr) 24px;
  align-items: stretch;
  justify-items: center;
  gap: 4px;
  padding: 6px;
  text-align: center;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-icon,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-icon {
  width: 44px;
  height: 44px;
  justify-self: center;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-main,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-main {
  align-content: start;
  justify-items: center;
  gap: 3px;
  width: 100%;
  padding: 0;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-name,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-name {
  font-size: 0.62rem;
  line-height: 1.05;
  text-align: center;
  -webkit-line-clamp: 2;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-stat-grid,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-primary,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-details {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-cost,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-cost {
  align-self: end;
  justify-self: center;
  min-width: 42px;
  min-height: 22px;
  padding: 3px 6px;
  font-size: 0.66rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-list {
  grid-auto-columns: minmax(168px, 54vw);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks {
  grid-auto-columns: minmax(180px, 58vw);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-button,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  justify-items: stretch;
  gap: 7px;
  text-align: left;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-main,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-main {
  align-content: center;
  justify-items: stretch;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-name,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-name {
  max-width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  overflow-wrap: normal;
  word-break: normal;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-cost,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-card .choice-cost {
  align-self: start;
  justify-self: end;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .mobile-shop-rarity,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-shop-rarity {
  top: 5px;
  left: 5px;
  max-width: 72px;
  padding: 2px 4px;
  font-size: 0.48rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel {
  grid-template-rows: 20px minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-list {
  grid-auto-columns: minmax(58px, 15vw);
  gap: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot {
  grid-template-columns: 1fr;
  min-height: 0;
  height: 100%;
  justify-items: center;
  padding: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot .choice-icon {
  width: 34px;
  height: 34px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-main {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .batch-controls,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .send-log {
  display: none !important;
}

@media (max-width: 430px) {
  body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-list {
    grid-auto-columns: minmax(152px, 50vw);
  }

  body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks {
    grid-auto-columns: minmax(166px, 54vw);
  }

  body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-list {
    grid-auto-columns: minmax(52px, 16vw);
  }
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-stat-grid > .stat-pill {
  min-height: 18px;
  padding: 2px 4px;
  font-size: 0.54rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-meta-row,
body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-trait-list--compact {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-name {
  font-size: 0.72rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .shop-card .choice-cost {
  min-width: 34px;
  padding: 4px 5px;
  font-size: 0.68rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(120px, 42vw);
  grid-template-columns: none;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
  scroll-snap-type: x proximity;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot {
  min-height: 64px;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 6px;
  padding: 6px;
  scroll-snap-align: start;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot .choice-icon {
  width: 36px;
  height: 36px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-title {
  font-size: 0.66rem;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot .tower-stat-grid,
body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-slot .tower-meta-row {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .hintbar {
  display: none;
}

/* Desktop HUD polish: keep late in the cascade so responsive mobile rules stay intact. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .topbar {
    display: grid;
    grid-template-columns: clamp(142px, 12vw, 184px) minmax(0, 1fr) 54px;
    align-items: stretch;
    gap: 8px;
    min-height: 78px;
  }

  body.match-active:not(.mobile-ui) .round-widget {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    min-height: 78px;
    padding: 8px 10px;
    text-align: center;
  }

  body.match-active:not(.mobile-ui) .round-widget span,
  body.match-active:not(.mobile-ui) .round-widget strong,
  body.match-active:not(.mobile-ui) .round-widget em {
    display: block;
    width: 100%;
    text-align: center;
  }

  body.match-active:not(.mobile-ui) .scoreboard {
    display: grid;
    grid-template-columns: repeat(6, minmax(96px, 1fr));
    align-items: stretch;
    align-content: stretch;
    gap: 6px;
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    min-height: 58px;
    gap: 6px;
    padding: 6px 7px;
  }

  body.match-active:not(.mobile-ui) .score-main,
  body.match-active:not(.mobile-ui) .score-header,
  body.match-active:not(.mobile-ui) .score-name {
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-values {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 3px 7px;
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-values > span,
  body.match-active:not(.mobile-ui) .icon-value {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
    line-height: 1;
  }

  body.match-active:not(.mobile-ui) .toolbar {
    align-self: start;
    justify-self: end;
  }

  body.match-active:not(.mobile-ui) .panel-title,
  body.match-active:not(.mobile-ui) .shop-toolbar,
  body.match-active:not(.mobile-ui) .selected-stat-row,
  body.match-active:not(.mobile-ui) .unit-shop-details > span,
  body.match-active:not(.mobile-ui) .tower-stat-grid > .stat-pill {
    align-items: center;
  }

  body.match-active:not(.mobile-ui) .panel-title h2,
  body.match-active:not(.mobile-ui) .choice-name,
  body.match-active:not(.mobile-ui) .bench-title span,
  body.match-active:not(.mobile-ui) .selected-tower-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 981px) and (max-width: 1280px) {
  body.match-active:not(.mobile-ui) .topbar {
    grid-template-columns: 124px minmax(0, 1fr) 52px;
    min-height: 116px;
  }

  body.match-active:not(.mobile-ui) .scoreboard {
    grid-template-columns: repeat(3, minmax(108px, 1fr));
  }

  body.match-active:not(.mobile-ui) .round-widget {
    min-height: 92px;
  }
}

/* Trait modal readability: tower names must never sit under sprites. */
.traits-panel .trait-card {
  min-width: 0;
}

.traits-panel .trait-card.is-open {
  contain: layout paint;
}

.traits-panel .trait-card-toggle {
  min-width: 0;
}

.traits-panel .trait-card-main {
  flex: 1 1 auto;
}

.traits-panel .trait-progress,
.traits-panel .trait-requirement,
.traits-panel .trait-tower-list {
  align-items: center;
  min-width: 0;
}

.traits-panel .trait-progress > span,
.traits-panel .trait-requirement > span,
.traits-panel .trait-tower-list > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.traits-panel .trait-reference-towers {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}

.traits-panel .reference-tower-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 58px;
  overflow: visible;
}

.traits-panel .reference-tower-card .choice-icon {
  position: relative;
  z-index: 0;
  grid-column: 1;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
}

.traits-panel .reference-tower-card > span:not(.choice-icon) {
  z-index: 1;
  grid-column: 2;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 0;
}

.traits-panel .reference-tower-card strong {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 981px) {
  .traits-panel {
    width: min(1120px, calc(100vw - 56px));
  }

  .traits-panel .traits-card-grid {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }

  .traits-panel .trait-card.is-open {
    grid-column: 1 / -1;
  }

  .traits-panel .trait-card.is-open .trait-card-detail {
    grid-template-columns: minmax(0, 0.95fr) minmax(300px, 1.05fr);
    align-items: start;
    column-gap: 14px;
  }

  .traits-panel .trait-card.is-open .trait-card-detail > p,
  .traits-panel .trait-card.is-open .trait-card-detail > .trait-bonus-block--inline,
  .traits-panel .trait-card.is-open .trait-card-detail > .trait-tower-list,
  .traits-panel .trait-card.is-open .trait-card-detail > .trait-tier-roadmap,
  .traits-panel .trait-card.is-open .trait-card-detail > .trait-bonus-block:last-child {
    grid-column: 1 / -1;
  }

  .traits-panel .trait-tier-row-head,
  .traits-panel .trait-tier-row-body {
    grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  }
}

/* Mobile refinements kept behind body.mobile-ui so desktop layout stays unchanged. */
body.mobile-ui.match-active .desktop-trait-rail {
  position: fixed;
  top: calc(var(--mobile-hud-height) + env(safe-area-inset-top) + 10px);
  left: 8px;
  z-index: 49;
  display: grid !important;
  gap: 5px;
  width: 42px;
  max-height: calc(100dvh - var(--mobile-hud-height) - var(--mobile-bottom-nav-height) - 28px);
  overflow: visible;
  pointer-events: none;
}

body.mobile-ui.match-active .desktop-trait-item {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 58%, rgba(255, 240, 190, 0.14));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 18%, transparent), transparent 70%),
    rgba(1, 10, 14, 0.68);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  opacity: 0.86;
  pointer-events: auto;
}

body.mobile-ui.match-active .desktop-trait-item.is-active {
  opacity: 1;
}

body.mobile-ui.match-active .desktop-trait-item > .trait-icon {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 78%, #fff8e8);
}

body.mobile-ui.match-active .desktop-trait-item > .trait-icon svg {
  width: 19px;
  height: 19px;
}

body.mobile-ui.match-active .desktop-trait-name,
body.mobile-ui.match-active .desktop-trait-popover {
  display: none !important;
}

body.mobile-ui.match-active .desktop-trait-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  min-width: 16px;
  height: 16px;
  place-items: center;
  padding: 0 4px;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 62%, rgba(255, 248, 232, 0.18));
  border-radius: 999px;
  background: rgba(3, 7, 5, 0.94);
  color: #fff8e8;
  font-size: 0.54rem;
  font-weight: 950;
  line-height: 1;
}

body.mobile-ui.match-active .desktop-trait-page-button {
  width: 38px;
  height: 26px;
  border: 1px solid rgba(255, 240, 190, 0.18);
  border-radius: 999px;
  background: rgba(1, 10, 14, 0.72);
  color: rgba(255, 248, 232, 0.82);
  font-size: 0.58rem;
  font-weight: 950;
  pointer-events: auto;
}

body.mobile-ui.match-active .desktop-trait-item.is-mobile-selected {
  opacity: 1;
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 78%, rgba(255, 248, 232, 0.3));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--trait-color, #d7a94a) 24%, transparent), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.mobile-trait-popover[hidden] {
  display: none !important;
}

body.mobile-ui.match-active .mobile-trait-popover {
  position: fixed;
  top: calc(var(--mobile-hud-height) + env(safe-area-inset-top) + 10px);
  left: 56px;
  z-index: 63;
  display: grid;
  gap: 8px;
  width: min(330px, calc(100vw - 68px));
  max-height: min(44dvh, 360px);
  padding: 10px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--trait-color, #d7a94a) 58%, rgba(255, 240, 190, 0.14));
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--trait-color, #d7a94a) 13%, transparent), transparent 46%),
    rgba(1, 10, 14, 0.95);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

body.mobile-ui.match-active .mobile-trait-popover header {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
}

body.mobile-ui.match-active .mobile-trait-popover header .trait-icon {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--trait-color, #d7a94a) 78%, #fff8e8);
}

body.mobile-ui.match-active .mobile-trait-popover h3,
body.mobile-ui.match-active .mobile-trait-popover h4,
body.mobile-ui.match-active .mobile-trait-popover p {
  margin: 0;
}

body.mobile-ui.match-active .mobile-trait-popover header span,
body.mobile-ui.match-active .mobile-trait-popover header em,
body.mobile-ui.match-active .mobile-trait-popover h4 {
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

body.mobile-ui.match-active .mobile-trait-popover h3 {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.92rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-trait-popover p {
  color: rgba(255, 248, 232, 0.78);
  font-size: 0.72rem;
  line-height: 1.3;
}

body.mobile-ui.match-active .mobile-trait-popover-close {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 240, 190, 0.14);
  border-radius: 8px;
  background: rgba(255, 248, 232, 0.07);
  color: #fff8e8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

body.mobile-ui.match-active .mobile-trait-popover-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.mobile-ui.match-active .mobile-trait-popover-status > span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(255, 240, 190, 0.1);
  border-radius: 7px;
  background: rgba(2, 9, 12, 0.5);
}

body.mobile-ui.match-active .mobile-trait-popover-status small {
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
}

body.mobile-ui.match-active .mobile-trait-popover-status strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-trait-popover section,
body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-next,
body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-requirements {
  display: grid;
  gap: 6px;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-requirements .trait-requirement {
  padding: 6px 7px;
  border-color: rgba(255, 240, 190, 0.12);
  background: rgba(2, 9, 12, 0.54);
  font-size: 0.64rem;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-requirements .trait-requirement--complete {
  border-color: color-mix(in srgb, var(--trait-color, #d7a94a) 42%, rgba(98, 234, 208, 0.28));
  color: #9ff7ff;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-towers {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
  overflow-x: auto;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-tower {
  display: grid;
  flex: 0 0 112px;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--rarity-color, #9fb4a6) 42%, rgba(255, 240, 190, 0.12));
  border-radius: 7px;
  background: rgba(4, 10, 12, 0.56);
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-tower .choice-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-tower strong {
  min-width: 0;
  overflow: hidden;
  color: #fff8e8;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active .mobile-trait-popover .desktop-trait-empty {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .sidebar {
  height: 118px;
  max-height: 118px;
  grid-template-rows: 26px minmax(0, 1fr);
  padding: 4px;
  border-color: rgba(215, 169, 74, 0.18);
  background: rgba(4, 8, 7, 0.28);
  backdrop-filter: blur(6px);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"].mobile-sheet-expanded .sidebar {
  height: clamp(210px, 32dvh, 300px);
  max-height: clamp(210px, 32dvh, 300px);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-bottom-sheet-header {
  min-height: 26px;
  padding: 0 0 2px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-bottom-sheet-header strong,
body.mobile-ui.match-active[data-mobile-panel="monsters"] #mobileSheetEyebrow,
body.mobile-ui.match-active[data-mobile-panel="monsters"] #mobileSheetCloseButton {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-close-button {
  min-width: 26px;
  min-height: 26px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks-panel {
  grid-template-rows: minmax(0, 1fr);
  padding: 4px;
  overflow: hidden;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks-panel .panel-title {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks {
  display: grid;
  width: 100%;
  height: 76px;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 8px) / 3);
  grid-template-columns: none;
  gap: 4px;
  overflow: hidden;
  padding: 0;
  scrollbar-width: none;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks::-webkit-scrollbar {
  display: none;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button.unit-shop-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) !important;
  grid-template-rows: 1fr 18px !important;
  align-items: center;
  gap: 3px 5px;
  min-width: 0;
  min-height: 0;
  height: 76px;
  padding: 4px;
  border-left-width: 3px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--rarity-color, #9fb4a6) 16%, transparent), transparent 68%),
    rgba(4, 8, 7, 0.78);
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button.unit-shop-card .choice-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button.unit-shop-card .choice-main {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button.unit-shop-card .choice-name {
  min-width: 0;
  overflow: hidden;
  font-size: 0.56rem;
  line-height: 1;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-primary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-pill {
  min-height: 16px;
  padding: 1px 3px;
  gap: 2px;
  border-radius: 5px;
  font-size: 0.5rem;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-pill .selected-stat-icon {
  width: 12px;
  height: 12px;
  padding: 1px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-pill .selected-stat-icon .stat-icon,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-pill .income-icon {
  width: 9px;
  height: 9px;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .unit-shop-details,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .mobile-shop-rarity,
body.mobile-ui.match-active[data-mobile-panel="monsters"] .shop-card-loader {
  display: none !important;
}

body.mobile-ui.match-active[data-mobile-panel="monsters"] .barracks .choice-button.unit-shop-card .choice-cost {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: center;
  min-width: 36px;
  min-height: 16px;
  padding: 1px 5px;
  font-size: 0.54rem;
  line-height: 1;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .sidebar {
  left: 8px;
  right: auto;
  bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
  width: min(360px, calc(100vw - 16px));
  height: auto;
  max-height: min(238px, 34dvh);
  grid-template-rows: 28px minmax(0, 1fr);
  padding: 6px;
  border-radius: 12px;
  background: rgba(5, 9, 8, 0.9);
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .mobile-bottom-sheet-header {
  min-height: 28px;
  padding: 0;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .mobile-bottom-sheet-header strong {
  font-size: 0.78rem;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-panel {
  gap: 5px;
  padding: 8px;
  overflow: auto;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] #placedTowerName {
  font-size: 0.82rem;
  line-height: 1;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-tower-stats {
  max-height: 62px;
  margin: 0;
  overflow: auto;
  font-size: 0.62rem;
  line-height: 1.2;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-stat-row {
  gap: 5px;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-panel .mode-button,
body.mobile-ui.match-active[data-mobile-panel="upgrades"] .selected-panel .danger-button {
  min-height: 32px;
  font-size: 0.68rem;
}

body.mobile-ui.match-active[data-mobile-panel="upgrades"] #benchTowerButton {
  order: -1;
  border-color: rgba(98, 234, 208, 0.58);
  background:
    linear-gradient(180deg, rgba(98, 234, 208, 0.12), transparent),
    rgba(5, 16, 15, 0.82);
  color: #9ff7ff;
}

/* Desktop scoreboard: spread player stats across the card instead of clustering them. */
@media (min-width: 981px) {
  body.match-active:not(.mobile-ui) .score-card {
    align-items: stretch;
    min-height: 74px;
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 8px 9px;
  }

  body.match-active:not(.mobile-ui) .score-avatar {
    align-self: center;
    width: 36px;
    height: 36px;
  }

  body.match-active:not(.mobile-ui) .score-main {
    display: grid;
    align-content: center;
    gap: 4px;
    min-width: 0;
  }

  body.match-active:not(.mobile-ui) .score-header {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  body.match-active:not(.mobile-ui) .score-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    margin-top: 0;
  }

  body.match-active:not(.mobile-ui) .score-values > span {
    display: grid;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 29px;
    padding: 3px 5px;
    border: 1px solid rgba(255, 240, 190, 0.08);
    border-radius: 6px;
    background: rgba(3, 8, 6, 0.36);
  }

  body.match-active:not(.mobile-ui) .score-values > span::before {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: rgba(255, 248, 232, 0.52);
    font-size: 0.48rem;
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.match-active:not(.mobile-ui) .score-values > span:nth-child(1)::before { content: "PV"; }
  body.match-active:not(.mobile-ui) .score-values > span:nth-child(2)::before { content: "Or"; }
  body.match-active:not(.mobile-ui) .score-values > span:nth-child(3)::before { content: "Eco"; }
  body.match-active:not(.mobile-ui) .score-values > span:nth-child(4)::before { content: "Def"; }

  body.match-active:not(.mobile-ui) .score-values .icon-value {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    gap: 4px;
    font-size: clamp(0.72rem, 0.58vw, 0.88rem);
    font-variant-numeric: tabular-nums;
  }

  body.match-active:not(.mobile-ui) .score-values .icon-value > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
  }
}

@media (min-width: 1550px) {
  body.match-active:not(.mobile-ui) .topbar {
    grid-template-columns: clamp(154px, 10vw, 190px) minmax(0, 1fr) 54px;
    min-height: 86px;
  }

  body.match-active:not(.mobile-ui) .scoreboard {
    grid-template-columns: repeat(6, minmax(152px, 1fr));
    gap: 8px;
  }

  body.match-active:not(.mobile-ui) .score-card {
    min-height: 78px;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
  }

  body.match-active:not(.mobile-ui) .score-avatar {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 2200px) {
  body.match-active:not(.mobile-ui) .score-values {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 981px) and (max-width: 1280px) {
  body.match-active:not(.mobile-ui) .score-card {
    min-height: 66px;
  }

  body.match-active:not(.mobile-ui) .score-values {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Mobile HUD polish: isolated from desktop with body.mobile-ui and max-width guards. */
@media (max-width: 980px) {
  body.mobile-ui.match-active {
    --mobile-hud-height: 112px;
    --mobile-bottom-nav-height: 66px;
    --touch-target-size: 46px;
  }

  body.mobile-ui.match-active .game-area {
    padding: calc(env(safe-area-inset-top) + 6px) 6px calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom) + 7px);
    gap: 6px;
  }

  body.mobile-ui.match-active .mobile-top-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 6px;
    min-height: var(--mobile-hud-height);
    padding: 6px;
  }

  body.mobile-ui.match-active .mobile-player-chip {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 86px minmax(0, 1fr);
    min-width: 0;
    padding: 2px 0;
  }

  body.mobile-ui.match-active .mobile-status-buttons {
    grid-template-columns: repeat(2, minmax(38px, 1fr));
  }

  body.mobile-ui.match-active .mobile-status-buttons .mobile-player-book-button,
  body.mobile-ui.match-active .mobile-status-buttons .mobile-player-traits-button {
    min-width: 38px;
    min-height: 38px;
    border-radius: 9px;
  }

  body.mobile-ui.match-active .mobile-menu-button {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    min-width: 52px;
    padding-inline: 7px;
    border-radius: 9px;
  }

  body.mobile-ui.match-active .mobile-hud-stats {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }

  body.mobile-ui.match-active .mobile-stat {
    align-content: center;
    min-height: 42px;
    padding: 4px 3px;
    border-radius: 7px;
  }

  body.mobile-ui.match-active .mobile-stat span {
    font-size: clamp(0.48rem, 1.9vw, 0.58rem);
    line-height: 1;
  }

  body.mobile-ui.match-active .mobile-stat strong {
    font-size: clamp(0.66rem, 2.7vw, 0.84rem);
    line-height: 1.08;
  }

  body.mobile-ui.match-active .mobile-bottom-nav {
    gap: 4px;
    padding-inline: 6px;
  }

  body.mobile-ui.match-active .mobile-action-button {
    min-width: 0;
    padding: 0 3px;
    border-radius: 9px;
    font-size: clamp(0.62rem, 2.35vw, 0.76rem);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  body.mobile-ui.match-active .sidebar {
    left: 6px;
    right: 6px;
    height: min(58dvh, 540px);
    max-height: min(58dvh, 540px);
    padding: 7px;
    border-radius: 13px 13px 10px 10px;
  }

  body.mobile-ui.match-active.mobile-sheet-expanded .sidebar {
    height: calc(100dvh - var(--mobile-hud-height) - var(--mobile-bottom-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 18px);
    max-height: calc(100dvh - var(--mobile-hud-height) - var(--mobile-bottom-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 18px);
  }

  body.mobile-ui.match-active .mobile-bottom-sheet-header {
    min-height: 42px;
    padding-bottom: 6px;
  }

  body.mobile-ui.match-active .sidebar .panel {
    padding: 9px;
  }

  body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar {
    grid-template-rows: auto minmax(0, 1.15fr) minmax(116px, 0.72fr);
  }

  body.mobile-ui.match-active .tower-panel .choice-button,
  body.mobile-ui.match-active .barracks .choice-button {
    min-height: 124px;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px;
  }

  body.mobile-ui.match-active .tower-panel .choice-icon,
  body.mobile-ui.match-active .barracks .choice-icon {
    width: 60px;
    height: 60px;
  }

  body.mobile-ui.match-active .shop-card .choice-name,
  body.mobile-ui.match-active .unit-shop-card .choice-name {
    font-size: 0.82rem;
    line-height: 1.12;
  }

  body.mobile-ui.match-active .tower-stat-grid,
  body.mobile-ui.match-active .unit-shop-primary,
  body.mobile-ui.match-active .unit-shop-details {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.mobile-ui.match-active .tower-stat-grid > .stat-pill,
  body.mobile-ui.match-active .unit-shop-pill,
  body.mobile-ui.match-active .unit-shop-details > span {
    min-height: 26px;
    padding: 4px 5px;
    font-size: 0.64rem;
  }

  body.mobile-ui.match-active .bench-slot {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 7px;
    padding: 7px;
  }

  body.mobile-ui.match-active .bench-slot .choice-icon {
    width: 46px;
    height: 46px;
  }

  body.mobile-ui.match-active .mobile-player-row {
    grid-template-columns: minmax(96px, 1.2fr) repeat(3, minmax(46px, 0.55fr)) 70px;
    gap: 6px;
  }

  body.mobile-ui.match-active .mobile-player-stat--score {
    display: none;
  }
}

@media (max-width: 430px) {
  body.mobile-ui.match-active {
    --mobile-hud-height: 134px;
    --mobile-bottom-nav-height: 64px;
    --touch-target-size: 44px;
  }

  body.mobile-ui.match-active .mobile-player-chip {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  body.mobile-ui.match-active .mobile-status-buttons .mobile-player-book-button,
  body.mobile-ui.match-active .mobile-status-buttons .mobile-player-traits-button {
    min-width: 36px;
    min-height: 36px;
  }

  body.mobile-ui.match-active .mobile-hud-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.mobile-ui.match-active .mobile-stat {
    min-height: 36px;
    grid-template-columns: minmax(28px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    text-align: left;
  }

  body.mobile-ui.match-active .mobile-stat span {
    font-size: 0.5rem;
  }

  body.mobile-ui.match-active .mobile-stat strong {
    text-align: right;
  }

  body.mobile-ui.match-active .mobile-bottom-nav {
    min-height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  body.mobile-ui.match-active .tower-panel .choice-button,
  body.mobile-ui.match-active .barracks .choice-button {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    min-height: 118px;
    gap: 8px;
    padding: 9px;
  }

  body.mobile-ui.match-active .tower-panel .choice-icon,
  body.mobile-ui.match-active .barracks .choice-icon {
    width: 52px;
    height: 52px;
  }

  body.mobile-ui.match-active .tower-stat-grid,
  body.mobile-ui.match-active .unit-shop-primary,
  body.mobile-ui.match-active .unit-shop-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.mobile-ui.match-active .mobile-player-row {
    grid-template-columns: minmax(92px, 1fr) repeat(3, minmax(40px, auto)) 66px;
  }
}

@media (orientation: landscape) and (max-width: 980px) {
  body.mobile-ui.match-active {
    --mobile-hud-height: 58px;
    --mobile-bottom-nav-height: 58px;
  }

  body.mobile-ui.match-active .mobile-top-bar {
    grid-template-columns: minmax(128px, 0.8fr) minmax(0, 1.9fr) auto;
    grid-template-rows: 1fr;
    min-height: var(--mobile-hud-height);
    padding: 5px;
  }

  body.mobile-ui.match-active .mobile-player-chip {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 82px minmax(0, 1fr);
  }

  body.mobile-ui.match-active .mobile-hud-stats {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  body.mobile-ui.match-active .mobile-menu-button {
    grid-column: 3;
    grid-row: 1;
  }

  body.mobile-ui.match-active .mobile-stat {
    min-height: 44px;
    grid-template-columns: 1fr;
    text-align: center;
  }

  body.mobile-ui.match-active .sidebar {
    height: auto;
    max-height: none;
  }
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .sidebar {
  height: min(38dvh, 350px);
  max-height: min(38dvh, 350px);
  grid-template-rows: 34px minmax(142px, 1.25fr) minmax(74px, 0.55fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"].mobile-sheet-expanded .sidebar {
  height: min(56dvh, 520px);
  max-height: min(56dvh, 520px);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .bench-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-button {
  min-height: 72px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 7px;
}

body.mobile-ui.match-active[data-mobile-panel="towers"] .tower-panel .choice-icon {
  width: 40px;
  height: 40px;
}
