/* Plazr Unified Matchmaking UI — Native Platform Surface (Dark & Light, RTL & LTR) */

.community-games-panel > .mm-entry-btn {
  flex-shrink: 0;
}

.mm-entry-btn {
  width: 100%;
  min-height: 54px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 13px;
  border: 1px solid rgba(75, 147, 255, 0.34);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(185, 154, 88, 0.16), transparent 58%),
    linear-gradient(135deg, rgba(47, 125, 246, 0.15), rgba(25, 28, 31, 0.88));
  color: var(--text, #f3f4f6);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  text-align: start;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.mm-entry-btn:hover {
  border-color: rgba(185, 154, 88, 0.62);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.mm-entry-btn:active {
  transform: translateY(0);
}

.mm-entry-btn:focus-visible,
.mm-modal button:focus-visible,
.mm-floating-bar:focus-visible {
  outline: 2px solid var(--blue2, #4b93ff);
  outline-offset: 2px;
}

.mm-entry-btn.hidden,
.mm-floating-bar.hidden,
.mm-modal.hidden {
  display: none !important;
}

.mm-entry-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(75, 147, 255, 0.24), rgba(185, 154, 88, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f2d899;
  flex-shrink: 0;
}

.mm-entry-icon svg {
  width: 20px;
  height: 20px;
}

.mm-entry-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mm-entry-copy strong {
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text, #f3f4f6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-entry-copy small {
  font-size: 0.78rem;
  color: var(--muted, #98a1ab);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-entry-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(75, 147, 255, 0.16);
  border: 1px solid rgba(75, 147, 255, 0.32);
  color: #9dc4ff;
  white-space: nowrap;
}

.mm-entry-btn[data-mm-active="searching"] {
  border-color: rgba(75, 147, 255, 0.68);
}

.mm-entry-btn[data-mm-active="searching"] .mm-entry-pill {
  background: rgba(47, 125, 246, 0.24);
  color: #cfe2ff;
}

.mm-entry-btn[data-mm-active="ready_check"] {
  border-color: rgba(33, 178, 107, 0.78);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(33, 178, 107, 0.22), transparent 60%),
    linear-gradient(135deg, rgba(33, 178, 107, 0.18), rgba(25, 28, 31, 0.92));
}

.mm-entry-btn[data-mm-active="ready_check"] .mm-entry-pill {
  background: rgba(33, 178, 107, 0.25);
  border-color: rgba(33, 178, 107, 0.55);
  color: #9bf2c4;
}

/* Floating compact bar when user minimizes modal while searching */
.mm-floating-bar {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 430px;
  margin-inline: auto;
  z-index: 1080;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(75, 147, 255, 0.48);
  background: rgba(22, 26, 31, 0.96);
  backdrop-filter: blur(12px);
  color: var(--text, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  font: inherit;
}

.mm-floating-bar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 700;
}

.mm-floating-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue2, #4b93ff);
  box-shadow: 0 0 0 4px rgba(75, 147, 255, 0.22);
  flex-shrink: 0;
  animation: mmPulseDot 1.6s ease-in-out infinite;
}

.mm-floating-bar[data-state="ready_check"] {
  border-color: rgba(33, 178, 107, 0.72);
}

.mm-floating-bar[data-state="ready_check"] .mm-floating-dot {
  background: var(--green, #21b26b);
  box-shadow: 0 0 0 5px rgba(33, 178, 107, 0.25);
}

.mm-floating-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f2d899;
}

/* Hide matchmaking overlays completely when inside an active game */
body.sd-web-game #matchmaking-modal,
body.sd-game-opening #matchmaking-modal,
body.sd-web-game #mm-floating-bar,
body.sd-game-opening #mm-floating-bar {
  display: none !important;
}

/* Unified Matchmaking Modal */
.mm-modal {
  z-index: 1200;
  padding: 16px;
}

.mm-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  background:
    radial-gradient(130% 90% at 50% 0%, rgba(47, 125, 246, 0.11), transparent 55%),
    var(--panel, #191c1f);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-inline-end: 36px;
}

.mm-head-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.mm-head-emblem {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(185, 154, 88, 0.25), rgba(47, 125, 246, 0.2));
  border: 1px solid rgba(185, 154, 88, 0.38);
  color: #f2d899;
  flex-shrink: 0;
}

.mm-head-emblem svg {
  width: 22px;
  height: 22px;
}

.mm-head-copy h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text, #f3f4f6);
}

.mm-head-copy p {
  margin: 3px 0 0;
  font-size: 0.81rem;
  color: var(--muted, #98a1ab);
  line-height: 1.35;
}

.mm-conn-pill {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(216, 155, 43, 0.16);
  border: 1px solid rgba(216, 155, 43, 0.42);
  color: #f7c96e;
  white-space: nowrap;
}

.mm-conn-pill.hidden {
  display: none !important;
}

/* Dynamic Game Tabs */
.mm-game-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.mm-game-tabs::-webkit-scrollbar {
  display: none;
}

.mm-game-tab {
  min-height: 44px;
  padding: 7px 13px;
  border-radius: 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.09));
  background: var(--panel2, #22262a);
  color: var(--muted, #98a1ab);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.mm-game-tab:hover:not(:disabled) {
  color: var(--text, #f3f4f6);
  border-color: rgba(255, 255, 255, 0.2);
}

.mm-game-tab.active {
  background: linear-gradient(135deg, rgba(47, 125, 246, 0.22), rgba(185, 154, 88, 0.16));
  border-color: rgba(75, 147, 255, 0.55);
  color: var(--text, #f3f4f6);
}

.mm-game-tab:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mm-game-tab-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.mm-game-tab-fallback {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: #f2d899;
}

/* Seasonal League & Rating Banner (100% independent of profile sprites) */
.mm-rating-banner {
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.09));
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel2, #22262a);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mm-rating-banner[data-league="bronze"] {
  --mm-tier-main: #cd8c52;
  --mm-tier-soft: rgba(205, 140, 82, 0.18);
  --mm-tier-border: rgba(205, 140, 82, 0.42);
}

.mm-rating-banner[data-league="silver"] {
  --mm-tier-main: #cbd5e1;
  --mm-tier-soft: rgba(203, 213, 225, 0.16);
  --mm-tier-border: rgba(203, 213, 225, 0.42);
}

.mm-rating-banner[data-league="gold"] {
  --mm-tier-main: #f2cf7d;
  --mm-tier-soft: rgba(242, 207, 125, 0.18);
  --mm-tier-border: rgba(242, 207, 125, 0.46);
}

.mm-rating-banner[data-league="legendary"] {
  --mm-tier-main: #c084fc;
  --mm-tier-soft: rgba(192, 132, 252, 0.2);
  --mm-tier-border: rgba(192, 132, 252, 0.5);
}

.mm-rating-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mm-league-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.mm-league-crest {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--mm-tier-soft, rgba(205, 140, 82, 0.18));
  border: 1px solid var(--mm-tier-border, rgba(205, 140, 82, 0.42));
  color: var(--mm-tier-main, #cd8c52);
  flex-shrink: 0;
}

.mm-league-crest svg {
  width: 23px;
  height: 23px;
}

.mm-league-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mm-league-eyebrow {
  font-size: 0.72rem;
  color: var(--muted, #98a1ab);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mm-season-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--text, #f3f4f6);
}

.mm-league-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mm-league-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--mm-tier-main, #f2cf7d);
}

.mm-rating-points {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text, #f3f4f6);
}

.mm-rating-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mm-stat-pill {
  padding: 4px 9px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--muted, #98a1ab);
  font-variant-numeric: tabular-nums;
}

.mm-stat-pill b {
  color: var(--text, #f3f4f6);
  font-weight: 800;
}

.mm-stat-pill.streak {
  border-color: rgba(242, 207, 125, 0.35);
  color: #f2cf7d;
}

.mm-tier-progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mm-tier-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--mm-tier-main, #cd8c52);
  transition: width 0.25s ease;
}

/* Inline Status / Notice Banner (Cancelled / Failed / Info) */
.mm-notice {
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

.mm-notice.hidden {
  display: none !important;
}

.mm-notice[data-tone="cancelled"] {
  border-color: rgba(75, 147, 255, 0.34);
  background: rgba(47, 125, 246, 0.1);
}

.mm-notice[data-tone="failed"] {
  border-color: rgba(229, 83, 83, 0.45);
  background: rgba(229, 83, 83, 0.12);
}

.mm-notice-text {
  color: var(--text, #f3f4f6);
  line-height: 1.4;
}

.mm-notice-retry {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #f3f4f6);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* Mode Cards Grid */
.mm-modes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 11px;
}

.mm-modes-list.hidden {
  display: none !important;
}

.mm-mode-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.09));
  background: var(--panel2, #22262a);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.mm-mode-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.mm-mode-card[data-queue-type="ranked"] {
  border-color: rgba(185, 154, 88, 0.34);
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(185, 154, 88, 0.12), transparent 60%),
    var(--panel2, #22262a);
}

.mm-mode-top {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mm-mode-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mm-queue-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(75, 147, 255, 0.16);
  color: #9dc4ff;
}

.mm-mode-card[data-queue-type="ranked"] .mm-queue-badge {
  background: rgba(185, 154, 88, 0.22);
  color: #f2cf7d;
}

.mm-players-chip {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted, #98a1ab);
}

.mm-mode-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text, #f3f4f6);
  line-height: 1.3;
}

.mm-mode-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #98a1ab);
  line-height: 1.4;
}

.mm-search-btn {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 0;
  background: var(--blue, #2f7df6);
  color: #ffffff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.mm-mode-card[data-queue-type="ranked"] .mm-search-btn {
  background: linear-gradient(135deg, #2f7df6, #1d63cf);
  box-shadow: inset 0 0 0 1px rgba(242, 207, 125, 0.28);
}

.mm-search-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.mm-search-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Active Lifecycle Stage Panel (Searching / Ready Check / Allocating / Matched) */
.mm-stage-panel {
  padding: 20px 16px;
  border-radius: 15px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  background:
    radial-gradient(100% 100% at 50% 0%, rgba(47, 125, 246, 0.12), transparent 65%),
    var(--panel2, #22262a);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.mm-stage-panel.hidden {
  display: none !important;
}

.mm-stage-panel[data-stage="ready_check"],
.mm-stage-panel[data-stage="matched"] {
  border-color: rgba(33, 178, 107, 0.48);
  background:
    radial-gradient(100% 100% at 50% 0%, rgba(33, 178, 107, 0.16), transparent 65%),
    var(--panel2, #22262a);
}

/* Plazr Radar / Pulse Visual */
.mm-radar {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(47, 125, 246, 0.16);
  border: 1px solid rgba(75, 147, 255, 0.45);
  color: #9dc4ff;
}

.mm-radar::before,
.mm-radar::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(75, 147, 255, 0.32);
  animation: mmRadarWave 2.1s ease-out infinite;
  pointer-events: none;
}

.mm-radar::after {
  animation-delay: 1.05s;
}

.mm-stage-panel[data-stage="ready_check"] .mm-radar,
.mm-stage-panel[data-stage="matched"] .mm-radar {
  background: rgba(33, 178, 107, 0.2);
  border-color: rgba(33, 178, 107, 0.6);
  color: #8cf0b9;
}

.mm-stage-panel[data-stage="ready_check"] .mm-radar::before,
.mm-stage-panel[data-stage="ready_check"] .mm-radar::after {
  border-color: rgba(33, 178, 107, 0.42);
}

.mm-radar svg {
  width: 28px;
  height: 28px;
}

.mm-stage-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text, #f3f4f6);
}

.mm-stage-sub {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted, #98a1ab);
  max-width: 40ch;
  line-height: 1.45;
}

.mm-timer-readout {
  font-variant-numeric: tabular-nums;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f2d899;
  padding: 4px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mm-stage-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mm-stage-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text, #f3f4f6);
}

.mm-stage-chip.requeued {
  background: rgba(216, 155, 43, 0.18);
  border: 1px solid rgba(216, 155, 43, 0.4);
  color: #f7c96e;
}

/* Ready Check Slots & Countdown Bar */
.mm-ready-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mm-ready-pip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted, #98a1ab);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.mm-ready-pip.filled {
  border-color: var(--green, #21b26b);
  background: rgba(33, 178, 107, 0.24);
  color: #9bf2c4;
}

.mm-countdown-track {
  width: min(320px, 100%);
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.mm-countdown-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #21b26b, #4b93ff);
  transition: width 0.2s linear;
}

.mm-stage-actions {
  width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.mm-ready-btn {
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 0;
  background: var(--green, #21b26b);
  color: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.mm-ready-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.mm-ready-btn:disabled {
  background: rgba(33, 178, 107, 0.28);
  border: 1px solid rgba(33, 178, 107, 0.55);
  color: #b7f7d4;
  cursor: default;
}

.mm-cancel-btn {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid rgba(229, 83, 83, 0.42);
  background: rgba(229, 83, 83, 0.12);
  color: #ff9c9c;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.mm-cancel-btn:hover:not(:disabled) {
  background: rgba(229, 83, 83, 0.2);
}

.mm-cancel-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.mm-stage-footnote {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted, #98a1ab);
}

/* Light Theme Refinements (WCAG AA Contrast) */
html[data-theme="light"] .mm-entry-btn {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(185, 154, 88, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(47, 125, 246, 0.1), #ffffff);
  border-color: rgba(47, 125, 246, 0.35);
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.07);
}

html[data-theme="light"] .mm-entry-icon,
html[data-theme="light"] .mm-head-emblem {
  color: #8a641b;
  border-color: rgba(185, 154, 88, 0.38);
}

html[data-theme="light"] .mm-entry-pill,
html[data-theme="light"] .mm-queue-badge {
  color: #1856bd;
  background: rgba(47, 125, 246, 0.12);
}

html[data-theme="light"] .mm-mode-card[data-queue-type="ranked"] .mm-queue-badge {
  color: #7d560f;
  background: rgba(185, 154, 88, 0.22);
}

html[data-theme="light"] .mm-rating-banner[data-league="bronze"] {
  --mm-tier-main: #8f4f1a;
}

html[data-theme="light"] .mm-rating-banner[data-league="silver"] {
  --mm-tier-main: #475569;
}

html[data-theme="light"] .mm-rating-banner[data-league="gold"] {
  --mm-tier-main: #8a6010;
}

html[data-theme="light"] .mm-rating-banner[data-league="legendary"] {
  --mm-tier-main: #7e22ce;
}

html[data-theme="light"] .mm-stat-pill,
html[data-theme="light"] .mm-timer-readout {
  background: rgba(17, 24, 39, 0.06);
  border-color: rgba(17, 24, 39, 0.1);
}

html[data-theme="light"] .mm-timer-readout {
  color: #14181f;
}

html[data-theme="light"] .mm-cancel-btn {
  color: #b42318;
  background: rgba(229, 83, 83, 0.1);
}

html[data-theme="light"] .mm-floating-bar {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.16);
}

html[data-theme="light"] .mm-floating-time {
  background: rgba(17, 24, 39, 0.08);
  color: #7d560f;
}

/* Mobile Layout Adjustments */
@media (max-width: 640px) {
  .mm-modal {
    padding: 0;
    align-items: flex-end;
  }

  .mm-modal-card {
    width: 100%;
    max-height: 92dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 18px 15px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .mm-modes-list {
    grid-template-columns: 1fr;
  }
}

@keyframes mmRadarWave {
  0% {
    transform: scale(0.92);
    opacity: 0.85;
  }
  100% {
    transform: scale(1.38);
    opacity: 0;
  }
}

@keyframes mmPulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.72;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-entry-btn,
  .mm-game-tab,
  .mm-tier-progress-bar,
  .mm-countdown-fill,
  .mm-radar::before,
  .mm-radar::after,
  .mm-floating-dot {
    animation: none !important;
    transition: none !important;
  }
}

/* Game-first matchmaking, using the same artwork and progression as the profile. */
.mm-modal-card {
  width: min(640px, 100%); max-height: min(90dvh, 850px);
  padding: 24px; gap: 13px; background: var(--panel, #171c1e);
}
.mm-head-copy h2 { font-size: 1.25rem; }
.mm-head-copy p { margin-top: 5px; }
.mm-game-tabs { padding: 3px 0 2px; }
.mm-game-tab { border-radius: 999px; min-height: 42px; padding: 6px 13px; }
.mm-game-tab.active { background: rgba(185,154,88,.16); border-color: rgba(185,154,88,.65); }
.mm-game-progress {
  display: grid; grid-template-columns: 80px minmax(0,1fr) 68px; align-items: center; gap: 14px;
  padding: 16px; border: 1px solid rgba(185,154,88,.36); border-radius: 17px;
  background: radial-gradient(circle at 15% 10%,rgba(185,154,88,.18),transparent 44%),linear-gradient(125deg,#123a3b,#102326 70%,#172624);
  color: #f3f5ed;
}
.mm-progress-art { width: 80px; height: 80px; object-fit: contain; filter: drop-shadow(0 7px 12px rgba(0,0,0,.25)); }
.mm-progress-body { min-width: 0; }
.mm-progress-eyebrow { color: #bfc9bc; font-size: .72rem; font-weight: 700; }
.mm-progress-body h3 { color: #fff; font-size: 1.18rem; margin: 2px 0 4px; }
.mm-progress-level { color: #f0d68d; font-size: .82rem; font-weight: 800; }
.mm-progress-rank { width: 68px; height: 68px; object-fit: contain; }
.mm-progress-track { height: 6px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.14); }
.mm-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#e0b867,#f4d98a); }
.mm-progress-counts { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; color: #d3dfd8; font-size: .71rem; }
.mm-progress-unavailable { margin: 8px 0 0; color: #d3dfd8; font-size: .77rem; }
.mm-rating-banner { padding: 11px 14px; gap: 8px; }
.mm-league-crest { width: 36px; height: 36px; }
.mm-rating-loading { color: var(--muted,#98a1ab); font-size: .8rem; }
.mm-modes-heading { margin: 3px 2px 0; color: var(--text,#f3f4f6); font-size: .96rem; }
.mm-modes-list { grid-template-columns: 1fr; gap: 8px; }
.mm-mode-card { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 13px; border-radius: 14px; }
.mm-mode-art { width: 58px; height: 58px; object-fit: contain; }
.mm-mode-top { gap: 4px; min-width: 0; }
.mm-mode-badges { justify-content: flex-start; flex-wrap: wrap; }
.mm-mode-title { font-size: .94rem; }
.mm-mode-subtitle { font-size: .76rem; }
.mm-search-btn { width: auto; min-width: 112px; padding-inline: 14px; }
.mm-mode-card[data-enabled="false"] { opacity: .72; }
.mm-mode-card[data-enabled="false"] .mm-search-btn { background: rgba(128,140,143,.18); color: var(--muted,#98a1ab); box-shadow: none; cursor: not-allowed; }
html[data-theme="light"] .mm-game-progress { background: radial-gradient(circle at 15% 10%,rgba(185,154,88,.18),transparent 44%),linear-gradient(125deg,#1c5652,#194244); }
@media (max-width: 640px) {
  .mm-modal { align-items: flex-end; }
  .mm-modal-card { max-height: 94dvh; padding: 19px 15px calc(20px + env(safe-area-inset-bottom,0px)); }
  .mm-head-copy h2 { font-size: 1.08rem; }
  .mm-head-copy p { font-size: .75rem; }
  .mm-game-progress { grid-template-columns: 58px minmax(0,1fr) 54px; gap: 9px; padding: 13px 11px; }
  .mm-progress-art { width: 58px; height: 58px; }
  .mm-progress-rank { width: 54px; height: 54px; }
  .mm-progress-body h3 { font-size: 1rem; }
  .mm-progress-counts { font-size: .66rem; }
  .mm-mode-card { grid-template-columns: 44px minmax(0,1fr) auto; gap: 9px; padding: 11px 10px; }
  .mm-mode-art { width: 44px; height: 44px; }
  .mm-search-btn { min-width: 78px; min-height: 42px; font-size: .76rem; padding-inline: 9px; }
}

/* The matchmaking surface is a normal platform page, not a dialog. */
.mm-page { max-width: 900px; }
.mm-page .mm-modal-card { width: 100%; max-height: none; overflow: visible; background: transparent; border: 0; box-shadow: none; padding: 0; border-radius: 0; gap: 12px; }
.mm-page .mm-page-back { position: absolute; inset-inline-end: 0; top: 1px; width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--panel2,#22262a); color: var(--text,#f3f4f6); font: inherit; font-size: 25px; cursor: pointer; }
.mm-page .mm-head { padding: 0 0 4px; padding-inline-end: 52px; min-height: 52px; }
.mm-page .mm-head-emblem { display: none; }
.mm-page .mm-head-copy h2 { font-size: 1.55rem; }
.mm-page .mm-game-progress { min-height: 160px; grid-template-columns: 120px minmax(0,1fr) 82px; padding: 22px; border-radius: 16px; }
.mm-page .mm-progress-art { width: 115px; height: 115px; }
.mm-page .mm-progress-rank { width: 82px; height: 82px; }
.mm-page .mm-game-tabs { border-bottom: 1px solid var(--line,rgba(255,255,255,.1)); gap: 5px; padding: 0; }
.mm-page .mm-game-tab { flex: 1; justify-content: center; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; padding: 11px 8px; }
.mm-page .mm-game-tab.active { background: transparent; border-bottom-color: #b99a58; color: var(--text,#f3f4f6); }
.mm-page .mm-mode-card { min-height: 95px; background: var(--panel2,#161b1e); }
.mm-page .mm-mode-card[data-queue-type="ranked"] { background: var(--panel2,#161b1e); }
@media (max-width: 640px) {
  .mm-page .mm-modal-card { padding: 0 0 16px; }
  .mm-page .mm-head-copy h2 { font-size: 1.2rem; }
  .mm-page .mm-game-progress { min-height: 135px; grid-template-columns: 66px minmax(0,1fr) 58px; gap: 9px; padding: 14px 11px; }
  .mm-page .mm-progress-art { width: 66px; height: 66px; }
  .mm-page .mm-progress-rank { width: 58px; height: 58px; }
  .mm-page .mm-mode-card { min-height: 91px; }
}
