:root {
  --bg-dark: #07090e;
  --bg-card: rgba(18, 24, 38, 0.85);
  --felt-base: #064e3b;
  --felt-dark: #022c22;
  --gold-primary: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.4);
  --gold-border: rgba(245, 158, 11, 0.3);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glass-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(6, 78, 59, 0.2) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
}

/* ==================== NAVIGATION ==================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold-primary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.brand-link:hover {
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.nav-divider {
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 1.1rem;
}

.nav-sublink {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 1px;
  transition: color 0.2s;
}

.nav-sublink:hover {
  color: #fff;
}

.game-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.1));
  border: 1px solid var(--gold-border);
  color: var(--gold-primary);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold-border);
  color: var(--gold-primary);
}

/* Guest & Auth Pill */
.guest-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  padding: 5px 12px;
  border-radius: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.guest-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.guest-edit-btn {
  background: none;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
}

.guest-edit-btn:hover {
  opacity: 1;
}

.skibidi-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--gold-border);
  padding: 4px 12px;
  border-radius: 24px;
}

.skibidi-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.skibidi-display-username {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.ranked-badge {
  background: var(--gold-primary);
  color: #000;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 10px;
}

.skibidi-logout-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.skibidi-logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* ==================== AMBIENT GLOWS ==================== */
.ambient-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(140px);
  opacity: 0.12;
}

.glow-gold {
  top: -100px;
  left: 20%;
  background: var(--gold-primary);
}

.glow-blue {
  bottom: 0;
  right: 15%;
  background: #38bdf8;
}

/* ==================== MAIN CONTAINER & PANELS ==================== */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 64px;
  position: relative;
  z-index: 10;
}

.view-panel {
  display: none;
  flex: 1;
  width: 100%;
}

.view-panel.active,
#lobbyView.active,
#waitingRoomView.active,
#gameTableView.active {
  display: flex !important;
  flex-direction: column;
}

/* ==================== VIEW 1: LOBBY ==================== */
#lobbyView {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

.lobby-hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-family: 'Cinzel', serif;
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  max-width: 700px;
  margin: 0 auto 20px auto;
  line-height: 1.6;
}

.guest-notice-banner {
  display: inline-block;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid var(--gold-border);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.9rem;
  color: var(--gold-primary);
}

.guest-notice-banner a {
  color: #fff;
  text-decoration: underline;
  font-weight: 700;
}

.lobby-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 50px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.action-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold-border);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
}

.bot-action-card {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 60%);
}

.card-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
}

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
  flex: 1;
}

.primary-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  border: none;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
  transition: var(--transition-smooth);
  width: 100%;
}

.primary-btn:hover {
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
  transform: translateY(-2px);
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.join-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.join-input-group input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 25px;
  padding: 10px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  outline: none;
}

.join-input-group input:focus {
  border-color: var(--gold-primary);
}

/* Rooms list */
.lobby-section {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  color: var(--gold-primary);
}

.refresh-btn {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: 0.2s;
}

.refresh-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.rooms-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.room-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 14px 20px;
  border-radius: 12px;
  transition: var(--transition-smooth);
}

.room-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--gold-border);
}

.room-info-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.room-title-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.room-code-tag {
  font-size: 0.75rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold-primary);
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 800;
}

.room-count-pill {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.3);
  padding: 4px 10px;
  border-radius: 12px;
}

/* ==================== VIEW 2: WAITING ROOM ==================== */
#waitingRoomView {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
  flex-direction: column;
}

.waiting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.room-pill {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.waiting-room-name {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: #fff;
}

.waiting-header-actions {
  display: flex;
  gap: 12px;
}

.leave-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 18px;
  border-radius: 25px;
  font-weight: 700;
  cursor: pointer;
}

/* Oval Table Preview */
.table-preview-wrapper {
  background: #090c12;
  border: 4px solid #1f293d;
  border-radius: 160px;
  padding: 40px;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  min-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
}

.table-preview-felt {
  width: 100%;
  height: 100%;
  border-radius: 130px;
  background: radial-gradient(ellipse at center, var(--felt-base) 0%, var(--felt-dark) 80%);
  border: 2px solid rgba(245, 158, 11, 0.25);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-preview-center {
  text-align: center;
}

.preview-logo {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.15);
}

.preview-status {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Seat Slots in Waiting Room */
.seat-card-slot {
  position: absolute;
  width: 150px;
  height: 90px;
  background: rgba(15, 23, 42, 0.85);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  padding: 8px;
}

.slot-bottom { bottom: 16px; }
.slot-top { top: 16px; }
.slot-left { left: 24px; }
.slot-right { right: 24px; }

.seat-empty-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.occupied-seat {
  border-style: solid;
  border-color: var(--gold-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.seat-avatar {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.seat-player-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.seat-bot-tag {
  font-size: 0.65rem;
  background: rgba(245, 158, 11, 0.2);
  color: var(--gold-primary);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 800;
}

.waiting-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.start-game-btn {
  width: auto;
  min-width: 220px;
  font-size: 1.15rem;
  padding: 14px 36px;
}

/* ==================== VIEW 3: GAME TABLE ==================== */
#gameTableView {
  flex-direction: column;
  height: calc(100vh - 64px);
  position: relative;
  overflow: hidden;
}

.game-hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  background: rgba(10, 14, 23, 0.9);
  border-bottom: 1px solid var(--glass-border);
  z-index: 50;
}

.hud-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin-right: 8px;
}

.radlci-badge {
  color: var(--gold-primary);
  border-color: var(--gold-border);
  background: rgba(245, 158, 11, 0.1);
}

.trick-counter {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.nav-btn-small {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: 6px;
}

.leave-btn-small {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: 6px;
}

/* The Felt Canvas Table */
.game-table-felt {
  flex: 1;
  margin: 16px 24px;
  background: radial-gradient(ellipse at center, #065f46 0%, #064e3b 45%, #022c22 85%);
  border: 8px solid #1a202c;
  border-radius: 180px;
  box-shadow: 
    inset 0 0 80px rgba(0, 0, 0, 0.8),
    0 15px 40px rgba(0, 0, 0, 0.6);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Seats Layout On Felt */
.table-player-seat {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
}

.seat-north { top: 20px; }
.seat-south { bottom: 12px; display: none; } /* South info is embedded in dock */
.seat-west { left: 40px; }
.seat-east { right: 40px; }

.player-avatar-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  overflow: hidden;
  background: #1e293b;
  border: 3px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: var(--transition-smooth);
}

.table-player-seat.active-turn .player-avatar-circle {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px var(--gold-glow);
  transform: scale(1.1);
}

.player-name-tag {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: rgba(10, 14, 23, 0.8);
  padding: 2px 10px;
  border-radius: 12px;
  margin-top: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.player-card-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.player-bid-bubble {
  position: absolute;
  top: -24px;
  background: var(--gold-primary);
  color: #000;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Center Trick Area */
.trick-zone {
  position: relative;
  width: 480px;
  height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trick-center-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.45);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.6);
  padding: 6px 16px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.played-card-slot {
  position: absolute;
  width: 140px;
  height: 242px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s;
  z-index: 5;
}

.played-card-slot img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.85);
  object-fit: cover;
}

/* Positioning 4 played cards meeting in center */
.slot-south {
  bottom: 12px;
  left: calc(50% - 70px);
  transform: rotate(0deg);
}

.slot-north {
  top: 12px;
  left: calc(50% - 70px);
  transform: rotate(180deg);
}

.slot-west {
  left: 12px;
  top: calc(50% - 121px);
  transform: rotate(90deg);
}

.slot-east {
  right: 12px;
  top: calc(50% - 121px);
  transform: rotate(-90deg);
}


/* ==================== BOTTOM PLAYER DOCK ==================== */
.player-hand-dock {
  background: rgba(10, 14, 23, 0.96);
  border-top: 1px solid var(--glass-border);
  padding: 6px 16px 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 250;
  height: 295px;
  min-height: 295px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.hand-controls-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 1300px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.hand-info-text {
  color: var(--gold-primary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hand-stats-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* The Interactive Card Fan - HUGE CARDS IN STRAIGHT LINE */
.cards-fan-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 255px;
  width: 100%;
  max-width: 1400px;
  padding-bottom: 5px;
  overflow-x: auto;
}

.tarok-card-elem {
  width: 140px;
  height: 242px;
  border-radius: 9px;
  cursor: pointer;
  position: relative;
  margin-left: -55px; /* Overlap cards cleanly */
  transform: none !important;
}

.tarok-card-elem:first-child {
  margin-left: 0;
}

.tarok-card-elem img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  display: block;
}

/* Strictly NO changes of any kind when hovering over cards in hand */
.tarok-card-elem:hover {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
  filter: none !important;
  outline: none !important;
}

.tarok-card-elem:hover img {
  transform: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6) !important;
}

.tarok-card-elem.discard-selected {
  outline: 4px solid var(--gold-primary);
  transform: none !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.95) !important;
  z-index: 100 !important;
}

.tarok-card-elem.legal-move {
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.55);
}

.tarok-card-elem.illegal-move {
  filter: brightness(0.4) grayscale(0.5);
  cursor: not-allowed;
}

.tarok-card-elem.illegal-move:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* ==================== MODALS & OVERLAYS ==================== */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.active {
  display: flex;
}

/* In-game modal overlay: leave the bottom player dock completely visible */
body.in-game-active .modal-backdrop {
  bottom: 295px; /* Leaves the 295px player hand dock completely uncovered and visible! */
  height: auto;
  max-height: calc(100vh - 295px);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

body.in-game-active .modal-card {
  max-height: calc(100vh - 320px);
  overflow-y: auto;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-wide { max-width: 720px; }
.modal-extra-wide { max-width: 960px; }

@keyframes modalScale {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-close:hover { color: #fff; }

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.modal-intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-warning {
  color: #f59e0b;
  font-size: 0.85rem;
  margin-bottom: 16px;
  background: rgba(245, 158, 11, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-group input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  padding: 12px 16px;
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
}

.form-group input[type="text"]:focus {
  border-color: var(--gold-primary);
  outline: none;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  cursor: pointer;
}

/* Bidding Grid */
.bidding-current-info {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--gold-border);
  padding: 8px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  color: var(--gold-primary);
}

.bidding-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.bid-contract-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 10px;
  color: #fff;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bid-contract-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.bid-contract-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.bid-btn-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.bid-btn-points {
  font-size: 0.8rem;
  color: var(--gold-primary);
}

.pass-btn {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.pass-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* King Selection Grid */
.king-selection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.king-choice-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.king-choice-card:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--gold-primary);
  transform: translateY(-4px);
}

.king-suit-icon {
  font-size: 3.2rem;
  margin-bottom: 8px;
}

.king-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.king-subtitle {
  font-size: 0.75rem;
  color: var(--gold-primary);
  margin-top: 4px;
}

/* Talon Packets & Discards */
.talon-packets-grid {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: stretch;
  margin: 20px 0;
  flex-wrap: wrap;
}

.talon-packet-group {
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.talon-packet-group:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.35);
}

.talon-cards-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.talon-mini-card {
  width: 120px;
  height: 207px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  display: block;
}

.talon-packet-select-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  pointer-events: none;
}

.discard-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  max-height: 380px;
  overflow-y: auto;
  padding: 10px;
}

.discard-selectable-card {
  width: 120px;
  height: 207px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: box-shadow 0.15s ease;
}

.discard-selectable-card.selected {
  outline: 4px solid var(--gold-primary);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.9) !important;
}

.discard-selectable-card img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: block;
}


/* Announcements Grid */
.announcements-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.announcement-card-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.announcement-card-btn:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--gold-border);
  transform: translateY(-2px);
}

.announcement-card-btn.selected {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--gold-primary);
  box-shadow: 0 0 15px var(--gold-glow);
}

.announcement-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.announcement-reward {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-primary);
}

.announcement-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.start-play-btn {
  width: auto;
  min-width: 220px;
  padding: 12px 28px;
  font-size: 1rem;
}

/* Scoreboard Breakdown */
.score-summary-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid var(--gold-border);
  padding: 16px;
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  color: var(--gold-primary);
  text-align: center;
  margin-bottom: 16px;
}

.score-breakdown-details {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.table-standings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.standing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 14px;
  border-radius: 8px;
}

/* Leaderboard Table */
.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--gold-primary);
  color: #000;
  font-weight: 700;
}

.leaderboard-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.leaderboard-table th {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.rank-badge {
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
}

.rank-1 { color: #f59e0b; }
.rank-2 { color: #94a3b8; }
.rank-3 { color: #d97706; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .lobby-actions-grid {
    grid-template-columns: 1fr;
  }
  .bidding-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .king-selection-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cards-fan-container {
    height: 185px;
    overflow-x: auto;
    padding-bottom: 5px;
  }
  .tarok-card-elem {
    width: 95px;
    height: 164px;
    margin-left: -40px;
    transform: none !important;
  }
}

/* Ko-fi Footer */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 30px;
}
.kofi-footer-container {
  margin: 10px 0;
  display: flex;
  justify-content: center;
  width: 100%;
}
.kofi-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000000 !important;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.kofi-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 26px rgba(245, 158, 11, 0.6);
  filter: brightness(1.05);
}
.kofi-icon {
  font-size: 1.2rem;
  display: inline-block;
  animation: kofi-wiggle 3.5s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes kofi-wiggle {
  0%, 82%, 100% { transform: rotate(0deg); }
  86% { transform: rotate(-12deg); }
  90% { transform: rotate(10deg); }
  94% { transform: rotate(-6deg); }
  97% { transform: rotate(4deg); }
}
