:root {
  /* Midnight Royal Sapphire & Warm Champagne Gold Theme */
  --bg-obsidian: #070b16;
  --bg-midnight: #0e1529;
  --bg-indigo: #162040;
  --surface-glass: rgba(17, 25, 48, 0.78);
  --surface-elevated: rgba(24, 35, 66, 0.88);
  --surface-border: rgba(255, 255, 255, 0.11);
  --gold-border: rgba(246, 196, 83, 0.34);

  --gold: #f6c453;
  --gold-bright: #ffe599;
  --gold-deep: #d48c1a;
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --violet: #8b5cf6;
  --violet-soft: #c4b5fd;
  --rose: #f43f5e;
  --danger: #ef4444;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --card-white: #ffffff;
  --suit-red: #e11d48;
  --suit-black: #0f172a;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(circle at 20% 10%, #1a264d 0%, var(--bg-midnight) 46%, var(--bg-obsidian) 100%);
  color: var(--text-main);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-mini {
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

button, input {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ================= Ambient Background Orbs ================= */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.34;
}

.orb-1 {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: radial-gradient(circle, #6d28d9, transparent 70%);
}

.orb-2 {
  width: 380px;
  height: 380px;
  bottom: -120px;
  right: -80px;
  background: radial-gradient(circle, #d97706, transparent 70%);
}

.orb-3 {
  width: 300px;
  height: 300px;
  top: 42%;
  right: 18%;
  background: radial-gradient(circle, #059669, transparent 70%);
  opacity: 0.18;
}

/* ================= Custom Scrollbars ================= */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 99px;
}

/* ================= Toast Notifications ================= */
#toast-container {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(15, 23, 46, 0.94);
  backdrop-filter: blur(18px);
  border: 1px solid var(--gold-border);
  border-left: 4px solid var(--gold);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideDown 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================= Screens & Smooth Transitions ================= */
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lobby-body, .modal-box, .hand-fan {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Smooth Ambient Orb Floating */
.orb-1 {
  animation: orbDrift1 16s ease-in-out infinite alternate;
}

.orb-2 {
  animation: orbDrift2 20s ease-in-out infinite alternate;
}

@keyframes orbDrift1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(35px, 25px) scale(1.08); }
}

@keyframes orbDrift2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-30px, -22px) scale(1.1); }
}

/* ================= Auth Screen ================= */
#auth-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  overflow-y: auto;
  gap: 20px;
}

.brand-hero {
  text-align: center;
}

.brand-emblem {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  border-radius: 24px;
  background: linear-gradient(145deg, #273766 0%, #101830 100%);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(246, 196, 83, 0.28);
}

.brand-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-mini-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(246, 196, 83, 0.45);
  object-fit: cover;
}

.brand-hero h1 {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #ffffff 10%, var(--gold-bright) 58%, var(--gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-hero p {
  margin: 6px 0 12px;
  color: var(--text-secondary);
  font-size: 0.96rem;
  font-weight: 500;
}

.brand-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.brand-pills span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.11);
  padding: 5px 11px;
  border-radius: 99px;
}

.glass-card {
  background: var(--surface-glass);
  border: 1px solid var(--surface-border);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: min(100%, 425px);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px);
}

.tab-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(6, 10, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 13px;
  padding: 4px;
  margin-bottom: 18px;
}

.tab-pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 6px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab-pill:hover {
  color: var(--text-main);
}

.tab-pill.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #141008;
  box-shadow: 0 4px 14px rgba(246, 196, 83, 0.28);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(6, 10, 22, 0.58);
  color: var(--text-main);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-field::placeholder {
  color: rgba(148, 163, 184, 0.65);
}

.input-field:focus {
  border-color: var(--gold);
  background: rgba(6, 10, 22, 0.8);
  box-shadow: 0 0 0 3px rgba(246, 196, 83, 0.16);
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.avatar-choice {
  padding: 10px 0;
  border-radius: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.3rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.16s ease;
}

.avatar-choice:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
}

.avatar-choice.selected {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(246, 196, 83, 0.25), rgba(212, 140, 26, 0.12));
  box-shadow: 0 0 16px rgba(246, 196, 83, 0.24);
  transform: translateY(-2px);
}

/* ================= Crisp Custom Inline SVG Icons & Compact Symmetric Buttons ================= */
.ui-ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-block;
}

.ui-ico.sm {
  width: 14px;
  height: 14px;
}

.muted-ico {
  color: var(--text-muted);
  opacity: 0.72;
}

.btn {
  border: none;
  border-radius: 10px;
  height: 38px;
  padding: 0 14px;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.15px;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-lg {
  height: 42px;
  padding: 0 18px;
  font-size: 0.9rem;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.compact-input {
  height: 38px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.16s ease;
}

.mode-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mode-head-row .mode-badge {
  margin-bottom: 0;
}

.game-tile-icon svg {
  width: 26px;
  height: 26px;
  display: block;
}

/* Per-Game Leaderboard Pill Bar (Symmetric 4-Way Grid) */
.lb-game-pills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(6, 10, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}

.lb-pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  height: 32px;
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.lb-pill:hover {
  color: var(--text-main);
}

.lb-pill.active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #141008;
  box-shadow: 0 2px 10px rgba(246, 196, 83, 0.25);
}

.lb-rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.lb-rank-badge.r-1 { background: linear-gradient(135deg, #ffe082, #d98c1c); color: #161105; }
.lb-rank-badge.r-2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #0f172a; }
.lb-rank-badge.r-3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #fff; }

.subnav-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(6, 10, 22, 0.45);
  border-radius: 12px;
  padding: 4px;
  border-bottom: none;
  margin-bottom: 12px;
}

.subnav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 0.8rem;
}

.game-tile {
  padding: 12px 12px;
  border-radius: 14px;
  gap: 11px;
}

.game-tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.game-tile-text strong {
  font-size: 0.96rem;
}

.mode-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mode-card {
  padding: 16px;
  border-radius: 16px;
  gap: 14px;
}

.mode-card h3 {
  font-size: 1.02rem;
}

.lobby-header {
  height: 58px;
  padding: 0 18px;
}

@media (max-width: 780px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }
  .lb-game-pills {
    grid-template-columns: repeat(2, 1fr);
  }
}

.btn-gold {
  background: linear-gradient(135deg, #ffe082 0%, #f6c453 45%, #d98c1c 100%);
  color: #161105;
  box-shadow: 0 6px 20px rgba(246, 196, 83, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-emerald {
  background: linear-gradient(135deg, #34d399 0%, #10b981 55%, #059669 100%);
  color: #032216;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 9px;
}

/* ================= Lobby Screen ================= */
.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: rgba(10, 16, 34, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-mini {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-bright);
  padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mini span {
  background: linear-gradient(90deg, #ffffff, var(--gold-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 560px) {
  .brand-mini {
    display: none;
  }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.user-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--gold-border);
}

.avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #273766, #111936);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.user-meta strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.15;
}

.user-meta span {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 1.05rem;
  transition: all 0.16s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  transform: translateY(-1px);
}

.icon-btn.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: var(--emerald);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.22);
}

.icon-btn.muted {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.42);
  color: #fda4af;
}

.badge-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--rose);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.5);
}

.lobby-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 28px;
  max-width: 1020px;
  width: 100%;
  margin: 0 auto;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.section-heading p {
  margin: 3px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  padding: 6px 12px;
  border-radius: 99px;
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-bright);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ================= 4-Game Showcase Selector ================= */
.game-selector-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.game-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(150deg, rgba(24, 34, 66, 0.85), rgba(12, 18, 38, 0.92));
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.game-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.24);
}

.game-tile-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.tile-call-break .game-tile-icon {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.28), rgba(6, 78, 59, 0.65));
  border-color: rgba(52, 211, 153, 0.35);
}

.tile-court-piece .game-tile-icon {
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.3), rgba(76, 29, 149, 0.65));
  border-color: rgba(167, 139, 250, 0.38);
}

.tile-ludo .game-tile-icon {
  background: linear-gradient(145deg, rgba(246, 196, 83, 0.3), rgba(180, 83, 9, 0.65));
  border-color: rgba(253, 224, 71, 0.38);
}

.tile-chess .game-tile-icon {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.28), rgba(30, 58, 138, 0.72));
  border-color: rgba(125, 211, 252, 0.42);
}

.game-tile-text strong {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.game-tile-text small {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.game-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.game-tile.active {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(246, 196, 83, 0.18), rgba(24, 34, 68, 0.96));
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(246, 196, 83, 0.3),
    0 0 24px rgba(246, 196, 83, 0.16);
  transform: translateY(-2px);
}

.game-tile.active .game-tag {
  background: rgba(246, 196, 83, 0.22);
  color: var(--gold-bright);
}

@media (max-width: 780px) {
  .game-selector-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .game-tile {
    padding: 12px 10px;
    gap: 10px;
  }
  .game-tile-text small {
    display: none;
  }
}

/* ================= Action Mode Cards ================= */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.mode-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-top-color: rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  transition: transform 0.18s ease, border-color 0.2s ease;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-card.mode-featured {
  background: linear-gradient(155deg, rgba(34, 46, 88, 0.88), rgba(15, 22, 46, 0.94));
  border-color: rgba(246, 196, 83, 0.28);
}

.mode-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 99px;
  margin-bottom: 10px;
}

.mode-badge.gold {
  background: rgba(246, 196, 83, 0.18);
  color: var(--gold-bright);
  border: 1px solid rgba(246, 196, 83, 0.35);
}

.mode-badge.emerald {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.34);
}

.mode-badge.violet {
  background: rgba(139, 92, 246, 0.18);
  color: var(--violet-soft);
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.mode-card h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  color: var(--text-main);
}

.mode-card p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.private-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.join-code-row {
  display: flex;
  gap: 8px;
}

.join-code-row input {
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-weight: 800;
  text-align: center;
}

/* ================= Social / Leaderboard Card ================= */
.social-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 16px;
}

.subnav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.subnav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.16s ease;
}

.subnav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.subnav-btn.active {
  background: rgba(246, 196, 83, 0.16);
  border-color: rgba(246, 196, 83, 0.35);
  color: var(--gold-bright);
}

.list-panel {
  min-height: 80px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 10px;
  transition: background 0.14s ease;
}

.list-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.list-row:last-child {
  border-bottom: none;
}

.status-pill {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 700;
}

.status-online { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.status-in_game, .status-lobby { background: rgba(246, 196, 83, 0.2); color: var(--gold-bright); }
.status-offline { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

/* ================= Active Game Screen & Per-Game Ambient Themes ================= */
#table-screen {
  position: relative;
  justify-content: space-between;
  background: radial-gradient(ellipse at 50% 45%, #115740 0%, #093025 56%, #051314 100%);
  transition: background 0.35s ease;
}

#table-screen.theme-court-piece {
  background: radial-gradient(ellipse at 50% 45%, #262261 0%, #14143c 56%, #070818 100%);
}

#table-screen.theme-ludo {
  background: radial-gradient(ellipse at 50% 45%, #1c274d 0%, #0f1630 58%, #070b17 100%);
}

#table-screen.theme-chess {
  background: radial-gradient(ellipse at 50% 45%, #231f3a 0%, #111326 58%, #070812 100%);
}

/* ================= Luxury 8x8 Chess Arena ================= */
.table-arena.chess-arena .seat-left,
.table-arena.chess-arena .seat-right {
  display: none !important;
}

.table-arena.chess-arena .seat-top {
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  gap: 10px;
}

.table-arena.chess-arena .seat-bottom {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  gap: 10px;
}

.table-arena.chess-arena .seat-identity {
  flex-direction: row;
  gap: 10px;
  align-items: center;
}

.table-arena.chess-arena .video-frame {
  width: 50px;
  height: 50px;
}

.table-arena.chess-arena .video-frame.has-video {
  width: 72px;
  height: 92px;
  border-radius: 14px;
}

.table-arena.chess-arena .seat-plate {
  margin-top: 0;
  text-align: left;
  min-width: 118px;
}

.chess-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.chess-board {
  width: min(92vw, 56dvh, 456px);
  height: min(92vw, 56dvh, 456px);
  border: 4px solid var(--gold);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
  box-shadow:
    0 20px 54px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(255, 255, 255, 0.14);
}

.chess-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.14s ease;
}

.chess-sq.sq-light { background: #f3e6cf; }
.chess-sq.sq-dark { background: #7a543e; }

.chess-sq.sq-last {
  box-shadow: inset 0 0 0 99px rgba(246, 196, 83, 0.36);
}

.chess-sq.sq-selected {
  box-shadow: inset 0 0 0 99px rgba(16, 185, 129, 0.45);
}

.chess-sq.sq-check {
  box-shadow: inset 0 0 22px 6px rgba(225, 29, 72, 0.85);
  animation: checkPulse 0.9s ease-in-out infinite alternate;
}

@keyframes checkPulse {
  from { box-shadow: inset 0 0 16px 4px rgba(225, 29, 72, 0.7); }
  to { box-shadow: inset 0 0 26px 8px rgba(244, 63, 94, 0.98); }
}

.chess-sq.sq-legal::after {
  content: '';
  position: absolute;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.32);
  pointer-events: none;
}

.chess-sq.sq-legal-cap::after {
  content: '';
  position: absolute;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  border: 4px solid rgba(225, 29, 72, 0.72);
  background: transparent;
  pointer-events: none;
}

.chess-coord {
  position: absolute;
  font-size: 0.54rem;
  font-weight: 800;
  opacity: 0.62;
  pointer-events: none;
}

.chess-coord.coord-rank { top: 2px; left: 3px; }
.chess-coord.coord-file { bottom: 1px; right: 3px; }
.sq-light .chess-coord { color: #5c3a28; }
.sq-dark .chess-coord { color: #f3e6cf; }

.chess-piece {
  font-size: clamp(1.55rem, 6.2vw, 2.7rem);
  line-height: 1;
  z-index: 2;
  pointer-events: none;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.chess-piece.piece-w {
  color: #ffffff;
  text-shadow:
    0 1px 0 #1e293b,
    0 -1px 0 #1e293b,
    1px 0 0 #1e293b,
    -1px 0 0 #1e293b,
    0 3px 6px rgba(0, 0, 0, 0.45);
}

.chess-piece.piece-b {
  color: #111827;
  text-shadow:
    0 1px 0 rgba(255, 240, 200, 0.55),
    0 3px 6px rgba(0, 0, 0, 0.48);
}

.chess-sq.sq-selected .chess-piece {
  transform: scale(1.14) translateY(-2px);
}

.chess-captured-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 20px;
  font-size: 0.95rem;
  width: min(92vw, 456px);
  padding: 0 4px;
  opacity: 0.9;
}

.chess-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(92vw, 456px);
  background: rgba(10, 16, 34, 0.92);
  border: 1px solid var(--gold-border);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.chess-status-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chess-opening-pill {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--violet-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chess-status-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ================= Post-Game Analysis & Book Openings Explorer ================= */
.analysis-acc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.analysis-acc-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

.analysis-acc-score {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--gold-bright);
  line-height: 1.1;
}

.analysis-section {
  background: rgba(6, 10, 22, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: left;
}

.analysis-section h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--gold-bright);
}

.analysis-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  justify-content: center;
}

.analysis-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
}

.weakness-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.1);
  border-left: 3px solid var(--rose);
  margin-bottom: 7px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.weakness-item.solid {
  background: rgba(16, 185, 129, 0.12);
  border-left-color: var(--emerald);
}

.move-eval-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.move-eval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
}

.move-eval-row.cls-blunder { background: rgba(244, 63, 94, 0.18); border-left: 3px solid var(--rose); }
.move-eval-row.cls-mistake { background: rgba(245, 158, 11, 0.16); border-left: 3px solid #f59e0b; }
.move-eval-row.cls-inaccuracy { background: rgba(250, 204, 21, 0.1); border-left: 3px solid #facc15; }
.move-eval-row.cls-book { background: rgba(139, 92, 246, 0.14); border-left: 3px solid var(--violet); }

.book-opening-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 8px;
}

.book-eco-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(246, 196, 83, 0.2);
  color: var(--gold-bright);
  margin-right: 6px;
}

.book-moves-line {
  font-family: 'Outfit', monospace;
  font-size: 0.8rem;
  color: var(--emerald-bright);
  margin: 4px 0;
}

.chess-last-move {
  color: var(--gold-bright);
  font-family: 'Outfit', monospace;
  font-size: 0.85rem;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.promo-btn {
  font-size: 2rem;
  padding: 12px 0;
  border-radius: 14px;
  border: 1.5px solid var(--gold-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.16s ease;
}

.promo-btn:hover {
  background: rgba(246, 196, 83, 0.22);
  transform: translateY(-2px);
}

.table-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(7, 11, 24, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(246, 196, 83, 0.2);
  z-index: 20;
  gap: 10px;
}

.hud-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.room-badge {
  background: linear-gradient(135deg, rgba(246, 196, 83, 0.2), rgba(212, 140, 26, 0.14));
  border: 1px solid rgba(246, 196, 83, 0.5);
  color: var(--gold-bright);
  padding: 5px 11px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  cursor: pointer;
}

.hud-round-pill {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 11px;
  border-radius: 10px;
}

.media-bar {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-arena {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
}

/* Sculpted Velvet Table Rail */
.felt-ring {
  position: absolute;
  inset: 52px 30px 104px 30px;
  border: 3px solid rgba(246, 196, 83, 0.28);
  border-radius: 160px;
  pointer-events: none;
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, 0.42),
    inset 0 0 0 10px rgba(0, 0, 0, 0.18),
    0 0 40px rgba(0, 0, 0, 0.35);
}

/* ================= Center Engraved Trump / Rang Medallion & Drop Zone ================= */
.table-trump-medallion {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.trump-ring-outer {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  padding: 6px;
  background: radial-gradient(circle, rgba(246, 196, 83, 0.16) 0%, rgba(246, 196, 83, 0.03) 72%, transparent 100%);
  border: 1.5px dashed rgba(246, 196, 83, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 32px rgba(246, 196, 83, 0.14);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.trump-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.12), rgba(7, 15, 24, 0.62) 85%);
  border: 1.5px solid rgba(246, 196, 83, 0.48);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.48);
}

.trump-suit-glyph {
  font-size: 2.35rem;
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55));
}

.table-trump-medallion.suit-red .trump-suit-glyph {
  color: #fb7185;
  text-shadow: 0 0 18px rgba(244, 63, 94, 0.65);
}

.table-trump-medallion.suit-black .trump-suit-glyph {
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(246, 196, 83, 0.55);
}

.table-trump-medallion.suit-pending .trump-suit-glyph {
  font-size: 1.5rem;
  color: var(--gold);
  opacity: 0.85;
}

.trump-suit-label {
  margin-top: 3px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold-bright);
  opacity: 0.9;
}

.table-trump-medallion.rang-pop .trump-ring-outer {
  animation: rangRevealPop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rangRevealPop {
  0% { transform: scale(0.55); opacity: 0.2; }
  60% { transform: scale(1.16); box-shadow: 0 0 42px rgba(246, 196, 83, 0.7); }
  100% { transform: scale(1); opacity: 1; }
}

/* Active Drag-to-Throw Drop Target Highlight */
.drag-drop-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--gold-bright);
  background: rgba(10, 16, 34, 0.88);
  border: 1px solid var(--gold);
  padding: 4px 12px;
  border-radius: 99px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.table-trump-medallion.drag-active .trump-ring-outer {
  transform: scale(1.12);
  border-style: solid;
  border-color: var(--gold);
  box-shadow: 0 0 36px rgba(246, 196, 83, 0.38);
}

.table-trump-medallion.drag-ready .trump-ring-outer {
  transform: scale(1.24);
  border-color: var(--emerald-bright);
  box-shadow: 0 0 48px rgba(16, 185, 129, 0.58);
}

.table-trump-medallion.drag-active .drag-drop-hint {
  opacity: 1;
  transform: translateY(0);
}

.table-trump-medallion.drag-ready .drag-drop-hint {
  opacity: 1;
  transform: translateY(0);
  background: rgba(16, 185, 129, 0.92);
  border-color: #a7f3d0;
  color: #032216;
}

/* Card Actively Being Dragged Out of Hand Bung */
.hand-fan .playing-card.legal {
  touch-action: none;
  cursor: grab;
}

.hand-fan .playing-card.dragging-card {
  cursor: grabbing;
  transition: none !important;
  z-index: 60 !important;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.72), 0 0 0 3px var(--gold-bright) !important;
}

.hand-fan .playing-card.dragging-card.drag-will-throw {
  box-shadow: 0 24px 48px rgba(16, 185, 129, 0.55), 0 0 0 3px var(--emerald-bright) !important;
}

/* ================= 4 Seat Pods with Live Voice & Video ================= */
.seat-pod {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 12;
  transition: transform 0.2s ease;
}

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

.seat-left {
  left: 12px;
  top: 41%;
  transform: translateY(-50%);
}

.seat-right {
  right: 12px;
  top: 41%;
  transform: translateY(-50%);
}

.seat-bottom {
  bottom: 136px;
  left: 16px;
}

.video-frame {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  position: relative;
  background: linear-gradient(145deg, #24335c, #0f162c);
  border: 2.5px solid rgba(255, 255, 255, 0.26);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.52);
  transition: width 0.28s cubic-bezier(0.22, 1, 0.36, 1), height 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.28s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

/* When live camera is active, morph into a crisp portrait video card so faces are clearly visible! */
.video-frame.has-video {
  width: 96px;
  height: 124px;
  border-radius: 16px;
  border-color: rgba(246, 196, 83, 0.65);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.video-frame.has-video::after {
  content: 'LIVE';
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(16, 185, 129, 0.9);
  color: #032216;
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 5px;
  z-index: 4;
  pointer-events: none;
}

/* Tap-to-Expand Floating Spotlight Video (PiP) */
.seat-pod.video-expanded {
  z-index: 48 !important;
}

.seat-pod.video-expanded .video-frame.has-video {
  width: 168px !important;
  height: 224px !important;
  border-radius: 20px !important;
  border: 2.5px solid var(--gold) !important;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.8), 0 0 0 4px rgba(246, 196, 83, 0.26) !important;
}

.seat-pod.active-turn .video-frame {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(246, 196, 83, 0.34), 0 0 22px rgba(246, 196, 83, 0.45);
}

.seat-pod.speaking .video-frame {
  border-color: var(--emerald-bright);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.48), 0 0 20px rgba(16, 185, 129, 0.4);
}

.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.video-frame.has-video video { opacity: 1; }
.video-frame video.mirrored { transform: scaleX(-1); }

.seat-avatar-fallback {
  font-size: 1.7rem;
  z-index: 1;
}

.video-frame.has-video .seat-avatar-fallback { opacity: 0; }

.seat-media-badges {
  position: absolute;
  bottom: 2px;
  right: 2px;
  display: flex;
  gap: 2px;
  z-index: 4;
}

.mini-badge {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(7, 11, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.62rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dealer-chip {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  color: #161105;
  font-weight: 900;
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.seat-plate {
  margin-top: 5px;
  background: rgba(9, 14, 28, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  padding: 4px 10px;
  text-align: center;
  min-width: 92px;
  max-width: 128px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.seat-name {
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-stats {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gold-bright);
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* ================= Center Trick Stage & Premium Playing Cards ================= */
.trick-stage {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 220px;
  height: 175px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 8;
}

.trick-slot {
  position: absolute;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.trick-slot.pos-top { top: 0; left: 50%; transform: translateX(-50%); }
.trick-slot.pos-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.trick-slot.pos-left { left: 10px; top: 50%; transform: translateY(-50%); }
.trick-slot.pos-right { right: 10px; top: 50%; transform: translateY(-50%); }

.playing-card {
  width: 62px;
  height: 88px;
  background: linear-gradient(160deg, #ffffff 0%, #f1f5f9 100%);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.46), inset 0 1px 0 #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  font-weight: 800;
}

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

.playing-card.spade-card {
  border-color: var(--gold);
  background: linear-gradient(160deg, #fffdf5 0%, #fef3c7 100%);
}

.playing-card.winning-card {
  box-shadow: 0 0 0 3px var(--gold), 0 10px 26px rgba(246, 196, 83, 0.45);
  transform: scale(1.06);
}

.card-corner {
  line-height: 1;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.card-center-suit {
  align-self: center;
  font-size: 1.65rem;
  line-height: 1;
}

/* Player Hand Fan */
.hand-dock {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  height: 122px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px 6px;
  z-index: 15;
}

.hand-fan {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-width: 100%;
  overflow-x: auto;
  padding: 20px 10px 4px;
}

.hand-fan .playing-card {
  width: 66px;
  height: 96px;
  margin-left: -24px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), filter 0.18s ease, box-shadow 0.18s ease;
  flex-shrink: 0;
}

.hand-fan .playing-card:first-child { margin-left: 0; }

.hand-fan .playing-card.legal {
  transform: translateY(-12px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55), 0 0 0 2px rgba(246, 196, 83, 0.85);
}

.hand-fan .playing-card.legal:hover,
.hand-fan .playing-card.legal:active {
  transform: translateY(-24px) scale(1.06);
  z-index: 30;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.65), 0 0 0 2.5px var(--gold-bright);
}

.hand-fan .playing-card.disabled-card {
  filter: brightness(0.62) saturate(0.7);
  cursor: not-allowed;
}

/* ================= Center Overlay (Waiting, Bidding, Rang, Winner) ================= */
.center-overlay {
  position: absolute;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  background: rgba(11, 17, 36, 0.94);
  backdrop-filter: blur(20px);
  border: 1.5px solid var(--gold-border);
  border-radius: 22px;
  padding: 22px;
  width: min(92vw, 390px);
  text-align: center;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.7);
  animation: overlaySpringIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes overlaySpringIn {
  from {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.bid-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.bid-btn {
  padding: 11px 0;
  border-radius: 12px;
  border: 1px solid rgba(246, 196, 83, 0.36);
  background: rgba(246, 196, 83, 0.12);
  color: var(--gold-bright);
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bid-btn:hover, .bid-btn:active {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #161105;
  transform: translateY(-2px);
}

/* Court Piece Trump Suit Picker */
.trump-suit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.trump-suit-btn {
  padding: 13px 12px;
  border-radius: 14px;
  border: 1.5px solid rgba(246, 196, 83, 0.45);
  background: linear-gradient(155deg, #ffffff, #eef2ff);
  font-weight: 800;
  font-size: 1.08rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.14s ease, box-shadow 0.16s ease;
}

.trump-suit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(246, 196, 83, 0.25);
}

.trump-suit-btn.suit-red { color: var(--suit-red); }
.trump-suit-btn.suit-black { color: var(--suit-black); }

/* Floating Chat Bubble */
.chat-bubble {
  position: absolute;
  top: -30px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 14px;
  white-space: nowrap;
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
  z-index: 30;
  animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= Modals (Desktop Dialog / Mobile Native Bottom Sheet) ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 16, 0.74);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: backdropFade 0.2s ease both;
}

@keyframes backdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: linear-gradient(160deg, #131d3b 0%, #0b1124 100%);
  border: 1px solid rgba(246, 196, 83, 0.28);
  border-radius: 22px;
  padding: 22px;
  width: min(100%, 470px);
  max-height: 84dvh;
  overflow-y: auto;
  box-shadow: 0 26px 64px rgba(0, 0, 0, 0.75);
  animation: modalSpringPop 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modalSpringPop {
  from { opacity: 0; transform: translateY(18px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ================= Card Deal, Throw, Shake & Ludo Animations ================= */
@keyframes cardDealIn {
  from {
    opacity: 0;
    transform: translateY(48px) scale(0.82) rotate(var(--fan-rot, 0deg));
  }
  to {
    opacity: 1;
    transform: translateY(var(--card-y, 0px)) scale(1) rotate(var(--fan-rot, 0deg));
  }
}

.hand-fan .playing-card {
  --fan-rot: 0deg;
  --card-y: 0px;
  transform: translateY(var(--card-y)) rotate(var(--fan-rot));
  transform-origin: bottom center;
  will-change: transform;
}

.hand-fan .playing-card.deal-anim {
  animation: cardDealIn 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--deal-delay, 0ms);
}

.hand-fan .playing-card.legal {
  --card-y: -11px;
  transform: translateY(var(--card-y)) rotate(var(--fan-rot));
}

.hand-fan .playing-card.legal:hover,
.hand-fan .playing-card.legal:active {
  transform: translateY(-24px) scale(1.08) rotate(0deg);
  z-index: 35;
}

@keyframes cardShake {
  0%, 100% { transform: translateY(var(--card-y)) translateX(0) rotate(var(--fan-rot)); }
  25% { transform: translateY(var(--card-y)) translateX(-6px) rotate(-3deg); }
  50% { transform: translateY(var(--card-y)) translateX(6px) rotate(3deg); }
  75% { transform: translateY(var(--card-y)) translateX(-4px) rotate(-2deg); }
}

.playing-card.shake-invalid {
  animation: cardShake 0.3s ease !important;
}

@keyframes throwFromBottom {
  from { opacity: 0; transform: translateY(72px) scale(0.75) rotate(-8deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes throwFromTop {
  from { opacity: 0; transform: translateY(-68px) scale(0.75) rotate(8deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes throwFromLeft {
  from { opacity: 0; transform: translateX(-78px) scale(0.75) rotate(-10deg); }
  to { opacity: 1; transform: translateX(0) scale(1) rotate(0deg); }
}

@keyframes throwFromRight {
  from { opacity: 0; transform: translateX(78px) scale(0.75) rotate(10deg); }
  to { opacity: 1; transform: translateX(0) scale(1) rotate(0deg); }
}

.card-throw-bottom { animation: throwFromBottom 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
.card-throw-top { animation: throwFromTop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
.card-throw-left { animation: throwFromLeft 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
.card-throw-right { animation: throwFromRight 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes diceTumble {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.16) rotate(-14deg); }
  55% { transform: scale(0.92) rotate(16deg); }
  80% { transform: scale(1.08) rotate(-6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.ludo-dice-btn.dice-rolling {
  animation: diceTumble 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tokenHopLand {
  0% { transform: scale(0.65) translateY(-16px); box-shadow: 0 12px 18px rgba(0, 0, 0, 0.55); }
  65% { transform: scale(1.18) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

.ludo-token.just-moved {
  animation: tokenHopLand 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modeSwap {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mode-grid.mode-swap-anim .mode-card,
.list-panel.tab-enter {
  animation: modeSwap 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Expanded mobile touch zone on movable Ludo cells */
.ludo-cell.has-movable {
  cursor: pointer;
  background-image: radial-gradient(circle, rgba(246, 196, 83, 0.32), transparent 72%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h3 {
  margin: 0;
  color: var(--gold-bright);
  font-size: 1.2rem;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.score-table th, .score-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.score-table th {
  color: var(--gold);
  font-weight: 700;
}

.emoji-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  justify-content: space-between;
}

.emoji-btn {
  flex: 1;
  font-size: 1.35rem;
  padding: 7px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.14s ease;
}

.emoji-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

/* ================= Ludo Arena & 15x15 Glossy Board ================= */
.table-arena.ludo-arena .seat-left {
  top: 8px; left: 12px; transform: none;
}

.table-arena.ludo-arena .seat-top {
  top: 8px; right: 12px; left: auto; transform: none;
}

.table-arena.ludo-arena .seat-bottom {
  bottom: 10px; left: 12px; top: auto; transform: none;
}

.table-arena.ludo-arena .seat-right {
  bottom: 10px; right: 12px; left: auto; top: auto; transform: none;
}

.table-arena.ludo-arena .video-frame {
  width: 56px;
  height: 56px;
}

.ludo-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.ludo-board {
  width: min(88vw, 54dvh, 430px);
  height: min(88vw, 54dvh, 430px);
  background: #f8fafc;
  border: 4px solid var(--gold);
  border-radius: 16px;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.15);
  overflow: hidden;
  position: relative;
}

.ludo-cell {
  border: 0.5px solid rgba(15, 23, 42, 0.14);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1px;
}

.ludo-cell.yard-green { background: #10b981; border-color: rgba(255, 255, 255, 0.14); }
.ludo-cell.yard-yellow { background: #f59e0b; border-color: rgba(255, 255, 255, 0.14); }
.ludo-cell.yard-red { background: #e11d48; border-color: rgba(255, 255, 255, 0.14); }
.ludo-cell.yard-blue { background: #2563eb; border-color: rgba(255, 255, 255, 0.14); }

.ludo-cell.yard-box {
  background: transparent;
  border-color: rgba(15, 23, 42, 0.06);
  z-index: 4;
}

/* Live WebRTC Video Feed Embedded Directly Inside Each 4x4 Ludo Home Yard! */
.ludo-yard-video-box {
  position: absolute;
  width: calc(4 / 15 * 100%);
  height: calc(4 / 15 * 100%);
  background: #ffffff;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.25s ease;
}

.ludo-yard-video-box.yard-seat-0 { top: calc(10 / 15 * 100%); left: calc(1 / 15 * 100%); }
.ludo-yard-video-box.yard-seat-1 { top: calc(1 / 15 * 100%);  left: calc(1 / 15 * 100%); }
.ludo-yard-video-box.yard-seat-2 { top: calc(1 / 15 * 100%);  left: calc(10 / 15 * 100%); }
.ludo-yard-video-box.yard-seat-3 { top: calc(10 / 15 * 100%); left: calc(10 / 15 * 100%); }

.ludo-yard-video-box video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.ludo-yard-video-box.has-video video {
  opacity: 1;
}

.ludo-yard-video-box video.mirrored {
  transform: scaleX(-1);
}

.ludo-yard-video-box.has-video::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background: linear-gradient(to top, rgba(7, 11, 22, 0.62), transparent);
  z-index: 2;
  pointer-events: none;
}

.ludo-yard-video-box.has-video::after {
  content: 'LIVE';
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(16, 185, 129, 0.92);
  color: #032216;
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  z-index: 3;
}

.ludo-yard-video-box.speaking {
  box-shadow: inset 0 0 0 3px var(--emerald-bright);
}

/* Keep outer Ludo corner pods compact when live video is shown inside the board yard */
.table-arena.ludo-arena .video-frame.has-video {
  width: 56px;
  height: 56px;
  border-radius: 50%;
}

.table-arena.ludo-arena .video-frame.has-video::after {
  display: none;
}

.ludo-cell.path-red { background: #f43f5e; color: #fff; }
.ludo-cell.path-green { background: #10b981; color: #fff; }
.ludo-cell.path-yellow { background: #fbbf24; color: #111; }
.ludo-cell.path-blue { background: #3b82f6; color: #fff; }

.ludo-cell.center-home-cell {
  background: transparent;
  border: none;
  z-index: 3;
}

.ludo-center-goal {
  position: absolute;
  top: 40%;
  left: 40%;
  width: 20%;
  height: 20%;
  background: conic-gradient(
    from -45deg,
    #f59e0b 0deg 90deg,
    #2563eb 90deg 180deg,
    #e11d48 180deg 270deg,
    #10b981 270deg 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.ludo-center-goal span {
  font-size: 1.15rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.cell-star {
  position: absolute;
  font-size: 0.68rem;
  opacity: 0.55;
  pointer-events: none;
  color: #0f172a;
}

.ludo-token {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.45);
  z-index: 4;
  transition: transform 0.16s ease;
}

.ludo-cell.multi-tok .ludo-token {
  width: 46%;
  height: 46%;
  border-width: 1.5px;
}

.ludo-token.tok-red { background: radial-gradient(circle at 32% 28%, #fda4af, #be123c); }
.ludo-token.tok-green { background: radial-gradient(circle at 32% 28%, #6ee7b7, #047857); }
.ludo-token.tok-yellow { background: radial-gradient(circle at 32% 28%, #fef08a, #b45309); }
.ludo-token.tok-blue { background: radial-gradient(circle at 32% 28%, #93c5fd, #1d4ed8); }

.ludo-token.movable {
  cursor: pointer;
  box-shadow: 0 0 0 3px #ffffff, 0 0 14px 4px var(--gold);
  animation: tokenPulse 0.72s infinite alternate;
  z-index: 9;
}

@keyframes tokenPulse {
  from { transform: scale(1); }
  to { transform: scale(1.24); }
}

/* Per-Player Ludo Corner Pods with Personal 3D Dice Cube */
.table-arena.ludo-arena .seat-pod {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.table-arena.ludo-arena .seat-top,
.table-arena.ludo-arena .seat-right {
  flex-direction: row-reverse;
}

.seat-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat-dice-btn {
  background: transparent;
  border: none;
  padding: 3px;
  cursor: default;
  border-radius: 14px;
  opacity: 0.42;
  transform: scale(0.88);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seat-dice-btn.turn-dice {
  opacity: 1;
  transform: scale(1);
}

.seat-dice-btn.can-roll {
  cursor: pointer;
}

.seat-dice-btn.can-roll .dice-cube {
  box-shadow:
    0 0 0 3px var(--gold),
    0 0 22px rgba(246, 196, 83, 0.65),
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    inset 0 -3px 6px rgba(15, 23, 42, 0.16);
  animation: diceReadyPulse 1.25s ease-in-out infinite alternate;
}

.seat-dice-btn.dice-rolling .dice-cube {
  animation: diceTumble3D 0.44s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.seat-dice-btn .dice-cube {
  width: 46px;
  height: 46px;
  padding: 6px;
  border-radius: 11px;
}

.seat-dice-btn .dice-pip {
  width: 8px;
  height: 8px;
}

.seat-dice-btn .dice-cube[data-face="1"] .dice-pip {
  width: 11px;
  height: 11px;
}

.ludo-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(10, 16, 34, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--gold-border);
  border-radius: 14px;
  padding: 9px 16px;
  width: min(88vw, 430px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.ludo-turn-banner {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

@keyframes tokenStepHop {
  0% { transform: scale(1) translateY(0); }
  45% { transform: scale(1.24) translateY(-11px); box-shadow: 0 11px 16px rgba(0, 0, 0, 0.52); }
  100% { transform: scale(1) translateY(0); }
}

.ludo-token.step-hopping {
  animation: tokenStepHop 0.14s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 12;
}

/* Natural 3D-Styled Ivory Dice Cube with Recessed Pips (No Numbers!) */
.ludo-dice-btn.natural-dice {
  background: transparent;
  border: none;
  padding: 4px;
  min-width: 58px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  transition: transform 0.14s ease, filter 0.18s ease;
}

.ludo-dice-btn.natural-dice:disabled {
  cursor: default;
  opacity: 0.92;
}

.ludo-dice-btn.natural-dice.can-roll .dice-cube {
  box-shadow:
    0 0 0 3px var(--gold),
    0 0 22px rgba(246, 196, 83, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    inset 0 -3px 6px rgba(15, 23, 42, 0.16);
  animation: diceReadyPulse 1.3s ease-in-out infinite alternate;
}

@keyframes diceReadyPulse {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

.dice-cube {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff 0%, #f1ede4 65%, #e2dccf 100%);
  border: 1.5px solid #cbd5e1;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.48),
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    inset 0 -3px 5px rgba(15, 23, 42, 0.16);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 7px;
  gap: 2px;
  place-items: center;
}

.dice-pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #334155, #0f172a);
  box-shadow: inset 0 1.5px 2px rgba(0, 0, 0, 0.65), 0 0.5px 0 rgba(255, 255, 255, 0.8);
}

.dice-cube[data-face="1"] .dice-pip {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle at 35% 30%, #fb7185, #be123c);
}

.dice-cube[data-face="6"] .dice-pip {
  background: radial-gradient(circle at 35% 30%, #fb7185, #be123c);
}

.ludo-dice-btn.dice-rolling .dice-cube {
  animation: diceTumble3D 0.44s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

@keyframes diceTumble3D {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.18) rotate(-26deg) translateY(-5px); }
  55% { transform: scale(0.92) rotate(24deg) translateY(2px); }
  80% { transform: scale(1.1) rotate(-10deg) translateY(-2px); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ================= Sarcastic Capture Animation & Victory Confetti ================= */
@keyframes ludoBoardShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-6px, 3px) rotate(-1.2deg); }
  40% { transform: translate(6px, -3px) rotate(1.2deg); }
  60% { transform: translate(-4px, 2px) rotate(-0.8deg); }
  80% { transform: translate(4px, -2px) rotate(0.8deg); }
}

.ludo-board.board-shake {
  animation: ludoBoardShake 0.42s ease;
}

.fx-sarcastic-banner {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  background: linear-gradient(145deg, rgba(225, 29, 72, 0.96), rgba(127, 29, 29, 0.96));
  border: 2px solid var(--gold-bright);
  border-radius: 20px;
  padding: 14px 22px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.7), 0 0 32px rgba(244, 63, 94, 0.55);
  pointer-events: none;
  animation: sarcasticPop 2.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fx-sarcastic-banner .fx-emoji-row {
  font-size: 2.1rem;
  letter-spacing: 6px;
  margin-bottom: 4px;
  animation: sarcasticWiggle 0.45s ease-in-out infinite alternate;
}

.fx-sarcastic-banner .fx-caption {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

@keyframes sarcasticPop {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(0.45) rotate(-8deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  24% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  82% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -72%) scale(0.85); }
}

@keyframes sarcasticWiggle {
  from { transform: rotate(-6deg) scale(1); }
  to { transform: rotate(6deg) scale(1.12); }
}

.fx-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 260;
}

.fx-confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: 0.95;
  animation: confettiFall var(--dur, 2.6s) cubic-bezier(0.2, 0.65, 0.35, 1) var(--delay, 0s) forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 40px), 105dvh, 0) rotate(var(--spin, 540deg));
    opacity: 0;
  }
}

.fx-win-trophy-burst {
  position: fixed;
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 265;
  font-size: 4rem;
  pointer-events: none;
  filter: drop-shadow(0 12px 28px rgba(246, 196, 83, 0.75));
  animation: trophyCelebrate 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes trophyCelebrate {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.3); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(-8deg); }
  38% { transform: translate(-50%, -52%) scale(1.05) rotate(8deg); }
  56% { transform: translate(-50%, -50%) scale(1.12) rotate(-4deg); }
  85% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.8); }
}

.ludo-dice-btn {
  padding: 8px 16px;
  font-size: 0.98rem;
  min-width: 112px;
}

.ludo-dice-btn:disabled {
  opacity: 0.48;
  cursor: default;
  transform: none;
  filter: none;
}

@media (min-width: 720px) {
  .video-frame {
    width: 82px;
    height: 82px;
  }
  .seat-bottom {
    bottom: 146px;
    left: 36px;
  }
  .hand-fan .playing-card {
    width: 76px;
    height: 110px;
    margin-left: -18px;
  }
  .playing-card {
    width: 68px;
    height: 98px;
  }
}

/* ================= Mobile-First UX Polish (<= 640px Phones) ================= */
@media (max-width: 640px) {
  /* Prevent iOS Safari auto-zoom on form inputs */
  .input-field {
    font-size: 16px;
    padding: 12px 13px;
  }

  /* Auth Screen compact spacing */
  #auth-screen {
    justify-content: flex-start;
    padding: 22px 14px 28px;
    gap: 14px;
  }

  .brand-emblem {
    width: 62px;
    height: 62px;
    font-size: 1.95rem;
    border-radius: 18px;
    margin-bottom: 8px;
  }

  .brand-hero h1 {
    font-size: 1.8rem;
  }

  .brand-pills span {
    font-size: 0.68rem;
    padding: 4px 9px;
  }

  .glass-card {
    padding: 18px 16px;
    border-radius: 20px;
  }

  /* Lobby Header & Body */
  .lobby-header {
    padding: 10px 12px;
  }

  .lobby-body {
    padding: 14px 12px 24px;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 1.25rem;
  }

  .game-selector-bar {
    gap: 8px;
    margin-bottom: 14px;
  }

  .game-tile {
    padding: 11px 6px;
    border-radius: 15px;
    gap: 6px;
  }

  .game-tile-icon {
    width: 42px;
    height: 42px;
    font-size: 1.35rem;
    border-radius: 12px;
  }

  .game-tile-text strong {
    font-size: 0.88rem;
  }

  .game-tag {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .mode-card {
    padding: 15px;
    gap: 12px;
    border-radius: 16px;
  }

  .mode-card h3 {
    font-size: 1.05rem;
  }

  .subnav-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .subnav-btn {
    padding: 8px 4px;
    font-size: 0.76rem;
    text-align: center;
  }

  /* Native Mobile Bottom-Sheet Modals */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 14px 18px calc(22px + var(--safe-bottom));
    border-bottom: none;
    animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .modal-box::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 auto 12px;
  }

  @keyframes sheetSlideUp {
    from { transform: translateY(100%); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* Active Game Table HUD (Clean 2-row or compact layout on phones) */
  .table-hud {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }

  .hud-info {
    width: 100%;
    justify-content: space-between;
    font-size: 0.76rem;
    gap: 6px;
  }

  .room-badge, .hud-round-pill {
    padding: 4px 8px;
    font-size: 0.74rem;
  }

  .media-bar {
    width: 100%;
    justify-content: space-between;
    gap: 5px;
  }

  .media-bar .icon-btn {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    font-size: 0.96rem;
  }

  /* Card Table Seats & Felt on Mobile */
  .felt-ring {
    inset: 42px 14px 118px 14px;
    border-radius: 90px;
    border-width: 2px;
  }

  .video-frame {
    width: 52px;
    height: 52px;
  }

  .video-frame.has-video {
    width: 74px;
    height: 98px;
    border-radius: 14px;
  }

  .seat-avatar-fallback {
    font-size: 1.3rem;
  }

  .seat-plate {
    min-width: 76px;
    max-width: 98px;
    padding: 3px 6px;
  }

  .seat-name { font-size: 0.68rem; }
  .seat-stats { font-size: 0.62rem; gap: 4px; }

  .seat-top { top: 6px; }
  .seat-left { left: 6px; top: 35%; }
  .seat-right { right: 6px; top: 35%; }

  /* Compact horizontal self-pod right above the card fan on phones! */
  .seat-bottom {
    bottom: 118px;
    left: 10px;
    flex-direction: row;
    align-items: flex-end;
    gap: 7px;
  }

  .seat-bottom .video-frame {
    width: 44px;
    height: 44px;
  }

  .seat-bottom .video-frame.has-video {
    width: 76px;
    height: 100px;
    border-radius: 14px;
  }

  .seat-pod.video-expanded .video-frame.has-video {
    width: 148px !important;
    height: 196px !important;
  }

  .seat-bottom .seat-plate {
    margin-top: 0;
    text-align: left;
  }

  .trick-stage {
    top: 37%;
    width: 175px;
    height: 140px;
  }

  .playing-card {
    width: 52px;
    height: 74px;
    border-radius: 8px;
    padding: 4px 5px;
  }

  .card-corner { font-size: 0.76rem; }
  .card-center-suit { font-size: 1.3rem; }

  /* Full-width fanned card hand that fits all 13 cards smoothly on 375px phones! */
  .hand-dock {
    height: 112px;
    bottom: 4px;
    padding: 0 4px 4px;
  }

  .hand-fan {
    padding: 18px 6px 4px;
    overflow-x: visible;
  }

  .hand-fan .playing-card {
    width: 54px;
    height: 82px;
    margin-left: var(--mobile-card-overlap, -28px);
  }

  .hand-fan .playing-card.legal {
    --card-y: -10px;
  }

  .hand-fan .playing-card.legal:active {
    transform: translateY(-22px) scale(1.08) rotate(0deg);
  }

  /* Ludo Mobile Ergonomics */
  .table-arena.ludo-arena .seat-pod {
    flex-direction: row;
    gap: 6px;
  }

  .table-arena.ludo-arena .seat-top,
  .table-arena.ludo-arena .seat-right {
    flex-direction: row-reverse;
  }

  .table-arena.ludo-arena .seat-bottom {
    bottom: 8px;
    left: 8px;
  }

  .table-arena.ludo-arena .seat-right {
    bottom: 8px;
    right: 8px;
  }

  .table-arena.ludo-arena .seat-left {
    top: 6px;
    left: 8px;
  }

  .table-arena.ludo-arena .seat-top {
    top: 6px;
    right: 8px;
  }

  .table-arena.ludo-arena .seat-dice-btn .dice-cube {
    width: 42px;
    height: 42px;
    padding: 5px;
    border-radius: 10px;
  }

  .table-arena.ludo-arena .seat-dice-btn .dice-pip {
    width: 7px;
    height: 7px;
  }

  .table-arena.ludo-arena .video-frame,
  .table-arena.ludo-arena .video-frame.has-video {
    width: 44px;
    height: 44px;
    border-radius: 50%;
  }

  .ludo-board {
    width: min(94vw, 52dvh, 390px);
    height: min(94vw, 52dvh, 390px);
    border-width: 3px;
    border-radius: 12px;
  }

  .ludo-controls-bar {
    width: min(94vw, 390px);
    padding: 8px 12px;
  }

  .ludo-turn-banner {
    font-size: 0.78rem;
  }

  /* ================= Sarcastic Capture Animation & Victory Confetti ================= */
@keyframes ludoBoardShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-6px, 3px) rotate(-1.2deg); }
  40% { transform: translate(6px, -3px) rotate(1.2deg); }
  60% { transform: translate(-4px, 2px) rotate(-0.8deg); }
  80% { transform: translate(4px, -2px) rotate(0.8deg); }
}

.ludo-board.board-shake {
  animation: ludoBoardShake 0.42s ease;
}

.fx-sarcastic-banner {
  position: fixed;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  background: linear-gradient(145deg, rgba(225, 29, 72, 0.96), rgba(127, 29, 29, 0.96));
  border: 2px solid var(--gold-bright);
  border-radius: 20px;
  padding: 14px 22px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.7), 0 0 32px rgba(244, 63, 94, 0.55);
  pointer-events: none;
  animation: sarcasticPop 2.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.fx-sarcastic-banner .fx-emoji-row {
  font-size: 2.1rem;
  letter-spacing: 6px;
  margin-bottom: 4px;
  animation: sarcasticWiggle 0.45s ease-in-out infinite alternate;
}

.fx-sarcastic-banner .fx-caption {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

@keyframes sarcasticPop {
  0% { opacity: 0; transform: translate(-50%, -35%) scale(0.45) rotate(-8deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  24% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  82% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -72%) scale(0.85); }
}

@keyframes sarcasticWiggle {
  from { transform: rotate(-6deg) scale(1); }
  to { transform: rotate(6deg) scale(1.12); }
}

.fx-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 260;
}

.fx-confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: 0.95;
  animation: confettiFall var(--dur, 2.6s) cubic-bezier(0.2, 0.65, 0.35, 1) var(--delay, 0s) forwards;
}

@keyframes confettiFall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 40px), 105dvh, 0) rotate(var(--spin, 540deg));
    opacity: 0;
  }
}

.fx-win-trophy-burst {
  position: fixed;
  top: 28%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 265;
  font-size: 4rem;
  pointer-events: none;
  filter: drop-shadow(0 12px 28px rgba(246, 196, 83, 0.75));
  animation: trophyCelebrate 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes trophyCelebrate {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.3); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(-8deg); }
  38% { transform: translate(-50%, -52%) scale(1.05) rotate(8deg); }
  56% { transform: translate(-50%, -50%) scale(1.12) rotate(-4deg); }
  85% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.8); }
}

.ludo-dice-btn {
    padding: 9px 14px;
    font-size: 0.92rem;
    min-width: 98px;
  }

  .center-overlay {
    width: min(92vw, 340px);
    padding: 16px;
    border-radius: 18px;
  }

  .bid-btn {
    padding: 12px 0;
    font-size: 1rem;
  }
}
