/* ════════════════════════════════════════════════════════════════════════════
   mp-quiz.css — Multiplayer waiting room, voting, chat & quiz overlay
   Visual language mirrors trivia_master_enhanced.html (neumorphic, --ac accents).
   Everything is scoped under .mpq-overlay so it never clashes with the page.
   ════════════════════════════════════════════════════════════════════════════ */

.mpq-overlay {
  --mpq-bg:    var(--primary-bg, #e0e5ec);
  --mpq-ac:    var(--primary-accent, #6d5dfc);
  --mpq-ac2:   #5b0eeb;
  --mpq-text:  var(--text-dark, #3d3d3d);
  --mpq-ok:    #4ade80;
  --mpq-bad:   #f87171;
  --mpq-warn:  #fbbf24;
  --mpq-gold:  #ffd700;
  --mpq-no:    8px 8px 16px #c1c8d1, -8px -8px 16px #fff;
  --mpq-ni:    inset 5px 5px 10px #c1c8d1, inset -5px -5px 10px #fff;
  --mpq-ns:    4px 4px 10px #c1c8d1, -4px -4px 10px #fff;

  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 22, 34, 0.55);
  backdrop-filter: blur(6px);
  font-family: 'Poppins', sans-serif;
  color: var(--mpq-text);
  animation: mpqFade 0.25s ease;
}
@keyframes mpqFade { from { opacity: 0; } to { opacity: 1; } }

.mpq-panel {
  background: var(--mpq-bg);
  border-radius: 26px;
  box-shadow: var(--mpq-no);
  width: 100%;
  max-width: 980px;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: mpqPop 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mpqPop { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }

/* ── Shared header ── */
.mpq-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 26px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}
.mpq-head h2 {
  font-family: 'Montserrat', sans-serif; font-weight: 800;
  font-size: 1.35rem; color: var(--mpq-ac); margin: 0;
}
.mpq-head .mpq-sub { font-size: 0.82rem; opacity: 0.7; width: 100%; }
.mpq-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 40px;
  background: var(--mpq-bg); box-shadow: var(--mpq-ns);
  font-size: 12px; font-weight: 600;
}
.mpq-pill i { color: var(--mpq-ac); }
.mpq-pill--live { color: var(--mpq-bad); }
.mpq-spacer { margin-left: auto; }
.mpq-icon-btn {
  border: none; background: var(--mpq-bg); box-shadow: var(--mpq-ns);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  color: var(--mpq-text); font-size: 15px; transition: all .2s;
}
.mpq-icon-btn:hover { box-shadow: var(--mpq-no); transform: translateY(-2px); }

.mpq-body { padding: 22px 26px; overflow-y: auto; }

/* ════════ WAITING ROOM LAYOUT ════════ */
.mpq-wr-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
}
.mpq-card {
  background: var(--mpq-bg); border-radius: 20px;
  box-shadow: var(--mpq-ni); padding: 18px;
}
.mpq-card h3 {
  font-size: 0.95rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px;
}
.mpq-card h3 i { color: var(--mpq-ac); }

/* Player slots */
.mpq-players { display: flex; flex-wrap: wrap; gap: 14px; }
.mpq-player {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 86px; text-align: center;
}
.mpq-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--mpq-bg); box-shadow: var(--mpq-no);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; position: relative; transition: all .3s;
}
.mpq-avatar.is-empty { box-shadow: var(--mpq-ni); color: rgba(0,0,0,.25); font-size: 18px; }
.mpq-avatar.is-you   { outline: 3px solid var(--mpq-ac); outline-offset: 3px; }
.mpq-avatar .mpq-ready-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--mpq-ok); color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--mpq-bg); opacity: 0; transform: scale(0); transition: all .25s;
}
.mpq-avatar.is-ready .mpq-ready-dot { opacity: 1; transform: scale(1); }

/* ── Animated emoji reactions floating beside a player profile ── */
.mpq-avatar .mpq-react-layer {
  position: absolute; inset: 0;
  pointer-events: none; overflow: visible;
}
.mpq-react-float {
  position: absolute;
  left: 50%; top: -6px;
  font-size: 1.5rem; line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.25));
  transform: translate(-50%, 0);
  animation: mpqReactFloat 1.5s cubic-bezier(.22,.61,.36,1) forwards;
  z-index: 5;
}
@keyframes mpqReactFloat {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.3) rotate(-12deg); }
  18%  { opacity: 1; transform: translate(-50%, -14px) scale(1.25) rotate(6deg); }
  40%  { transform: translate(calc(-50% + var(--drift, 0px)), -34px) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift, 0px)), -62px) scale(.85) rotate(2deg); }
}
.mpq-player .mpq-pname { font-size: 0.72rem; font-weight: 600; max-width: 84px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mpq-player .mpq-ptag { font-size: 0.62rem; opacity: 0.6; }
@keyframes mpqJoin { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.mpq-avatar.just-joined { animation: mpqJoin 0.4s cubic-bezier(.34,1.56,.64,1); }

/* Countdown / status bar */
.mpq-status-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 0.8rem; }
.mpq-bar { height: 8px; border-radius: 8px; background: var(--mpq-bg); box-shadow: var(--mpq-ni); overflow: hidden; margin-top: 8px; }
.mpq-bar-fill { height: 100%; width: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--mpq-ac), var(--mpq-ac2)); transition: width 1s linear; }
.mpq-bar-fill.warn { background: linear-gradient(90deg, var(--mpq-warn), #f59e0b); }

/* ── Category voting ── */
.mpq-vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.mpq-vote-chip {
  position: relative; overflow: hidden;
  border: none; cursor: pointer; text-align: center;
  background: var(--mpq-bg); box-shadow: var(--mpq-ns);
  border-radius: 14px; padding: 10px 6px;
  font-family: 'Poppins', sans-serif; font-size: 0.72rem; font-weight: 600; color: var(--mpq-text);
  transition: all .2s;
}
.mpq-vote-chip:hover { transform: translateY(-2px); box-shadow: var(--mpq-no); }
.mpq-vote-chip .mpq-vc-emoji { display: block; font-size: 1.3rem; margin-bottom: 3px; }
.mpq-vote-chip.is-picked { box-shadow: var(--mpq-ni); color: var(--mpq-ac); }
.mpq-vote-tally {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--mpq-ac); transition: width .4s ease; width: 0;
}
.mpq-vote-count {
  position: absolute; top: 4px; right: 5px;
  font-size: 0.62rem; background: var(--mpq-ac); color: #fff;
  border-radius: 10px; padding: 0 5px; min-width: 16px; opacity: 0; transition: opacity .2s;
}
.mpq-vote-count.show { opacity: 1; }
.mpq-diff-row { display: flex; gap: 8px; margin-top: 12px; }
.mpq-diff-btn {
  flex: 1; border: none; cursor: pointer; border-radius: 12px; padding: 9px;
  background: var(--mpq-bg); box-shadow: var(--mpq-ns); font-weight: 600; font-size: 0.78rem;
  color: var(--mpq-text); transition: all .2s;
}
.mpq-diff-btn.is-picked { box-shadow: var(--mpq-ni); color: var(--mpq-ac); }

/* ── Chat ── */
.mpq-chat { display: flex; flex-direction: column; height: 100%; min-height: 230px; }
.mpq-chat-log {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 7px;
  padding: 4px 6px 4px 0; max-height: 260px;
}
.mpq-msg { font-size: 0.78rem; line-height: 1.35; }
.mpq-msg .mpq-msg-who { font-weight: 700; color: var(--mpq-ac); margin-right: 5px; }
.mpq-msg.is-system { opacity: 0.6; font-style: italic; font-size: 0.72rem; }
.mpq-msg.is-you .mpq-msg-who { color: var(--mpq-ac2); }
.mpq-chat-input { display: flex; gap: 8px; margin-top: 10px; }
.mpq-chat-input input {
  flex: 1; border: none; border-radius: 12px; padding: 10px 14px;
  background: var(--mpq-bg); box-shadow: var(--mpq-ni); font-family: inherit;
  color: var(--mpq-text); font-size: 0.82rem; outline: none;
}
.mpq-chat-input button {
  border: none; cursor: pointer; border-radius: 12px; padding: 0 16px;
  background: var(--mpq-ac); color: #fff; box-shadow: var(--mpq-ns); font-size: 0.85rem;
}

/* ── Emoji reaction bar (Quick Match) — pill of glossy round reactions ── */
.mpq-react-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
  justify-content: center;
  padding: 8px;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(109,93,252,.10), rgba(91,14,235,.04));
  box-shadow: var(--mpq-ni);
}
.mpq-react-btn {
  border: none; cursor: pointer; border-radius: 50%;
  width: 40px; height: 40px; padding: 0; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--mpq-bg); box-shadow: var(--mpq-ns);
  font-size: 1.2rem;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  position: relative;
}
.mpq-react-btn::after {
  /* soft glossy highlight on top of the button */
  content: ''; position: absolute; inset: 3px 3px auto 3px; height: 38%;
  border-radius: 50% 50% 40% 40%;
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
  pointer-events: none; opacity: .7;
}
.mpq-react-btn:hover {
  transform: translateY(-3px) scale(1.18) rotate(-4deg);
  box-shadow: var(--mpq-no);
}
.mpq-react-btn:active { transform: scale(.86); box-shadow: var(--mpq-ni); }
/* tactile pop when clicked (toggled from JS) */
.mpq-react-btn.pop { animation: mpqReactPop .35s cubic-bezier(.34,1.56,.64,1); }
@keyframes mpqReactPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.35) rotate(8deg); }
  100% { transform: scale(1); }
}

/* ── Footer actions ── */
.mpq-foot {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  padding: 18px 26px; border-top: 1px solid rgba(0,0,0,0.06);
}
.mpq-btn {
  border: none; cursor: pointer; font-family: 'Poppins', sans-serif; font-weight: 600;
  border-radius: 14px; padding: 12px 22px; font-size: 0.9rem;
  background: var(--mpq-bg); box-shadow: var(--mpq-no); color: var(--mpq-text);
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.mpq-btn:hover:not(:disabled) { transform: translateY(-2px); }
.mpq-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mpq-btn--primary { background: var(--mpq-ac); color: #fff; box-shadow: 0 6px 18px rgba(109,93,252,.4); }
.mpq-btn--ok { background: var(--mpq-ok); color: #06381c; }
.mpq-btn--danger { background: var(--mpq-bad); color: #fff; }

/* ════════ QUIZ SCREEN (enhanced style) ════════ */
.mpq-quiz-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }

.mpq-qcard { background: var(--mpq-bg); border-radius: 22px; box-shadow: var(--mpq-no); padding: 22px; }
.mpq-qtop { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* circular timer */
.mpq-ring { position: relative; width: 58px; height: 58px; flex-shrink: 0; }
.mpq-ring svg { transform: rotate(-90deg); width: 58px; height: 58px; }
.mpq-ring .t-bg { fill: none; stroke: rgba(0,0,0,.08); stroke-width: 6; }
.mpq-ring .t-arc { fill: none; stroke: var(--mpq-ac); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke .3s; }
.mpq-ring.low .t-arc { stroke: var(--mpq-bad); }
.mpq-ring .t-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; }

.mpq-qbadge, .mpq-qround {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 30px;
  background: var(--mpq-bg); box-shadow: var(--mpq-ni); font-size: 0.78rem; font-weight: 600;
}
.mpq-qimg-wrap {
  width: 100%; height: 200px; border-radius: 16px; overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--mpq-ni); display: none; position: relative; background: rgba(109,93,252,.05);
}
.mpq-qimg-wrap.show { display: block; }
.mpq-qimg-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.mpq-qimg-wrap img.in { opacity: 1; }

.mpq-qtext { font-size: 1.18rem; font-weight: 600; line-height: 1.45; margin-bottom: 18px; }
.mpq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mpq-opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: none; cursor: pointer; border-radius: 14px; padding: 15px 16px;
  background: var(--mpq-bg); box-shadow: var(--mpq-no); color: var(--mpq-text);
  font-family: 'Poppins', sans-serif; font-size: 0.92rem; transition: all .2s;
}
.mpq-opt:hover:not(:disabled) { transform: translateY(-2px); }
.mpq-opt:disabled { cursor: default; }
.mpq-opt .mpq-ltr {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--mpq-bg); box-shadow: var(--mpq-ni);
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--mpq-ac);
}
.mpq-opt.correct { box-shadow: 0 0 0 2px var(--mpq-ok), var(--mpq-ns); }
.mpq-opt.correct .mpq-ltr { background: var(--mpq-ok); color: #fff; }
.mpq-opt.wrong   { box-shadow: 0 0 0 2px var(--mpq-bad), var(--mpq-ns); }
.mpq-opt.wrong .mpq-ltr { background: var(--mpq-bad); color: #fff; }
.mpq-opt.dim { opacity: .45; }

.mpq-progress { display: flex; align-items: center; gap: 12px; margin-top: 18px; font-size: 0.78rem; opacity: 0.8; }
.mpq-progress .mpq-pbar { flex: 1; height: 7px; border-radius: 7px; background: var(--mpq-bg); box-shadow: var(--mpq-ni); overflow: hidden; }
.mpq-progress .mpq-pfill { height: 100%; background: linear-gradient(90deg, var(--mpq-ac), var(--mpq-ac2)); transition: width .4s; }

.mpq-expl { margin-top: 16px; padding: 14px 16px; border-radius: 14px; box-shadow: var(--mpq-ni);
  font-size: 0.85rem; line-height: 1.5; display: none; }
.mpq-expl.show { display: block; animation: mpqFade .3s ease; }
.mpq-expl .mpq-expl-head { font-weight: 700; margin-bottom: 5px; }
.mpq-expl.ok  .mpq-expl-head { color: var(--mpq-ok); }
.mpq-expl.bad .mpq-expl-head { color: var(--mpq-bad); }

/* Live scoreboard sidebar */
.mpq-side { display: flex; flex-direction: column; gap: 16px; }
.mpq-board { background: var(--mpq-bg); border-radius: 20px; box-shadow: var(--mpq-ni); padding: 16px; }
.mpq-board h3 { font-size: 0.9rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.mpq-board h3 i { color: var(--mpq-gold); }
.mpq-rank { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; transition: all .3s; }
.mpq-rank.is-you { box-shadow: var(--mpq-ns); }
.mpq-rank .mpq-rk-pos { width: 22px; font-weight: 800; opacity: 0.6; font-size: 0.85rem; }
.mpq-rank .mpq-rk-av { width: 30px; height: 30px; border-radius: 50%; background: var(--mpq-bg);
  box-shadow: var(--mpq-ns); display: flex; align-items: center; justify-content: center; font-size: 15px;
  position: relative; }
.mpq-rank .mpq-rk-name { flex: 1; font-size: 0.82rem; font-weight: 600; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.mpq-rank .mpq-rk-score { font-weight: 800; color: var(--mpq-ac); font-size: 0.9rem; }
.mpq-rank.answered { animation: mpqPing .4s ease; }
@keyframes mpqPing { 50% { transform: scale(1.04); } }

/* compact in-quiz chat */
.mpq-side .mpq-chat { min-height: 0; }
.mpq-side .mpq-chat-log { max-height: 150px; }

/* ── Results ── */
.mpq-results { text-align: center; }
.mpq-results .mpq-trophy { font-size: 3.4rem; margin-bottom: 6px; }
.mpq-results h2 { font-family: 'Montserrat', sans-serif; color: var(--mpq-ac); margin-bottom: 4px; }
.mpq-final-board { margin: 18px auto 0; max-width: 480px; }
.mpq-final-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 8px;
  border-radius: 14px; box-shadow: var(--mpq-ns); }
.mpq-final-row.is-you { box-shadow: var(--mpq-no); }
.mpq-final-row.gold { background: linear-gradient(135deg, rgba(255,215,0,.18), rgba(255,215,0,.05)); }
.mpq-final-row .mpq-fr-medal { font-size: 1.3rem; width: 30px; }
.mpq-final-row .mpq-fr-name { flex: 1; text-align: left; font-weight: 600; }
.mpq-final-row .mpq-fr-score { font-weight: 800; color: var(--mpq-ac); }

/* ════════ RESPONSIVE ════════ */
@media (max-width: 880px) {
  .mpq-wr-grid, .mpq-quiz-grid { grid-template-columns: 1fr; }
  .mpq-side { flex-direction: row; flex-wrap: wrap; }
  .mpq-side .mpq-board { flex: 1; min-width: 220px; }
}
@media (max-width: 560px) {
  .mpq-body { padding: 16px; }
  .mpq-head { padding: 16px; }
  .mpq-foot { padding: 14px 16px; }
  .mpq-opts { grid-template-columns: 1fr; }
  .mpq-qtext { font-size: 1.05rem; }
  .mpq-player { width: 72px; }
  .mpq-avatar { width: 52px; height: 52px; font-size: 22px; }
  .mpq-side { flex-direction: column; }
  .mpq-btn { padding: 11px 16px; font-size: 0.84rem; }
}

/* ════════════════════════════════════════════════════════════
   PRIVATE ROOM: host Kick button, Host tag, join-request prompt,
   and the kicked/closed notice panel.
   ════════════════════════════════════════════════════════════ */
.mpq-player { position: relative; }
.mpq-kick-btn {
  position: absolute; top: -4px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--mpq-bad); color: #fff; font-size: 11px;
  box-shadow: var(--mpq-ns);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, filter .15s ease;
}
.mpq-kick-btn:hover { transform: scale(1.12); filter: brightness(1.05); }
.mpq-ptag.is-host-tag { color: var(--mpq-ac); opacity: 0.95; font-weight: 700; }

/* Join-request prompt (host accepts/denies a returning player) */
.mpq-joinreq {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; padding: 14px;
  z-index: 5; animation: mpqJoin 0.25s ease;
}
.mpq-joinreq-card {
  background: var(--mpq-bg); box-shadow: var(--mpq-no);
  border-radius: 16px; padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  max-width: 90%;
}
.mpq-joinreq-text { font-size: 0.9rem; }
.mpq-joinreq-actions { display: flex; gap: 10px; }

/* Notice panel that replaces the room when kicked / closed */
.mpq-notice-panel { text-align: center; padding: 40px 30px; }
.mpq-notice-icon { font-size: 56px; margin-bottom: 10px; }
.mpq-notice-panel h2 { margin: 0 0 8px; color: var(--mpq-text); }
.mpq-notice-panel p  { margin: 0 0 20px; opacity: 0.75; }
