/* ============================================================
   Jogos nas chamadas (xadrez) e bot de música.
   Vale para o app do PC e para o site (no celular, html.mobile).
   ============================================================ */

/* ---------- menu "Jogos" ---------- */
.games-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: min(420px, 82vw);
}
.gm-row,
.gm-game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-elev);
}
.gm-game {
  background: transparent;
  padding: 10px 2px 2px;
}
.gm-info {
  flex: 1;
  min-width: 0;
}
.gm-info b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gm-emoji {
  font-size: 20px;
}
.gm-emoji.big {
  font-size: 30px;
}
.gm-empty {
  margin: 0;
  padding: 4px 2px;
}

/* ---------- convite recebido ---------- */
#game-invites {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 20px));
  pointer-events: none;
}
.game-invite {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
  animation: gi-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes gi-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
  }
}
.gi-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.gi-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
html.mobile .game-invite {
  flex-wrap: wrap;
}
html.mobile .gi-btns {
  width: 100%;
}
html.mobile .gi-btns .btn {
  flex: 1;
}

/* ---------- janela do jogo ---------- */
.game-win {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 120;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 16px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: gi-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.game-win.hidden {
  display: none;
}
.gw-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px 14px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.gw-title {
  font-weight: 700;
}
.gw-vs {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gw-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gw-status {
  text-align: center;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text-2);
}
.gw-status.mine {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-elev));
  color: var(--text);
}
.gw-status.over {
  background: color-mix(in srgb, var(--accent) 35%, var(--bg-elev));
  color: var(--text);
}
.gw-moves {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--text-2);
  padding-bottom: 2px;
}
.gw-moves b {
  color: var(--muted);
  font-weight: 600;
}
.gw-btns,
.gw-offer {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}
.gw-offer {
  padding: 8px;
  border-radius: 10px;
  background: var(--bg-elev);
}
html.mobile .game-win {
  inset: 0;
  top: 0;
  right: 0;
  width: auto;
  max-height: none;
  border-radius: 0;
  border: 0;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
html.mobile .gw-head {
  cursor: default;
}

/* tabuleiro */
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-select: none;
}
.chess-board .sq {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chess-board .sq.light {
  background: #ebe7da;
}
.chess-board .sq.dark {
  background: #8a7bd1;
}
.chess-board .sq.last.light {
  background: #f2e48f;
}
.chess-board .sq.last.dark {
  background: #c2b45e;
}
.chess-board .sq.sel {
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.85);
}
.chess-board .sq.check {
  background: radial-gradient(circle, #ff5a5a 0%, #e53935 45%, rgba(229, 57, 53, 0.2) 75%);
}
.chess-board .sq.dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28%;
  height: 28%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(20, 20, 30, 0.32);
}
.chess-board .sq.cap::after {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(20, 20, 30, 0.35);
}
.chess-board .pc {
  position: absolute;
  inset: 4%;
  width: 92%;
  height: 92%;
  pointer-events: none;
  filter: drop-shadow(0 2px 1.5px rgba(0, 0, 0, 0.35));
}
.pc.pw {
  fill: #fbf8f0;
  stroke: #26252b;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.pc.pb {
  fill: #2c2b33;
  stroke: #f1eee6;
  stroke-width: 1.05;
  stroke-linejoin: round;
}
.pc.pw .eye {
  fill: #26252b;
}
.pc.pb .eye {
  fill: #f1eee6;
}
.chess-board .co {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.75;
  pointer-events: none;
}
.chess-board .sq.light .co {
  color: #8a7bd1;
}
.chess-board .sq.dark .co {
  color: #ebe7da;
}
.chess-board .co.rk {
  top: 3px;
  left: 3px;
}
.chess-board .co.fl {
  right: 3px;
  bottom: 2px;
}
.promo-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.promo-btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: var(--bg-elev);
}
.promo-btn:hover {
  background: var(--bg-active);
}
.promo-btn .pc {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
}

/* ---------- bot de música ---------- */
/* quadro do bot na grade da chamada: o player do YouTube fica por cima do .music-slot */
.tile.music-tile {
  background: #0d0d10;
  min-height: 200px;
}
.music-slot {
  position: absolute;
  inset: 0;
}
#music-player {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
}
#music-player .mp-video {
  position: relative;
  flex: 1;
  min-height: 0;
}
#music-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
#music-player .mp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(14, 14, 18, 0.92);
  color: #fff;
  flex-shrink: 0;
}
#music-player .mp-emoji {
  font-size: 16px;
}
#music-player .mp-text {
  flex: 1;
  min-width: 0;
}
#music-player .mp-title,
#music-player .mp-by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#music-player .mp-title {
  font-size: 13px;
  font-weight: 600;
}
#music-player .mp-mute {
  color: #fff;
}
#music-player .mp-vol {
  width: 84px;
  accent-color: var(--accent);
}
#music-player .mp-tap {
  display: none;
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
}
#music-player.blocked .mp-tap {
  display: block;
}
/* fora da tela da chamada: mini-player no canto (a música continua) */
#music-player.mini {
  right: 16px;
  bottom: 76px;
  width: 300px;
  height: 214px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
html.mobile #music-player.mini {
  right: 10px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(300px, calc(100vw - 20px));
}
/* linha do bot na lista da sala de voz */
.voice-user.music-user .mu-av {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ff4f6d;
  font-size: 13px;
  flex-shrink: 0;
}
.voice-user.music-user .mu-st {
  margin-left: auto;
}
/* no celular o quadro da música ocupa a linha inteira (cabe o título e o volume) */
html.mobile .tiles .tile.music-tile {
  grid-column: 1 / -1;
  min-height: 230px;
}
html.mobile #music-player .mp-vol {
  width: 70px;
}
