/*
 * ==========================================================================
 *  COINFLIP / MONKEY FLIP  --  Extracted from style.css
 *  Lunex Club
 * ==========================================================================
 */

/* ===== COIN FLIP - 3D COIN ===== */
.coin-scene {
  width: 180px;
  height: 180px;
  perspective: 800px;
  margin: 1rem auto;
  position: relative;
  z-index: 1;
}
.coin-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.1s;
}
.coin-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 900;
  backface-visibility: hidden;
  /* Edge ring effect */
  box-shadow: 0 0 0 6px rgba(0,0,0,0.3), inset 0 0 30px rgba(0,0,0,0.1);
}
.coin-heads-face {
  background: linear-gradient(145deg, #ffe066, #ffd700, #e6ac00);
  color: #7a5c00;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  box-shadow: 0 0 0 6px #c9960c, 0 0 40px var(--gold-glow), inset 0 0 30px rgba(255,255,255,0.2);
}
.coin-tails-face {
  background: linear-gradient(145deg, #d4d4d8, #a1a1aa, #909098);
  color: #3f3f46;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  box-shadow: 0 0 0 6px #71717a, 0 0 40px rgba(160,160,170,0.3), inset 0 0 30px rgba(255,255,255,0.15);
  transform: rotateX(180deg);
}
.coin-3d.flip-heads { transform: rotateX(1800deg); }
.coin-3d.flip-tails { transform: rotateX(1980deg); }
.coin-3d.flipping {
  transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.coin-3d.idle-heads { transform: rotateX(0deg); }
.coin-3d.idle-tails { transform: rotateX(180deg); }

/* Coin shine sweep */
.coin-face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
  pointer-events: none;
}

/* Coin shadow on surface */
.coin-shadow {
  width: 160px;
  height: 20px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.3) 0%, transparent 70%);
  margin: 0.5rem auto 0;
  border-radius: 50%;
  position: relative;
  z-index: 0;
}

/* ===== COIN CHOICE BUTTONS ===== */
.choice-buttons { display: flex; gap: 1rem; margin-bottom: 1rem; }
.choice-btn {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
}
.choice-btn:hover { border-color: var(--accent); }
.choice-btn.active {
  border-color: var(--accent);
  background: rgba(0,212,170,0.1);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0,212,170,0.15);
}

/* ===== MONKEY FLIP - CASINO TABLE ===== */
.monkey-stage {
  background: radial-gradient(ellipse at 50% 40%, #0f6b3a, #0a4a25 60%, #073d1e);
  border: none;
}
.felt-pattern {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 25px, rgba(255,215,0,0.015) 25px, rgba(255,215,0,0.015) 26px),
    repeating-linear-gradient(-45deg, transparent, transparent 25px, rgba(255,215,0,0.015) 25px, rgba(255,215,0,0.015) 26px);
}
.table-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  box-shadow: inset 0 0 120px rgba(0,0,0,0.5);
  border: 3px solid #c9960c;
}
.table-deco {
  position: absolute; font-size: 2rem; opacity: 0.08; color: #ffd700; pointer-events: none; z-index: 0;
}
.td-tl { top: 12px; left: 16px; } .td-tr { top: 12px; right: 16px; }
.td-bl { bottom: 12px; left: 16px; } .td-br { bottom: 12px; right: 16px; }

/* Monkey Character */
.monkey { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; animation: mkIdle 3s ease-in-out infinite; }
@keyframes mkIdle { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

.mk-hat { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; margin-bottom: -10px; }
.mk-hat-top { width: 60px; height: 38px; background: linear-gradient(135deg, #1a1a1a, #333, #1a1a1a); border-radius: 8px 8px 0 0; position: relative; display: flex; align-items: center; justify-content: center; }
.mk-hat-badge { color: #ffd700; font-size: 1rem; text-shadow: 0 0 6px rgba(255,215,0,0.5); }
.mk-hat-band { width: 60px; height: 6px; background: linear-gradient(90deg, #8b6914, #ffd700, #daa520, #ffd700, #8b6914); }
.mk-hat-brim { width: 95px; height: 12px; background: linear-gradient(180deg, #2a2a2a, #1a1a1a); border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

.mk-head { width: 130px; height: 120px; background: radial-gradient(circle at 50% 38%, #d4944e, #b07430, #8b5e3c); border-radius: 50% 50% 44% 44%; position: relative; z-index: 1; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.mk-ear { position: absolute; width: 34px; height: 34px; background: radial-gradient(circle, #c68642, #a0703a); border-radius: 50%; top: 30px; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.mk-ear::after { content:''; position: absolute; width: 20px; height: 20px; background: radial-gradient(circle, #f0d0a0, #deb887); border-radius: 50%; top: 7px; left: 7px; }
.mk-ear-l { left: -14px; } .mk-ear-r { right: -14px; }

.mk-brow { position: absolute; width: 20px; height: 4px; background: #5a3825; border-radius: 2px; top: 30px; z-index: 2; transition: transform 0.3s; }
.mk-brow-l { left: 24px; transform: rotate(-5deg); } .mk-brow-r { right: 24px; transform: rotate(5deg); }

.mk-eye { position: absolute; width: 20px; height: 20px; background: #fff; border-radius: 50%; top: 38px; z-index: 2; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.mk-eye-l { left: 22px; } .mk-eye-r { right: 22px; }
.mk-pupil { width: 11px; height: 11px; background: radial-gradient(circle at 40% 40%, #3a2010, #1a1a1a); border-radius: 50%; position: absolute; top: 5px; left: 5px; transition: transform 0.3s; }
.mk-pupil::after { content:''; position: absolute; width: 4px; height: 4px; background: #fff; border-radius: 50%; top: 2px; right: 2px; }

.mk-muzzle { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 72px; height: 50px; background: radial-gradient(ellipse, #f0d0a0, #deb887); border-radius: 50%; z-index: 2; }
.mk-nostril-l, .mk-nostril-r { position: absolute; width: 6px; height: 4px; background: #8b5e3c; border-radius: 50%; top: 16px; }
.mk-nostril-l { left: 24px; } .mk-nostril-r { right: 24px; }
.mk-mouth { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); width: 22px; height: 8px; border-bottom: 3px solid #8b5e3c; border-radius: 0 0 50% 50%; transition: all 0.3s; }

.mk-body { margin-top: -4px; position: relative; display: flex; flex-direction: column; align-items: center; }
.mk-tie { position: relative; z-index: 2; width: 36px; height: 14px; display: flex; align-items: center; justify-content: center; }
.mk-tie-l, .mk-tie-r { width: 16px; height: 13px; background: #e63946; border-radius: 3px; }
.mk-tie-l { transform: skewY(-6deg); } .mk-tie-r { transform: skewY(6deg); }
.mk-tie-knot { width: 8px; height: 8px; background: #c0303c; border-radius: 50%; position: absolute; z-index: 1; }

.mk-vest { width: 60px; height: 36px; background: linear-gradient(180deg, #2a2a2a, #1a1a1a); border-radius: 0 0 30px 30px; position: relative; border: 1px solid #333; border-top: none; }
.mk-btn-row { position: absolute; left: 50%; transform: translateX(-50%); top: 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.mk-vest-btn { width: 5px; height: 5px; background: #c9960c; border-radius: 50%; display: block; box-shadow: 0 0 3px rgba(201,150,12,0.4); }

.mk-arm { position: absolute; width: 18px; height: 50px; background: linear-gradient(180deg, #c68642, #a0703a); border-radius: 9px; top: 10px; transform-origin: top center; transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1); }
.mk-arm-l { left: -16px; transform: rotate(-15deg); } .mk-arm-r { right: -16px; transform: rotate(15deg); }
.mk-hand { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 16px; height: 14px; background: radial-gradient(circle, #d4944e, #c68642); border-radius: 50%; }

/* Monkey States */
.monkey.throwing { animation: none; }
.monkey.throwing .mk-arm-r { transform: rotate(-75deg); }
.monkey.throwing .mk-pupil { transform: translateY(2px); }

.monkey.celebrating .mk-arm-l { transform: rotate(-55deg); }
.monkey.celebrating .mk-arm-r { transform: rotate(55deg); }
.monkey.celebrating .mk-mouth { width: 28px; height: 12px; border-bottom-width: 3.5px; border-radius: 0 0 50% 50%; }
.monkey.celebrating .mk-brow-l { transform: rotate(-15deg) translateY(-3px); }
.monkey.celebrating .mk-brow-r { transform: rotate(15deg) translateY(-3px); }
.monkey.celebrating { animation: mkCelebrate 0.5s ease-in-out 3; }
@keyframes mkCelebrate { 0%,100%{transform:translateY(0) rotate(0)} 25%{transform:translateY(-10px) rotate(-4deg)} 75%{transform:translateY(-10px) rotate(4deg)} }

.monkey.sad .mk-mouth { border-bottom: none; border-top: 3px solid #8b5e3c; border-radius: 50% 50% 0 0; bottom: 12px; }
.monkey.sad .mk-arm-l { transform: rotate(-5deg); } .monkey.sad .mk-arm-r { transform: rotate(5deg); }
.monkey.sad .mk-brow-l { transform: rotate(10deg) translateY(2px); } .monkey.sad .mk-brow-r { transform: rotate(-10deg) translateY(2px); }
.monkey.sad .mk-pupil { transform: translateY(3px); }
.monkey.sad { animation: none; transform: translateY(4px); }

/* Monkey Coin */
.mk-game-content { display: flex; flex-direction: column; align-items: center; z-index: 2; }
.mk-coin-wrap { margin-top: 8px; position: relative; z-index: 1; }
.mk-coin-scene { width: 140px; height: 140px; perspective: 700px; margin: 0 auto; }
.mk-coin { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.1s; }
.mk-coin-face { position: absolute; width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; backface-visibility: hidden; }
.mk-coin-face::after { content:''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 50%); pointer-events: none; }
.mk-coin-h { background: linear-gradient(145deg, #ffe066, #ffd700, #daa520); box-shadow: 0 0 0 6px #b8860b, 0 0 40px var(--gold-glow), inset 0 0 25px rgba(255,255,255,0.25); }
.mk-coin-t { background: linear-gradient(145deg, #d4d4d8, #b0b0b0, #8a8a90); box-shadow: 0 0 0 6px #71717a, 0 0 35px rgba(160,160,170,0.3), inset 0 0 25px rgba(255,255,255,0.18); transform: rotateX(180deg); }
.mk-coin.flipping { transition: transform 1s cubic-bezier(0.25,0.46,0.45,0.94); }
.mk-coin.flip-heads { transform: rotateX(1800deg); }
.mk-coin.flip-tails { transform: rotateX(1980deg); }
.mk-coin.idle-heads { transform: rotateX(0deg); }
.mk-coin.idle-tails { transform: rotateX(180deg); }
.mk-coin-shadow { width: 120px; height: 16px; background: radial-gradient(ellipse, rgba(0,0,0,0.35) 0%, transparent 70%); margin: 6px auto 0; border-radius: 50%; }

/* Win Streak */
.mk-streak { position: absolute; bottom: 14px; right: 14px; display: flex; gap: 5px; align-items: center; z-index: 5; }
.streak-fire { font-size: 1.5rem; }
.streak-count { background: linear-gradient(135deg, #ff6b35, #ff2e63); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-weight: 900; font-size: 1.4rem; }

/* ===== RESPONSIVE ===== */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
  /* Monkey + coin - scale as one unit */
  .mk-game-content { transform: scale(0.8); transform-origin: center center; }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
  /* Monkey + coin - scale for phone */
  .mk-game-content { transform: scale(0.5); transform-origin: center top; }
  .table-deco { font-size: 1.2rem; }
  .td-tl { top: 4px; left: 6px; } .td-tr { top: 4px; right: 6px; }
  .td-bl { bottom: 4px; left: 6px; } .td-br { bottom: 4px; right: 6px; }
  .mk-streak { bottom: 4px; right: 5px; }
  .streak-fire { font-size: 1rem; }
  .streak-count { font-size: 0.9rem; }
}

/* Very small/short screens */
@media (max-height: 600px) {
  .mk-game-content { transform: scale(0.38); transform-origin: center top; }
}
