/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #D32F2F;
  --red-bg: #E53935;
  --green: #388E3C;
  --green-bg: #43A047;
  --yellow: #F9A825;
  --yellow-bg: #FBC02D;
  --blue: #1565C0;
  --blue-bg: #1E88E5;
  --gold: #ffd700;
  --accent: #e94560;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  /* Ludo King warm gradient background */
  background: radial-gradient(ellipse at 50% 30%, #2d1b4e 0%, #1a0f30 50%, #0d0a1a 100%);
}

.gold { color: var(--gold); }
.hidden { display: none !important; }

/* ===== TOP HEADER ===== */
.top-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  min-height: 44px;
  background: linear-gradient(180deg, #2d1b4e 0%, #1a0f30 100%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(255,215,0,0.15);
  flex-wrap: wrap; gap: 4px;
}
.header-logo {
  font-family: 'Fredoka One', cursive;
  font-size: 15px; color: #fff; white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.hdr-btn {
  border: none; border-radius: 6px; padding: 4px 8px;
  font-family: 'Nunito', sans-serif; font-size: 10px; font-weight: 800;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.hdr-login { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.hdr-login:hover { background: rgba(255,255,255,0.15); }
.hdr-register { background: var(--gold); color: #1a0f30; }
.hdr-deposit { background: var(--gold); color: #1a0f30; }
.hdr-play { background: linear-gradient(135deg, #e94560, #c0392b); color: #fff; animation: hdr-play-pulse 2s ease-in-out infinite; }
.hdr-play:hover { filter: brightness(1.15); }
@keyframes hdr-play-pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(233,69,96,0.4); } 50%{ box-shadow: 0 0 10px 3px rgba(233,69,96,0.3); } }

.hdr-balance {
  display: flex; align-items: center; gap: 3px;
  background: rgba(0,0,0,0.3); border-radius: 20px; padding: 3px 8px;
  font-size: 10px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.hdr-balance-icon { font-size: 12px; }

.hdr-user-pill {
  display: flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,0.08); border-radius: 20px; padding: 3px 8px;
  cursor: pointer; font-size: 10px; font-weight: 700;
  max-width: 90px; overflow: hidden;
}
.hdr-user-pill:hover { background: rgba(255,255,255,0.14); }
.hdr-user-icon {
  font-size: 12px; width: 22px; height: 22px; border-radius: 50%;
  overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#hdr-username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== USER DROPDOWN ===== */
.user-dropdown {
  position: fixed; top: 52px; right: 10px; z-index: 600;
  background: linear-gradient(170deg, #2a1845, #1a1030);
  border: 1px solid rgba(255,215,0,0.2); border-radius: 12px;
  padding: 14px; min-width: 200px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}
.dd-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
.dd-avatar-wrap {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,215,0,0.3);
  flex-shrink: 0;
}
.dd-icon { font-size: 20px; }
.dd-avatar-btn { text-align: center !important; color: var(--gold) !important; border-color: rgba(255,215,0,0.2) !important; font-size: 12px !important; }
.dd-balance { font-size: 13px; color: var(--gold); margin-bottom: 10px; }
.dd-btn {
  display: block; width: 100%; padding: 8px; margin-bottom: 6px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: #fff; font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700; cursor: pointer; text-align: left;
}
.dd-btn:hover { background: rgba(255,255,255,0.12); }
.dd-logout { color: var(--accent); border-color: rgba(233,69,96,0.2); }
.dd-logout:hover { background: rgba(233,69,96,0.1); }

/* ===== ACTION BAR (bottom) ===== */
.action-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 10px;
  background: linear-gradient(0deg, #1a0f30 0%, #2d1b4e 100%);
  border-top: 1px solid rgba(255,215,0,0.15);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
}
.action-bar.hidden { display: none !important; }
.ab-btn {
  flex: 1; padding: 8px 4px; border: none; border-radius: 8px;
  font-family: 'Nunito', sans-serif; font-size: 11px; font-weight: 800;
  cursor: pointer; transition: all 0.2s; text-align: center; white-space: nowrap;
}
.ab-deposit { background: var(--gold); color: #1a0f30; }
.ab-withdraw { background: rgba(76,175,80,0.2); color: #4caf50; border: 1px solid rgba(76,175,80,0.3); }
.ab-play { background: linear-gradient(135deg, #e94560, #c0392b); color: #fff; animation: hdr-play-pulse 2s ease-in-out infinite; }

@media (min-width: 600px) {
  .action-bar { max-width: 500px; left: 50%; transform: translateX(-50%); border-radius: 12px 12px 0 0; }
  .ab-btn { font-size: 13px; padding: 10px 8px; }
}

/* ===== GAME SCREEN ===== */
#game-screen {
  position: absolute;
  top: 44px; left: 0; right: 0; bottom: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 0;
  overflow: hidden;
}

/* ===== PLAYER CARDS ===== */
.player-row {
  display: flex;
  width: 90%;
  max-width: 500px;
  gap: 6px;
  flex-shrink: 0;
  z-index: 5;
}

.pcard {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.08);
  transition: all 0.35s ease;
  opacity: 0.55;
  min-height: 42px;
}
.pcard.active {
  opacity: 1;
  border-color: var(--glow-color, rgba(255,255,255,0.3));
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 12px 2px var(--glow-color, rgba(255,255,255,0.15));
  animation: card-pulse 1.5s ease-in-out infinite;
}
@keyframes card-pulse {
  0%, 100% { box-shadow: 0 0 10px 1px var(--glow-color, rgba(255,255,255,0.15)); }
  50% { box-shadow: 0 0 18px 4px var(--glow-color, rgba(255,255,255,0.25)); }
}

.pcard[data-color="red"]   { --glow-color: var(--red); --bar-color: var(--red-bg); }
.pcard[data-color="green"] { --glow-color: var(--green); --bar-color: var(--green-bg); }
.pcard[data-color="yellow"]{ --glow-color: var(--yellow); --bar-color: var(--yellow-bg); }
.pcard[data-color="blue"]  { --glow-color: var(--blue); --bar-color: var(--blue-bg); }

.pcard-avatar {
  font-size: 20px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.25);
  flex-shrink: 0;
  overflow: hidden;
}
/* Circular avatar image (used in player cards, matchmaking, dropdown) */
.avatar-img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 20%;
  border-radius: 50%; display: block;
}
.pcard-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.15;
}
.pcard-name {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcard-status {
  font-size: 9px;
  font-weight: 600;
  opacity: 0.6;
}
.pcard.active .pcard-status {
  opacity: 1;
  color: var(--gold);
}
.pcard-tokens {
  font-size: 11px;
  font-weight: 800;
  color: var(--bar-color, #888);
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  padding: 2px 5px;
  flex-shrink: 0;
}
.pcard-tokens span {
  color: #fff;
}

/* ===== BOARD WRAPPER ===== */
.board-wrapper {
  position: relative;
  width: 90vw;
  max-width: 500px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  /* Ludo King board shadow */
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.5),
    0 0 40px rgba(100,60,180,0.15);
}

#board-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ===== DICE ROW (below board) ===== */
.dice-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 4px 0;
}

.dice {
  width: 48px; height: 48px;
  background: linear-gradient(145deg, #fff 0%, #e8dcc8 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform 0.3s;
}
.dice.rolling { animation: dice-roll 0.4s ease-out; }
@keyframes dice-roll {
  0%   { transform: rotate(0) scale(1); }
  25%  { transform: rotate(90deg) scale(1.2); }
  50%  { transform: rotate(180deg) scale(1); }
  75%  { transform: rotate(270deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}
.dice-face {
  font-size: 24px;
  font-weight: 800;
  color: #2a1a3e;
  font-family: 'Fredoka One', cursive;
}

.btn-roll {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold), #e6a800);
  color: #2a1a3e;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(255,215,0,0.4);
  transition: transform 0.15s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-roll:active { transform: scale(0.9); }
.btn-roll:disabled { opacity: 0.25; cursor: not-allowed; }
.btn-roll.my-turn {
  animation: roll-glow 1.2s ease-in-out infinite;
}
@keyframes roll-glow {
  0%, 100% { box-shadow: 0 3px 10px rgba(255,215,0,0.4); }
  50% { box-shadow: 0 0 20px 6px rgba(255,215,0,0.6); }
}

/* ===== GAME MESSAGE ===== */
.game-message {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}
.game-message.highlight {
  color: var(--gold);
  animation: pulse-msg 0.5s;
}
@keyframes pulse-msg {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(6px);
}
.modal-overlay.hidden { display: none; }

.modal-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 24px;
  background: linear-gradient(170deg, #2a1845 0%, #1a1030 100%);
  border-radius: 18px;
  border: 2px solid rgba(255,215,0,0.25);
  box-shadow: 0 10px 50px rgba(0,0,0,0.6);
  animation: pop-in 0.3s ease-out;
  width: 88%;
  max-width: 340px;
}
@keyframes pop-in {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-icon {
  font-size: 48px;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.modal-card h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 26px;
  color: #fff;
}
.modal-sub {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}
.modal-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== AUTH TABS ===== */
.auth-card { max-width: 360px; gap: 10px; position: relative; }

/* ===== MODAL CLOSE BUTTON ===== */
.modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; color: rgba(255,255,255,0.4); font-size: 26px;
  cursor: pointer; line-height: 1; z-index: 10;
}
.modal-close:hover { color: #fff; }
.auth-tabs {
  display: flex; width: 100%; gap: 0;
  border-bottom: 2px solid rgba(255,255,255,0.08); margin-bottom: 4px;
}
.auth-tab {
  flex: 1; padding: 10px; text-align: center;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: rgba(255,255,255,0.4); font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 800; cursor: pointer; transition: all 0.2s;
}
.auth-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.auth-tab-content {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}
.auth-tab-content.hidden { display: none; }

.auth-input {
  width: 100%; padding: 11px 14px;
  border: 2px solid rgba(255,255,255,0.12); border-radius: 10px;
  background: rgba(255,255,255,0.08); color: #fff;
  font-size: 14px; font-family: 'Nunito', sans-serif;
  outline: none; transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--gold); }
.auth-input::placeholder { color: rgba(255,255,255,0.3); }

/* ===== DEPOSIT MODAL ===== */
.deposit-card {
  max-width: 400px; text-align: left; gap: 12px; position: relative;
  padding: 20px 20px 24px;
}
.deposit-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: rgba(255,255,255,0.5); font-size: 24px;
  cursor: pointer; line-height: 1;
}
.deposit-close:hover { color: #fff; }
.deposit-title {
  font-family: 'Fredoka One', cursive; font-size: 20px; text-align: center; width: 100%;
}

.deposit-method-box {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,215,0,0.2);
  border-radius: 10px; padding: 10px 14px; width: 100%;
}
.deposit-method-icon { font-size: 20px; }
.deposit-method-label { font-size: 14px; font-weight: 700; flex: 1; }
.deposit-bonus-tag {
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
}

.deposit-section-header {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; font-size: 13px; font-weight: 700;
}
.deposit-bonus-explain { font-size: 11px; color: var(--gold); }

.deposit-quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%;
  margin-top: 6px;
}
.qv {
  position: relative; background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 8px;
  padding: 22px 4px 8px; text-align: center; color: #fff;
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 800;
  cursor: pointer; transition: all 0.2s; overflow: visible;
}
.qv:hover, .qv.selected { border-color: var(--gold); background: rgba(255,215,0,0.06); }
.qv-tag {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 8px; font-weight: 800;
  padding: 1px 5px; border-radius: 3px; white-space: nowrap; line-height: 1.4;
}

.deposit-input-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 0 14px;
}
.deposit-currency { font-size: 14px; font-weight: 800; color: rgba(255,255,255,0.5); }
.deposit-input {
  flex: 1; background: none; border: none; color: #fff;
  font-family: 'Nunito', sans-serif; font-size: 14px; padding: 12px 0;
  outline: none;
}
.deposit-input::placeholder { color: rgba(255,255,255,0.25); }
.deposit-confirm { margin-top: 4px; }

.btn-gold {
  width: 100%;
  padding: 13px 24px;
  background: linear-gradient(135deg, var(--gold), #e6a800);
  color: #2a1a3e;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,215,0,0.3);
  transition: transform 0.15s;
}
.btn-gold:active { transform: scale(0.96); }

.error-msg {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* ===== MATCH SELECTION ===== */
.match-card { max-width: 420px; position: relative; max-height: 90vh; overflow-y: auto; }
.match-how-box {
  width: 100%; background: rgba(255,255,255,0.04); border-radius: 10px;
  padding: 10px 12px; border: 1px solid rgba(255,255,255,0.06);
}
.match-how-title {
  font-size: 13px; font-weight: 800; color: var(--gold); margin-bottom: 6px;
}
.match-how-steps {
  display: flex; flex-direction: column; gap: 3px;
}
.match-how-step {
  display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,0.7);
}
.mhs-num {
  width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #1a0f30;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800;
  flex-shrink: 0;
}
.match-how-example {
  margin-top: 8px; font-size: 10px; color: rgba(255,255,255,0.5); text-align: center;
  padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); line-height: 1.6;
}
.match-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%;
}
.match-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 8px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
  color: #fff; font-family: 'Nunito', sans-serif; cursor: pointer;
  transition: all 0.25s;
}
.match-btn:hover {
  border-color: var(--gold); background: rgba(255,215,0,0.08);
  transform: translateY(-2px); box-shadow: 0 4px 16px rgba(255,215,0,0.15);
}
.match-players-count {
  font-size: 9px; font-weight: 700; color: #4caf50; letter-spacing: 0.5px;
}
.match-bet {
  font-size: 20px; font-weight: 800; font-family: 'Fredoka One', cursive;
  color: var(--gold);
}
.match-prize { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.6); }
.match-prize b { color: #4caf50; }

.match-balance-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.05); font-size: 14px; font-weight: 700;
}
.match-actions-row {
  display: flex; gap: 8px; width: 100%;
}
.btn-match-action {
  flex: 1; padding: 10px; border-radius: 10px; border: none;
  font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 800;
  cursor: pointer; transition: all 0.2s;
}
.btn-match-deposit {
  background: linear-gradient(135deg, var(--gold), #e6a800); color: #1a0f30;
}
.btn-match-deposit:hover { transform: scale(1.02); }
.btn-match-withdraw {
  background: rgba(76,175,80,0.15); color: #4caf50; border: 1px solid rgba(76,175,80,0.3);
}
.btn-match-withdraw:hover { background: rgba(76,175,80,0.25); }

/* ===== POOL DISPLAY ===== */
.pool-display {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 4px 14px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(233,69,96,0.1));
  border: 1px solid rgba(255,215,0,0.25);
  animation: pool-glow 2s ease-in-out infinite;
}
.pool-display.hidden { display: none !important; }
.pool-icon { font-size: 14px; }
.pool-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.6); }
.pool-value { font-size: 14px; font-weight: 800; color: var(--gold); font-family: 'Fredoka One', cursive; }
@keyframes pool-glow { 0%,100%{ box-shadow: 0 0 0 0 rgba(255,215,0,0); } 50%{ box-shadow: 0 0 12px 2px rgba(255,215,0,0.15); } }
.pool-animate { animation: pool-reveal 0.8s ease-out; }
@keyframes pool-reveal { 0%{ opacity:0; transform:translateY(-10px) scale(0.8); } 100%{ opacity:1; transform:translateY(0) scale(1); } }

/* ===== PRIZE INFO ===== */
.prize-info {
  background: rgba(0,0,0,0.25); border-radius: 10px; padding: 12px 16px;
  width: 100%; font-size: 14px; font-weight: 700; text-align: center;
}
.prize-win { color: #4caf50; font-size: 20px; font-weight: 800; }
.prize-lose { color: var(--accent); font-size: 16px; }

/* ===== MATCHMAKING ===== */
.matchmaking-card { max-width: 400px; text-align: center; }
.mm-spinner {
  width: 36px; height: 36px; border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--gold); border-radius: 50%;
  animation: mm-spin 0.8s linear infinite; margin: 0 auto 6px;
}
@keyframes mm-spin { to { transform: rotate(360deg); } }
.mm-players {
  display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 8px;
}
.mm-slot {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 10px 14px;
  transition: all 0.4s ease;
}
.mm-slot.mm-found {
  border-color: var(--gold); background: rgba(255,215,0,0.06);
  animation: mm-pop 0.4s ease;
}
@keyframes mm-pop {
  0% { transform: scale(0.92); opacity: 0.5; }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}
.mm-avatar {
  font-size: 22px; width: 36px; height: 36px; text-align: center;
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.2);
}
.mm-name { flex: 1; font-size: 14px; font-weight: 700; text-align: left; }
.mm-badge {
  font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 6px;
}
.mm-ready { background: #4caf50; color: #fff; }
.mm-searching { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.35); }
.mm-found-badge { background: var(--gold); color: #2a1a3e; }
.mm-bet-info {
  margin-top: 10px; font-size: 13px; font-weight: 700;
  color: rgba(255,255,255,0.5);
}
.modal-sub {
  font-size: 13px; color: rgba(255,255,255,0.5); margin: -4px 0 6px;
  font-weight: 600;
}

/* ===== AUTO-ROLL TIMER ===== */
.timer-bar-wrap {
  width: 100%; height: 4px; background: rgba(255,255,255,0.08);
  border-radius: 2px; margin-top: 4px; overflow: hidden;
}
.timer-bar {
  height: 100%; background: var(--gold); border-radius: 2px;
  transition: width 1s linear;
}
.timer-bar.urgent { background: var(--accent); }

/* ===== WITHDRAW BUTTON ===== */
.hdr-withdraw { background: rgba(76,175,80,0.2); color: #4caf50; font-size: 11px; padding: 5px 10px; border: 1px solid rgba(76,175,80,0.3); }
.hdr-withdraw:hover { background: rgba(76,175,80,0.3); }

/* ===== WITHDRAWAL MODAL ===== */
.withdraw-card { max-width: 380px; gap: 10px; position: relative; }
.withdraw-balance {
  width: 100%; text-align: center; font-size: 14px; font-weight: 700;
  color: rgba(255,255,255,0.7); padding: 8px; background: rgba(255,255,255,0.05);
  border-radius: 8px;
}
.withdraw-balance b { color: var(--gold); }
.withdraw-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.wd-history {
  width: 100%; max-height: 150px; overflow-y: auto; margin-top: 6px;
  display: flex; flex-direction: column; gap: 6px;
}
.wd-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.04); border-radius: 8px; padding: 8px 12px;
  font-size: 12px; font-weight: 600;
}
.wd-status-pending { color: var(--gold); }
.wd-status-approved { color: #4caf50; }
.wd-status-rejected { color: var(--accent); }

/* ===== CONFETTI & PARTICLES CANVAS ===== */
#confetti-canvas, #particles-canvas {
  position: fixed; inset: 0; z-index: 510; pointer-events: none;
}

/* ===== WIN CELEBRATION ===== */
.game-over-card {
  overflow: visible; position: relative; z-index: 1;
  transition: transform 0.5s ease;
}
.game-over-card.go-win {
  animation: go-card-enter 0.6s ease-out;
}
@keyframes go-card-enter {
  0% { opacity: 0; transform: scale(0.6) translateY(30px); }
  50% { transform: scale(1.05) translateY(-5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.game-over-card .modal-icon { font-size: 56px; }
.go-icon-avatar {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  margin: 0 auto; border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(255,215,0,0.4);
}
.go-icon-avatar .avatar-img { width: 100%; height: 100%; }

/* Glow behind card on win */
.go-glow {
  position: absolute; top: -40px; left: -40px; right: -40px; bottom: -40px;
  border-radius: 28px; z-index: -1; opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
}
.go-win .go-glow {
  opacity: 1;
  background: radial-gradient(ellipse at center, rgba(255,215,0,0.25) 0%, transparent 70%);
  animation: go-glow-pulse 2s ease-in-out infinite;
}
@keyframes go-glow-pulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* Win tier label (WIN / BIG WIN / MEGA WIN / SUPER WIN) */
.go-tier {
  position: absolute; top: -38px; left: 50%; transform: translateX(-50%);
  font-family: 'Fredoka One', cursive; font-weight: 900;
  padding: 4px 22px; border-radius: 12px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 2px;
  z-index: 10; animation: go-tier-pop 0.5s ease-out;
}
.go-tier.hidden { display: none; }
.go-tier-win {
  font-size: 14px; background: linear-gradient(135deg, #ffd700, #e6a800);
  color: #1a0f30; box-shadow: 0 0 20px rgba(255,215,0,0.5);
}
.go-tier-big {
  font-size: 16px; background: linear-gradient(135deg, #ff9800, #f57c00);
  color: #fff; box-shadow: 0 0 25px rgba(255,152,0,0.6);
}
.go-tier-mega {
  font-size: 18px; background: linear-gradient(135deg, #e94560, #d32f2f);
  color: #fff; box-shadow: 0 0 30px rgba(233,69,96,0.6);
}
.go-tier-super {
  font-size: 20px; background: linear-gradient(135deg, #e91e63, #9c27b0);
  color: #fff; box-shadow: 0 0 40px rgba(156,39,176,0.7);
  animation: go-tier-pop 0.5s ease-out, go-tier-glow 1s ease-in-out infinite 0.5s;
}
.go-tier-second {
  font-size: 14px; background: linear-gradient(135deg, #c0c0c0, #8a8a8a);
  color: #1a0f30; box-shadow: 0 0 15px rgba(192,192,192,0.4);
}
.go-second .go-glow {
  opacity: 1;
  background: radial-gradient(ellipse at center, rgba(192,192,192,0.15) 0%, transparent 70%);
}
@keyframes go-tier-pop {
  0% { transform: translateX(-50%) scale(0) translateY(10px); opacity: 0; }
  60% { transform: translateX(-50%) scale(1.2) translateY(-5px); }
  100% { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}
@keyframes go-tier-glow {
  0%,100% { box-shadow: 0 0 20px rgba(156,39,176,0.4); }
  50% { box-shadow: 0 0 40px rgba(156,39,176,0.8), 0 0 60px rgba(233,69,96,0.3); }
}

/* Prize counter */
.go-counter-wrap {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  margin: 4px 0;
}
.go-plus {
  font-family: 'Fredoka One', cursive; font-size: 28px; color: #4caf50;
}
.go-counter {
  font-family: 'Fredoka One', cursive; font-size: 36px; color: #4caf50;
  text-shadow: 0 0 20px rgba(76,175,80,0.5), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.1s;
}
.go-counter.counting { animation: go-count-bump 0.15s ease; }
@keyframes go-count-bump {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Details line */
.go-details {
  font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 6px; text-align: center;
}
.go-details .go-balance { color: var(--gold); font-weight: 800; }

/* Lose styling */
.game-over-card.go-lose { animation: go-card-enter 0.4s ease-out; }
.go-lose .go-counter-wrap .go-plus { color: var(--accent); }
.go-lose .go-counter { color: var(--accent); font-size: 28px; text-shadow: none; }

/* ===== FREE ROUND MODALS ===== */
.free-round-card, .know-play-card, .free-win-card {
  text-align: center; max-width: 380px; padding: 32px 24px;
}
.fr-icon {
  font-size: 56px; margin-bottom: 8px;
  animation: fr-bounce 0.6s ease-out;
}
@keyframes fr-bounce {
  0% { transform: scale(0); } 40% { transform: scale(1.3); } 100% { transform: scale(1); }
}
.fr-subtitle {
  font-size: 15px; color: rgba(255,255,255,0.85); margin: 8px 0; line-height: 1.5;
}
.fr-desc {
  font-size: 13px; color: rgba(255,255,255,0.5); margin: 6px 0 16px; line-height: 1.5;
}
.fr-prize {
  font-family: 'Fredoka One', cursive; font-size: 42px; color: #4caf50;
  text-shadow: 0 0 30px rgba(76,175,80,0.5); margin: 12px 0;
  animation: fr-prize-pop 0.5s ease-out;
}
@keyframes fr-prize-pop {
  0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; }
}
.know-play-btns {
  display: flex; flex-direction: column; gap: 10px; margin-top: 8px;
}
.btn-outline {
  width: 100%; padding: 13px 24px; background: transparent;
  color: var(--gold); font-weight: 800; border: 2px solid var(--gold);
  border-radius: 12px; font-size: 16px; font-family: 'Nunito', sans-serif;
  cursor: pointer; transition: all 0.15s;
}
.btn-outline:hover { background: rgba(255,215,0,0.08); }
.btn-outline:active { transform: scale(0.96); }
.fr-later {
  margin-top: 8px; font-size: 13px; padding: 10px; border-width: 1px;
  color: rgba(255,255,255,0.4); border-color: rgba(255,255,255,0.15);
}

/* ===== TUTORIAL OVERLAY ===== */
.tutorial-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.tutorial-box {
  background: var(--card); border: 2px solid var(--gold);
  border-radius: 18px; padding: 28px 24px; max-width: 340px; width: 90%;
  text-align: center; position: relative;
  animation: tut-enter 0.3s ease-out;
}
@keyframes tut-enter {
  0% { transform: scale(0.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.tutorial-step-indicator {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 16px;
}
.tutorial-step-indicator .tut-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.2); transition: all 0.3s;
}
.tutorial-step-indicator .tut-dot.active {
  background: var(--gold); transform: scale(1.3);
  box-shadow: 0 0 8px rgba(255,215,0,0.5);
}
.tutorial-icon { font-size: 48px; margin-bottom: 8px; }
.tutorial-title {
  font-size: 18px; font-weight: 800; color: var(--gold); margin-bottom: 8px;
}
.tutorial-text {
  font-size: 14px; color: rgba(255,255,255,0.75); line-height: 1.6; margin-bottom: 16px;
}
.tutorial-next { font-size: 14px; padding: 10px 20px; }

/* ===== COLOR UTILITIES ===== */
.color-red { color: var(--red) !important; }
.color-green { color: var(--green) !important; }
.color-yellow { color: var(--yellow) !important; }
.color-blue { color: var(--blue) !important; }

/* ===== MOBILE DEPOSIT FIX ===== */
@media (max-width: 420px) {
  .deposit-card { padding: 16px 14px 20px; }
  .deposit-quick-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .qv { font-size: 14px; padding: 20px 2px 6px; }
  .qv-tag { font-size: 7px; padding: 1px 3px; }
  .deposit-method-label { font-size: 13px; }
  .deposit-section-header { font-size: 12px; }
  .deposit-bonus-explain { font-size: 10px; }
}

/* ===== DESKTOP ADAPTATION ===== */
@media (min-width: 600px) {
  .top-header { min-height: 48px; padding: 0 12px; flex-wrap: nowrap; }
  .header-logo { font-size: 17px; }
  .header-actions { gap: 8px; flex-wrap: nowrap; }
  .hdr-btn { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
  .hdr-balance { padding: 4px 12px; font-size: 12px; }
  .hdr-balance-icon { font-size: 14px; }
  .hdr-user-pill { padding: 4px 10px; font-size: 12px; max-width: 160px; }
  .hdr-user-icon { font-size: 14px; width: 26px; height: 26px; }
  .board-wrapper { max-width: 520px; }
  .player-row { max-width: 520px; }
  .pcard { padding: 8px 10px; min-height: 48px; }
  .pcard-avatar { font-size: 22px; width: 32px; height: 32px; }
  .pcard-name { font-size: 13px; }
  .pcard-status { font-size: 10px; }
  .dice { width: 54px; height: 54px; }
  .dice-face { font-size: 28px; }
  .btn-roll { width: 50px; height: 50px; font-size: 24px; }
  .game-message { font-size: 14px; }
  .deposit-card { max-width: 420px; }
  .auth-card { max-width: 380px; }
}
