/* Master League */
.ml-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 0 40px;
  position: relative;
  z-index: 1;
}

/* Season picker + motif logo — one compact row, vertically centered */
.ml-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.ml-toolbar {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  display: flex;
  margin: 0;
}
.ml-toolbar-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}
.ml-season-select {
  width: auto;
  max-width: min(100%, 280px);
  flex: 0 1 auto;
  min-width: 0;
  padding: 8px 36px 8px 14px;
  font-weight: 700;
  font-size: 14px;
}
.ml-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ml-status-pill--active {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.45);
}
.ml-status-pill--upcoming {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.4);
}
.ml-status-pill--ended {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Page layout */
.ml-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ml-page-header > .ml-hero {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  min-width: 0;
}
.ml-page-header .ml-motif-logo {
  display: block;
  width: auto;
  max-width: min(280px, 72vw);
  max-height: 132px;
  height: auto;
  margin: 0;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.55));
}
.ml-motif-logo {
  display: block;
  max-width: min(300px, 88vw);
  height: auto;
  margin: 0;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.55));
}

/* Boost / terrain card — in-game banner layout */
.ml-boost-banner {
  position: relative;
  overflow: hidden;
  margin: 10px 0 18px;
  padding: 0;
}
.ml-boost-banner > .ml-boost-card {
  position: relative;
  z-index: 1;
  width: 100%;
}
.ml-boost-card {
  position: relative;
  margin: 0;
  padding: 16px 0 14px;
  min-height: 196px;
  border-radius: 2px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(118, 16, 26, 0.97) 0%, rgba(62, 8, 14, 0.98) 48%, rgba(34, 4, 9, 1) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(196, 206, 220, 0.65),
    inset 0 0 0 4px rgba(28, 6, 10, 0.95),
    0 10px 28px rgba(0, 0, 0, 0.55);
  clip-path: polygon(
    0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px)
  );
}
.ml-boost-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--ml-boost-bg, none);
  background-size: cover;
  background-position: center;
  opacity: 0.42;
  filter: sepia(0.28) saturate(2.1) hue-rotate(-14deg) brightness(0.72);
  pointer-events: none;
  z-index: 0;
}
.ml-boost-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(18, 2, 5, 0.72) 0%, rgba(18, 2, 5, 0.08) 22%, rgba(18, 2, 5, 0.05) 50%, rgba(18, 2, 5, 0.08) 78%, rgba(18, 2, 5, 0.72) 100%),
    radial-gradient(ellipse 55% 70% at 50% 42%, rgba(220, 45, 55, 0.28), transparent 70%);
  pointer-events: none;
  z-index: 1;
}
.ml-boost-portraits {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.ml-boost-card--portraits .ml-boost-portrait {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
}
.ml-boost-card--portraits .ml-boost-portrait--left {
  left: 0;
  justify-content: flex-start;
}
.ml-boost-card--portraits .ml-boost-portrait--right {
  right: 0;
  justify-content: flex-end;
}
.ml-boost-card--portraits .ml-boost-portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.ml-boost-card--portraits .ml-boost-portrait--left::after {
  background:
    linear-gradient(90deg, rgba(48, 4, 9, 0.08) 0%, transparent 38%, rgba(72, 8, 14, 0.42) 78%, rgba(48, 4, 9, 0.72) 100%),
    linear-gradient(180deg, rgba(48, 4, 9, 0.18) 0%, transparent 28%, transparent 100%);
}
.ml-boost-card--portraits .ml-boost-portrait--right::after {
  background:
    linear-gradient(270deg, rgba(48, 4, 9, 0.08) 0%, transparent 38%, rgba(72, 8, 14, 0.42) 78%, rgba(48, 4, 9, 0.72) 100%),
    linear-gradient(180deg, rgba(48, 4, 9, 0.18) 0%, transparent 28%, transparent 100%);
}
.ml-boost-card--portraits .ml-boost-portrait-img {
  position: relative;
  z-index: 1;
  width: auto;
  height: 96%;
  max-width: 108%;
  min-width: 78%;
  object-fit: contain;
  object-position: center 12%;
  opacity: 0.72;
  transform: scale(1.3);
  filter:
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55))
    sepia(0.22)
    saturate(1.45)
    hue-rotate(-10deg)
    brightness(0.88)
    contrast(1.05);
}
.ml-boost-card--portraits .ml-boost-portrait--left .ml-boost-portrait-img {
  object-position: left 8%;
  transform-origin: left center;
  margin-left: -12%;
}
.ml-boost-card--portraits .ml-boost-portrait--right .ml-boost-portrait-img {
  object-position: right 8%;
  transform-origin: right center;
  margin-right: -12%;
}
.ml-boost-inner {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 18px;
}
.ml-boost-card--portraits {
  background:
    linear-gradient(180deg, rgba(118, 16, 26, 0.92) 0%, rgba(62, 8, 14, 0.94) 48%, rgba(34, 4, 9, 0.96) 100%);
}
.ml-boost-card--portraits::before {
  opacity: 0.18;
}
.ml-boost-card--portraits::after {
  background:
    radial-gradient(ellipse 46% 72% at 50% 44%, rgba(28, 4, 8, 0.82) 0%, rgba(28, 4, 8, 0.55) 42%, transparent 72%),
    linear-gradient(90deg, rgba(18, 2, 5, 0.35) 0%, rgba(18, 2, 5, 0.02) 18%, transparent 50%, rgba(18, 2, 5, 0.02) 82%, rgba(18, 2, 5, 0.35) 100%),
    radial-gradient(ellipse 38% 52% at 50% 40%, rgba(220, 45, 55, 0.12), transparent 64%);
  z-index: 2;
}
.ml-boost-card--portraits .ml-boost-inner {
  position: relative;
  z-index: 3;
  padding: 10px min(11%, 92px) 12px;
  gap: 8px;
}
.ml-boost-stage-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.ml-boost-stage-label {
  font-size: clamp(17px, 2.4vw, 22px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.02em;
}
.ml-boost-terrain-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ml-boost-terrain-ic {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
}
.ml-boost-heading {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  margin: 2px 0 4px;
}
.ml-boost-pct {
  font-size: 13px;
  font-weight: 800;
  color: #fecaca;
  letter-spacing: 0.06em;
  margin-top: -4px;
}
.ml-boost-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(520px, 100%);
  margin-top: 4px;
}
.ml-boost-tag-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}
.ml-boost-tag-prefix {
  font-size: clamp(14px, 2vw, 16px);
  font-weight: 800;
  color: #fecaca;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
}
.ml-boost-tags .tag-composite {
  flex-shrink: 0;
}

/* Info panels */
.ml-section {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card, rgba(0, 0, 0, 0.28));
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.ml-section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-cyan);
  letter-spacing: 0.02em;
}
.ml-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
}
.ml-meta-item {
  font-size: 13px;
  line-height: 1.4;
}
.ml-meta-k {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.ml-meta-v {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}

/* Rank tiers with rewards */
.ml-rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ml-rank-row {
  padding: 12px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
}
.ml-rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.ml-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}
.ml-rank-emblem {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}
.ml-rank-pts {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}
.ml-rank-pts-k {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ml-rank-pts-v {
  font-weight: 700;
  color: var(--accent-cyan);
}
.ml-rank-rewards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ml-rank-none {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Reward chips */
.ml-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  max-width: 100%;
}
.ml-reward-chip--clickable {
  cursor: pointer;
}
.ml-reward-chip--clickable:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
}
.ml-reward-chip-ic {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}
.ml-reward-chip-ic--title {
  width: auto;
  max-width: 120px;
  height: 36px;
  padding: 2px 4px;
}
.ml-reward-chip-fallback {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ml-reward-chip-fallback--title {
  width: auto;
  min-width: 48px;
  max-width: 120px;
  height: 36px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(255, 255, 255, 0.18);
}
.ml-reward-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.25;
  min-width: 0;
  word-break: break-word;
}
.ml-reward-chip-count {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: auto;
}

/* Scoring */
.ml-section--scoring .ml-scoring-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ml-scoring-list li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding: 4px 0;
}

.ml-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .ml-wrap {
    padding-top: 6px;
  }
  .ml-page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    margin-bottom: 8px;
  }
  .ml-toolbar {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }
  .ml-toolbar-inner {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  .ml-page-header > .ml-hero {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
  }
  .ml-page-header .ml-motif-logo {
    max-width: min(220px, 58vw);
    max-height: 108px;
  }
  .ml-boost-card {
    padding: 12px 0 12px;
    min-height: 172px;
  }
  .ml-boost-card--portraits .ml-boost-portrait {
    width: 50%;
    height: 100%;
  }
  .ml-boost-card--portraits .ml-boost-portrait-img {
    height: 92%;
    opacity: 0.68;
    transform: scale(1.3);
  }
  .ml-boost-card--portraits .ml-boost-inner {
    padding: 0 min(12%, 88px);
  }
  .ml-boost-terrain-ic {
    width: 24px;
    height: 24px;
  }
  .ml-section {
    padding: 14px 12px;
  }
  .ml-rank-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .ml-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .ml-meta-grid {
    grid-template-columns: 1fr;
  }
}
