/* 🕵️ Mystery Player — Guess-Who board styles (player page + big-screen display).
   Mobile-first: 3 portrait columns on small phones, 4 on larger phones, 5-6 upward.
   Loaded by player.html and host_display.html with ?v= stamps. All game copy is set
   via textContent in JS — these classes carry the entire look (no inline styles). */

.mystery-header {
  flex: 0 0 auto; width: 100%; text-align: center; font-weight: 800; font-size: 1rem;
  background: linear-gradient(90deg, #7c3aed, #db2777); padding: 5px 8px;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.mystery-header-pill {
  background: rgba(0, 0, 0, .35); border-radius: 999px; padding: 1px 10px;
  font-size: .85rem; font-weight: 700; white-space: nowrap;
}
.mystery-status {
  flex: 0 0 auto; text-align: center; font-size: .85rem; opacity: .9; padding: 4px 8px;
  min-height: 1.6em;
}
.mystery-status.mystery-status-warn { color: #f87171; }
.mystery-status.mystery-status-good { color: #4ade80; }

.mystery-grid-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; }
.mystery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
@media (min-width: 420px) { .mystery-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .mystery-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1100px) { .mystery-grid { grid-template-columns: repeat(6, 1fr); } }

.mystery-card {
  position: relative; border: 2px solid #334155; border-radius: 12px; overflow: hidden;
  background: #1e293b; padding: 0; cursor: pointer; text-align: center;
  touch-action: manipulation; transition: transform .08s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.mystery-card:active { transform: scale(.96); }
.mystery-card-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #0f172a;
}
.mystery-card-emoji {
  width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; background: #0f172a;
}
.mystery-card-name {
  font-size: .72rem; font-weight: 700; padding: 3px 4px; color: #e2e8f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mystery-card.eliminated { border-color: #1f2937; }
.mystery-card.eliminated .mystery-card-img,
.mystery-card.eliminated .mystery-card-emoji { filter: grayscale(1) brightness(.45); }
.mystery-card.eliminated .mystery-card-name { color: #64748b; text-decoration: line-through; }
.mystery-card .mystery-x {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-size: 2.6rem; font-weight: 900; color: #ef4444; text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  pointer-events: none;
}
.mystery-card.eliminated .mystery-x { display: flex; }
.mystery-card.self { opacity: .55; cursor: default; }
.mystery-card.self .mystery-card-name::after { content: ' (you)'; }
.mystery-card.guess-eligible { border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, .5); }
.mystery-card.guess-picked { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .7); }

.mystery-incoming {
  flex: 0 0 auto; margin: 6px; padding: 10px; border-radius: 14px;
  background: linear-gradient(160deg, #7c2d12, #b45309); border: 2px solid #fbbf24;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); z-index: 60;
}
.mystery-incoming-from { font-size: .8rem; font-weight: 800; color: #fde68a; }
.mystery-incoming-q { font-size: 1.05rem; font-weight: 700; margin: 4px 0 8px; color: #fff; }
.mystery-incoming-btns { display: flex; gap: 8px; }
.mystery-incoming-btns .btn { flex: 1 1 0; font-weight: 800; padding: 10px 4px; }
.mystery-btn-yes { background: #16a34a; color: #fff; }
.mystery-btn-no { background: #dc2626; color: #fff; }
.mystery-btn-invalid { background: #475569; color: #fff; font-size: .8rem; }

.mystery-footer { flex: 0 0 auto; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(0, 0, 0, .35); }
.mystery-ask-row { display: flex; gap: 6px; }
.mystery-q-input { flex: 1 1 auto; background: #1e293b; color: #fff; border: 1px solid #475569; }
.mystery-q-input:disabled { opacity: .5; }
.mystery-btn-ask { background: #7c3aed; color: #fff; font-weight: 800; min-width: 72px; }
.mystery-action-row { display: flex; gap: 6px; margin-top: 6px; }
.mystery-action-row .btn { flex: 1 1 0; font-weight: 700; }
.mystery-btn-guess { background: #fbbf24; color: #1f2937; }
.mystery-btn-secondary { background: #334155; color: #e2e8f0; }
.mystery-footer .btn:disabled { opacity: .45; }

.mystery-history {
  flex: 0 0 auto; max-height: 30vh; overflow-y: auto; margin: 0 6px; padding: 8px;
  background: rgba(15, 23, 42, .95); border: 1px solid #334155; border-radius: 10px;
  font-size: .85rem;
}
.mystery-history-row { display: flex; gap: 6px; padding: 3px 0; border-bottom: 1px solid rgba(51, 65, 85, .5); }
.mystery-history-a { font-weight: 800; white-space: nowrap; }
.mystery-history-a.yes { color: #4ade80; }
.mystery-history-a.no { color: #f87171; }
.mystery-history-a.invalid { color: #94a3b8; }

.mystery-result {
  position: absolute; left: 8px; right: 8px; bottom: calc(90px + env(safe-area-inset-bottom));
  padding: 12px; border-radius: 14px; text-align: center; z-index: 70;
  background: linear-gradient(160deg, #1e293b, #0f172a); border: 2px solid #7c3aed;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .6); font-weight: 700;
}
.mystery-result .mystery-result-big { font-size: 1.25rem; font-weight: 900; margin-bottom: 4px; }
.mystery-result.correct { border-color: #22c55e; }
.mystery-result.wrong { border-color: #ef4444; }

/* ── Big-screen display overlay ─────────────────────────────────────────── */
.mystery-disp-wrap { text-align: center; padding: 2vh 3vw; }
.mystery-disp-title { font-size: 2.4rem; font-weight: 900; letter-spacing: .06em; }
.mystery-disp-sub { opacity: .85; font-size: 1.1rem; margin-bottom: 1vh; }
.mystery-disp-grid {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 1.5vh 0;
}
.mystery-disp-avatar {
  width: 72px; height: 72px; border-radius: 14px; object-fit: cover;
  border: 2px solid #7c3aed; background: #1e293b;
  animation: mysteryPulse 2.2s ease-in-out infinite;
}
.mystery-disp-avatar-emoji {
  width: 72px; height: 72px; border-radius: 14px; border: 2px solid #7c3aed; background: #1e293b;
  display: flex; align-items: center; justify-content: center; font-size: 2rem;
}
@keyframes mysteryPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.mystery-disp-stats { display: flex; gap: 18px; justify-content: center; font-size: 1.15rem; font-weight: 700; flex-wrap: wrap; }
.mystery-disp-feed { max-width: 720px; margin: 1vh auto 0; text-align: left; font-size: .95rem; opacity: .9; }
.mystery-disp-chain { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 1.5vh; }
.mystery-disp-chain-row {
  display: flex; align-items: center; gap: 12px; font-size: 1.15rem; font-weight: 700;
  background: rgba(30, 41, 59, .8); border-radius: 12px; padding: 6px 14px;
}
.mystery-disp-chain-row img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.mystery-disp-chain-arrow { font-size: 1.4rem; }
@media (prefers-reduced-motion: reduce) {
  .mystery-disp-avatar { animation: none; }
}
