/* ==========================================================================
   06-tictactoe-chat.css — Tic-Tac-Toe in-chat overlay styles
   Scoped to avoid conflicts with the main app.
   ========================================================================== */

/* ── Game button in input bar ──────────────────────────────────────────── */
.ttt-game-btn, .moment-game-btn {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(91,140,255,.28);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(61,26,0,.08);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 11;
}
.ttt-game-btn:hover, .moment-game-btn:hover {
  background: #fff;
  border-color: rgba(91,140,255,.55);
  transform: scale(1.06);
}
.ttt-game-btn:active, .moment-game-btn:active { transform: scale(.90); }

/* ── Mini pop-up game menu ─────────────────────────────────────────────── */
.ttt-game-menu {
  background: #15171f;
  border: 1px solid #272b3a;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  padding: 6px;
  min-width: 200px;
  z-index: 9999;
  animation: tttMenuIn .16s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes tttMenuIn {
  from { opacity: 0; transform: translateY(6px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.ttt-game-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #f3f4f8;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  text-align: left;
  transition: background .12s, color .12s;
}
.ttt-game-menu-item:hover { background: rgba(91,140,255,0.15); color: #5b8cff; }

/* ── Dedicated Challenge Zone ─────────────────────────────────────────── */
.ttt-challenge-zone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 320px;
  pointer-events: auto;
}
.ttt-challenge-zone:empty {
  display: none !important;
  pointer-events: none !important;
}

/* ── Challenge card ────────────────────────────────────────────────────── */
.ttt-challenge-card {
  background: #15171f;
  border: 1.5px solid #272b3a;
  border-radius: 20px;
  padding: 18px 20px 14px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(0,0,0,.5);
  max-width: 300px;
  width: 100%;
  color: #f3f4f8;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}
.ttt-challenge-card.entering { animation: momentIn .38s cubic-bezier(.34,1.56,.64,1) both; }
.ttt-challenge-card.exiting  { animation: momentOut .15s ease forwards; }

.ttt-chal-badge {
  display: inline-block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #5b8cff;
  background: rgba(91,140,255,0.12);
  border: 1px solid rgba(91,140,255,0.25);
  border-radius: 99px;
  padding: 3px 10px;
  margin-bottom: 8px;
}
.ttt-chal-title  { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 700; color: #f3f4f8; margin-bottom: 4px; }
.ttt-chal-sub    { font-size: 13px; font-weight: 500; color: #9498ab; margin-bottom: 14px; line-height: 1.4; font-family: 'Inter', sans-serif; }
.ttt-chal-sub strong { color: #5b8cff; }

.ttt-chal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.ttt-chal-btn {
  min-height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  transition: transform .12s ease, filter .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.ttt-chal-btn:active { transform: scale(.95); }
.ttt-chal-accept {
  background: linear-gradient(135deg, #5b8cff, #8f6cff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(91,140,255,.4);
}
.ttt-chal-accept:hover { filter: brightness(1.08); }
.ttt-chal-decline {
  background: #1b1e29;
  color: #9498ab;
  border: 1px solid #272b3a;
}
.ttt-chal-decline:hover { background: #222634; color: #f3f4f8; }

/* ── Quit / rematch dialog (inside TicTacToe overlay) ──────────────────── */
.ttt-quit-dialog {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(11,12,18,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tttMenuIn .2s ease both;
}
.ttt-quit-box {
  background: #1b1e29;
  border: 1px solid #272b3a;
  border-radius: 22px;
  padding: 28px 24px 22px;
  text-align: center;
  max-width: 280px;
  width: 100%;
}
.ttt-quit-title {
  font-family: 'Space Grotesk', 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #f3f4f8;
  margin-bottom: 6px;
}
.ttt-quit-sub {
  font-size: 13px;
  color: #9498ab;
  margin-bottom: 20px;
}
.ttt-quit-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.ttt-quit-actions .ttt-chal-btn {
  flex: 1;
  min-height: 44px;
}

/* ── System event bubble (game events in chat zone) ─────────────────────── */
.ttt-event-bubble {
  font-size: 13px !important;
  font-weight: 700 !important;
  background: rgba(230,235,255,0.88) !important;
  color: #4a5080 !important;
  border-color: rgba(100,120,240,.2) !important;
  padding: 10px 18px !important;
}

/* ── TTT overlay z-index fix (must sit above moment-window) ─────────────── */
#ttt-overlay.is-open {
  z-index: 2000 !important;
}

/* ── Disconnect / reconnecting banner ───────────────────────────────────── */
.ttt-reconnecting {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,207,92,.9);
  color: #3d2a00;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 99px;
  z-index: 30;
  white-space: nowrap;
  animation: tttMenuIn .2s ease both;
}

/* ── Mobile safe-area ───────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .ttt-game-menu {
    min-width: 170px;
  }
  .ttt-chal-actions {
    flex-direction: column;
  }
  .ttt-chal-btn {
    width: 100%;
    justify-content: center;
  }
  #ttt-overlay .ttt-card {
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
  }
}

/* ── Small phone ────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .ttt-challenge-card { padding: 14px 14px 12px; }
  .ttt-chal-title { font-size: 15px; }
}
