/* NitroPlayer online match bar (MP / MATCHMAKING). Used by mp.js (board games) and race.js (races). Uses site tokens from style.css. */
.np-mp-bar { position: relative; display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; min-width: 0; max-width: 100%; }

.np-mp-panel { background: var(--bg-card, #fff); border: 1px solid var(--border, #e1ded3); border-radius: var(--r, 14px);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-1, none); min-width: 0; transition: box-shadow .2s, border-color .2s; }
.np-mp-panel:empty, .np-mp-panel[hidden] { display: none; }
.np-mp-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.np-mp-row .btn { min-height: 40px; }
.np-mp-sub { font-size: 13px; color: var(--text-dim, #565a72); }
.np-mp-wait { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.np-mp-wait-t { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; color: var(--text, #12142a); text-align: center; }
.np-mp-local { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }

/* Searching: animated radar dots */
.np-mp-search { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; }
.np-mp-search-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.np-mp-search-t b { font-size: 15px; color: var(--text, #12142a); }
.np-mp-radar { position: relative; width: 36px; height: 36px; flex: none; }
.np-mp-radar span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent, #3e7d00); opacity: 0; animation: np-mp-ping 1.8s ease-out infinite; }
.np-mp-radar span:nth-child(2) { animation-delay: .6s; }
.np-mp-radar span:nth-child(3) { animation-delay: 1.2s; }
.np-mp-radar::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent, #3e7d00); }
@keyframes np-mp-ping { 0% { transform: scale(.25); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.np-mp-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong, #cfcbbd); border-top-color: var(--accent, #3e7d00);
  animation: np-mp-spin .8s linear infinite; flex: none; }
@keyframes np-mp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .np-mp-radar span { animation-duration: 4s; } .np-mp-spin { animation-duration: 2.4s; } }

/* Board dimmed while we look for an opponent; the compact card sits INSIDE the board area (.np-mm-ov) */
.game-area.np-mm-wait { position: relative; }
.game-area.np-mm-wait > *:not(.np-mm-ov) { opacity: .4; filter: saturate(.6); pointer-events: none; transition: opacity .2s; }
.np-mm-ov { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 10px; }
.game-area:not(.np-mm-wait) > .np-mm-ov { display: none; }
.np-mm-card { width: 100%; max-width: 340px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  background: var(--bg-card, #fff); color: var(--text, #12142a); border: 1px solid var(--border, #e1ded3); border-radius: var(--r, 14px); box-shadow: var(--shadow-2, 0 8px 28px rgba(0,0,0,.18)); }
.np-mm-card .np-mp-search { justify-content: flex-start; }
.np-mm-card .np-mp-row .btn { flex: 1 1 130px; }
.np-mm-q { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.np-mm-q b { font-size: 16px; }
.np-mp-search-t, .np-mp-sub { min-width: 0; overflow-wrap: break-word; }
/* Two-option card: Play online / Play with a friend (+ "Play solo" link on races) */
.np-mm-choose { display: flex; flex-direction: column; gap: 8px; }
.np-mm-opt { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 14px; text-align: left; cursor: pointer;
  border-radius: var(--r, 14px); border: 1px solid var(--border, #e1ded3); background: var(--bg-panel, #eceae2); color: var(--text, #12142a); font: inherit;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .12s, box-shadow .12s; }
.np-mm-opt:hover { box-shadow: var(--shadow-1, 0 2px 8px rgba(0,0,0,.12)); }
.np-mm-opt:active { transform: scale(.98); }
.np-mm-opt:focus-visible { outline: 3px solid var(--accent, #3e7d00); outline-offset: 2px; }
.np-mm-opt.is-main { background: var(--volt, #d4ff3a); color: var(--volt-ink, #0e1020); border-color: transparent; }
.np-mm-ic { width: 38px; height: 38px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(14,16,32,.08); }
.np-mm-ot { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.np-mm-ot b { font-size: 16px; line-height: 1.2; }
.np-mm-ot small { font-size: 13px; line-height: 1.25; opacity: .78; }
.np-mm-note { font-size: 13px; text-align: center; color: var(--text-dim, #565a72); overflow-wrap: break-word; }
.np-mm-solo { appearance: none; align-self: center; background: none; border: 0; padding: 4px 10px; min-height: 32px; cursor: pointer;
  color: var(--text-dim, #565a72); font: 600 13px/1 var(--font-body, system-ui); text-decoration: underline; text-underline-offset: 3px; }
.np-mm-solo:hover { color: var(--text, #12142a); }
@media (max-height: 500px) {
  .np-mm-ov { padding: 6px; }
  .np-mm-card { padding: 10px; gap: 6px; }
  .np-mm-card .np-mp-radar { width: 26px; height: 26px; }
  .np-mm-card .np-mp-search { min-height: 30px; }
  .np-mm-card .np-mp-row .btn { min-height: 36px; }
  .np-mm-opt { min-height: 46px; padding: 7px 12px; gap: 10px; }
  .np-mm-ic { width: 30px; height: 30px; }
  .np-mm-ic svg { width: 18px; height: 18px; }
  .np-mm-ot b { font-size: 15px; }
  .np-mm-solo { min-height: 26px; padding: 2px 8px; }
}
@media (max-height: 500px) and (min-width: 600px) {
  .np-mm-card { max-width: 520px; }
  .np-mm-choose { flex-direction: row; }
  .np-mm-opt { flex: 1 1 0; }
}

.np-mp-share { display: flex; gap: 6px; width: 100%; flex-wrap: wrap; }
.np-mp-link { flex: 1 1 180px; min-width: 0; min-height: 40px; padding: 8px 10px; border-radius: var(--r-sm, 8px); border: 1px solid var(--border, #e1ded3);
  background: var(--bg, #f3f2ec); color: var(--text, #12142a); font: 13px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Players */
.np-mp-vs { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.np-mp-vs-x { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted, #8a8da3); }
.np-mp-chip { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; flex: 0 1 auto; min-width: 0;
  background: var(--bg-panel, #eceae2); border: 1px solid var(--border, #e1ded3); color: var(--text, #12142a); max-width: 100%; }
.np-mp-chip.is-you { background: var(--accent-soft, #eaf8c9); }
.np-mp-chip.is-empty { padding: 8px 12px; color: var(--text-dim, #565a72); }
.np-mp-av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--ink-3, #232848); color: #fff; font-size: 16px; font-weight: 700; }
.np-mp-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.np-mp-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-mp-name a { color: inherit; text-decoration: none; }
.np-mp-name a:hover { text-decoration: underline; }
.np-mp-meta { font-size: 11px; font-weight: 600; color: var(--text-muted, #8a8da3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-mp-side { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--bg-card, #fff); color: var(--text-dim, #565a72); border: 1px solid var(--border, #e1ded3); }
.np-mp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted, #8a8da3); flex: none; }
.np-mp-dot.is-on { background: var(--green, #1f9d55); box-shadow: 0 0 0 3px rgba(31,157,85,.18); }

/* Emote bubble above a chip */
.np-mp-bubble { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 25; white-space: nowrap;
  background: var(--ink, #0e1020); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 12px; pointer-events: none;
  box-shadow: var(--shadow-2, 0 4px 14px rgba(0,0,0,.2)); }
.np-mp-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink, #0e1020); }
.np-mp-bubble[hidden] { display: none; }
.np-mp-bubble.is-in { animation: np-mp-pop .25s ease-out; }
@keyframes np-mp-pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.np-mp-vs .np-mp-chip.is-you .np-mp-bubble { left: 24px; transform: none; }
.np-mp-vs .np-mp-chip.is-you .np-mp-bubble.is-in { animation-name: np-mp-pop2; }
.np-mp-vs .np-mp-chip.is-you .np-mp-bubble::after { left: 16px; }
@keyframes np-mp-pop2 { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Quick chat (emotes) */
.np-mp-emote { position: static; display: inline-flex; }
.np-mp-panel { position: relative; }
.np-mp-emote-btn { min-width: 40px; padding: 0 10px; }
/* anchored to the panel (not the button) so it never leaves the screen on phones */
.np-mp-tray { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 30; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  padding: 8px; border-radius: var(--r, 14px); background: var(--bg-card, #fff); border: 1px solid var(--border, #e1ded3); box-shadow: var(--shadow-2, 0 6px 20px rgba(0,0,0,.18)); }
.np-mp-tray[hidden] { display: none; }
.np-mp-em { appearance: none; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border, #e1ded3); background: var(--bg-panel, #eceae2);
  color: var(--text, #12142a); font: 700 13px/1 var(--font-body, system-ui); cursor: pointer; touch-action: manipulation; }
.np-mp-em:hover, .np-mp-em:focus-visible { background: var(--accent-soft, #eaf8c9); outline: none; }

/* Turn / status */
.np-mp-play { justify-content: flex-start; }
.np-mp-play .btn[data-a="resign"] { margin-left: auto; }
.np-mp-turn { font-weight: 700; padding: 8px 12px; border-radius: 999px; background: var(--bg-panel, #eceae2); color: var(--text-dim, #565a72); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.np-mp-turn.is-mine { background: var(--volt, #d4ff3a); color: var(--volt-ink, #0e1020); animation: np-mp-turn 1.6s ease-in-out 2; }
@keyframes np-mp-turn { 50% { box-shadow: 0 0 0 6px rgba(212,255,58,.35); } }
.np-mp-bar.is-myturn .np-mp-panel { border-color: var(--accent, #3e7d00); box-shadow: 0 0 0 2px var(--accent-soft, #eaf8c9), var(--shadow-1, none); }
.np-mp-bar.is-sending .np-mp-turn { opacity: .6; }
.np-mp-conn { font-size: 12px; color: var(--text-muted, #8a8da3); }
.np-mp-conn:empty { display: none; }
.np-mp-conn.is-warn { color: var(--gold, #e9a400); }
.np-mp-conn.is-bad { color: var(--red, #e23d4b); }
.np-mp-result { font-size: 15px; color: var(--text-dim, #565a72); text-align: center; }
.np-mp-result b { font-size: 18px; color: var(--text, #12142a); margin-right: 4px; }
.np-mp-result.is-win b { color: var(--accent, #3e7d00); }
.np-mp-result.is-loss b { color: var(--red, #e23d4b); }
.np-mp-more { margin-top: -4px; }

.np-mp-toast { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); z-index: 30; background: var(--ink, #0e1020); color: #fff;
  font-size: 13px; padding: 8px 12px; border-radius: var(--r-sm, 8px); box-shadow: var(--shadow-2, none); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.np-mp-toast[hidden] { display: none; }

/* Claim the win when the opponent disconnected */
.np-mp-claim:empty { display: none; }

/* Incoming challenge */
.np-mp-invite[hidden] { display: none; }
.np-mp-inv { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 14px;
  border-radius: var(--r, 14px); background: var(--accent-soft, #eaf8c9); border: 1px solid var(--accent, #3e7d00); color: var(--text, #12142a); font-size: 14px; }

.np-mp-bar button, .np-mp-bar a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

@media (max-width: 560px) {
  .np-mp-panel { padding: 8px; gap: 8px; }
  .np-mp-vs { gap: 4px; }
  .np-mp-chip { gap: 6px; padding: 3px 8px 3px 3px; }
  .np-mp-av { width: 28px; height: 28px; font-size: 14px; }
  .np-mp-name { font-size: 13px; }
  .np-mp-row { gap: 6px; }
  .np-mp-row .btn { padding: 0 12px; }
  .np-mp-turn { padding: 8px 10px; font-size: 13px; }
}
@media (max-width: 380px) {
  .np-mp-meta { font-size: 10px; }
  .np-mp-vs-x { display: none; }
}

/* The AI companion panel is hidden during online matches (ai-companion.js adds the class) */
#np-companion.np-companion--online { display: none !important; }
