/* ===== Games launcher + Color Dice (shared by chat.php / feed.php) ===== */

.fm-games-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: var(--surface-2, #1e1e2a);
  color: var(--text-2, #9494a8);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition, .2s ease);
  padding: 0;
}
.fm-games-btn:hover {
  color: #fff;
  border-color: var(--primary, #5b5fea);
  background: rgba(var(--primary-rgb, 91,95,234), .15);
}

.fm-games-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2147483000;
}
.fm-games-overlay.open { display: flex; }

.fm-games-modal {
  width: min(380px, 100%);
  max-height: min(620px, 90vh);
  background: var(--surface, #16161e);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text, #e8e8ee);
  animation: fmgPop .18s ease;
}
@keyframes fmgPop {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fm-games-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.1));
  flex-shrink: 0;
}
.fm-games-title {
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.fm-games-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: var(--surface-2, #1e1e2a);
  color: var(--text-2, #9494a8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition, .2s ease);
  font-size: 13px;
}
.fm-games-close:hover { color: #fff; border-color: var(--red, #ef4444); }

.fm-games-body { overflow-y: auto; flex: 1; min-height: 0; padding: 14px; }
.fm-games-list { display: flex; flex-direction: column; gap: 10px; }

.fm-game-item {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--surface-2, #1e1e2a);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  color: var(--text, #e8e8ee);
  font-family: inherit;
  transition: var(--transition, .2s ease);
}
.fm-game-item:hover {
  border-color: var(--primary, #5b5fea);
  background: var(--surface-3, #262636);
  transform: translateY(-1px);
}
.fm-game-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary, #5b5fea), #818cf8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.fm-game-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fm-game-name { font-weight: 700; font-size: 14px; }
.fm-game-desc { font-size: 12px; color: var(--text-3, #6b6b80); line-height: 1.4; }
.fm-game-arrow { color: var(--text-3, #6b6b80); }

.fm-games-foot {
  border-top: 1px solid var(--border, rgba(255,255,255,.1));
  padding: 10px 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fm-games-back {
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: var(--surface-2, #1e1e2a);
  color: var(--text-2, #9494a8);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition, .2s ease);
}
.fm-games-back:hover { color: #fff; border-color: var(--primary, #5b5fea); }

/* ===== Color Dice ===== */
.fmg-dice { display: flex; flex-direction: column; gap: 12px; }
.fmg-dice.flash { border-radius: 12px; animation: fmgCdCardFlash 1.2s ease-in-out infinite; }
@keyframes fmgCdCardFlash {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 193, 7, 0); }
  50% { box-shadow: 0 0 30px rgba(255, 193, 7, 0.6), inset 0 0 20px rgba(34, 197, 94, 0.25); }
}
.fmg-dice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fmg-dice-head-title { font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.fmg-dice-round { font-size: 12px; color: var(--text-2, #9494a8); }

.fmg-timer {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 10px;
  border-radius: 999px;
  border: 1px solid rgba(110, 231, 183, 0.5);
  background: rgba(52, 211, 153, 0.13);
  color: #6ee7b7;
  box-shadow: 0 0 14px rgba(110, 231, 183, 0.28);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.4;
  box-sizing: border-box;
  transition: color .3s ease, border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.fmg-timer > i.fa { font-size: 12px; opacity: 0.9; }
.fmg-timer-txt { position: relative; z-index: 1; white-space: nowrap; }
.fmg-timer-radar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
}
.fmg-timer-radar i {
  position: absolute;
  top: 0;
  left: -45%;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: #a7f3d0;
  animation: fmgTimerSweep 1.5s linear infinite;
}
@keyframes fmgTimerSweep {
  0% { left: -45%; }
  100% { left: 110%; }
}
.fmg-timer-open {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.6);
  background: rgba(52, 211, 153, 0.15);
  box-shadow: 0 0 16px rgba(110, 231, 183, 0.32);
}
.fmg-timer-open .fmg-timer-radar i { background: #a7f3d0; }
.fmg-timer-wait {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.5);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 12px rgba(110, 231, 183, 0.22);
}
.fmg-timer-wait .fmg-timer-radar i { background: #a7f3d0; }
.fmg-timer-roll {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.55);
  background: rgba(52, 211, 153, 0.13);
  animation: fmgTimerRollPulse 1s ease-in-out infinite;
}
.fmg-timer-roll .fmg-timer-radar i { background: #a7f3d0; }
@keyframes fmgTimerRollPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(110, 231, 183, 0.3); }
  50% { box-shadow: 0 0 18px rgba(110, 231, 183, 0.6); }
}
.fmg-timer-off { color: var(--text-3, #6b6b80); opacity: 0.85; }
.fmg-timer-off .fmg-timer-radar i { background: #a7f3d0; animation: none; }
.fmg-dice-status { font-size: 13px; color: var(--text-2, #9494a8); line-height: 1.45; }
.fmg-dice-status.err { color: #f87171; }
.fmg-dice-balance { font-size: 13px; color: var(--text, #e8e8ee); font-weight: 700; }

.fmg-dice-colors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.fmg-tile {
  background: var(--surface-2, #1e1e2a);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.fmg-tile.mine { border-color: var(--primary, #5b5fea); }
.fmg-tile-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: block;
  box-shadow: inset -2px -3px 6px rgba(0,0,0,.25);
}
.fmg-tile-name { font-weight: 800; font-size: 13px; }
.fmg-tile-meta { font-size: 11px; color: var(--text-3, #6b6b80); }
.fmg-tile-mybet { font-size: 11px; color: var(--primary, #5b5fea); font-weight: 800; }
.fmg-tile-bet { display: flex; gap: 6px; margin-top: 2px; }
.fmg-amount-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface, #16161e);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  color: var(--text, #e8e8ee);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.fmg-amount-input:focus { border-color: var(--primary, #5b5fea); }
.fmg-amount-input:disabled { opacity: .5; }
.fmg-bet-btn {
  flex-shrink: 0;
  border: none;
  background: var(--primary, #5b5fea);
  color: #fff;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition, .2s ease);
}
.fmg-bet-btn:hover { background: var(--primary-hover, #7074f0); }
.fmg-bet-btn:disabled { opacity: .5; cursor: not-allowed; }

.fmg-dice-roll {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, .88);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
}
.fmg-dice-roll-label { font-weight: 800; font-size: 14px; letter-spacing: .03em; }
.fmg-dice-roll-row { display: flex; gap: 10px; }
.fmg-die {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(0,0,0,.5);
}
.fmg-die-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: block;
  background: var(--c, #888);
  box-shadow: inset -2px -3px 6px rgba(0,0,0,.25);
}

.colordice-last {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}
.colordice-last-head {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.colordice-last-dice {
  font-size: 1.3rem;
  letter-spacing: 4px;
}
.colordice-last-winners {
  font-size: 0.7rem;
  color: #ffc107;
  margin-top: 4px;
}
.colordice-last-winners.none {
  color: rgba(255, 255, 255, 0.5);
}

/* Winner board (shown when there are winners) */
.colordice-win-board {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  padding: 12px 10px;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.16), rgba(34, 197, 94, 0.14), rgba(59, 130, 246, 0.16));
  border: 1px solid rgba(255, 193, 7, 0.5);
  box-shadow: 0 0 24px rgba(255, 193, 7, 0.3), inset 0 0 18px rgba(34, 197, 94, 0.12);
  animation: fmgCdWinPop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4), fmgCdWinGlow 1.8s ease-in-out infinite;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
@keyframes fmgCdWinPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes fmgCdWinGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 193, 7, 0.28); }
  50% { box-shadow: 0 0 34px rgba(34, 197, 94, 0.5); }
}
.colordice-win-glow {
  position: absolute;
  top: -60%;
  left: -30%;
  width: 160%;
  height: 220%;
  background: conic-gradient(from 0deg, transparent 0 40deg, rgba(255, 255, 255, 0.12) 50deg, transparent 60deg);
  animation: fmgCdWinSweep 2.4s linear infinite;
  pointer-events: none;
}
@keyframes fmgCdWinSweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.colordice-win-dice {
  font-size: 1.5rem;
  letter-spacing: 3px;
  line-height: 1;
  color: #fff;
  animation: fmgCdWinBounce 1s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.8));
}
@keyframes fmgCdWinBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.06); }
}
.colordice-win-title {
  font-family: var(--brand-font, 'Inter', system-ui, sans-serif);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ffc107;
  text-shadow: 0 0 14px rgba(255, 193, 7, 0.8);
}
.colordice-win-text {
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  max-width: 95%;
  text-align: center;
}

.fmg-dice-payouts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fmg-dice-payouts-timer { justify-content: center; }
.fmg-dice-payouts + .fmg-dice-payouts { margin-top: 12px; justify-content: center; }
.fmg-dice-payouts span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2, #9494a8);
  background: var(--surface-2, #1e1e2a);
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: 999px;
  padding: 4px 10px;
}

/* Feed chat input button sizing */
.feed-chat-input-row .fm-games-btn {
  width: 34px;
  height: 34px;
  font-size: 14px;
}
.lc-composer-row .fm-games-btn { width: 38px; height: 38px; }