/* Quest multiplayer: the world side panel (chat, who is online, scores), the CHAT button
   and the name tags / chat bubbles over the game. Markup is built by js/mp.js into slots
   that quest.php provides (#btnChat, #mpTags). Same palette as the site nav. */
:root { --mp-w: 320px; }   /* PANEL_W in js/mp.js */

/* A display rule must never beat the hidden attribute (a stuck overlay once shipped on /city that way). */
.mp-panel [hidden], .mp-tags [hidden], .btn-chat[hidden] { display: none !important; }

/* ---- panel: docked beside the game from 1000px, a drawer over it below ---------------- */
.mp-panel {
  position: fixed;
  top: var(--site-nav-h, 0px);
  right: 0;
  bottom: 0;
  z-index: 900;                                   /* under the sticky site nav (1000) */
  width: var(--mp-w);
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: rgba(14, 14, 18, .97);
  border-left: 1px solid #242428;
  box-shadow: -14px 0 34px rgba(0, 0, 0, .5);
  color: #eaeaea;
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
}
.mp-panel.open { transform: none; visibility: visible; transition: transform .22s ease; }

@media (min-width: 1000px) {
  .mp-open .frame { padding-right: calc(var(--mp-w) + 10px); }
  .mp-panel { box-shadow: none; }
}
@media (max-width: 999px) {
  .mp-panel { width: min(360px, 100vw); }
}

.mp-panel button { font-family: inherit; }

.mp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid #1f1f24;
}
.mp-title {
  margin: 0;
  font: 400 19px/1 Righteous, cursive;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #ef50d5, #15f0f2, #f2a415);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.mp-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #9a9aa2;
}
.mp-online i { width: 7px; height: 7px; border-radius: 50%; background: #5be37d; box-shadow: 0 0 6px #5be37d; }
.mp-online.off i { background: #55555c; box-shadow: none; }
.mp-online b { color: #eaeaea; font-weight: 600; }
.mp-x {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid #3a3a40;
  border-radius: 50%;
  background: transparent;
  color: #9a9aa2;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.mp-x:hover { color: #eaeaea; border-color: #15f0f2; }

.mp-me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  padding: 9px 12px 7px;
  font-size: 12px;
  color: #9a9aa2;
}
.mp-ini, .mp-ini-in {
  font: 700 13px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 2px;
  background: #1b1b21;
  border: 1px solid #3a3a40;
  border-radius: 5px;
  padding: 5px 7px 4px 9px;
}
.mp-ini { cursor: pointer; }
.mp-ini:hover { border-color: #15f0f2; box-shadow: 0 0 8px rgba(21, 240, 242, .25); }
.mp-ini-in { width: 62px; color: #eaeaea; text-transform: uppercase; }
.mp-ini-in:focus { outline: none; border-color: #15f0f2; }
.mp-ini-form { display: flex; gap: 6px; align-items: center; }
.mp-hint { font-size: 11px; color: #6c6c74; }
.mp-me > span:first-child { white-space: nowrap; }
.mp-mini {
  background: transparent;
  border: 1px solid #3a3a40;
  border-radius: 999px;
  color: #9a9aa2;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 10px;
  cursor: pointer;
}
.mp-mini:hover { color: #eaeaea; border-color: #15f0f2; }
.mp-note {
  margin: 0 12px 8px;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(65, 40, 117, .35);
  border: 1px solid rgba(154, 108, 255, .4);
  font-size: 12px;
}

.mp-tabs { display: flex; gap: 20px; padding: 0 12px; border-bottom: 1px solid #1f1f24; }
.mp-tab {
  position: relative;
  background: none;
  border: 0;
  padding: 9px 0 8px;
  color: #9a9aa2;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
}
.mp-tab:hover, .mp-tab[aria-selected="true"] { color: #eaeaea; }
.mp-tab::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, #ef50d5, #15f0f2, #f2a415);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
.mp-tab[aria-selected="true"]::after { transform: scaleX(1); }

.mp-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: #3a3a40 transparent;
}

/* ---- chat ------------------------------------------------------------------------------ */
.mp-live-note {
  margin: 8px 12px 0;
  padding: 6px 9px;
  border: 1px dashed #3a3a40;
  border-radius: 6px;
  color: #9a9aa2;
  font-size: 11px;
  line-height: 1.4;
}
.mp-live-note b { color: #eaeaea; font-weight: 600; }
.mp-msg { padding: 3px 0; overflow-wrap: anywhere; }
.mp-time { color: #55555c; font-size: 10px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.mp-chip { font: 700 12px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; margin-right: 6px; }
.mp-text { unicode-bidi: isolate; color: #d6d6dc; }
/* JMP: the verified site owner (only the server can hand those initials out) */
.mp-owner { color: #f2a415; text-shadow: 0 0 8px rgba(242, 164, 21, .35); }
.mp-check {
  display: inline-block;
  margin-left: 3px;
  padding: 0 3px;
  border-radius: 3px;
  background: #f2a415;
  color: #131313;
  font: 700 9px/13px -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0;
  vertical-align: 1px;
  text-shadow: none;
}
.mp-msg.mine .mp-text { color: #fff; }
.mp-sys { color: #f2a415; font-size: 12px; }
.mp-local { color: #15f0f2; }

.mp-say {
  position: relative;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 10px 12px 12px;
  border-top: 1px solid #1f1f24;
}
.mp-input {
  flex: 1;
  min-width: 0;
  background: #1b1b21;
  border: 1px solid #3a3a40;
  border-radius: 999px;
  padding: 9px 38px 9px 13px;
  color: #eaeaea;
  font: inherit;
}
.mp-input::placeholder { color: #6c6c74; }
.mp-input:focus { outline: none; border-color: #15f0f2; box-shadow: 0 0 10px rgba(21, 240, 242, .22); }
.mp-input:disabled { opacity: .55; }
.mp-count { position: absolute; right: 62px; font-size: 10px; color: #9a9aa2; font-variant-numeric: tabular-nums; }
.mp-send {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #3a3a40;
  background: #232328;
  color: #15f0f2;
  font-size: 14px;
  cursor: pointer;
}
.mp-send:hover { border-color: #15f0f2; box-shadow: 0 0 10px rgba(21, 240, 242, .3); }
.mp-status { margin: 0; padding: 0 12px 12px; font-size: 11px; color: #9a9aa2; }

/* ---- owner moderation (the controls exist only while the owner session lives) ---------- */
.mp-modding .mp-msg:not(.mp-local) { cursor: pointer; border-radius: 4px; }
.mp-modding .mp-msg:not(.mp-local):hover { background: rgba(255, 255, 255, .05); }
.mp-act { display: flex; flex-wrap: wrap; gap: 6px; margin: 3px 0 8px; padding: 6px; border-radius: 6px;
  background: #1b1b21; border: 1px solid #3a3a40; }
.mp-mini.bad { color: #ff8a8a; border-color: rgba(255, 138, 138, .45); }
.mp-mini.bad:hover { color: #ffd0d0; border-color: #ff8a8a; }
.mp-link { margin-left: auto; padding: 0; border: 0; background: none; color: #9a9aa2; font-size: 11px;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.mp-link:hover { color: #15f0f2; }
.mp-notice {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(242, 164, 21, .5);
  background: #232328; font-size: 15px; cursor: pointer;
}
.mp-notice:hover { box-shadow: 0 0 10px rgba(242, 164, 21, .35); }
.mp-bans h3 { margin: 14px 0 4px; font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #9a9aa2; }
.mp-people li .mp-mini { margin-left: auto; }
.mp-people li em + .mp-mini { margin-left: 8px; }
.mp-rows.mod li { grid-template-columns: 20px 44px 1fr auto 18px; }
.mp-del { padding: 0; border: 0; background: none; color: #6c6c74; font-size: 11px; cursor: pointer; }
.mp-del:hover { color: #ff8a8a; }

/* ---- online / scores ------------------------------------------------------------------- */
.mp-people { list-style: none; margin: 0; padding: 0; }
.mp-people li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #1a1a1f; color: #b5b5bd; }
.mp-people em { margin-left: auto; font-style: normal; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #15f0f2; }
.mp-foot { margin: 8px 0; color: #6c6c74; font-size: 12px; }

.mp-game { margin: 4px 0 16px; }
.mp-game h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 6px;
  font: 400 15px/1.2 Righteous, cursive;
  letter-spacing: 1px;
}
.mp-game h3 small {
  font: 500 10px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6c6c74;
}
.mp-rows { list-style: none; margin: 0; padding: 0; }
.mp-rows li {
  display: grid;
  grid-template-columns: 20px 44px 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding: 3px 4px;
  border-radius: 4px;
  font-size: 12px;
}
.mp-rows li.mine { background: rgba(21, 240, 242, .08); }
.mp-rank { color: #6c6c74; text-align: right; font-variant-numeric: tabular-nums; }
.mp-rows li:first-child .mp-rank { color: #f2a415; }
.mp-score { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-ago { color: #55555c; font-size: 10px; }

/* ---- inside the game shell --------------------------------------------------------------- */
.btn-chat {
  position: absolute;
  top: 6px;
  right: 54px;                                    /* beside .btn-view */
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 10, 14, .78);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  color: var(--cyan, #15f0f2);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  cursor: pointer;
  transition: box-shadow .2s;
}
.btn-view[hidden] + .btn-chat { right: 6px; }
.btn-chat:hover { box-shadow: 0 0 10px rgba(21, 240, 242, .4); }
.btn-chat .mp-n { color: #eaeaea; font-weight: 600; letter-spacing: 0; }
.btn-chat .mp-unread { background: #ef50d5; color: #fff; border-radius: 999px; font-size: 9px; letter-spacing: 0; padding: 1px 5px; }
/* phones draw the game at 1x (240 px), too narrow for the BADGES pill and two buttons in one
   row: an icon button under the 3D one */
@media (max-width: 505px) {
  .btn-chat { top: 32px; right: 6px; gap: 4px; padding: 4px 7px; }
  .btn-view[hidden] + .btn-chat { top: 6px; }
  .btn-chat > span:first-child { display: none; }
  .btn-chat::before { content: '\1F4AC'; letter-spacing: 0; }
}

.mp-tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mp-tag { position: absolute; left: 0; top: 0; will-change: transform; }
.mp-tag-in { display: flex; flex-direction: column; align-items: center; gap: 3px; transform-origin: 50% 100%; }
.mp-name {
  font: 700 10px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 1px;
  padding: 2px 4px 1px 5px;
  border-radius: 3px;
  background: rgba(10, 10, 14, .74);
  white-space: nowrap;
  text-shadow: 0 1px 0 #000;
}
.mp-name.owner { color: #131313; background: linear-gradient(90deg, #f2a415, #ffd23f); text-shadow: none; }
.mp-bubble {
  max-width: 150px;
  padding: 4px 7px;
  background: #f6f2e8;                            /* the game's dialog box */
  color: #1c1c1f;
  border: 2px solid #1c1c1f;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px #8f86c9;
  font: 11px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow-wrap: anywhere;
  unicode-bidi: isolate;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.diorama .btn-chat, .diorama .mp-tags, .diorama .mp-panel { display: none !important; }

@media (pointer: coarse) {
  .mp-input, .mp-ini-in { font-size: 16px; }      /* iOS zooms into smaller inputs */
}
@media (prefers-reduced-motion: reduce) {
  .mp-panel, .mp-panel.open, .mp-tab::after { transition: none; }
}
