:root {
  --bg-dark: #0b1118;
  --felt-green: #0d3824;
  --felt-border: #1a5638;
  --accent-gold: #f5c518;
  --accent-gold-glow: rgba(245, 197, 24, 0.4);
  --accent-blue: #2a75d3;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --card-red: #e11d48;
  --card-dark: #0f172a;
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(255, 255, 255, 0.12);
  --font-family: 'Vazirmatn', 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Glassmorphism Header */
.glass-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 700;
  font-size: 14px;
}

.user-status {
  font-size: 11px;
  color: var(--text-muted);
}

.coin-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 197, 24, 0.15);
  border: 1px solid var(--accent-gold);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  color: var(--accent-gold);
}

/* Screen Transitions */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* Hero & Lobby UI */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* User Profile Card Top Section */
.user-profile-card {
  padding: 16px;
  margin-bottom: 14px;
}

/* News Marquee Ticker */
.news-ticker-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(245, 197, 24, 0.3);
  overflow: hidden;
}

.ticker-badge {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.ticker-text-wrap {
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}

.ticker-text {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  animation: marqueeTicker 18s linear infinite;
}

@keyframes marqueeTicker {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* VIP Ring & XP Bar */
.profile-avatar.vip-ring {
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 14px rgba(245, 197, 24, 0.7);
  animation: vipGlow 2s infinite ease-in-out;
}

@keyframes vipGlow {
  0% { box-shadow: 0 0 6px rgba(245, 197, 24, 0.5); }
  50% { box-shadow: 0 0 16px rgba(245, 197, 24, 0.9); }
  100% { box-shadow: 0 0 6px rgba(245, 197, 24, 0.5); }
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vip-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
}

.xp-bar-wrap {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.xp-text {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 800;
  color: #ffffff;
  line-height: 12px;
}

/* Daily Reward Card */
.daily-reward-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(245, 197, 24, 0.15), rgba(234, 179, 8, 0.05));
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: 16px;
}

.reward-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reward-icon {
  font-size: 24px;
}

.reward-texts {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.reward-texts strong {
  font-size: 12px;
  color: var(--accent-gold);
}

.reward-texts small {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-gold {
  background: linear-gradient(135deg, #f5c518, #d97706);
  color: #0f172a;
  font-weight: 800;
  border: none;
  padding: 6px 14px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 197, 24, 0.3);
  transition: transform 0.2s ease;
}

.btn-gold:hover {
  transform: translateY(-2px);
}

/* 2x2 Interactive Game Cards Grid */
.game-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.game-mode-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
}

.game-mode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.game-mode-card.active {
  border-color: var(--accent-gold);
  background: rgba(245, 197, 24, 0.1);
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.3);
}

.mode-badge {
  font-size: 8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.mode-badge.gold { background: rgba(245, 197, 24, 0.2); color: #f5c518; border: 1px solid #f5c518; }
.mode-badge.purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid #c084fc; }
.mode-badge.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid #60a5fa; }
.mode-badge.red { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #f87171; }

.mode-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.mode-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.mode-desc {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.2;
}

.mode-meta {
  font-size: 9px;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 6px;
  width: 100%;
  text-align: center;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-avatar-wrap {
  position: relative;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.status-indicator.online {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid #0f172a;
  border-radius: 50%;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.profile-name {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.profile-status {
  font-size: 11px;
  color: #22c55e;
  font-weight: 600;
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 197, 24, 0.15);
  border: 1px solid var(--accent-gold);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 13px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
}

/* Play Action Card Middle Section */
.play-action-card {
  padding: 16px;
  margin-bottom: 14px;
  text-align: center;
}

.section-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--accent-gold);
}

.large-play-btn {
  font-size: 15px;
  font-weight: 800;
  padding: 14px;
}

/* Bottom Tabs Header & Leaderboard Table */
.bottom-tabs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.bottom-tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-gold), #f59e0b);
  color: #0f172a;
  border-color: var(--accent-gold);
  font-weight: 800;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.leaderboard-table th {
  text-align: right;
  color: var(--text-muted);
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
}

.leaderboard-table td {
  padding: 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11px;
}

.rank-1 { background: #f5c518; color: #000; }
.rank-2 { background: #cbd5e1; color: #000; }
.rank-3 { background: #b45309; color: #fff; }
.rank-other { background: rgba(255, 255, 255, 0.1); color: #fff; }

.hero-banner {
  text-align: center;
  margin-bottom: 20px;
}

.hero-title {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #f5c518, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Game Selection Tabs */
.game-type-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.pulse {
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.6); }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Card Table & Felt */
.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 12px;
}

.score-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.score-details small {
  font-size: 9px;
  color: var(--text-muted);
}

.score-val {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-gold);
}

.tricks-val {
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  margin-top: 2px;
}

.trump-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.card-table {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 360px;
  background: radial-gradient(circle, var(--felt-green) 0%, #051a10 100%);
  border: 8px solid var(--felt-border);
  border-radius: 50%;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8), 0 12px 36px rgba(0, 0, 0, 0.6);
  margin-bottom: 12px;
}

/* Seats Positioning around circular felt */
.player-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  z-index: 10;
}

.seat-top { top: 10px; left: 50%; transform: translateX(-50%); }
.seat-bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }
.seat-left { left: 10px; top: 50%; transform: translateY(-50%); }
.seat-right { right: 10px; top: 50%; transform: translateY(-50%); }

.avatar-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.avatar-timer-ring {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f5c518 100%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.avatar-timer-ring.active {
  opacity: 1;
  box-shadow: 0 0 12px rgba(245, 197, 24, 0.6);
}

.avatar-circle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 2;
}

.player-name {
  font-weight: 600;
  margin-top: 2px;
}

.card-count-badge {
  font-size: 10px;
  color: var(--text-muted);
}

/* Active Turn Glowing Seat Highlights */
.player-seat.active-turn .avatar-circle {
  border-color: #f5c518;
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.9), 0 0 4px #f5c518;
  animation: pulseAvatarTurn 1.4s infinite ease-in-out;
}

.player-seat.active-turn .player-name {
  color: #f5c518;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(245, 197, 24, 0.6);
}

@keyframes pulseAvatarTurn {
  0% { box-shadow: 0 0 8px rgba(245, 197, 24, 0.6), 0 0 2px #f5c518; transform: scale(1.08); }
  50% { box-shadow: 0 0 20px rgba(245, 197, 24, 1), 0 0 6px #f5c518; transform: scale(1.2); }
  100% { box-shadow: 0 0 8px rgba(245, 197, 24, 0.6), 0 0 2px #f5c518; transform: scale(1.08); }
}

/* Trick Arena */
.trick-arena {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
}

.played-card-slot {
  position: absolute;
  width: 48px;
  height: 68px;
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot-top { top: 0; left: 56px; }
.slot-bottom { bottom: 0; left: 56px; }
.slot-left { left: 0; top: 46px; }
.slot-right { right: 0; top: 46px; }

/* Hand Fan Container */
.hand-container {
  display: flex;
  flex-direction: column;
  padding: 12px;
  position: relative;
  z-index: 1000;
}

.hand-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.turn-indicator {
  font-weight: 700;
  color: var(--accent-gold);
}

.cards-fan {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 100px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 5px;
}

/* Playing Card styling */
.playing-card {
  width: 52px;
  height: 76px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 4px;
  font-weight: 800;
  font-size: 13px;
  margin-left: -18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.playing-card:hover, .playing-card:active {
  transform: translateY(-16px) scale(1.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
  z-index: 50;
}

.playing-card.red { color: var(--card-red); }
.playing-card.black { color: var(--card-dark); }

/* Playable Cards Green Aura Glow */
.playing-card.playable {
  border: 2px solid #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.8), 0 0 4px #22c55e, 0 4px 10px rgba(0, 0, 0, 0.4);
  animation: pulseGreenGlow 1.8s infinite ease-in-out;
  transform: translateY(-4px);
}

@keyframes pulseGreenGlow {
  0% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.6), 0 0 2px #22c55e; }
  50% { box-shadow: 0 0 16px rgba(34, 197, 94, 1), 0 0 6px #22c55e; }
  100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.6), 0 0 2px #22c55e; }
}

.playing-card.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Winner Celebration Modal */
.winner-celebration-card {
  position: relative;
  text-align: center;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 32px rgba(245, 197, 24, 0.6), inset 0 0 16px rgba(245, 197, 24, 0.2);
  animation: modalPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPopIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.trophy-badge-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trophy-icon {
  font-size: 52px;
  z-index: 2;
  animation: bounceTrophy 1.5s infinite ease-in-out;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.15); }
}

.starburst-fx {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 197, 24, 0.4) 0%, rgba(245, 197, 24, 0) 70%);
  animation: pulseStarburst 2s infinite linear;
}

@keyframes pulseStarburst {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

.winner-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-gold);
  margin: 0 0 4px 0;
  text-shadow: 0 0 10px rgba(245, 197, 24, 0.5);
}

.winner-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}

.rewards-summary-box {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.reward-pill {
  background: rgba(245, 197, 24, 0.15);
  border: 1px solid var(--accent-gold);
  border-radius: 12px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-summary-grid {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-around;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.card-top { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.card-suit-big { font-size: 18px; align-self: center; }

/* Modal for Trump Selection */
.modal-overlay {
  display: none;
  position: fixed;
  top: 55px;
  left: 0;
  right: 0;
  bottom: 140px; /* Leaves hand container at bottom completely clear and unblurred */
  background: rgba(11, 17, 24, 0.55);
  z-index: 900;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

#gameEndedModal, #createRoomModal {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(11, 17, 24, 0.85);
  backdrop-filter: blur(8px);
}

.modal-card {
  text-align: center;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--accent-gold);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 20px var(--accent-gold-glow);
}

.trump-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.trump-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

.trump-btn.hearts, .trump-btn.diamonds { color: var(--card-red); }
.trump-btn.spades, .trump-btn.clubs { color: #ffffff; }

.suit-sym { font-size: 28px; }

.game-notice {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.timer-badge {
  display: inline-block;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #f87171;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  margin-right: 8px;
  transition: all 0.3s ease;
}

.timer-badge.active {
  animation: pulseTimer 1s infinite ease-in-out;
}

.btn-leave-room {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-leave-room:hover {
  background: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  border-color: #ef4444;
}

@keyframes pulseTimer {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 10px rgba(239, 68, 68, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
}

/* Speech Bubbles above player seats */
.chat-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--accent-gold);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.chat-bubble.active {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

.chat-bubble:after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--accent-gold) transparent transparent transparent;
}

/* Chat & Emotes Bar */
.chat-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

.quick-emotes {
  display: flex;
  justify-content: space-around;
}

.emote-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.emote-btn:active {
  transform: scale(1.3);
}

.chat-input-wrapper {
  display: flex;
  gap: 6px;
}

.chat-input-wrapper input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 12px;
  outline: none;
}

.chat-input-wrapper input:focus {
  border-color: var(--accent-gold);
}

.btn-send {
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Toast Notifications System */
.toast-container {
  position: fixed;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 380px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: auto;
}

.toast-item.error {
  background: rgba(185, 28, 28, 0.92);
  border: 1px solid #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.toast-item.warning {
  background: rgba(180, 83, 9, 0.92);
  border: 1px solid var(--accent-gold);
  box-shadow: 0 8px 24px rgba(245, 197, 24, 0.4);
}

.toast-item.success {
  background: rgba(4, 120, 87, 0.92);
  border: 1px solid #10b981;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateY(-20px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-item.fade-out {
  animation: toastOut 0.3s forwards;
}

@keyframes toastOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.9); }
}

/* Waiting For Players Overlay Banner */
.waiting-radar-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 290px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(245, 197, 24, 0.4);
  background: rgba(11, 17, 24, 0.88);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(245, 197, 24, 0.2);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: waitingPopIn 0.4s ease-out forwards;
}

@keyframes waitingPopIn {
  0% { opacity: 0; transform: translate(-50%, -45%) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.radar-pulse-ring {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(245, 197, 24, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent-gold);
  animation: radarGlow 2s infinite ease-in-out;
}

@keyframes radarGlow {
  0% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0.6); }
  70% { box-shadow: 0 0 0 18px rgba(245, 197, 24, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0); }
}

.radar-center-icon {
  font-size: 24px;
  animation: spinHourglass 3s infinite linear;
}

@keyframes spinHourglass {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

.waiting-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-gold);
  margin: 0;
}

.waiting-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.btn-invite-share {
  background: linear-gradient(135deg, #f5c518 0%, #d4a017 100%);
  color: #0b1118;
  font-weight: 800;
  font-size: 12px;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 197, 24, 0.3);
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 4px;
}

.btn-invite-share:active {
  transform: scale(0.96);
}

/* Empty Seat Styling */
.player-seat.seat-empty .avatar-circle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(245, 197, 24, 0.4);
  color: rgba(255, 255, 255, 0.4);
  animation: emptySeatPulse 2s infinite ease-in-out;
}

@keyframes emptySeatPulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}
