/* ==========================================================================
   Scrabble & Wordfeud Online - Modern Luxury Theme
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Color Palette */
  --bg-dark: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-elevated: #1a243d;
  --bg-card: rgba(22, 32, 54, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-gold: #fbbf24;
  --accent-gold-hover: #f59e0b;
  --primary-teal: #06b6d4;
  --primary-teal-hover: #0891b2;
  --accent-green: #10b981;
  --accent-danger: #f43f5e;

  /* Scrabble Bonus Cell Colors */
  --bonus-tw-bg: linear-gradient(135deg, #f43f5e, #be123c);
  --bonus-dw-bg: linear-gradient(135deg, #fb923c, #c2410c);
  --bonus-tl-bg: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --bonus-dl-bg: linear-gradient(135deg, #38bdf8, #0369a1);
  --bonus-star-bg: linear-gradient(135deg, #fbbf24, #d97706);
  --bonus-qw-bg: linear-gradient(135deg, #a855f7, #6b21a8);
  --bonus-ql-bg: linear-gradient(135deg, #10b981, #047857);
  --cell-normal-bg: #1e293b;

  /* Tactile Wooden Letter Tile */
  --tile-bg: linear-gradient(145deg, #fffbeb 0%, #fef3c7 45%, #fde68a 100%);
  --tile-border: #d97706;
  --tile-text: #451a03;
  --tile-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.9), inset 0 -2px 3px rgba(180, 83, 9, 0.35);

  /* Rack Wood */
  --wood-grain: linear-gradient(180deg, #5c2c16 0%, #3e1b0c 60%, #260e05 100%);
  --wood-lip: #7c3a1e;

  /* Shadows & Glassmorphism */
  --glass-bg: rgba(19, 27, 46, 0.7);
  --glass-blur: blur(16px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.5), 0 4px 12px -2px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
    linear-gradient(180deg, #0b0f19 0%, #060911 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header
   ========================================================================== */

.main-header {
  height: calc(64px + env(safe-area-inset-top, 0px));
  min-height: calc(64px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 0;
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.main-header::-webkit-scrollbar {
  display: none;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.header-brand:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.logo-tile {
  width: 40px;
  height: 40px;
  background: var(--tile-bg);
  color: var(--tile-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--tile-shadow);
  border: 1px solid var(--tile-border);
  transform: rotate(-3deg);
  transition: transform 0.2s ease;
}

.logo-tile:hover {
  transform: rotate(0deg) scale(1.08);
}

.logo-tile[data-game="azul"] {
  background: #1e3a8a;
  border-color: #3b82f6;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.45);
  overflow: hidden;
}

.logo-tile[data-game="qwirkle"] {
  background: #111827;
  border-color: #374151;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
  overflow: hidden;
}

.logo-tile svg {
  display: block;
  max-width: 82%;
  max-height: 82%;
  width: auto;
  height: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #f8fafc, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ==========================================================================
   Buttons & UI Elements
   ========================================================================== */

button {
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-hover));
  color: #451a03;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-teal-hover));
  color: #042f2e;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-accent:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.25);
  border-color: #f43f5e;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   App Layout & Views
   ========================================================================== */

.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  width: 100%;
}

.view.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* Card */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

/* ==========================================================================
   Lobby View
   ========================================================================== */

#lobby-view {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  gap: 1.75rem;
}

.lobby-hero {
  text-align: center;
  max-width: 650px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Wordfeud Asynchronous Active Games & Invites Section
   ========================================================================== */

.active-games-section {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

/* Tab navigation in active-games-section */
.active-games-tab-bar {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
}

.active-games-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.active-games-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.active-games-tab.active {
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
  border-bottom: 2px solid var(--accent-gold);
}

.games-pane {
  display: none;
}

.games-pane.active {
  display: block;
}

/* History filter and search controls */
.history-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.history-filters-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.history-filters-scroll::-webkit-scrollbar {
  display: none;
}

.history-filter-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.history-filter-pill:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.history-filter-pill.active {
  background: var(--accent-gold);
  color: #0f172a;
  border-color: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.history-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.history-search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-main);
  box-sizing: border-box;
}

.history-search-input:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.history-search-clear {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
}

/* History Cards */
.history-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 0.85rem;
}

.history-game-card {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.history-game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.history-game-card.won {
  border-left: 3px solid #10b981;
}

.history-game-card.lost {
  border-left: 3px solid #f87171;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-badge.won {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.history-badge.lost {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.history-players-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.history-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.history-player-row.winner {
  font-weight: 700;
  color: var(--accent-gold);
}

.history-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.empty-state-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

.active-games-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.85rem;
}

.active-games-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.active-games-icon {
  font-size: 1.4rem;
}

.active-games-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.async-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.active-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.active-game-card {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.25s ease;
  position: relative;
}

.active-game-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.active-game-card.my-turn {
  border-color: var(--accent-gold);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(245, 158, 11, 0.08));
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.opponents-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.opp-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.opp-details {
  display: flex;
  flex-direction: column;
}

.opp-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.card-room-code {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold, #fbbf24);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.08rem 0.38rem;
  border-radius: 6px;
  letter-spacing: 0.04em;
  user-select: all;
}

.opp-tag {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.turn-pill {
  padding: 0.3rem 0.65rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.turn-pill.your-turn {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #34d399;
  animation: pulse-ring 2s infinite;
}

.turn-pill.their-turn {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.turn-pill.waiting-turn {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #cbd5e1;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.opp-avatar-stack {
  display: flex;
  align-items: center;
}

.opp-avatar-stacked {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface-elevated, #1a243d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  margin-left: -10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.opp-avatar-stacked:first-child {
  margin-left: 0;
}

.card-scores-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.card-player-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.card-player-chip.is-me-chip {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.35);
}

.card-player-chip.is-turn-chip {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.22);
}

.card-player-chip .chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-player-chip .chip-name {
  color: var(--text-main, #f8fafc);
  font-weight: 600;
  max-width: 95px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-player-chip .chip-score {
  color: var(--accent-gold, #fbbf24);
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: 0.95rem;
}

.card-player-chip .chip-turn-indicator {
  font-size: 0.72rem;
  color: #fbbf24;
  margin-left: 1px;
}

.card-last-move {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-resume-game {
  width: 100%;
}

/* Pending Invites Banner */
.pending-invites-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.invite-banner-item {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.invite-banner-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.invite-banner-actions {
  display: flex;
  gap: 0.5rem;
}

.lobby-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 860px) {
  .lobby-grid {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
  }
}

.lobby-card {
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.card-icon {
  font-size: 1.4rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.1rem;
  line-height: 1.45;
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-stack .form-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.highlight-card {
  border-color: rgba(6, 182, 212, 0.3);
  background: linear-gradient(145deg, rgba(22, 32, 54, 0.8), rgba(6, 182, 212, 0.08));
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.form-row {
  display: flex;
  gap: 1rem;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

select {
  padding-right: 1.85rem;
  cursor: pointer;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

/* ==========================================================================
   Custom Dropdown Selects (Rich UI with Flags, Icons, Badges & Animation)
   ========================================================================== */

.custom-select-target {
  display: none !important;
}

.custom-select-wrap {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.custom-select-trigger {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  background: rgba(11, 15, 25, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm, 8px);
  padding: 0.6rem 0.85rem;
  color: var(--text-main, #f8fafc);
  font-family: var(--font-main, inherit);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.custom-select-trigger:hover,
.custom-select-trigger:focus-visible {
  background: rgba(22, 32, 54, 0.95);
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}

.custom-select-wrap.is-open .custom-select-trigger {
  border-color: var(--accent-gold, #f59e0b);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
  background: rgba(22, 32, 54, 0.98);
}

.custom-select-selected-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
}

.custom-select-selected-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main, #f8fafc);
  font-size: 0.92rem;
  font-weight: 600;
}

.custom-select-chevron {
  font-size: 0.65rem;
  color: var(--accent-gold, #f59e0b);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-select-wrap.is-open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(245, 158, 11, 0.15);
  padding: 0.4rem;
  z-index: 125;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 270px;
  overflow-y: auto;
  box-sizing: border-box;
  animation: customSelectFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-menu.open-upwards {
  top: auto;
  bottom: calc(100% + 5px);
}

.custom-select-wrap.is-open .custom-select-menu {
  display: flex;
}

@keyframes customSelectFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  color: #cbd5e1;
  background: transparent;
  box-sizing: border-box;
}

.custom-select-option:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.custom-select-option.is-selected {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.25));
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #ffffff;
}

.custom-select-opt-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.custom-select-opt-icon {
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.custom-select-opt-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.custom-select-opt-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-opt-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.25;
  white-space: normal;
}

.custom-select-opt-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.custom-select-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  white-space: nowrap;
}

.custom-select-option.is-selected .custom-select-badge {
  background: rgba(245, 158, 11, 0.3);
  color: var(--accent-gold, #f59e0b);
}

.custom-select-check {
  font-size: 0.85rem;
  color: var(--accent-gold, #f59e0b);
  display: none;
}

.custom-select-option.is-selected .custom-select-check {
  display: inline-block;
}

.flag-icon {
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  display: block;
}

/* Custom select inside compact waiting room bot inputs */
.bot-inputs-wrap .custom-select-wrap {
  width: auto;
  min-width: 140px;
}

.bot-inputs-wrap .custom-select-trigger {
  min-height: 34px;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
}

/* Slim scrollbar for custom select menu */
.custom-select-menu::-webkit-scrollbar {
  width: 5px;
}
.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}


@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 0.95rem;
  }

  .form-group label {
    font-size: 0.78rem;
    margin-bottom: 0.15rem;
  }

  input[type="text"],
  select {
    font-size: 0.88rem;
    padding: 0.65rem 0.85rem;
    min-height: 42px;
  }

  .lang-pill-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    width: 100%;
  }

  .lang-badge {
    display: inline-block !important;
  }
}

.room-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.room-input-wrap input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 1.05rem;
  text-align: center;
  padding: 0.65rem 0.5rem;
}

.room-input-wrap button {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ==========================================================================
   Waiting Room View
   ========================================================================== */

#waiting-view {
  max-width: 780px;
  margin: 2rem auto;
  padding: 1.5rem;
}

.waiting-card {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  text-align: center;
}

.badge-tag {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 0.25rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.waiting-room-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
}

.code-highlight {
  color: var(--accent-gold);
  letter-spacing: 0.15em;
}

.waiting-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.share-box {
  display: flex;
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.share-box input {
  background: rgba(0, 0, 0, 0.4);
  font-family: monospace;
  font-size: 0.9rem;
}

.room-settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.waiting-players-section {
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.host-timer-bar {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.95rem 1.05rem;
  margin-top: 1.15rem;
  margin-bottom: 0.85rem;
  box-sizing: border-box;
  width: 100%;
}

.host-timer-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
}

#host-max-players-field {
  margin-top: 1.5rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.host-timer-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.host-timer-select {
  width: 100%;
  box-sizing: border-box;
}

.waiting-actions-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.host-bot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: visible;
}

.bot-row-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.bot-inputs-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
}

.btn-compact-bot {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 0.95rem !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.bot-diff-select {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 0.5rem !important;
  font-size: 0.85rem !important;
  box-sizing: border-box;
}

.host-controls {
  display: flex;
  gap: 0.5rem;
}

.select-sm {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  width: auto;
}

.waiting-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.player-waiting-item {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.player-avatar-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.player-name-text {
  font-weight: 600;
  font-size: 0.95rem;
}

.badge-host {
  font-size: 0.85rem;
  color: var(--accent-gold);
}

.btn-remove-player {
  background: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 4px;
}

.btn-remove-player:hover {
  color: var(--accent-danger);
}

.waiting-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   Active Game Table View
   ========================================================================== */

#game-view {
  display: none;
  height: calc(100vh - 64px);
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  overflow: hidden;
}

#game-view.active {
  display: flex;
  flex-direction: column;
}

/* Topbar */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.6rem;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.85rem;
  min-height: 44px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.room-badge,
.lang-badge,
.bag-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.room-badge {
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.room-badge:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.room-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.room-val {
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.bag-label {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.turn-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.timer-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.timer-warning {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
  animation: pulse-warning 0.8s infinite;
}

@keyframes pulse-warning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Game Arena Grid */
.game-arena {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 0.75rem;
  height: calc(100% - 56px);
  overflow: hidden;
}

@media (max-width: 1100px) {
  .game-arena {
    grid-template-columns: 200px 1fr 260px;
  }
}

/* Drawer backdrop & header */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 490;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.btn-drawer-close {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-main);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-drawer-close:hover,
.btn-drawer-close:active {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--accent-danger);
  color: #fff;
}

/* Left: Players Panel */
.players-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.player-score-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.25s ease;
}

.player-score-card.active-turn {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
  transform: scale(1.02);
}

.player-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.player-card-score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent-gold);
}

.player-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.turn-history-preview {
  margin-top: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sub-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.last-move-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Center: Scrabble Board & Rack Column
   ========================================================================== */

/* Persistent Top Scoreboard Bar (Always visible on mobile & desktop above the board) */
.game-scoreboard-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: min(94vw, 540px);
  margin: 0 auto;
  padding: 0.22rem 0.45rem;
  background: rgba(19, 27, 46, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
  flex-shrink: 0;
}

.scoreboard-chip {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  transition: all 0.25s ease;
  min-width: 100px;
  min-height: 30px;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

.scoreboard-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.scoreboard-chip.active-turn {
  background: rgba(245, 158, 11, 0.16);
  border-color: var(--accent-gold);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.scoreboard-chip.filtering-player,
.player-score-card.filtering-player {
  border-color: var(--chip-player-color, var(--accent-gold)) !important;
  box-shadow: 0 0 16px var(--chip-player-glow, rgba(245, 158, 11, 0.5)) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  transform: translateY(-1px);
}

.scoreboard-player-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

.scoreboard-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.scoreboard-text {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.scoreboard-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.scoreboard-score-line {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  line-height: 1;
  flex-shrink: 0;
  margin-left: auto;
}

.scoreboard-score-val {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.scoreboard-score-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
}

.lobby-auth-card {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(19, 27, 46, 0.75);
}

.review-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  margin-top: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  width: 100%;
  box-sizing: border-box;
}

.scoreboard-score-unit {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.scoreboard-vs-divider {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-dim);
  text-transform: uppercase;
  flex-shrink: 0;
  opacity: 0.6;
}

.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 100%;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.board-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
  max-height: calc(100% - 150px);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.scrabble-board {
  will-change: transform;
  transform-origin: center center;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 2px;
  background: #0f172a;
  padding: 0;
  border-radius: 4px;
  border: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
  aspect-ratio: 1 / 1;
  height: 100%;
  max-height: 100%;
}


/* Cells */
.cell {
  position: relative;
  background: var(--cell-normal-bg);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
  overflow: hidden;
}

.cell:hover {
  filter: brightness(1.15);
}

.cell.cell-tw {
  background: var(--bonus-tw-bg);
  color: #fff;
}

.cell.cell-dw {
  background: var(--bonus-dw-bg);
  color: #fff;
}

.cell.cell-tl {
  background: var(--bonus-tl-bg);
  color: #fff;
}

.cell.cell-dl {
  background: var(--bonus-dl-bg);
  color: #fff;
}

.cell.cell-star {
  background: var(--bonus-star-bg);
  color: #fff;
}

.cell.cell-qw {
  background: var(--bonus-qw-bg);
  color: #fff;
}

.cell.cell-ql {
  background: var(--bonus-ql-bg);
  color: #fff;
}

.cell-bonus-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.62rem, 1.3vw, 0.92rem);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* Board size specific tweaks */
.scrabble-board[data-size="11"] {
  gap: 2px;
  padding: 0;
}
.scrabble-board[data-size="11"] .cell-bonus-label {
  font-size: clamp(0.7rem, 1.6vw, 1.1rem);
}
.scrabble-board[data-size="11"] .tile .tile-letter {
  font-size: clamp(1rem, 2.2vw, 1.6rem);
}
.scrabble-board[data-size="11"] .tile .tile-points {
  font-size: clamp(0.5rem, 1vw, 0.8rem);
}

.scrabble-board[data-size="21"] {
  gap: 1px;
  padding: 0;
}
.scrabble-board[data-size="21"] .cell-bonus-label {
  font-size: clamp(0.35rem, 0.72vw, 0.58rem);
}
.scrabble-board[data-size="21"] .tile .tile-letter {
  font-size: clamp(0.56rem, 1.05vw, 0.88rem);
  transform: translate(-0.5px, -0.5px);
}
.scrabble-board[data-size="21"] .tile .tile-points {
  font-size: clamp(0.3rem, 0.52vw, 0.48rem);
  right: 1px;
  bottom: 0px;
}

/* Drag over highlight */
.cell.drag-over {
  outline: 2px dashed var(--accent-gold);
  background: rgba(245, 158, 11, 0.25) !important;
}

/* ==========================================================================
   Letter Tiles (On Board and On Rack)
   ========================================================================== */

.tile {
  width: 94%;
  height: 94%;
  background: var(--tile-bg);
  border-radius: 4px;
  border: 1px solid var(--tile-border);
  box-shadow: var(--tile-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s;
}

.tile:active {
  cursor: grabbing;
}

.tile * {
  pointer-events: none;
}

.tile-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.85rem, 2vw, 1.25rem);
  color: var(--tile-text);
  line-height: 1;
}

.tile-points {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: clamp(0.42rem, 0.8vw, 0.6rem);
  color: #92400e;
  line-height: 1;
}

/* Board specific tile sizing to prevent letter and point collisions */
.scrabble-board .tile .tile-letter {
  font-size: clamp(0.72rem, 2.2vw, 1.1rem);
  transform: translate(-1.2px, -1.2px);
}

.scrabble-board .tile .tile-points {
  font-size: clamp(0.56rem, 1.15vw, 0.74rem);
  bottom: 2.5px;
  right: 3px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

/* Rack specific tile sizing */
.player-rack .tile .tile-letter {
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  transform: translate(-1px, -1px);
}

.player-rack .tile .tile-points {
  font-size: 0.72rem;
  bottom: 3px;
  right: 3.5px;
}

.tile.is-blank {
  border-color: #38bdf8;
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
}

.tile.is-blank .tile-letter {
  color: #0369a1;
  font-weight: 900;
}

.tile.is-blank .tile-points {
  display: block;
  color: #0284c7;
  font-weight: 800;
}

.blank-star-marker {
  position: absolute;
  bottom: 2px;
  left: 3px;
  font-size: 0.6rem;
  color: #0284c7;
  pointer-events: none;
  line-height: 1;
}

/* Newly Placed uncommitted tiles */
.tile.tile-uncommitted {
  outline: 2px solid var(--accent-gold);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
  animation: tile-placed-pulse 2s infinite;
  cursor: grab;
}

.tile.tile-uncommitted:active {
  cursor: grabbing;
}

.tile.tile-dragging {
  opacity: 0.45;
  transform: scale(0.92);
}

.player-rack.drag-over-rack {
  outline: 2px dashed var(--accent-gold);
  background: rgba(245, 158, 11, 0.15);
}

@keyframes tile-placed-pulse {
  0%, 100% { outline-color: var(--accent-gold); }
  50% { outline-color: #38bdf8; }
}

/* Pop animation when placed */
.tile-pop {
  animation: tile-pop-anim 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tile-pop-anim {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Player Tile Dot Indicator */
.tile-player-dot {
  position: absolute;
  top: 3.5px;
  left: 3.5px;
  width: 8.5px;
  height: 8.5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.8), inset 0 0 2px rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.35);
}

/* Last Move Glowing Highlight - Distinct Cyan Pulse with Corner Pip */
.tile.tile-last-move {
  z-index: 4;
  outline: 2.5px solid #06b6d4 !important;
  outline-offset: -1px;
  box-shadow: 0 0 0 1.5px #38bdf8, 0 0 14px rgba(6, 182, 212, 0.8), inset 0 0 8px rgba(56, 189, 248, 0.35) !important;
  animation: last-move-glow 1.8s ease-in-out infinite alternate !important;
}

.tile.tile-last-move::after {
  content: '';
  position: absolute;
  top: -2.5px;
  right: -2.5px;
  width: clamp(7px, 0.8vw, 9.5px);
  height: clamp(7px, 0.8vw, 9.5px);
  background: #38bdf8;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px #0284c7;
  animation: last-move-pip 1.5s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 6;
}

@keyframes last-move-glow {
  0% {
    box-shadow: 0 0 0 1px #06b6d4, 0 0 8px rgba(6, 182, 212, 0.6), inset 0 0 4px rgba(56, 189, 248, 0.2);
    outline-color: #06b6d4;
  }
  100% {
    box-shadow: 0 0 0 2px #38bdf8, 0 0 18px rgba(56, 189, 248, 0.95), inset 0 0 10px rgba(56, 189, 248, 0.45);
    outline-color: #7dd3fc;
  }
}

@keyframes last-move-pip {
  0% { transform: scale(0.9); opacity: 0.85; }
  100% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #38bdf8; }
}

.cell.cell-last-move {
  background: rgba(6, 182, 212, 0.18) !important;
  box-shadow: inset 0 0 8px rgba(6, 182, 212, 0.35);
}

/* Player Filtering: Highlight vs Dimmed */
.tile.tile-player-highlighted {
  z-index: 5;
  transform: scale(1.08);
  outline: 2.5px solid var(--player-highlight-color, var(--accent-gold)) !important;
  box-shadow: 0 0 14px var(--player-highlight-glow, rgba(245, 158, 11, 0.7)) !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, outline 0.2s ease;
}

.tile.tile-player-dimmed {
  opacity: 0.28 !important;
  filter: grayscale(40%) !important;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

/* ==========================================================================
   Player Rack & Action Bar
   ========================================================================== */

.player-controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.rack-section {
  display: flex;
  justify-content: center;
}

.rack-wood {
  background: var(--wood-grain);
  border-radius: var(--radius-md);
  padding: 4px 12px 6px 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.15);
  border-bottom: 3px solid var(--wood-lip);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.player-rack {
  display: flex;
  gap: 6px;
  min-height: 42px;
  align-items: center;
}

.rack-slot {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 5px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  transition: all 0.15s ease;
}

.rack-slot.drag-over-slot {
  outline: 2px solid var(--accent-gold);
  background: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
  transform: scale(1.06);
}

.rack-slot .tile {
  width: 100%;
  height: 100%;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.rack-slot .tile:active {
  cursor: grabbing;
}

.rack-slot .tile:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.rack-slot .tile.selected {
  transform: translateY(-8px) scale(1.08);
  outline: 2px solid var(--accent-gold);
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.5);
}

.touch-drag-ghost {
  pointer-events: none;
  user-select: none;
  touch-action: none;
  z-index: 99999;
}

/* Action Buttons Bar */
.action-buttons-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon-text {
  font-size: 1rem;
}

/* Live Move Score Preview Bar & Button Badges */
.move-score-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 6px auto 8px auto;
  padding: 6px 14px;
  max-width: 95%;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: movePreviewSlideUp 0.22s ease-out;
}

@keyframes movePreviewSlideUp {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.move-score-preview-bar.valid-preview {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(6, 95, 70, 0.24));
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

/* Word Validity Color Themes */
.move-score-preview-bar.word-status-valid {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(6, 95, 70, 0.38));
  border: 1px solid rgba(16, 185, 129, 0.65);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #f0fdf4;
}

.move-score-preview-bar.word-status-invalid {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(159, 18, 57, 0.38));
  border: 1px solid rgba(239, 68, 68, 0.65);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #fff1f2;
}

.move-score-preview-bar.word-status-pending {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(30, 58, 138, 0.28));
  border: 1px solid rgba(14, 165, 233, 0.45);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.2);
  color: #f0f9ff;
}

.move-score-preview-bar.invalid-preview {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(180, 83, 9, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
  color: #fef3c7;
  font-size: 0.82rem;
}

.move-score-preview-bar .preview-icon {
  font-size: 1rem;
  line-height: 1;
}

.move-score-preview-bar .preview-word-main {
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.move-score-preview-bar .preview-word-main.word-invalid-tag {
  color: #fecdd3;
  text-decoration: underline wavy #ef4444;
}

.move-score-preview-bar .preview-valid-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.5);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.move-score-preview-bar .preview-invalid-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.32);
  color: #fecdd3;
  border: 1px solid rgba(239, 68, 68, 0.55);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  animation: badgeBlink 2.2s infinite ease-in-out;
}

@keyframes badgeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

.move-score-preview-bar .preview-score-chip {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  padding: 2px 9px;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.move-score-preview-bar .preview-score-chip.score-chip-invalid {
  background: linear-gradient(135deg, #e11d48, #be123c);
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.35);
}

.move-score-preview-bar .preview-words-breakdown {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.move-score-preview-bar .preview-word-item {
  color: #e2e8f0;
  font-weight: 700;
}

.move-score-preview-bar .preview-word-item.word-item-valid {
  color: #a7f3d0;
  border-bottom: 2px solid #10b981;
}

.move-score-preview-bar .preview-word-item.word-item-invalid {
  color: #fecdd3;
  border-bottom: 2px solid #ef4444;
}

.move-score-preview-bar .preview-word-item .word-pts {
  color: #6ee7b7;
  font-size: 0.76rem;
  font-weight: 700;
  margin-left: 2px;
}

.move-score-preview-bar .preview-word-item.word-item-invalid .word-pts {
  color: #fecdd3;
}

.move-score-preview-bar .preview-math-sym {
  color: #94a3b8;
  font-weight: 600;
}

.move-score-preview-bar .preview-bingo-chip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #451a03;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.78rem;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  animation: bingoPulse 1.8s infinite ease-in-out;
}

@keyframes bingoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.move-score-preview-bar .preview-warning-text {
  color: #fde68a;
}

/* Play Move button points badge */
.btn-play-move-score {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 1px 7px;
  border-radius: 9999px;
  margin-left: 6px;
  letter-spacing: 0.2px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}

.action-btn.has-score.word-status-valid {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.55), 0 0 12px rgba(16, 185, 129, 0.45) !important;
}

.action-btn.has-score.word-status-invalid {
  background: linear-gradient(135deg, #f43f5e, #be123c) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.55), 0 0 12px rgba(244, 63, 94, 0.35) !important;
}

/* ==========================================================================
   Right Panel: Tabs (Chat, History, Letter Distribution)
   ========================================================================== */

.sidebar-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.panel-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  background: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.05);
}

.tab-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
}

/* Tab: Chat */
.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  max-width: 90%;
}

.chat-msg.mine {
  align-self: flex-end;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.chat-msg-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.chat-sender {
  font-weight: 700;
  color: var(--primary-teal);
}

.chat-msg.mine .chat-sender {
  color: var(--accent-gold);
}

.chat-text {
  font-size: 0.85rem;
  word-break: break-word;
}

.chat-system-msg {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.4rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.chat-input-form {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-quick-emojis {
  display: flex;
  gap: 0.35rem;
}

.btn-emoji {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.95rem;
}

.btn-emoji:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
}

/* Tab: History */
.history-list {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent-gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.85rem;
}

.history-pts {
  color: var(--accent-gold);
  font-family: var(--font-display);
}

.history-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Tab: Letter Distribution */
.letter-values-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.letters-grid {
  flex: 1;
  padding: 0.5rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.letter-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.letter-char {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent-gold);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
  animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  animation: modal-scale-up 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-scale-up {
  from { transform: scale(0.9); }
  to { transform: scale(1); }
}

.modal-large {
  max-width: 650px;
}

.modal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.modal-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Blank Tile Picker */
.blank-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.btn-blank-letter {
  background: var(--tile-bg);
  border: 1px solid var(--tile-border);
  color: var(--tile-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  box-shadow: var(--tile-shadow);
}

.btn-blank-letter:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

/* Swap Selection */
.swap-selection-grid {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 1rem 0;
}

.swap-tile-item {
  width: 52px;
  height: 52px;
  position: relative;
  cursor: pointer;
}

.swap-tile-item input {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 2;
  accent-color: var(--accent-gold);
  width: 18px;
  height: 18px;
}

.swap-tile-item.checked .tile {
  outline: 2px solid var(--accent-gold);
  transform: translateY(-4px);
}

/* Rules Modal */
.rules-body {
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-right: 0.5rem;
}

.rule-section h4 {
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.rule-section ul {
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.rule-section strong {
  color: var(--text-main);
}

.bonus-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.badge-tw, .badge-dw, .badge-tl, .badge-dl, .badge-star {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

.badge-tw { background: var(--bonus-tw-bg); }
.badge-dw { background: var(--bonus-dw-bg); }
.badge-tl { background: var(--bonus-tl-bg); }
.badge-dl { background: var(--bonus-dl-bg); }
.badge-star { background: var(--bonus-star-bg); }
.badge-qw { background: var(--bonus-qw-bg); }
.badge-ql { background: var(--bonus-ql-bg); }

/* Celebration & Game Over */
.celebration-card {
  text-align: center;
}

.celebration-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.gameover-podium {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.podium-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.podium-item.winner {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--accent-gold);
  transform: scale(1.03);
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-container {
  position: fixed;
  top: calc(75px + env(safe-area-inset-top, 0px));
  right: max(20px, env(safe-area-inset-right, 0px));
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}

.toast {
  pointer-events: auto;
  background: #1e293b; /* 100% solid, fully opaque background */
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  padding: 0.9rem 1.3rem;
  border-radius: var(--radius-md);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.85), 0 4px 12px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 440px;
  animation: toast-slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.toast-error {
  border-color: #f43f5e;
  background: #2b0b14; /* Solid, deep dark red/rose background */
  color: #ffffff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(244, 63, 94, 0.4);
}

.toast.toast-error span:last-child {
  color: #fff1f2;
}

.toast.toast-success {
  border-color: #10b981;
  background: #06281e; /* Solid, deep dark emerald background */
  color: #ffffff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(16, 185, 129, 0.35);
}

.toast.toast-success span:last-child {
  color: #ecfdf5;
}

.toast.toast-warning {
  border-color: #f59e0b;
  background: #291a05; /* Solid, deep dark amber background */
  color: #ffffff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(245, 158, 11, 0.35);
}

.toast.toast-warning span:last-child {
  color: #fffbeb;
}

.toast.toast-info {
  border-color: #06b6d4;
  background: #082531; /* Solid, deep dark cyan background */
  color: #ffffff;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.9), 0 0 15px rgba(6, 182, 212, 0.35);
}

.toast.toast-info span:last-child {
  color: #ecfeff;
}

/* ==========================================================================
   Mobile & Responsive Adaptations (Smartphones & Tablets / PWA)
   ========================================================================== */

.mobile-only {
  display: none !important;
}

@media (max-width: 900px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .hide-mobile {
    display: none !important;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .main-header {
    height: calc(52px + env(safe-area-inset-top, 0px));
    min-height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .main-header::-webkit-scrollbar {
    display: none;
  }

  .header-brand {
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .logo-tile {
    width: 30px;
    height: 30px;
    font-size: 1.15rem;
  }

  .brand-title {
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .brand-badge {
    display: none !important;
  }

  .header-actions {
    gap: 0.3rem;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  .header-actions .btn-sm {
    padding: 0.25rem 0.45rem;
    font-size: 0.75rem;
    min-width: 32px;
    height: 32px;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  .header-actions .btn-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 1rem;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  .user-badge {
    padding: 0.2rem 0.45rem;
    gap: 0.3rem;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: manipulation;
  }

  .user-badge:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
  }

  .user-avatar-circle {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
    flex-shrink: 0;
    cursor: pointer;
  }

  .user-tag {
    max-width: 65px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
    cursor: pointer;
  }

  #btn-open-settings {
    min-width: 30px;
    height: 30px;
    padding: 0;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  .btn-logout-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: 30px;
    height: 30px;
    margin-left: 0.15rem;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  @media (max-width: 480px) {
    .brand-title {
      font-size: 0.8rem;
      letter-spacing: 0;
    }

    .user-tag {
      max-width: 58px;
    }

    .header-actions {
      gap: 0.22rem;
    }

    #btn-toggle-ui-lang {
      min-width: 36px !important;
      padding: 0.2rem 0.35rem !important;
      font-size: 0.72rem !important;
    }
  }



  @media (max-width: 360px) {
    .brand-title {
      display: none; /* Icon-only brand on ultra compact phones */
    }

    .user-tag {
      max-width: 44px;
    }
  }

  .modal-overlay {
    padding: 0.75rem 0.5rem;
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-card {
    padding: 1.25rem 1rem;
    max-height: 88vh;
    overflow-y: auto;
    width: 100%;
    margin: 1rem auto;
    box-sizing: border-box;
  }

  #lobby-view {
    padding: 0.85rem 0.6rem 1.5rem 0.6rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    gap: 1.25rem;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .active-games-section {
    padding: 0.85rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 1rem auto;
    box-sizing: border-box;
  }

  .active-games-grid {
    grid-template-columns: 1fr;
  }

  .lobby-grid {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
  }

  .lobby-card {
    padding: 0.95rem 1.05rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 0.75rem;
    gap: 0.5rem;
  }

  .card-icon {
    font-size: 1.3rem;
  }

  .card-title {
    font-size: 1.15rem;
  }

  .card-desc {
    font-size: 0.82rem;
    margin-bottom: 0.75rem;
  }

  .lobby-form {
    gap: 0.85rem;
  }

  .form-row {
    gap: 0.6rem;
  }

  #game-view {
    height: auto;
    min-height: calc(100vh - 52px);
    padding: 0.35rem 0 1rem 0;
    gap: 0.35rem;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .game-topbar {
    display: flex;
    flex-wrap: nowrap !important;
    justify-content: space-between;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.45rem;
    height: auto;
    min-height: 36px;
    margin: 0.15rem 0.5rem 0.3rem 0.5rem;
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
    box-sizing: border-box;
    overflow: hidden;
  }

  .game-topbar::-webkit-scrollbar {
    display: none;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    min-width: 0;
    padding-right: 0.2rem;
  }
  .topbar-left::-webkit-scrollbar {
    display: none;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .topbar-right::-webkit-scrollbar {
    display: none;
  }

  /* .topbar-center removed */

  .room-badge,
  .lang-badge,
  .bag-badge {
    padding: 0.2rem 0.45rem;
    font-size: 0.74rem;
    gap: 0.25rem;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }

  .lang-badge #game-lang-text {
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .room-label,
  .bag-label {
    font-size: 0.70rem;
    display: inline;
  }

  .turn-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1;
    min-width: 0;
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
  }

  .turn-indicator-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
  }

  #turn-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
  }

  .timer-box {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.74rem;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .game-topbar .btn-secondary,
  .game-topbar .btn-danger,
  .game-topbar .btn-icon {
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .game-topbar #btn-open-sync-words,
  .game-topbar #btn-save-board {
    display: none !important;
  }

  .game-scoreboard-bar {
    width: calc(100% - 1rem);
    max-width: 100vw;
    margin: 0.15rem auto 0.25rem auto;
    padding: 0.25rem 0.45rem;
    gap: 0.3rem;
  }

  .scoreboard-chip {
    padding: 0.25rem 0.45rem;
    gap: 0.35rem;
    min-width: 85px;
  }

  .tile-player-dot {
    top: 2px;
    left: 2px;
    width: 3.5px;
    height: 3.5px;
  }

  .scoreboard-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .scoreboard-name {
    font-size: 0.75rem;
    max-width: 100%;
  }

  .scoreboard-sub {
    font-size: 0.64rem;
  }

  .scoreboard-score-val {
    font-size: 0.85rem;
  }

  .scoreboard-score-label {
    font-size: 0.6rem;
  }

  .lobby-auth-card {
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
  }

  .review-controls-bar {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.65rem;
  }
  .review-controls-bar button {
    width: 100% !important;
  }

  .game-arena {
    display: flex;
    flex-direction: column;
    position: relative;
    height: auto;
    overflow: visible;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .board-column {
    width: 100%;
    max-width: 100vw;
    order: 1;
    height: auto;
    overflow: visible;
    justify-content: flex-start;
    gap: 0.25rem;
    box-sizing: border-box;
  }

  .board-wrapper {
    position: relative;
    width: 100vw;
    height: 100vw;
    max-width: 100vw;
    max-height: 100vw;
    margin: 0 auto;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    border: none;
    box-shadow: none;
    flex-shrink: 0;
  }

  @media (orientation: landscape) and (max-height: 600px) {
    .board-wrapper {
      width: min(100vw, calc(100vh - 110px));
      height: min(100vw, calc(100vh - 110px));
      max-width: calc(100vh - 110px);
      max-height: calc(100vh - 110px);
    }
  }

  .scrabble-board {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    gap: 1px;
    box-sizing: border-box;
  }

  .scrabble-board[data-size="11"] {
    gap: 1.5px;
    padding: 0;
  }

  .scrabble-board[data-size="21"] {
    gap: 0.5px;
    padding: 0;
  }

  .player-controls-container {
    padding: 0 0.5rem;
    width: 100%;
    box-sizing: border-box;
  }

  .cell-bonus-label {
    font-size: clamp(0.68rem, 3.2vw, 0.90rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.2px;
  }

  .scrabble-board[data-size="11"] .cell-bonus-label {
    font-size: clamp(0.85rem, 4vw, 1.15rem);
  }

  .scrabble-board[data-size="21"] .cell-bonus-label {
    font-size: clamp(0.42rem, 1.8vw, 0.62rem);
  }

  /* Board Tiles on Mobile: enlarged and clearly legible, point value neatly positioned */
  .scrabble-board .tile .tile-letter {
    font-size: clamp(0.82rem, 3.5vw, 1.08rem);
    font-weight: 800;
    line-height: 1;
    transform: translate(-1.2px, -1.2px);
  }

  .scrabble-board .tile .tile-points {
    font-size: clamp(0.44rem, 1.6vw, 0.58rem);
    bottom: 1.5px;
    right: 2px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1;
  }

  .scrabble-board[data-size="11"] .tile .tile-letter {
    font-size: clamp(1rem, 4.5vw, 1.35rem);
  }

  .scrabble-board[data-size="11"] .tile .tile-points {
    font-size: clamp(0.52rem, 2vw, 0.7rem);
  }

  .scrabble-board[data-size="21"] .tile .tile-letter {
    font-size: clamp(0.58rem, 2.2vw, 0.8rem);
  }

  .scrabble-board[data-size="21"] .tile .tile-points {
    font-size: clamp(0.32rem, 1.1vw, 0.44rem);
  }

  .scrabble-board .tile.is-blank .blank-star-marker {
    font-size: 0.55rem;
    bottom: 1.5px;
    left: 2px;
    line-height: 1;
  }

  .scrabble-board .tile .tile-player-dot {
    top: 1.5px;
    left: 1.5px;
    width: 4.5px;
    height: 4.5px;
  }

  .tile.tile-last-move::after {
    top: -1.5px;
    right: -1.5px;
    width: 5.5px;
    height: 5.5px;
  }

  .player-controls-container {
    gap: 0.35rem;
    padding: 0 0.35rem;
  }

  .rack-wood {
    padding: 2.5px 8px 4px 8px;
    border-bottom: 2.5px solid var(--wood-lip);
    border-radius: 6px;
  }

  .player-rack {
    gap: 4px;
    min-height: 34px;
  }

  .rack-slot {
    width: clamp(32px, 9.8vw, 38px);
    height: clamp(32px, 9.8vw, 38px);
    border-radius: 4px;
  }

  .player-rack .tile .tile-letter {
    font-size: clamp(0.92rem, 2.7vw, 1.2rem);
  }

  .player-rack .tile .tile-points {
    font-size: 0.6rem;
    bottom: 2px;
    right: 2.5px;
  }

  .game-scoreboard-bar {
    padding: 0.16rem 0.35rem;
    gap: 0.35rem;
    margin-bottom: 0.15rem;
  }

  .scoreboard-chip {
    padding: 0.16rem 0.45rem;
    min-height: 28px;
    gap: 0.3rem;
  }

  .scoreboard-avatar {
    width: 21px;
    height: 21px;
    font-size: 0.7rem;
  }

  .scoreboard-name {
    font-size: 0.76rem;
  }

  .scoreboard-score-val {
    font-size: 0.88rem;
  }

  .action-buttons-row {
    gap: 0.35rem;
  }

  .action-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
  }

  /* Slide-in drawers for mobile */
  .players-panel,
  .sidebar-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 500;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.28s;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.85);
    display: flex;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

  .players-panel {
    left: 0;
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
  }

  .players-panel.mobile-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-panel {
    right: 0;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar-panel.mobile-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  /* Tap targets touch friendly */
  button, .cell, .tile {
    touch-action: manipulation;
  }
}

/* ==========================================================================
   User Profile, Authentication & Friends / Favorites Styles
   ========================================================================== */

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.25rem 0.65rem 0.25rem 0.35rem;
  border-radius: 30px;
  cursor: pointer;
}

#btn-open-settings {
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-logout-chip {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 0.25rem;
}

.btn-logout-chip:hover {
  background: rgba(244, 63, 94, 0.35);
  border-color: #f43f5e;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.3);
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #451a03;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.user-avatar-circle:hover {
  transform: scale(1.08);
}

/* ==========================================================================

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-tag {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent-gold);
}

.user-stats {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.badge-count {
  background: var(--accent-danger);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-left: 4px;
}

/* Friends button with pending request animation */
.friends-icon-star {
  display: inline-block;
  transform-origin: center center;
  transition: transform 0.25s ease;
}

#btn-friends.has-pending-requests {
  position: relative;
  border-color: rgba(251, 191, 36, 0.75) !important;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
  animation: friendBtnPulse 2.4s infinite ease-in-out;
}

#btn-friends.has-pending-requests .friends-icon-star {
  animation: friendStarFlipPulse 2.4s infinite cubic-bezier(0.34, 1.56, 0.64, 1);
}

#btn-friends.has-pending-requests .badge-count {
  animation: friendBadgePop 2.4s infinite ease-in-out;
}

@keyframes friendStarFlipPulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
  }
  12% {
    transform: scale(1.35) rotate(-15deg);
  }
  28% {
    transform: scale(1.3) rotate(375deg);
  }
  42% {
    transform: scale(1.15) rotate(360deg);
  }
  55% {
    transform: scale(1) rotate(360deg);
  }
}

@keyframes friendBtnPulse {
  0%, 100% {
    border-color: rgba(251, 191, 36, 0.45);
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
  }
  50% {
    border-color: rgba(251, 191, 36, 0.95);
    box-shadow: 0 0 14px 2px rgba(251, 191, 36, 0.55);
  }
}

@keyframes friendBadgePop {
  0%, 100% {
    transform: scale(1);
  }
  15%, 45% {
    transform: scale(1.22);
  }
  30% {
    transform: scale(1.05);
  }
}

/* Panel Tabs Counts styling */
.tab-count {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.82em;
  opacity: 0.88;
  margin-left: 3px;
  font-weight: 700;
  vertical-align: baseline;
}

/* Auth Divider & Google Login Button */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  padding: 0 0.75rem;
}

.btn-google {
  background: #ffffff;
  color: #374151;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-google:hover {
  background: #f9fafb;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Tag prefix input */
.tag-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding-left: 0.75rem;
}

.tag-prefix {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 1.1rem;
  margin-right: 0.2rem;
}

.tag-input-wrap input {
  border: none !important;
  background: transparent !important;
  padding-left: 0 !important;
  box-shadow: none !important;
}

.form-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* Friends & Favorites list */
.friends-subpane {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.search-wrap {
  display: flex;
  gap: 0.5rem;
}

.friends-list-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.friend-card-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.friend-card-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.friend-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.friend-details {
  display: flex;
  flex-direction: column;
}

.friend-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.friend-tag {
  font-size: 0.78rem;
  color: var(--accent-gold);
}

.friend-meta {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.friend-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
 * Custom Words & Consensus Voting Styles
 * --------------------------------------------------------------------------- */
.custom-word-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.custom-word-pill:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
}

.btn-delete-word {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 1rem;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.15s ease, transform 0.15s ease;
}

.btn-delete-word:hover {
  color: var(--accent-red, #ef4444);
  transform: scale(1.2);
}

.sync-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sync-word-row:hover {
  background: rgba(255, 255, 255, 0.07);
}

.sync-word-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sync-word-text {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-400, #fbbf24);
}

.sync-word-badge {
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.toast-proposal-box {
  margin-top: 0.5rem;
}

.btn-propose-action {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-propose-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ==========================================================================
   Admin Dashboard & User Settings Styling
   ========================================================================== */
.admin-users-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.admin-user-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 10px);
  transition: all 0.2s ease;
}

.admin-user-card:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(245, 158, 11, 0.3);
}

.admin-user-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-user-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.admin-avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #0f172a;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.admin-user-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-user-name {
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-tag {
  font-size: 0.82rem;
  color: var(--text-dim, #94a3b8);
}

.role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-badge.admin {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.role-badge.player {
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user-email {
  font-size: 0.8rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-user-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.admin-user-stats-pill {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.admin-user-stats-pill:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.admin-user-stats-pill strong {
  color: #f8fafc;
}

.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Admin Active Session & Push Notification Badges */
.admin-session-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.admin-session-pill.in-game {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.admin-session-pill.in-game.is-turn {
  background: rgba(16, 185, 129, 0.25);
  border: 1px solid rgba(52, 211, 153, 0.65);
  color: #6ee7b7;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.admin-session-pill.in-lobby {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.admin-session-pill.offline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #64748b;
}

.admin-push-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.admin-push-pill.enabled {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.admin-push-pill.disabled {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #64748b;
}

.admin-user-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.admin-user-last-push {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.admin-user-last-push strong {
  color: #f1f5f9;
}

.admin-user-last-push .push-time {
  color: #64748b;
}

.admin-user-last-push.dim {
  color: #64748b;
  font-style: italic;
}

.avatar-color-picker {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  padding: 0.4rem 0;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transform: scale(1.15);
}

.color-dot.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

@media (max-width: 640px) {
  .admin-user-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .admin-user-stats-pill {
    justify-content: space-around;
  }
  .admin-user-actions {
    justify-content: flex-end;
  }
}

/* ---------------------------------------------------------------------------
   Word Proposal Banner & Badges (Asynchronous Voting)
   --------------------------------------------------------------------------- */
.game-proposal-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(139, 92, 246, 0.18));
  border: 1px solid rgba(245, 158, 11, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: bannerPulse 3s infinite ease-in-out;
  width: 100%;
  box-sizing: border-box;
}

@keyframes bannerPulse {
  0%, 100% { border-color: rgba(245, 158, 11, 0.45); }
  50% { border-color: rgba(245, 158, 11, 0.85); box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25); }
}

.proposal-banner-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: #fff;
  flex: 1;
}

.proposal-banner-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.proposal-banner-sub {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}

.card-proposal-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.45rem;
}

.card-proposal-badge.card-proposal-action {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.55);
  color: #fbbf24;
}

.card-proposal-badge.card-proposal-pending {
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #93c5fd;
}

.card-proposal-badge.card-proposal-done {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

/* ==========================================================================
   Connection & Offline Status Banner
   ========================================================================== */
.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 0.5rem) 1rem 0.55rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  font-size: 0.88rem;
  font-weight: 600;
  animation: slideDownBanner 0.25s ease-out;
  transition: background 0.3s ease, opacity 0.3s ease;
}

.connection-banner.disconnected {
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.95), rgba(194, 65, 12, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border-bottom: 1px solid rgba(251, 146, 60, 0.4);
}

.connection-banner.connected {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border-bottom: 1px solid rgba(52, 211, 153, 0.4);
}

.connection-banner-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 600px;
  width: 100%;
  justify-content: space-between;
}

.connection-banner .conn-icon {
  font-size: 1.15rem;
  animation: pulseIcon 1.5s infinite ease-in-out;
  flex-shrink: 0;
}

.connection-banner.connected .conn-icon {
  animation: none;
}

.connection-banner .conn-text {
  flex: 1;
  text-align: left;
  line-height: 1.25;
}

.btn-conn-reconnect {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  min-height: 32px;
}

.btn-conn-reconnect:hover,
.btn-conn-reconnect:active {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.02);
}

.connection-banner.connected .btn-conn-reconnect {
  display: none;
}

@keyframes slideDownBanner {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pulseIcon {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.75;
  }
}

/* ==========================================================================
   Pass & Play (Samen op 1 Scherm) & Custom Dialogs
   ========================================================================== */
.pass-player-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
}

.pass-player-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.pass-player-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  padding: 0.35rem 0.2rem !important;
  font-size: 0.9rem !important;
}

.pass-player-input:focus {
  outline: none !important;
}

.btn-pass-remove {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.btn-pass-remove:hover {
  background: rgba(239, 68, 68, 0.15);
}

.pass-and-play-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

/* Custom Prompt / Dialog input */
.dialog-input:focus {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25) !important;
  outline: none;
}

/* ==========================================================================
   Winfeud Word Helper Styles
   ========================================================================== */

/* Winfeud Action Button */
.btn-winfeud {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff !important;
  border: 1px solid rgba(251, 191, 36, 0.5) !important;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.35);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.btn-winfeud * {
  pointer-events: none;
}

.btn-winfeud:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.btn-winfeud:active {
  transform: translateY(1px);
}

/* Board Anchor Tile Highlight */
.tile-winfeud-anchor {
  outline: 3px solid #fbbf24 !important;
  outline-offset: 1px;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.9), 0 4px 8px rgba(0, 0, 0, 0.4) !important;
  animation: pulseWinfeudAnchor 1.6s infinite ease-in-out;
  z-index: 10;
}

@keyframes pulseWinfeudAnchor {
  0% {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.95), 0 4px 12px rgba(245, 158, 11, 0.6);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
    transform: scale(1);
  }
}

/* Winfeud Modal Card */
.modal-winfeud-card {
  max-width: 640px;
  width: 95%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: rgba(19, 27, 46, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(251, 191, 36, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-lg);
}

.winfeud-status-panel {
  background: rgba(26, 36, 61, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.winfeud-anchor-row,
.winfeud-rack-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.winfeud-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 130px;
}

.winfeud-anchor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-gold);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.btn-winfeud-tiny {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-winfeud-tiny:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.winfeud-rack-tiles {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.winfeud-mini-tile {
  width: 26px;
  height: 28px;
  background: var(--tile-bg);
  color: var(--tile-text);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  user-select: none;
}

.winfeud-mini-tile .mini-pts {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 0.52rem;
  font-weight: 600;
  opacity: 0.75;
}

.winfeud-tip {
  font-size: 0.76rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.35rem;
}

/* Filters & Sorting */
.winfeud-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.winfeud-sort-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.winfeud-sort-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.winfeud-sort-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.winfeud-sort-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.winfeud-search-box input {
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  box-sizing: border-box;
}

.winfeud-search-box input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  outline: none;
}

/* Results List */
.winfeud-results-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0.25rem 0.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.winfeud-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow-y: auto;
  max-height: 420px;
  padding-right: 0.25rem;
}

.winfeud-results-list::-webkit-scrollbar {
  width: 6px;
}

.winfeud-results-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Word Card */
.winfeud-word-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(26, 36, 61, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.winfeud-word-card:hover {
  background: rgba(30, 41, 69, 0.8);
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.winfeud-word-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.winfeud-word-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.winfeud-anchor-char {
  color: var(--accent-gold);
  text-decoration: underline;
  text-decoration-color: var(--accent-gold);
  text-underline-offset: 2px;
}

.winfeud-meta-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.winfeud-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.winfeud-word-scores {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.winfeud-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  min-width: 58px;
}

.winfeud-score-badge.board-score {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.winfeud-score-badge.base-score {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.winfeud-score-badge .score-val {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
}

.winfeud-score-badge .score-lbl {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.winfeud-bingo-tag {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  animation: pulse 1s infinite alternate;
}

.btn-winfeud-apply {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.3);
}

.btn-winfeud-apply:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  transform: scale(1.03);
}

/* Loading & Empty States */
.winfeud-loading,
.winfeud-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  gap: 0.75rem;
  text-align: center;
}

.winfeud-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(245, 158, 11, 0.2);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Winfeud Limit, Badge & Confirmation Views */
.winfeud-btn-badge {
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold-400, #fbbf24);
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  line-height: 1.1;
  margin-left: 0.25rem;
  letter-spacing: 0.02em;
}

.winfeud-btn-badge.exhausted {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.18);
}

.winfeud-attempts-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--gold-400, #fbbf24);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.2;
}

.winfeud-attempts-badge.exhausted {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

.winfeud-confirm-view,
.winfeud-exhausted-view {
  padding: 1.25rem 0.5rem 0.75rem;
  text-align: center;
  animation: fadeIn 0.2s ease-out;
}

.winfeud-confirm-card {
  max-width: 440px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md, 12px);
  padding: 1.5rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.winfeud-confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.85rem;
  font-size: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.winfeud-confirm-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.75rem;
}

.winfeud-remaining-pill-box {
  margin-bottom: 0.85rem;
}

.winfeud-remaining-pill {
  display: inline-block;
  text-align: center;
  padding: 0.4rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.12));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15);
}

.winfeud-remaining-pill strong {
  margin: 0 0.25rem;
  color: #fff;
}

.winfeud-confirm-desc {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0 0 1.25rem;
}

.winfeud-confirm-preview-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm, 8px);
  padding: 0.75rem 0.85rem;
  margin-bottom: 1.35rem;
  text-align: left;
}

.winfeud-confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.winfeud-btn-confirm {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #000 !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  padding: 0.75rem 1rem !important;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35) !important;
  border: none !important;
  cursor: pointer;
}

.winfeud-btn-confirm:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5) !important;
}

/* ---------------------------------------------------------------------------
   Winfeud Mobile Responsive Layout
   --------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .modal-winfeud-card {
    padding: 0.85rem 0.65rem;
    width: 95%;
    max-height: 92vh;
  }

  .winfeud-status-panel {
    padding: 0.6rem 0.75rem;
    margin: 0.45rem 0;
  }

  .winfeud-results-list {
    max-height: 52vh;
    gap: 0.55rem;
  }

  .winfeud-word-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .winfeud-word-left {
    width: 100%;
  }

  .winfeud-word-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
  }

  .winfeud-meta-tags {
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 0.7rem;
    margin-top: 0.15rem;
  }

  .winfeud-word-scores {
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .winfeud-score-badge {
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.35rem;
  }

  .winfeud-score-badge .score-val {
    font-size: 0.95rem;
  }

  .winfeud-score-badge .score-lbl {
    font-size: 0.58rem;
    white-space: nowrap;
  }

  .btn-winfeud-apply {
    flex: 1.35;
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }
}

/* ==========================================================================
   Custom Dropdown Component (Modern, Glassmorphic, with Flag SVGs & Badges)
   Replaces native browser / mobile modal selects across lobby, solo & waiting room
   ========================================================================== */

select.custom-select-target[data-custom-enhanced="true"] {
  display: none !important;
}

/* Stacking context fixes: ensure cards and containers elevate when select is open */
.card:has(.custom-select-wrap.open),
.lobby-card.has-open-select,
.card.has-open-select {
  z-index: 100 !important;
  position: relative !important;
}

.form-group:has(.custom-select-wrap.open),
.form-group.has-open-select,
.host-timer-field:has(.custom-select-wrap.open),
.host-timer-field.has-open-select,
.host-bot-row:has(.custom-select-wrap.open),
.host-bot-row.has-open-select,
.bot-inputs-wrap:has(.custom-select-wrap.open),
.bot-inputs-wrap.has-open-select {
  z-index: 110 !important;
  position: relative !important;
}

.custom-select-wrap.open {
  z-index: 120 !important;
  position: relative !important;
}

.custom-select-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
  text-align: left !important;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 12px);
  padding: 0.65rem 0.9rem;
  color: var(--text-main, #f8fafc);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  text-align: left !important;
  outline: none;
  min-height: 46px;
  box-sizing: border-box;
}

.custom-select-trigger:hover {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(15, 23, 42, 0.9);
}

.custom-select-trigger:focus-visible {
  border-color: var(--accent-gold, #fbbf24);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.custom-select-wrap.open .custom-select-trigger {
  border-color: var(--accent-gold, #fbbf24);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.custom-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: left !important;
}

.custom-select-flag {
  width: 22px;
  height: 15px;
  border-radius: 2.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.custom-select-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  line-height: 1;
  text-align: center;
}

.custom-select-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  text-align: left !important;
}

.custom-select-label {
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  font-size: 0.88rem;
  text-align: left !important;
}

.custom-select-sub {
  font-size: 0.73rem;
  color: var(--text-dim, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  text-align: left !important;
}

.custom-select-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold, #fbbf24);
  border: 1px solid rgba(245, 158, 11, 0.35);
  white-space: nowrap;
  margin-left: auto;
  margin-right: 0.4rem;
  flex-shrink: 0;
}

.custom-select-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim, #94a3b8);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  flex-shrink: 0;
}

.custom-select-wrap.open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--accent-gold, #fbbf24);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 0.35rem;
  max-height: 290px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
  text-align: left !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.4) transparent;
}

.custom-select-menu::-webkit-scrollbar {
  width: 6px;
}
.custom-select-menu::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.4);
  border-radius: 4px;
}

.custom-select-wrap.open .custom-select-menu {
  display: block;
  animation: customSelectMenuFade 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.custom-select-wrap.open-upward .custom-select-menu {
  top: auto;
  bottom: calc(100% + 5px);
  animation: customSelectMenuFadeUp 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes customSelectMenuFade {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes customSelectMenuFadeUp {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text-main, #f8fafc);
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  box-sizing: border-box;
  text-align: left !important;
}

.custom-select-option:hover,
.custom-select-option.highlighted {
  background: rgba(255, 255, 255, 0.08);
}

.custom-select-option.selected {
  background: rgba(245, 158, 11, 0.16);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.custom-select-check {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold, #fbbf24);
  margin-left: 0.4rem;
  flex-shrink: 0;
}

.custom-select-option.selected .custom-select-check {
  display: inline-flex;
}

/* Compact variants for waiting room and sub-bars */
.custom-select-wrap.select-sm .custom-select-trigger {
  min-height: 38px;
  padding: 0.4rem 0.7rem;
  font-size: 0.84rem;
  border-radius: 8px;
}

.custom-select-wrap.select-sm .custom-select-option {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

.bot-inputs-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.bot-inputs-wrap .custom-select-wrap {
  flex: 0 0 160px;
  width: 160px;
  min-width: 150px;
  max-width: 170px;
  margin: 0 !important;
  padding: 0 !important;
  height: 36px !important;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center !important;
}

.bot-inputs-wrap .custom-select-trigger {
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 0.75rem !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius-sm, 8px) !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.bot-inputs-wrap .custom-select-trigger-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.bot-inputs-wrap .custom-select-icon {
  font-size: 0.95rem !important;
  width: 18px !important;
  line-height: 1 !important;
  text-align: center;
  flex-shrink: 0;
}

.bot-inputs-wrap .custom-select-text {
  min-width: 0;
  flex: 1;
  overflow: visible;
}

.bot-inputs-wrap .custom-select-label {
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: visible;
}

.bot-inputs-wrap .custom-select-menu {
  min-width: 160px;
}

.bot-inputs-wrap .custom-select-option {
  padding: 0.45rem 0.65rem !important;
  font-size: 0.85rem !important;
}

/* Mobile fine-tuning */
@media (max-width: 600px) {
  .custom-select-trigger {
    padding: 0.65rem 0.8rem;
    font-size: 0.86rem;
  }
  .custom-select-menu {
    max-height: 250px;
  }
  .custom-select-sub {
    font-size: 0.7rem;
  }
  .custom-select-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
  }
  .bot-inputs-wrap {
    flex-wrap: wrap;
  }
  .bot-inputs-wrap .custom-select-wrap {
    flex: 1 1 120px;
  }
  #modal-friends .panel-tabs .tab-btn {
    padding: 0.55rem 0.25rem;
    font-size: 0.74rem;
    white-space: nowrap;
    letter-spacing: -0.2px;
  }
  #modal-friends .tab-count {
    font-size: 0.72rem;
    margin-left: 2px;
  }
}

/* ==========================================================================
   iOS Installation Banner & Modal
   ========================================================================== */

.ios-install-banner {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.96) 0%, rgba(37, 99, 235, 0.96) 100%);
  border-bottom: 1px solid rgba(147, 197, 253, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  gap: 0.65rem;
  position: relative;
  z-index: 95;
  animation: ios-banner-slide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ios-banner-slide {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ios-banner-clickable {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity var(--transition-fast);
}

.ios-banner-clickable:hover {
  opacity: 0.92;
}

.ios-banner-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.ios-banner-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.ios-banner-title {
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ios-banner-subtitle {
  color: #bfdbfe;
  font-size: 0.74rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ios-banner-chevron {
  color: #93c5fd;
  font-size: 0.85rem;
  font-weight: 800;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.ios-banner-dismiss {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.ios-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Modal styling */
.ios-install-modal-card {
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.ios-modal-intro {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 1.15rem;
}

.ios-steps-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ios-step-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
}

.ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.ios-step-content {
  flex: 1;
  min-width: 0;
}

.ios-step-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 0.25rem 0;
}

.ios-step-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0;
}

.ios-step-desc strong {
  color: #e2e8f0;
}

.ios-share-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -3px;
  background: rgba(59, 130, 246, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.55);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  color: #60a5fa;
  margin: 0 0.25rem;
  line-height: 1;
}

.ios-share-badge svg.ios-svg-icon {
  display: block;
  width: 17px;
  height: 17px;
}

.ios-dont-show-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  margin-top: 0.5rem;
}

.ios-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.ios-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary, #3b82f6);
  cursor: pointer;
}

/* Settings iOS Box */
.settings-ios-install-box {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.25) 0%, rgba(37, 99, 235, 0.18) 100%);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  margin-top: 1.15rem;
}

/* ==========================================================================
   Game Type Selector Tabs (Letterduel vs Qwirkle) & Badges
   ========================================================================== */

.create-game-type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.15rem;
  background: rgba(11, 15, 25, 0.65);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.create-game-tab {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.create-game-tab:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
}

.create-game-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(30, 41, 59, 0.9) 100%);
  border-color: rgba(245, 158, 11, 0.55);
  color: var(--text-main);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 12px rgba(245, 158, 11, 0.15);
}

.create-game-tab-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  line-height: 1.2;
}

.create-game-tab-text strong {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.create-game-tab-text small {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 580px) {
  .create-game-type-tabs {
    gap: 0.35rem;
    padding: 0.3rem;
  }

  .create-game-tab {
    gap: 0.4rem;
    padding: 0.45rem 0.5rem;
  }

  .create-game-tab .game-type-badge {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }

  .create-game-tab .game-type-badge svg {
    width: 18px;
    height: 18px;
  }

  .create-game-tab-text strong {
    font-size: 0.84rem;
  }

  .create-game-tab-text small {
    font-size: 0.62rem;
  }
}

@media (max-width: 420px) {
  .create-game-tab {
    flex-direction: column;
    text-align: center;
    gap: 0.25rem;
    padding: 0.45rem 0.25rem;
  }

  .create-game-tab-text {
    align-items: center;
    width: 100%;
  }

  .create-game-tab-text small {
    display: none;
  }
}

.create-game-tab.active .create-game-tab-text small {
  color: #fbbf24;
}

.game-type-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.game-type-badge-scrabble {
  background: var(--tile-bg, linear-gradient(145deg, #fef3c7, #f59e0b));
  color: var(--tile-text, #451a03);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  border: 1px solid rgba(217, 119, 6, 0.6);
}

.game-type-badge-qwirkle {
  background: linear-gradient(145deg, #1e293b 0%, #090d16 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.game-type-card-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.game-type-card-icon.scrabble {
  background: var(--tile-bg, linear-gradient(145deg, #fef3c7, #f59e0b));
  color: var(--tile-text, #451a03);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  border: 1px solid rgba(217, 119, 6, 0.6);
}

.game-type-card-icon.qwirkle {
  background: linear-gradient(145deg, #1e293b 0%, #090d16 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 2px;
}

.game-type-badge-azul {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  border: 1px solid rgba(59, 130, 246, 0.45);
  overflow: hidden;
}

.game-type-card-icon.azul {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  border: 1px solid rgba(59, 130, 246, 0.45);
  padding: 1px;
}

.azul-icon-svg {
  display: block;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.btn-lobby-rules {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-lobby-rules:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Qwirkle Board, Tiles, Uncommitted Highlights, Zoom Controls & Cell Picker
   ========================================================================== */

.scrabble-board[data-game-type="qwirkle"] {
  grid-template-columns: repeat(var(--qwirkle-board-size, 31), var(--qwirkle-cell-px, 22px)) !important;
  grid-template-rows: repeat(var(--qwirkle-board-size, 31), var(--qwirkle-cell-px, 22px)) !important;
  gap: 2px !important;
  padding: 2px !important;
  width: max-content !important;
  height: max-content !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  will-change: auto !important;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.scrabble-board[data-game-type="qwirkle"] .cell {
  background: rgba(30, 41, 59, 0.65);
  border-radius: 3px;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.scrabble-board[data-game-type="qwirkle"] .cell:hover {
  background: rgba(56, 189, 248, 0.2);
}

.scrabble-board[data-game-type="qwirkle"] .cell.cell-star {
  background: rgba(245, 158, 11, 0.22);
  border: 1px dashed rgba(251, 191, 36, 0.55);
}

.scrabble-board[data-game-type="qwirkle"] .cell.cell-picker-active {
  background: rgba(251, 191, 36, 0.28) !important;
  outline: 2px solid #fbbf24;
  outline-offset: -1px;
  z-index: 5;
}

.tile.qwirkle-tile {
  background: linear-gradient(145deg, #263248 0%, #0f172a 60%, #090d16 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.18);
  padding: 9%;
  box-sizing: border-box;
}

.scrabble-board[data-game-type="qwirkle"] .tile.qwirkle-tile {
  width: 100% !important;
  height: 100% !important;
  border-radius: 3px;
  padding: 9%;
}

.tile.qwirkle-tile svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Smaller, subtler player indicator dot & last-move pulsing dot on Qwirkle board tiles */
.tile.qwirkle-tile .tile-player-dot {
  top: 2px;
  left: 2px;
  width: var(--qwirkle-dot-px, 4px);
  height: var(--qwirkle-dot-px, 4px);
  border-width: 0.75px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.85);
}

.tile.qwirkle-tile.tile-last-move {
  outline: 1.5px solid #06b6d4 !important;
  outline-offset: -1px;
  box-shadow: 0 0 0 1px #38bdf8, 0 0 7px rgba(6, 182, 212, 0.7) !important;
}

.tile.qwirkle-tile.tile-last-move::after {
  top: -1px;
  right: -1px;
  width: calc(var(--qwirkle-dot-px, 4px) + 0.5px);
  height: calc(var(--qwirkle-dot-px, 4px) + 0.5px);
  border: 0.75px solid #ffffff;
  box-shadow: 0 0 4px #0284c7;
}

@media (max-width: 600px) {
  .tile.qwirkle-tile .tile-player-dot {
    top: 1.5px;
    left: 1.5px;
  }
}

/* Extra-clear visual styling for uncommitted tiles placed this turn */
.tile.tile-uncommitted {
  z-index: 6;
  outline: 3px solid #fbbf24 !important;
  outline-offset: -1px;
  box-shadow: 0 0 0 2px #f59e0b, 0 0 18px rgba(251, 191, 36, 0.95), inset 0 0 10px rgba(251, 191, 36, 0.35) !important;
  transform: scale(1.04);
}

.tile.qwirkle-tile.tile-uncommitted {
  background: linear-gradient(145deg, #334155 0%, #1e293b 65%, #0f172a 100%);
  border-color: #fde047 !important;
  outline-width: 2px !important;
  transform: none;
}

.tile.tile-uncommitted::before {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: var(--qwirkle-dot-px, 4.5px);
  height: var(--qwirkle-dot-px, 4.5px);
  border-radius: 50%;
  background: #fde047;
  box-shadow: 0 0 4px #f59e0b;
  z-index: 7;
  pointer-events: none;
}

/* Qwirkle Valid Tile Cell Picker Popover */
.qwirkle-cell-picker {
  position: fixed;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 24px rgba(245, 158, 11, 0.22);
  min-width: 170px;
  max-width: 92vw;
  animation: tile-pop-anim 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.qwirkle-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
}

.qwirkle-picker-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.qwirkle-picker-close:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

.qwirkle-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.qwirkle-picker-option,
.qwirkle-picker-tile-btn {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: linear-gradient(145deg, #263248 0%, #090d16 100%);
  border: 2px solid rgba(255, 255, 255, 0.24);
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qwirkle-picker-tile-btn .tile {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 6px;
}

.qwirkle-picker-option:hover,
.qwirkle-picker-option:focus-visible,
.qwirkle-picker-tile-btn:hover,
.qwirkle-picker-tile-btn:focus-visible {
  transform: translateY(-2px) scale(1.06);
  border-color: #fbbf24;
  box-shadow: 0 6px 14px rgba(245, 158, 11, 0.45);
  outline: none;
}

.qwirkle-picker-option svg,
.qwirkle-picker-tile-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}





/* Qwirkle board must never widen its container (keeps the wrapper exactly as wide as the screen) */
.board-wrapper:has(.scrabble-board[data-game-type="qwirkle"]) {
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
}

/* Azul View & Arena Layout overrides */
#game-view[data-game-type="azul"],
#game-view[data-game-type="rummikub"] {
  height: calc(100vh - 64px);
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

#game-view[data-game-type="azul"] .game-arena,
#game-view[data-game-type="rummikub"] .game-arena {
  height: auto !important;
  min-height: 100% !important;
  overflow: visible !important;
}

#game-view[data-game-type="azul"] .board-column,
#game-view[data-game-type="rummikub"] .board-column {
  height: auto !important;
  min-height: 0 !important;
  overflow-y: visible !important;
  overflow-x: hidden !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  width: 100% !important;
}

#game-view[data-game-type="azul"] .player-controls-container,
#game-view[data-game-type="rummikub"] .player-controls-container {
  display: none !important;
}

/* ==========================================================================
   Azul Arena: Market, Factories, Center Pool, Pattern Lines, Wall & Floor
   ========================================================================== */

.azul-arena {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Market Area (Factories + Center) */
.azul-market-section {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.azul-market-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.azul-market-compact-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0.15rem;
}

.azul-market-compact-stats {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.azul-market-compact-bar .badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.azul-market-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
}

.azul-factories-wrap {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 3px 2px;
  box-sizing: border-box;
}

.azul-factories-wrap::-webkit-scrollbar {
  display: none;
}

/* Circular Factory Disc */
.azul-factory-disc {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #475569 0%, #1e293b 70%, #0f172a 100%);
  border: 2px solid rgba(203, 213, 225, 0.25);
  box-shadow: inset 0 2px 5px rgba(255, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.45);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  padding: 6px;
  gap: 4px;
  box-sizing: border-box;
  align-items: center;
  justify-items: center;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.azul-factory-disc .azul-tile {
  width: 30px;
  height: 30px;
}

.azul-factory-disc.has-selection {
  border-color: #fbbf24;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.azul-factory-disc.is-empty {
  opacity: 0.35;
  background: radial-gradient(circle at 35% 35%, #1e293b 0%, #090d16 100%);
}

.azul-factory-disc.is-empty::after {
  content: "—";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 1.1rem;
}

/* Center Table Pool */
.azul-center-pool {
  min-width: 130px;
  max-width: 320px;
  min-height: 86px;
  border-radius: 18px;
  background: radial-gradient(ellipse at center, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 2px dashed rgba(203, 213, 225, 0.25);
  padding: 8px 10px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.azul-center-pool.has-selection {
  border-color: #fbbf24;
  border-style: solid;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.azul-center-pool.is-empty::after {
  content: "Leeg midden";
  color: var(--text-dim);
  font-size: 0.78rem;
  font-style: italic;
}

/* Azul Tile Element */
.azul-tile {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  padding: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease, filter 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.azul-tile svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 5px;
}

.azul-tile:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
  filter: brightness(1.1);
  z-index: 2;
}

.azul-tile.selected {
  outline: 3px solid #fbbf24;
  outline-offset: 1px;
  transform: scale(1.12);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.75);
  z-index: 3;
}

.azul-tile.dimmed {
  opacity: 0.28;
  filter: grayscale(40%);
  cursor: default;
}

.azul-tile.ghost {
  opacity: 0.22;
  cursor: default;
  box-shadow: none;
}

.azul-tile.ghost svg {
  filter: grayscale(20%);
}

/* Floating Azul Placement Confirmation Popover */
.azul-confirm-popover {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(96, 165, 250, 0.55);
  border-radius: 16px;
  padding: 0.85rem 1.15rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(37, 99, 235, 0.25);
  min-width: 270px;
  max-width: 92vw;
  animation: slideUpFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.azul-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.azul-popover-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main, #f8fafc);
  line-height: 1.3;
}

.azul-popover-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cbd5e1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.azul-popover-close:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.azul-popover-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.azul-popover-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 0.2rem;
}

.azul-popover-actions .btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
}

.azul-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.azul-preview-pill.penalty {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.35);
}

/* Wall column choice prompt */
.azul-wall-prompt {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(30, 41, 59, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.azul-wall-prompt-text {
  font-size: 0.9rem;
  color: #fbbf24;
  font-weight: 600;
}

/* Player Boards Area */
.azul-boards-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

/* Active Main Player Board */
.azul-board-main {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.azul-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.azul-board-player-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.azul-board-player-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
}

.azul-board-score-badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Grid holding Pattern Lines (left) and Wall (right) */
.azul-board-grid {
  --azul-cell-size: 40px;
  --azul-cell-gap: 5px;
  --azul-board-pad: 8px;

  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.25rem;
}

/* Pattern Lines Section */
.azul-pattern-section,
.azul-wall-section {
  display: flex;
  flex-direction: column;
}

.azul-section-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  height: 20px;
  line-height: 20px;
  margin: 0 0 8px 0;
  box-sizing: border-box;
  padding: 0 2px;
}

/* Pattern Rows and Wall Grid: Identical Row Templates, Padding & Border */
.azul-pattern-rows,
.azul-wall-grid {
  display: grid;
  grid-template-rows: repeat(5, var(--azul-cell-size));
  gap: var(--azul-cell-gap);
  padding: var(--azul-board-pad);
  background: rgba(11, 15, 25, 0.65);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
  width: max-content;
}

.azul-pattern-rows {
  width: max-content;
}

.azul-pattern-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--azul-cell-gap);
  height: var(--azul-cell-size);
  min-height: var(--azul-cell-size);
  max-height: var(--azul-cell-size);
  box-sizing: border-box;
  padding: 0 4px;
  border-radius: 6px;
  transition: all 0.18s ease;
  user-select: none;
}

.azul-pattern-row.selectable {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 0 0 0 1.5px rgba(96, 165, 250, 0.6);
  cursor: pointer;
  animation: azulPulsingBorder 1.5s infinite;
}

.azul-pattern-row.selectable:hover {
  background: rgba(245, 158, 11, 0.18);
  box-shadow: inset 0 0 0 1.5px #fbbf24, 0 0 8px rgba(245, 158, 11, 0.35);
  filter: brightness(1.08);
}

.azul-pattern-row.selected {
  background: rgba(34, 197, 94, 0.22);
  box-shadow: inset 0 0 0 2px #22c55e, 0 0 10px rgba(34, 197, 94, 0.35);
}

.azul-pattern-row.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.azul-row-arrow {
  color: var(--text-dim);
  font-size: 0.95rem;
  width: 18px;
  height: var(--azul-cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-weight: 700;
  flex-shrink: 0;
  opacity: 0.8;
}

.azul-pattern-slot {
  width: var(--azul-cell-size);
  height: var(--azul-cell-size);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 1px rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.azul-pattern-row.selectable .azul-pattern-slot:not(.filled) {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(30, 58, 138, 0.2);
}

.azul-pattern-row.selected .azul-pattern-slot:not(.filled) {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.25);
}

.azul-pattern-slot.filled,
.azul-pattern-slot.preview {
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  background: transparent;
}

/* Wall Section */
.azul-wall-grid {
  grid-template-columns: repeat(5, var(--azul-cell-size));
}

.azul-wall-cell {
  width: var(--azul-cell-size);
  height: var(--azul-cell-size);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  position: relative;
  transition: all 0.15s ease;
}

.azul-wall-cell.filled {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  z-index: 1;
}

.azul-wall-cell.selectable-wall-col {
  box-shadow: inset 0 0 0 2px #fbbf24;
  cursor: pointer;
  background: rgba(245, 158, 11, 0.2);
  animation: azulPulsingBorder 1.2s infinite;
}

.azul-wall-cell.selectable-wall-col:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
  z-index: 2;
}

.azul-tile-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.azul-wall-gain-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #22c55e;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Floor Line Section */
.azul-floor-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.azul-floor-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px dashed transparent;
  transition: all 0.18s ease;
  width: max-content;
  max-width: 100%;
}

.azul-floor-line.selectable {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
  cursor: pointer;
}

.azul-floor-line.selectable:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
}

.azul-floor-line.selected {
  border-color: #ef4444;
  border-style: solid;
  background: rgba(239, 68, 68, 0.22);
}

.azul-floor-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.azul-floor-box {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.azul-floor-box.filled,
.azul-floor-box.preview {
  border: none;
  background: transparent;
}

.azul-floor-penalty {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f87171;
}

/* Opponent Mini Boards */
.azul-opponents-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.azul-opp-card {
  flex: 1;
  min-width: 240px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.azul-opp-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.azul-opp-card.is-active-turn {
  border-color: #fbbf24;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.25);
}

.azul-opp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.azul-opp-name {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.azul-opp-score {
  font-weight: 800;
  color: var(--accent-gold);
  font-size: 0.95rem;
}

.azul-opp-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.azul-opp-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.azul-opp-line-row {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.azul-opp-mini-slot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.azul-opp-wall-grid {
  display: grid;
  grid-template-columns: repeat(5, 12px);
  grid-template-rows: repeat(5, 12px);
  gap: 2.5px;
  background: rgba(11, 15, 25, 0.85);
  padding: 4px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.azul-opp-wall-dot {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px dashed rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.azul-opp-wall-dot.filled,
.azul-opp-mini-slot.filled {
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.azul-opp-floor {
  font-size: 0.74rem;
  color: #f87171;
  font-weight: 700;
}

/* Animations */
@keyframes azulPulsingBorder {
  0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(96, 165, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}

/* Responsive adjustments for Azul Arena */
@media (max-width: 768px) {
  .azul-board-grid {
    --azul-cell-size: 34px;
    --azul-cell-gap: 4px;
    --azul-board-pad: 6px;
    gap: 0.85rem;
  }

  .azul-tile {
    width: 30px;
    height: 30px;
  }

  .azul-floor-box {
    width: 32px;
    height: 32px;
  }

  .azul-factories-wrap {
    gap: 6px;
  }

  .azul-factory-disc {
    width: 72px;
    height: 72px;
    padding: 5px;
    gap: 3px;
  }

  .azul-factory-disc .azul-tile {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 440px) {
  .azul-market-section {
    padding: 0.65rem 0.45rem;
  }

  .azul-board-main {
    padding: 0.75rem 0.5rem;
    overflow-x: auto;
  }

  .azul-board-grid {
    --azul-cell-size: 30px;
    --azul-cell-gap: 3px;
    --azul-board-pad: 4px;
    gap: 0.45rem;
  }

  .azul-tile {
    width: 28px;
    height: 28px;
  }

  .azul-floor-box {
    width: 28px;
    height: 28px;
  }

  .azul-factories-wrap {
    gap: 4px;
  }

  .azul-factory-disc {
    width: 64px;
    height: 64px;
    padding: 4px;
    gap: 2.5px;
  }

  .azul-factory-disc .azul-tile {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 360px) {
  .azul-board-grid {
    --azul-cell-size: 27px;
    --azul-cell-gap: 2px;
    --azul-board-pad: 3px;
    gap: 0.35rem;
  }

  .azul-row-arrow {
    width: 14px;
    font-size: 0.8rem;
  }

  .azul-tile {
    width: 25px;
    height: 25px;
  }

  .azul-floor-box {
    width: 25px;
    height: 25px;
  }

  .azul-factories-wrap {
    gap: 3px;
  }

  .azul-factory-disc {
    width: 58px;
    height: 58px;
    padding: 3px;
    gap: 2px;
  }

  .azul-factory-disc .azul-tile {
    width: 22px;
    height: 22px;
  }
}

/* ==========================================================================
   Rummikub Arena, Sets, Tiles & Rack Styling
   ========================================================================== */

.logo-tile[data-game="rummikub"] {
  background: #fef3c7;
  border-color: #d97706;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.35);
  overflow: hidden;
}

.rummikub-arena {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  gap: 0.6rem;
  box-sizing: border-box;
}

.rummikub-header-bar {
  display: none !important;
}

.rummikub-status-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rummikub-meld-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.rummikub-meld-badge.is-done {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.rummikub-turn-info {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.rummikub-table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rummikub-table-mat {
  flex: 1 1 auto;
  min-height: 220px;
  background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  overscroll-behavior: auto;
  box-sizing: border-box;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.rummikub-sets-container {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.75rem;
  min-height: 100%;
}

.rummikub-set {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.35rem 0.45rem;
  gap: 0.25rem;
  min-height: 52px;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

.rummikub-set:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
}

.rummikub-set.invalid-set {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.rummikub-set.target-highlight {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

/* Rummikub Tile Authentic Design */
.rummikub-tile {
  width: 36px;
  height: 48px;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f0 70%, #f3eee3 100%);
  border: 1px solid #dcd5c5;
  border-radius: 6px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}

.rummikub-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.45), inset 0 1px 0 #ffffff;
}

.rummikub-tile.selected {
  outline: 2px solid #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  transform: translateY(-4px);
}

.rummikub-number {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1;
}

.rummikub-dot {
  width: 14px;
  height: 2.5px;
  border-radius: 2px;
  margin-top: 2px;
}

/* 4 Colors */
.rummikub-tile.color-red .rummikub-number { color: #dc2626; }
.rummikub-tile.color-red .rummikub-dot { background: #dc2626; }

.rummikub-tile.color-blue .rummikub-number { color: #2563eb; }
.rummikub-tile.color-blue .rummikub-dot { background: #2563eb; }

.rummikub-tile.color-yellow .rummikub-number { color: #d9a404; text-shadow: 0 0.5px 0.5px rgba(180, 130, 0, 0.25); }
.rummikub-tile.color-yellow .rummikub-dot { background: #d9a404; }

.rummikub-tile.color-black .rummikub-number { color: #1e293b; }
.rummikub-tile.color-black .rummikub-dot { background: #1e293b; }

.rummikub-tile.is-joker {
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 60%, #fef3c7 100%);
  border-color: #fde68a;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.rummikub-tile.is-joker.color-red {
  border-color: rgba(220, 38, 38, 0.45);
}

.rummikub-tile.is-joker.color-black {
  border-color: rgba(30, 41, 59, 0.45);
}

.rummikub-tile.is-joker:hover {
  box-shadow: 0 5px 12px rgba(245, 158, 11, 0.35), inset 0 1px 0 #ffffff;
}

.rummikub-joker-face {
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

.rummikub-tile.is-joker-old {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fbbf24;
}

/* Rack wood design */
.rummikub-rack-bar {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rummikub-rack-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.rummikub-rack-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
}

.rummikub-sort-btns {
  display: flex;
  gap: 0.35rem;
}

.btn-sort-rack {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-weight: 800;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sort-rack:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-gold);
  color: #fbbf24;
}

.btn-sort-rack.active {
  background: rgba(245, 158, 11, 0.35);
  border-color: #fbbf24;
  color: #fbbf24;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.btn-sort-rack.btn-reset-rack,
.btn-sort-rack.btn-undo-rack {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-sort-rack.btn-reset-rack:disabled,
.btn-sort-rack.btn-undo-rack:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.rummikub-rack-wood {
  background: linear-gradient(180deg, #451a03 0%, #291003 70%, #1c0b02 100%);
  border: 2px solid #78350f;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.rummikub-player-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 52px;
  align-items: center;
}

.rummikub-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.rummikub-actions-row .btn-action {
  padding: 0.45rem 1.1rem;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .rummikub-tile {
    width: 30px;
    height: 42px;
    border-radius: 5px;
  }
  .rummikub-number {
    font-size: 1.15rem;
  }
  .rummikub-dot {
    width: 11px;
    height: 2px;
  }
  .rummikub-set {
    min-height: 44px;
    padding: 0.25rem 0.35rem;
    gap: 0.2rem;
  }
  .rummikub-table-mat {
    min-height: 180px;
    padding: 0.5rem;
  }
  .rummikub-header-bar {
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
  }
  .rummikub-sort-btns {
    gap: 0.2rem;
  }
  .btn-sort-rack {
    padding: 0.15rem 0.35rem;
    font-size: 0.72rem;
  }
  .rummikub-actions-row {
    width: 100%;
    justify-content: space-between;
  }
  .rummikub-actions-row .btn-action {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
  }
  .rummikub-rack-bar {
    padding: 0.35rem 0.2rem;
  }
  .rummikub-rack-wood {
    padding: 0.35rem 0.2rem;
    border-width: 1.5px;
  }
  .rummikub-player-rack {
    gap: 3px;
    justify-content: flex-start;
  }
  .rummikub-player-rack .rummikub-tile {
    width: calc((100% - 27px) / 10);
    max-width: 36px;
    min-width: 25px;
    height: auto;
    aspect-ratio: 30 / 42;
    border-radius: 4px;
    padding: 0;
  }
  .rummikub-player-rack .rummikub-number {
    font-size: clamp(0.92rem, 3.4vw, 1.2rem);
  }
  .rummikub-player-rack .rummikub-dot {
    width: 10px;
    height: 2px;
  }
  .rummikub-player-rack .rummikub-joker-face {
    width: 18px;
    height: 18px;
  }
  .rummikub-last-move-bar {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .rummikub-last-move-bar {
    display: none !important;
  }
}

.rummikub-add-set-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 130px;
  padding: 0.35rem 0.85rem;
  border: 2px dashed rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.06);
  border-radius: 10px;
  color: #fbbf24;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.rummikub-add-set-slot:hover {
  background: rgba(251, 191, 36, 0.16);
  border-color: #fbbf24;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.rummikub-empty-table-placeholder:hover {
  border-color: rgba(251, 191, 36, 0.5) !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Newly drawn tile from pool on player rack */
.rummikub-tile.tile-just-drawn {
  box-shadow: 0 0 0 2px #0ea5e9, 0 3px 10px rgba(14, 165, 233, 0.45) !important;
  position: relative;
}

.rummikub-tile.tile-just-drawn::after {
  content: '+';
  position: absolute;
  top: -4px;
  right: -4px;
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 5;
  animation: pulse-just-drawn 2s ease-in-out infinite;
}

@keyframes pulse-just-drawn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Newly placed tile from rack this turn */
.rummikub-tile.tile-newly-placed {
  box-shadow: 0 0 0 2.5px #f59e0b, 0 4px 14px rgba(245, 158, 11, 0.55) !important;
  transform: translateY(-2px);
  position: relative;
}

.rummikub-tile.tile-newly-placed::after {
  content: '★';
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 8px;
  line-height: 1;
  font-weight: 900;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Set status styling: clean borders without text badges */
.rummikub-set {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.12);
}

/* Valid modified set: warm golden outline */
.rummikub-set.set-modified:not(.invalid-set) {
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.07) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35) !important;
}

/* Invalid set (e.g. < 3 tiles or invalid combinations): crisp red outline */
.rummikub-set.invalid-set {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45) !important;
}

.rummikub-set.set-original:not(.invalid-set) {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

/* Last placed tiles by opponent */
.rummikub-tile.tile-last-opponent-move {
  box-shadow: 0 0 0 2.5px var(--opp-color, #0ea5e9), 0 4px 14px var(--opp-glow, rgba(14, 165, 233, 0.45)) !important;
  position: relative;
}

.rummikub-tile.tile-last-opponent-move::after {
  content: '●';
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--opp-color, #0ea5e9);
  color: #ffffff;
  font-size: 7px;
  line-height: 1;
  font-weight: 900;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@keyframes rummikubPulseGlow {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.12); filter: brightness(1.3); box-shadow: 0 0 18px var(--opp-color, #38bdf8), 0 0 0 3px var(--opp-color, #38bdf8) !important; }
  100% { transform: scale(1); filter: brightness(1); }
}

.rummikub-tile.pulse-highlight {
  animation: rummikubPulseGlow 0.8s ease 2;
  z-index: 10;
}

.rummikub-last-move-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: 10px;
  font-size: 0.84rem;
  color: #f1f5f9;
  margin: 0.35rem 0.5rem 0.5rem 0.5rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
  user-select: none;
}

.rummikub-last-move-bar:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.rummikub-last-move-tiles {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Authentic Miniature Rummikub Tile in Last Move Bar */
.rummikub-mini-tile {
  width: 26px;
  height: 35px;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f0 70%, #f3eee3 100%);
  border: 1px solid #dcd5c5;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
}

.rummikub-mini-tile.is-joker {
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 60%, #fef3c7 100%);
  border-color: #fde68a;
}
.rummikub-mini-tile.is-joker.color-red {
  border-color: rgba(220, 38, 38, 0.5);
}
.rummikub-mini-tile.is-joker.color-black {
  border-color: rgba(30, 41, 59, 0.45);
}
.rummikub-mini-tile.is-joker-old {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fbbf24;
}

.rummikub-mini-tile .rummikub-number {
  font-family: var(--font-display, inherit);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1;
}

.rummikub-mini-tile .rummikub-dot {
  width: 10px;
  height: 2px;
  border-radius: 1px;
  margin-top: 1.5px;
}

.rummikub-mini-tile.color-red .rummikub-number { color: #dc2626; }
.rummikub-mini-tile.color-red .rummikub-dot { background: #dc2626; }

.rummikub-mini-tile.color-blue .rummikub-number { color: #2563eb; }
.rummikub-mini-tile.color-blue .rummikub-dot { background: #2563eb; }

.rummikub-mini-tile.color-yellow .rummikub-number { color: #d9a404; }
.rummikub-mini-tile.color-yellow .rummikub-dot { background: #d9a404; }

.rummikub-mini-tile.color-black .rummikub-number { color: #1e293b; }
.rummikub-mini-tile.color-black .rummikub-dot { background: #1e293b; }

/* Game Type Filter Pills for Active Games and History */
.game-type-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.game-type-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.game-type-pill:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}

.game-type-pill.active {
  background: var(--accent-gold);
  color: #0f172a;
  border-color: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.game-type-pill.active .type-count-badge {
  background: rgba(15, 23, 42, 0.25);
  color: #0f172a;
}

.type-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 700;
}

/* ==========================================================================
   Admin User Details Modal Enhancements & Subtabs
   ========================================================================== */
.admin-details-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.admin-details-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-details-info-item .info-label {
  font-size: 0.74rem;
  color: var(--text-dim, #94a3b8);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.admin-details-info-item .info-value {
  font-size: 0.88rem;
  color: var(--text-main, #f8fafc);
  word-break: break-all;
}

.admin-details-tabs-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.admin-details-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  color: var(--text-dim, #94a3b8);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.18s ease;
}

.admin-details-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.admin-details-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.badge-mini {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}

.admin-device-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
}

.admin-device-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.admin-device-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.admin-word-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.82rem;
  color: #f8fafc;
  transition: all 0.18s ease;
}

.admin-word-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

.admin-word-chip .word-text {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.admin-word-chip .word-lang {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--accent-gold, #fbbf24);
  background: rgba(245, 158, 11, 0.15);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
}

.admin-word-chip .btn-del-word {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #f87171;
  padding: 0 0.15rem;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.admin-word-chip .btn-del-word:hover {
  opacity: 1;
}

.game-type-badge-rummikub {
  background: linear-gradient(135deg, #fffcf5 0%, #f7f0e3 100%);
  border: 1px solid rgba(213, 199, 178, 0.7);
  overflow: hidden;
}

.game-type-card-icon.rummikub {
  background: linear-gradient(135deg, #fffcf5 0%, #f7f0e3 100%);
  border: 1px solid rgba(213, 199, 178, 0.7);
  padding: 1px;
}

/* Admin Details Active Games Scrollable Row */
.admin-details-game-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.admin-details-game-info-scroll {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 0.15rem 0;
}

.admin-details-game-info-scroll::-webkit-scrollbar {
  display: none;
}

/* ---------------------------------------------------------------------------
 * Hive Game Styles
 * --------------------------------------------------------------------------- */
.game-type-badge-hive {
  background: linear-gradient(135deg, #2b251e 0%, #15110d 100%);
  border: 1px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.game-type-card-icon.hive {
  background: linear-gradient(135deg, #2b251e 0%, #15110d 100%);
  border: 1px solid rgba(245, 158, 11, 0.6);
  padding: 1px;
}

.hive-arena {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  background: radial-gradient(circle at 50% 35%, #1e1b18 0%, #12100e 100%);
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.15);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  position: relative;
  user-select: none;
}

.hive-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: rgba(18, 16, 14, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 0.6rem;
  flex-wrap: wrap;
  z-index: 5;
}

.hive-turn-indicator {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main, #f1f5f9);
}

.hive-turn-badge {
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hive-turn-badge.white {
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.hive-turn-badge.black {
  background: #1e1b18;
  color: #f59e0b;
  border: 1px solid #f59e0b;
}

.hive-turn-text {
  font-size: 0.84rem;
  color: var(--text-dim, #94a3b8);
}

.hive-queen-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.hive-queen-pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.hive-queen-pill.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.04); }
}

.hive-view-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-hive-ctrl {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-hive-ctrl:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.hive-board-viewport {
  width: 100%;
  height: 480px;
  min-height: 380px;
  position: relative;
  overflow: hidden;
  cursor: grab;
  background: radial-gradient(circle at center, rgba(35, 30, 24, 0.5) 0%, rgba(15, 13, 11, 0.9) 100%);
}

.hive-board-viewport:active {
  cursor: grabbing;
}

.hive-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.hive-target-hex {
  cursor: pointer;
}

.hive-target-hex polygon {
  cursor: pointer;
  transition: all 0.16s ease;
}

.hive-target-hex:hover polygon {
  fill: rgba(16, 185, 129, 0.5) !important;
  stroke-width: 3.2px !important;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.7));
}

.hive-empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(18, 16, 14, 0.85);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  color: #f59e0b;
  font-size: 0.88rem;
  pointer-events: none;
  text-align: center;
  animation: float-hint 2s ease-in-out infinite;
}

@keyframes float-hint {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, -54%); }
}

/* Bottom Reserve Trays */
.hive-reserves-container {
  background: rgba(18, 16, 14, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.65rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hive-reserve-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hive-reserve-tabs {
  display: flex;
  gap: 0.35rem;
}

.hive-res-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim, #94a3b8);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.hive-res-tab.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

.btn-hive-pass {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f59e0b;
  color: #17130e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.hive-reserve-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 0.25rem 0.1rem;
}

.hive-res-piece-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  min-width: 76px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.hive-res-piece-card:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-2px);
}

.hive-res-piece-card.selected {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  transform: translateY(-3px);
}

.hive-res-piece-card.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.hive-res-piece-name {
  font-size: 0.68rem;
  font-weight: 600;
  margin-top: 0.35rem;
  color: #e2e8f0;
  text-align: center;
}

.hive-res-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f59e0b;
  color: #111827;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 9999px;
  padding: 0.1rem 0.35rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Hex pieces on SVG */
.hive-hex-tile {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.hive-hex-tile:hover {
  filter: brightness(1.1);
}

.hive-hex-selected {
  filter: drop-shadow(0 0 8px #f59e0b) brightness(1.15);
}

.hive-target-hex {
  cursor: pointer;
  transition: all 0.2s ease;
}

.hive-target-hex:hover polygon {
  fill: rgba(16, 185, 129, 0.35);
  stroke-width: 2.5;
}


/* ==========================================================================
   Start Draw Reveal Animation Modal (Letterduel & Rummikub)
   ========================================================================== */

.start-draw-card {
  max-width: 520px;
  width: 92%;
  padding: 1.75rem 1.5rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: startDrawModalPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes startDrawModalPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.start-draw-icon {
  font-size: 2.4rem;
  margin-bottom: 0.25rem;
  display: inline-block;
  animation: startDrawDiceWobble 2s ease-in-out infinite alternate;
}

@keyframes startDrawDiceWobble {
  0% { transform: rotate(-8deg) scale(0.95); }
  100% { transform: rotate(8deg) scale(1.05); }
}

.start-draw-desc {
  font-size: 0.92rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.start-draw-players {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.25rem;
  margin: 1.5rem 0 0.75rem;
  flex-wrap: wrap;
}

.start-draw-player-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 86px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease, filter 0.4s ease;
}

.start-draw-player-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-draw-flip-card {
  width: 76px;
  height: 104px;
  perspective: 900px;
  border-radius: 8px;
  position: relative;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.start-draw-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.2, 0.85, 0.35, 1.2);
}

.start-draw-flip-inner.is-flipped {
  transform: rotateY(180deg);
}

.start-draw-flip-front,
.start-draw-flip-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

/* Card Back: Scrabble wood design */
.start-draw-flip-front.scrabble-back {
  background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
  border: 2px solid #b45309;
  color: #fef08a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.start-draw-flip-front.scrabble-back .flip-back-letter {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  opacity: 0.8;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Card Back: Rummikub deep navy ivory design */
.start-draw-flip-front.rummikub-back {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #0284c7;
  color: #38bdf8;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.start-draw-flip-front.rummikub-back .flip-back-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Card Face: Revealed tile */
.start-draw-flip-back {
  transform: rotateY(180deg);
  background: #ffffff;
}

/* Revealed Scrabble Tile */
.start-draw-tile.scrabble-tile {
  width: 100%;
  height: 100%;
  background: var(--tile-bg, #fef3c7);
  border: 2px solid var(--tile-border, #d97706);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.start-draw-tile.scrabble-tile .tile-letter {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 900;
  color: #1e293b;
  line-height: 1;
}

.start-draw-tile.scrabble-tile .tile-points {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #64748b;
  line-height: 1;
}

.start-draw-tile.scrabble-tile.is-blank {
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
  border-color: #38bdf8;
}

.start-draw-tile.scrabble-tile.is-blank .tile-letter {
  color: #0284c7;
}

/* Revealed Rummikub Tile */
.start-draw-tile.rummikub-tile {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, #faf8f0 70%, #f3eee3 100%);
  border: 2px solid #dcd5c5;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.start-draw-tile.rummikub-tile .rummikub-number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}

.start-draw-tile.rummikub-tile .rummikub-dot {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  margin-top: 5px;
}

.start-draw-tile.rummikub-tile.color-red .rummikub-number { color: #dc2626; }
.start-draw-tile.rummikub-tile.color-red .rummikub-dot { background: #dc2626; }

.start-draw-tile.rummikub-tile.color-blue .rummikub-number { color: #2563eb; }
.start-draw-tile.rummikub-tile.color-blue .rummikub-dot { background: #2563eb; }

.start-draw-tile.rummikub-tile.color-yellow .rummikub-number { color: #d9a404; }
.start-draw-tile.rummikub-tile.color-yellow .rummikub-dot { background: #d9a404; }

.start-draw-tile.rummikub-tile.color-black .rummikub-number { color: #1e293b; }
.start-draw-tile.rummikub-tile.color-black .rummikub-dot { background: #1e293b; }

.start-draw-tile-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
  min-height: 1.3rem;
  transition: color 0.3s ease;
}

/* Winner Spotlight */
.start-draw-player-item.is-winner {
  position: relative;
}

.start-draw-player-item.is-winner .start-draw-flip-card {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 0 0 3px #f59e0b, 0 8px 30px rgba(245, 158, 11, 0.65);
  animation: startDrawWinnerGlow 1.2s ease-in-out infinite alternate;
}

@keyframes startDrawWinnerGlow {
  0% { box-shadow: 0 0 0 3px #f59e0b, 0 8px 25px rgba(245, 158, 11, 0.55); }
  100% { box-shadow: 0 0 0 4px #fbbf24, 0 10px 38px rgba(245, 158, 11, 0.85); }
}

.start-draw-player-item.is-winner .start-draw-player-name {
  color: #fbbf24;
}

.start-draw-player-item.is-winner .start-draw-tile-label {
  color: #f59e0b;
  font-weight: 800;
}

.start-draw-players.has-winner .start-draw-player-item:not(.is-winner) {
  opacity: 0.6;
  filter: grayscale(0.25);
  transform: scale(0.95);
}

/* Winner Celebration Banner */
.start-draw-winner-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.12) 100%);
  border: 1px solid rgba(245, 158, 11, 0.6);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  animation: startDrawBannerSlide 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes startDrawBannerSlide {
  0% { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.start-draw-winner-trophy {
  font-size: 1.8rem;
  animation: startDrawTrophyBounce 0.7s ease infinite alternate;
}

@keyframes startDrawTrophyBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-4px) scale(1.15); }
}

.start-draw-winner-text {
  font-size: 0.98rem;
  color: #fef08a;
  text-align: left;
  line-height: 1.35;
}

.start-draw-winner-text b {
  color: #ffffff;
  font-size: 1.05rem;
}

.start-draw-winner-text .winner-sub {
  font-size: 0.85rem;
  color: #cbd5e1;
  display: block;
}

/* Ensure hidden utility and start draw hidden state are strictly hidden */
.start-draw-winner-banner.hidden,
.hidden,
[hidden] {
  display: none !important;
}


/* ==========================================================================
   WebRTC Voice Chat Styles
   ========================================================================== */

.btn-voice-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-voice-toggle.in-voice {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.btn-voice-toggle.in-voice.is-muted {
  background: rgba(244, 63, 94, 0.15) !important;
  border-color: #f43f5e !important;
  color: #fb7185 !important;
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.35);
}

.voice-badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.btn-voice-toggle.has-active-voice {
  border-color: #10b981 !important;
  color: #34d399 !important;
  background: rgba(16, 185, 129, 0.14) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
  animation: pulse-voice 2s infinite ease-in-out;
}

@keyframes pulse-voice {
  0%, 100% {
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.6) !important;
  }
  50% {
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.75);
    border-color: #10b981 !important;
  }
}

#btn-toggle-chat {
  position: relative;
}

.chat-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  pointer-events: none;
  animation: pulse-badge 2s infinite ease-in-out;
}

.chat-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 0.35rem;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
  }
  50% {
    transform: scale(1.12);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
  }
}

/* Dedicated Voice Bar under Bottom Action Buttons */
.voice-overlay-widget {
  position: static;
  margin: 0.75rem auto 0 auto;
  padding: 0;
  width: 100%;
  max-width: 580px;
  box-sizing: border-box;
}

.voice-widget-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  padding: 0.4rem 0.6rem 0.4rem 0.75rem;
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.btn-voice-mute {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
  color: #f8fafc;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-voice-mute:hover {
  background: rgba(16, 185, 129, 0.3);
  transform: scale(1.02);
}

.btn-voice-mute.is-muted {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #fca5a5;
}

.btn-voice-mute.is-muted:hover {
  background: rgba(244, 63, 94, 0.32);
}

.voice-widget-middle {
  display: flex;
  align-items: center;
  max-width: 320px;
  overflow-x: auto;
  scrollbar-width: none;
}
.voice-widget-middle::-webkit-scrollbar {
  display: none;
}

.voice-participants-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.voice-peer-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  padding: 0.25rem 0.55rem 0.25rem 0.45rem;
  font-size: 0.78rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.voice-peer-pill.is-speaking {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.22) !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.65);
  animation: voice-avatar-pulse 1s infinite alternate;
}

@keyframes voice-avatar-pulse {
  0% { transform: scale(1); box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
  100% { transform: scale(1.06); box-shadow: 0 0 14px rgba(16, 185, 129, 0.85); }
}

.voice-peer-pill.is-muted {
  opacity: 0.65;
  border-color: rgba(244, 63, 94, 0.4);
}

.btn-voice-leave {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-voice-leave:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #ffffff;
  transform: scale(1.02);
}

/* In-Game / Waiting Room Speaking Indicators on Player Cards */
.player-card.voice-speaking,
.waiting-player-card.voice-speaking {
  border-color: #10b981 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.6) !important;
  animation: voice-card-pulse 1.1s infinite alternate;
}

@keyframes voice-card-pulse {
  0% { box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }
  100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.75); }
}

.player-voice-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .voice-widget-card {
    padding: 0.35rem 0.5rem;
    gap: 0.5rem;
  }
  .btn-voice-mute .voice-mic-text {
    display: none !important;
  }
  .btn-voice-mute {
    padding: 0.4rem 0.65rem;
    gap: 0;
    font-size: 1rem;
    min-width: 40px;
    justify-content: center;
  }
}
