/* =========================================================
   SCORCHED DIVIDE — ONLINE PLAY: opponent switch + matchmaking
   ========================================================= */

/* ---------- Home: Online player / AI switch ---------- */
.mm-mode-opts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 3px;
    gap: 3px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 5px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#main-menu .mm-mode-opt {
    padding: 8px 10px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: var(--haze);
    font-family: var(--display);
    font-weight: 700;
    font-size: 17px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
}

#main-menu .mm-mode-opt:hover { color: var(--bone); }

#main-menu .mm-mode-opt.active {
    background: rgba(232, 226, 212, 0.12);
    color: var(--bone);
    box-shadow: inset 0 -2px 0 var(--amber);
}

.mm-online-note {
    display: none;
    margin: 0;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 13px;
    color: var(--haze);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mm-online-note b { color: var(--bone); font-weight: 600; }

#main-menu[data-mode="online"] .mm-intel { display: none; }
#main-menu[data-mode="online"] .mm-online-note { display: block; }

@media (max-height: 760px) and (min-width: 1021px) {
    #main-menu .mm-mode-opt { padding: 6px 8px; font-size: 15px; }
}

@media (max-height: 500px) and (min-width: 640px) {
    .mm-online-note { display: none !important; }
}

/* ---------- Matchmaking overlay ---------- */
.mp-overlay {
    position: fixed;
    inset: 0;
    z-index: 280;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 11, 15, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: 'Barlow', 'Chakra Petch', system-ui, sans-serif;
    color: #e8e2d4;
}

.mp-overlay.hidden { display: none !important; }
.mp-overlay, .mp-overlay * { touch-action: manipulation; }

.mp-panel {
    width: min(440px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px 26px 24px;
    background: #0f151c;
    border: 1px solid rgba(232, 226, 212, 0.16);
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.mp-radar {
    position: relative;
    width: 84px;
    height: 84px;
    margin-bottom: 6px;
    border-radius: 50%;
    border: 2px solid rgba(242, 169, 0, 0.55);
    background:
        radial-gradient(circle, rgba(242, 169, 0, 0.18) 0 2px, transparent 3px),
        repeating-radial-gradient(circle, transparent 0 13px, rgba(242, 169, 0, 0.18) 13px 14px);
    overflow: hidden;
}

.mp-radar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(242, 169, 0, 0.55), rgba(242, 169, 0, 0) 70deg, transparent 360deg);
    animation: mp-sweep 1.6s linear infinite;
}

.mp-overlay[data-state="found"] .mp-radar { border-color: #5bc27a; }
.mp-overlay[data-state="found"] .mp-radar::after { animation: none; background: rgba(91, 194, 122, 0.3); }
.mp-overlay[data-state="ai"] .mp-radar::after { animation: none; background: rgba(152, 162, 172, 0.2); }
.mp-overlay[data-state="ai"] .mp-radar { border-color: rgba(152, 162, 172, 0.6); }

@keyframes mp-sweep { to { transform: rotate(360deg); } }

.mp-title {
    margin: 0;
    font-family: 'Barlow Condensed', 'Chakra Petch', 'Arial Narrow', sans-serif;
    font-weight: 800;
    font-size: 30px;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.mp-detail {
    margin: 0;
    max-width: 34ch;
    font-size: 15px;
    line-height: 1.45;
    color: #98a2ac;
}

.mp-timer {
    margin: 2px 0 6px;
    font-family: 'Barlow Condensed', 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: #f2a900;
    font-variant-numeric: tabular-nums;
}

.mp-overlay:not([data-state="searching"]) .mp-timer { display: none; }

.mp-cancel {
    min-width: 140px;
    padding: 10px 18px;
    border: 1px solid rgba(232, 226, 212, 0.3);
    border-radius: 4px;
    background: transparent;
    color: #e8e2d4;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.mp-cancel:hover { border-color: #f2a900; color: #f2a900; }
.mp-cancel:focus-visible { outline: 2px solid #f2a900; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .mp-radar::after { animation: none; }
}


/* Above the loadout screen (z-index 400), which is where Start battle is pressed */
.mp-overlay { z-index: 450; }

/* Server unreachable: Play the AI / Back */
.mp-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
}

.mp-primary {
    min-width: 170px;
    padding: 10px 18px;
    border: 1px solid #f2a900;
    border-radius: 4px;
    background: #f2a900;
    color: #1a1406;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.mp-primary:hover { background: #ffbb24; border-color: #ffbb24; }
.mp-primary:focus-visible { outline: 2px solid #e8e2d4; outline-offset: 2px; }
.mp-primary[hidden], .mp-cancel[hidden] { display: none; }

.mp-overlay[data-state="offline"] .mp-radar { border-color: rgba(239, 106, 110, 0.6); }
.mp-overlay[data-state="offline"] .mp-radar::after { animation: none; background: rgba(239, 106, 110, 0.15); }
