/* =====================================================================
   دوري العتور — 3atoor Leauge
   Authentic Arabesque Board Game Styling with Tajawal Typography
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&family=Amiri:wght@700&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Authentic Arabian Board Game Palette */
  --bg-dark:        #0c101a;
  --bg-card:        #131a2b;
  --bg-card-hover:  #19233a;
  --bg-surface:     #1d2842;
  --border:         #23304b;
  --border-gold:    rgba(212, 175, 55, 0.25);
  
  --text-main:      #ffffff;
  --text-muted:     #94a3b8;
  --text-dim:       #64748b;

  /* Traditional Gold, Amber & Wood Tones */
  --gold-primary:   #d4af37;
  --gold-light:     #fde68a;
  --gold-dark:      #b45309;
  --amber-warm:     #d97706;
  --wood-light:     #f6e8cd;
  --wood-mid:       #edd4ae;
  --wood-dark:      #deb887;
  --wood-shadow:    #8b5a2b;

  /* Letter League Multiplier Colors */
  --ll-sand-bg:     #f8dfc2;
  --ll-board-cell:  #faecd8;
  --ll-board-border:#ebd2b5;
  --ll-purple:      #6366f1;
  --ll-purple-dark: #4338ca;
  --ll-orange:      #d97706;
  --ll-orange-hover:#f59e0b;

  --ll-2l-bg:       #bae6fd; /* 2L Sky Blue */
  --ll-2l-text:     #0284c7;
  --ll-2w-bg:       #bbf7d0; /* 2W Mint Green */
  --ll-2w-text:     #16a34a;
  --ll-3l-bg:       #fde68a; /* 3L Warm Gold */
  --ll-3l-text:     #b45309;
  --ll-3w-bg:       #fca5a5; /* 3W Coral */
  --ll-3w-text:     #b91c1c;
  --ll-star-bg:     #fffbeb;
  --ll-star-color:  #7c3aed;

  /* Tile Aesthetics (Authentic Scrabble & Discord Letter League Wood) */
  --tile-bg:        #f6e8cd;
  --tile-player-bg: #edd4ae;
  --tile-board-bg:  #ffffff;
  --tile-text-board:#2c1a0e;
  --tile-shadow:    #8b5a2b;

  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  direction: rtl;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-size: 15px;
  font-family: 'Tajawal', sans-serif;
}

body {
  background: 
    radial-gradient(ellipse at 50% 10%, rgba(217, 119, 6, 0.08) 0%, transparent 65%),
    radial-gradient(circle at 90% 90%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Top Navigation Bar ────────────────────────────────────────────── */
.top-navbar {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: rgba(14, 20, 33, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.brand-badge:hover {
  transform: translateY(-1px);
}

.brand-logo-icon.authentic-wood-mini {
  width: 40px;
  height: 40px;
  background: linear-gradient(155deg, #f7ebd4 0%, #edd3aa 50%, #deb887 100%);
  border: 1.5px solid #fffdf7;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.8),
    inset 0 -2px 3px rgba(139, 90, 43, 0.3);
}
.authentic-wood-mini .mini-char {
  font-size: 1.25rem;
  font-weight: 900;
  color: #2c1a0e;
  line-height: 1;
}
.authentic-wood-mini .mini-sub {
  font-size: 0.95rem;
  font-weight: 800;
  color: #92400e;
  line-height: 1;
}

.brand-text-col {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-title-ar {
  font-size: 1.2rem;
  font-weight: 900;
  color: #ffffff;
  font-family: 'Tajawal', sans-serif;
  letter-spacing: -0.3px;
}
.brand-title-en {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f59e0b;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  font-family: 'Tajawal', sans-serif;
}
.brand-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.profile-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px 4px 6px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.2s;
}
.profile-pill-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--ll-purple);
  transform: translateY(-1px);
}
.profile-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid var(--ll-orange);
}
.profile-pill-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.icon-btn.sound-muted-btn {
  background: rgba(239, 68, 68, 0.22) !important;
  border: 1.5px solid #ef4444 !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4) !important;
}

.icon-btn.sound-active-btn {
  background: rgba(34, 197, 94, 0.12) !important;
  border: 1px solid rgba(34, 197, 94, 0.4) !important;
  color: #86efac !important;
}

.dropdown-item.sound-muted-item {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border-left: 3px solid #ef4444 !important;
}

/* ─── Global Hidden Attribute ───────────────────────────────────────── */
[hidden],
.screen[hidden],
#game-screen[hidden],
#lobby-screen[hidden],
#pass-device-screen[hidden],
#gameover-screen[hidden],
.modal-overlay[hidden],
.ll-in-game-dropdown[hidden] {
  display: none !important;
}

/* ─── Screen Framework ──────────────────────────────────────────────── */
.screen {
  width: 100%;
  max-width: 1200px;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* ─── Hero / Home Screen ────────────────────────────────────────────── */
/* ─── Hero / Home Screen ────────────────────────────────────────────── */
.hero-card {
  width: 100%;
  background: linear-gradient(180deg, #131b2e 0%, #0d1322 100%);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 22px;
  padding: 2.2rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}
.hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, #c59b27 25%, #fde68a 50%, #c59b27 75%, transparent);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   👑 دوري العتور (3ATOOR LEAUGE) — AUTHENTIC ARABIC BOARD LOGO
   ═══════════════════════════════════════════════════════════════════════════════ */
.atoor-logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0.5rem auto 1.2rem auto;
  position: relative;
  user-select: none;
}

/* Emblem & Authentic Scrabble Wooden Tiles */
.atoor-emblem-badge {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.emblem-crown-float {
  font-size: 2.3rem;
  line-height: 1;
  margin-bottom: -6px;
  z-index: 5;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
  animation: crownGentleFloat 3s ease-in-out infinite;
}

.emblem-tiles-duo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  direction: ltr !important;
  position: relative;
  z-index: 4;
}

.atoor-wood-tile {
  width: 60px;
  height: 60px;
  background: linear-gradient(155deg, #f7ebd4 0%, #ecd3aa 45%, #deb887 85%, #c89d66 100%);
  border-radius: 12px;
  border: 2px solid #fffdf7;
  box-shadow: 
    0 8px 18px rgba(0, 0, 0, 0.4),
    0 2px 4px rgba(139, 90, 43, 0.25),
    inset 0 2px 3px rgba(255, 255, 255, 0.9),
    inset 0 -2px 4px rgba(120, 68, 20, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s ease;
}

.atoor-wood-tile.tile-num {
  transform: rotate(-5deg);
}

.atoor-wood-tile.tile-alpha {
  transform: rotate(5deg);
}

.atoor-wood-tile:hover {
  transform: scale(1.08) rotate(0deg) !important;
}

.atoor-wood-tile .tile-char {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  color: #2c1808;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
  line-height: 1;
}

.atoor-wood-tile .tile-pts {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 0.72rem;
  font-weight: 900;
  color: #8a4312;
  font-family: 'Tajawal', sans-serif;
  line-height: 1;
}

.emblem-warm-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 80px;
  background: radial-gradient(ellipse at center, rgba(217, 119, 6, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
}

/* Titles: Arabic on Top, English Underneath */
.atoor-title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

.atoor-arabic-title {
  font-size: clamp(2.4rem, 6.5vw, 4rem);
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  color: #ffffff;
  margin: 0.4rem 0 0.1rem 0;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
  letter-spacing: -0.5px;
  line-height: 1.15;
  direction: rtl;
}

.atoor-english-subtitle {
  font-size: clamp(1.15rem, 3.2vw, 1.7rem);
  font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #f59e0b;
  margin-bottom: 0.5rem;
  direction: ltr !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.atoor-gold-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0.3rem auto 0.8rem auto;
  width: 100%;
  max-width: 260px;
}

.divider-line {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.5), transparent);
}

.divider-symbol {
  color: #d4af37;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Arabic Sub-badge */
.atoor-arabic-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(19, 26, 43, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fde68a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-family: 'Tajawal', sans-serif;
}

.atoor-arabic-badge .badge-icon {
  font-size: 1rem;
}

@keyframes crownGentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 580px;
  margin: 0 auto 1.8rem auto;
  line-height: 1.7;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  width: 100%;
  max-width: 950px;
}

.mode-card {
  background: #141c2e;
  border: 1.5px solid #23304b;
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.mode-card:hover {
  border-color: #d97706;
  background: #18233a;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 14px rgba(217, 119, 6, 0.2);
}
.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mode-icon {
  font-size: 2.2rem;
}
.mode-tag {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(217, 119, 6, 0.12);
  color: #fde68a;
  border: 1px solid rgba(217, 119, 6, 0.25);
  font-family: 'Tajawal', sans-serif;
}
.mode-name {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: 'Tajawal', sans-serif;
  color: #ffffff;
}
.mode-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-family: 'Tajawal', sans-serif;
}

.difficulty-selector {
  width: 100%;
  max-width: 600px;
  background: #101626;
  border: 1px solid #23304b;
  border-radius: 16px;
  padding: 0.45rem;
  display: flex;
  gap: 0.5rem;
}
.diff-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.diff-tab span.count {
  font-size: 0.75rem;
  opacity: 0.85;
}
.diff-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}
.diff-tab.active {
  background: linear-gradient(145deg, #d97706, #b45309);
  border-color: #fde68a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: 14px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid #fde68a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--ll-orange-hover), var(--ll-orange));
  transform: translateY(-1px);
}
.btn-secondary {
  background: linear-gradient(135deg, var(--ll-purple), var(--ll-purple-dark));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(124, 77, 255, 0.35);
}
.btn-secondary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
}
.btn-ghost:hover {
  background: var(--bg-card-hover);
}
.btn-danger {
  background: #ef4444;
  color: #ffffff;
}
.btn-lg {
  padding: 0.95rem 2rem;
  font-size: 1.1rem;
}

/* ─── Discord Letter League In-Game Layout ──────────────────────────── */
#game-screen {
  position: relative;
  overflow: hidden;
}

#game-screen.game-screen-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: #eedfc7 !important; /* Authentic sand table background from Letter League screenshots */
  z-index: 100 !important;
  display: block;
}

#game-screen.game-screen-fullscreen[hidden] {
  display: none !important;
}
.game-scoreboard {
  width: 100%;
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 12px 4px 6px 4px; /* Space for the floating badges */
}
.scoreboard-card {
  flex: 1;
  min-width: 150px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  transition: all 0.25s;
}
.scoreboard-card.active-turn {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.25), rgba(24, 32, 53, 0.95));
  border-color: var(--ll-purple);
  box-shadow: 0 0 20px rgba(124, 77, 255, 0.4);
}
.scoreboard-card.active-turn::after {
  content: 'الدور الآن';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ll-purple);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.sb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--ll-purple);
  flex-shrink: 0;
}
.sb-details {
  display: flex;
  flex-direction: column;
}
.sb-name {
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
}
.sb-score {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--ll-orange);
}

/* ─── Letter League Top Center Header Control Bar ───────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════════
   🎮 DISCORD LETTER LEAGUE TOP HEADER (EXACT 2-ROW DESIGN)
   ═══════════════════════════════════════════════════════════════════════════════ */
.ll-top-header {
  pointer-events: auto !important;
  width: 100%;
  max-width: 560px;
  background: #5b52e0;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: visible;
  position: relative;
  user-select: none;
  margin-bottom: 0.5rem;
}

/* Row 1: Purple Header Bar */
.ll-header-top-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background: #5c53f4;
  min-height: 58px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  overflow: hidden;
}

.ll-header-left-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.9rem;
  flex: 1;
}

.ll-player-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.ll-big-score {
  font-size: 2.6rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  font-family: 'Tajawal', sans-serif;
  letter-spacing: -1px;
}

.ll-timer-info-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.ll-timer-text {
  font-size: 0.68rem;
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: 'Tajawal', sans-serif;
  opacity: 0.95;
}

.ll-pause-timer-btn {
  background: #7e76fb;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s;
  font-family: 'Tajawal', sans-serif;
}
.ll-pause-timer-btn:hover {
  background: #9891fc;
}

/* Row 1 Right: Solid Orange Turn Status Block */
.ll-status-badge {
  background: #f06c45;
  color: #ffffff;
  min-width: 105px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  font-family: 'Tajawal', sans-serif;
  user-select: none;
  border-top-right-radius: 12px;
}
.ll-status-badge .badge-line-1 {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.ll-status-badge .badge-line-2 {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Row 2: Dark Navigation Bar */
.ll-header-bottom-bar {
  background: #1a1a22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.8rem;
  min-height: 38px;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ll-btn-pass {
  background: #f06c45;
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 4px 14px;
  font-weight: 900;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: 'Tajawal', sans-serif;
}
.ll-btn-pass:hover {
  background: #f58866;
  transform: translateY(-1px);
}
.ll-btn-pass:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Turn Navigation Center & BIG Turn Name */
.ll-turn-nav-center {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin: 0 auto;
  direction: ltr !important;
}

.ll-nav-arrow-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ll-nav-arrow-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}
.ll-nav-arrow-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  background: transparent;
  border-color: transparent;
}

.ll-turn-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

#ll-turn-round-num {
  font-size: 1.55rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1.5px;
  font-family: 'Tajawal', sans-serif;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ll-turn-live-tag {
  background: #d97706;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.2px;
}

/* Turn History Review Card */
.ll-history-card {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 96%;
  max-width: 480px;
  background: rgba(18, 24, 38, 0.97);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 16px;
  padding: 0.85rem 1.1rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 20px rgba(212, 175, 55, 0.15);
  z-index: 250;
  direction: rtl;
  animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
  margin-bottom: 0.6rem;
}
.history-card-title-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.history-card-turn {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fde68a;
  font-family: 'Tajawal', sans-serif;
}
.history-close-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  border: 1px solid #fde68a;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  transition: all 0.15s;
}
.history-close-btn:hover {
  transform: scale(1.05);
  background: #f59e0b;
}

.history-card-body {
  font-size: 0.92rem;
  line-height: 1.5;
  color: #e2e8f0;
  font-family: 'Tajawal', sans-serif;
}

.history-item-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.history-player-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}
.history-action-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.8rem;
}
.history-action-badge.play {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
  border: 1px solid rgba(22, 163, 74, 0.4);
}
.history-action-badge.swap {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}
.history-action-badge.pass {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.history-word-display {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0.4rem 0;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
}
.history-word-text {
  font-size: 1.35rem;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 0.5px;
}
.history-score-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: #4ade80;
}
.history-def-text {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  line-height: 1.4;
}
  text-align: center;
  font-weight: 900;
  font-size: 0.85rem;
  animation: pulse-turn 2s infinite;
}
@keyframes pulse-turn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* ─── 19×27 Board Viewport & Zoom/Pan Container ─────────────────────────── */
.board-viewport {
  position: absolute !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
  cursor: grab !important;
  user-select: none !important;
  touch-action: none !important;
  z-index: 1 !important;
  margin: 0 !important;
}

.board-viewport.panning {
  cursor: grabbing !important;
}

.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  user-select: none;
  will-change: transform;
}

#board-grid {
  display: grid;
  grid-template-columns: repeat(27, 36px);
  grid-template-rows: repeat(19, 36px);
  gap: 2px;
  padding: 4px;
  background: #ebd8be;
  border: 4px solid #caa885;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  direction: rtl; /* RTL Grid: Col 0 on visual RIGHT */
  width: max-content;
  height: max-content;
}

.board-cell {
  width: 36px;
  height: 36px;
  background: var(--ll-board-cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  font-family: 'Tajawal', sans-serif;
  position: relative;
  cursor: pointer;
  transition: all 0.12s;
  border-radius: 4px;
  color: #78624c;
  line-height: 1;
}
.board-cell:hover:not(.locked) {
  filter: brightness(1.15);
}
.board-cell.drag-over {
  outline: 3px solid var(--ll-purple);
  z-index: 5;
  background: rgba(124, 77, 255, 0.3) !important;
}

/* Exact Multipliers Matching Discord Letter League Screenshot */
.board-cell.double-letter {
  background: var(--ll-2l-bg);
  color: var(--ll-2l-text);
}
.board-cell.triple-letter {
  background: var(--ll-3l-bg);
  color: var(--ll-3l-text);
}
.board-cell.double-word {
  background: var(--ll-2w-bg);
  color: var(--ll-2w-text);
}
.board-cell.triple-word {
  background: var(--ll-3w-bg);
  color: #ffffff;
}
.board-cell.center {
  background: var(--ll-star-bg);
  color: var(--ll-star-color);
  font-size: clamp(0.85rem, 1.4vw, 1.25rem);
}
.board-cell.center.center-star-pulse {
  animation: center-star-glow 1.6s ease-in-out infinite alternate;
  z-index: 2;
}
@keyframes center-star-glow {
  0% {
    box-shadow: 0 0 6px rgba(124, 77, 255, 0.4);
    transform: scale(1.0);
  }
  100% {
    box-shadow: 0 0 16px rgba(124, 77, 255, 0.95);
    transform: scale(1.06);
    filter: brightness(1.2);
  }
}

/* ─── Placed Tile on Board (Image 1 Active Placed Style) ─────────────── */
.tile.on-board {
  width: 95%;
  height: 95%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  border-radius: 6px;
  box-sizing: border-box;
}

/* Active Tile placed this turn (warm terracotta clay matching Image 1) */
.tile.on-board.placed-active {
  background: #ff7a45;
  color: #ffffff;
  border: 1px solid #ff9266;
  box-shadow: 0 2px 0 #9c3c13, 0 3px 6px rgba(0, 0, 0, 0.3);
}

.placed-tile-top {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  padding: 1px 3px !important;
  position: absolute !important;
  top: 1px !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box !important;
  direction: ltr !important; /* Multiplier on LEFT, Score on RIGHT */
}

/* Active tile multiplier badge on LEFT */
.placed-tile-mult {
  font-size: 0.52rem !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  opacity: 0.95 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6) !important;
  font-family: 'Tajawal', sans-serif !important;
  text-align: left !important;
  line-height: 1 !important;
}

/* Active tile score on RIGHT */
.placed-tile-val {
  font-size: 0.58rem !important;
  font-weight: 900 !important;
  color: #ffffff !important;
  opacity: 0.95 !important;
  font-family: 'Tajawal', sans-serif !important;
  text-align: right !important;
  margin-left: auto !important;
  line-height: 1 !important;
  position: static !important;
}

.placed-tile-letter {
  font-size: clamp(0.75rem, 1.4vw, 1.15rem);
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
}

/* Valid Word Highlight: Glowing Blue Outline Capsule (Image 1 Replica) */
.board-cell.word-valid-highlight {
  background: rgba(124, 181, 255, 0.35) !important;
  outline: 2px solid #7cb5ff !important;
  box-shadow: 0 0 14px rgba(124, 181, 255, 0.8), inset 0 0 8px rgba(124, 181, 255, 0.4) !important;
  z-index: 10;
  animation: valid-word-pulse 1.8s infinite alternate ease-in-out;
}

.tile.on-board.placed-active.word-valid {
  box-shadow: 0 0 0 2px #7cb5ff, 0 4px 14px rgba(124, 181, 255, 0.85) !important;
  border-color: #bfdbfe !important;
}

@keyframes valid-word-pulse {
  0%   { filter: drop-shadow(0 0 2px #7cb5ff); }
  100% { filter: drop-shadow(0 0 8px #93c5fd); }
}

/* ─── Locked Played Tile on Board (Image 2 Replica) ─────────────────── */
.tile.on-board.locked.played-green-tile {
  background: #7ee07a !important; /* Fresh lime green matching Image 2 */
  border: 2px solid #fed55f !important; /* Yellow-gold accent border */
  border-radius: 6px !important;
  box-shadow: 0 2px 0 #9f8c72, 0 2px 4px rgba(0, 0, 0, 0.25) !important;
  padding: 1px;
}

.played-tile-top {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  padding: 1px 3px !important;
  position: absolute !important;
  top: 1px !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box !important;
  direction: ltr !important; /* Forces Multiplier on LEFT, Score on RIGHT */
}

/* Multiplier badge on top LEFT (e.g. ٢ك, ٣ك, ٢ح, ٣ح) */
.played-tile-mult {
  color: #ffffff !important;
  font-size: 0.54rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7) !important;
  letter-spacing: 0 !important;
  font-family: 'Tajawal', sans-serif !important;
  text-align: left !important;
}

/* Multiplied letter score on top RIGHT (e.g. 16, 20, 8, 4) */
.played-tile-score {
  color: #1e293b !important;
  font-size: 0.62rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  font-family: 'Tajawal', sans-serif !important;
  text-align: right !important;
  margin-left: auto !important;
}

/* Center black Arabic letter */
.played-tile-letter {
  color: #000000 !important;
  font-size: clamp(0.78rem, 1.45vw, 1.25rem);
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
  margin-top: 4px;
}

/* ─── Floating Top HUD Bar ─────────────────────────────────────────── */
.ll-hud-top {
  position: fixed !important;
  top: 12px !important;
  left: 0 !important;
  right: 0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  padding: 0 1.25rem !important;
  pointer-events: none !important;
  z-index: 50 !important;
}

.ll-hud-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}
.ll-hud-brand:hover {
  background: var(--ll-purple);
  transform: translateY(-2px);
}
.ll-hud-logo-icon { font-size: 1.25rem; }
.ll-hud-logo-text { font-size: 1rem; font-weight: 900; }


.ll-hud-top-right {
  pointer-events: auto !important;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ll-in-game-dropdown {
  position: absolute;
  left: 0;
  top: 48px;
  width: 225px;
  background: #1e293b;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 0.5rem;
  box-shadow: 0 12px 28px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 100;
}
.ll-in-game-dropdown[hidden] {
  display: none !important;
}
.dropdown-item {
  background: transparent;
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: right;
  cursor: pointer;
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.dropdown-item.danger {
  color: #fca5a5;
}
.dropdown-item.danger:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ─── Left Toolbar (Eye for Lexicon + Zoom Controls) ─────────────────── */
.left-toolbar {
  position: fixed !important;
  left: 1.25rem !important;
  top: 45% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.5rem !important;
  z-index: 50 !important;
  pointer-events: auto !important;
}
.left-tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(36, 47, 76, 0.95);
  backdrop-filter: blur(6px);
  border: 2px solid #3b4b74;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}
.left-tool-btn:hover {
  background: var(--ll-purple);
  border-color: #ffffff;
  transform: scale(1.08);
}

/* ─── Bottom-Left Cute Tile Bag Character ───────────────────────────── */
.tile-bag-character-wrapper {
  position: fixed !important;
  left: 1.5rem !important;
  bottom: 1.25rem !important;
  display: flex !important;
  align-items: flex-end !important;
  gap: 0.75rem !important;
  z-index: 50 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.tile-bag-character {
  width: 70px;
  height: 70px;
  background: #ff7a45;
  border-radius: 20px 20px 24px 24px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 -4px 0 #cf4f1f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: bag-bob 3s ease-in-out infinite;
  transition: transform 0.2s;
}
.tile-bag-character:hover {
  transform: scale(1.1) rotate(-3deg);
}
@keyframes bag-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.bag-eyes {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}
.bag-eye {
  width: 6px;
  height: 12px;
  background: #ffffff;
  border-radius: 4px;
}
.bag-count-tag {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #242f4c;
  color: #ffffff;
  border: 2px solid #ff7a45;
  font-size: 0.75rem;
  font-weight: 900;
  border-radius: 12px;
  padding: 1px 6px;
}

/* Speech Bubble */
.bag-speech-bubble {
  background: #ffffff;
  color: #1e293b;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  position: relative;
  white-space: nowrap;
}
.bag-speech-bubble::after {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 12px;
  border-width: 8px 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #ffffff;
}

/* ─── Bottom-Center Floating Deck (Actions + Rack + Reactions) ─────── */
.ll-bottom-deck {
  position: fixed !important;
  bottom: 1.25rem !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.45rem !important;
  z-index: 50 !important;
  pointer-events: auto !important;
}

/* Action Controls Strip (3 Buttons Matching Discord Letter League Exactly) */
.ll-action-bar {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 520px;
  justify-content: center;
}
.ll-action-btn {
  flex: 1;
  height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.ll-action-btn:active { transform: scale(0.96); }

.ll-btn-swap {
  background: #ff7a45;
  color: #ffffff;
}
.ll-btn-swap:hover { background: #ff9266; }

.ll-btn-play {
  background: #475569;
  color: #94a3b8;
  min-width: 130px;
}
.ll-btn-play .play-label {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}
.ll-btn-play .play-pts-badge {
  font-size: 0.8rem;
  font-weight: 900;
  color: #fef08a;
  line-height: 1;
  display: none;
}
.ll-btn-play.ready {
  background: #7c4dff !important; /* Discord Letter League Purple matching Image 1 */
  color: #ffffff !important;
  box-shadow: 0 4px 18px rgba(124, 77, 255, 0.6) !important;
  transform: translateY(-2px);
  animation: play-btn-pulse 1.4s infinite alternate ease-in-out;
  cursor: pointer;
}
.ll-btn-play.ready .play-pts-badge {
  display: inline-block;
}
.ll-btn-play.ready:hover {
  background: #9065ff !important;
  box-shadow: 0 6px 24px rgba(124, 77, 255, 0.85) !important;
}

/* Trial mode ready state (when trying out words during opponent's turn) */
.ll-btn-play.trial-ready {
  background: linear-gradient(135deg, #4f46e5, #4338ca) !important;
  color: #e0e7ff !important;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45) !important;
  cursor: not-allowed !important;
  opacity: 0.92 !important;
  transform: translateY(-1px);
}
.ll-btn-play.trial-ready .play-pts-badge {
  display: inline-block;
  color: #fef08a;
}

@keyframes play-btn-pulse {
  0%   { box-shadow: 0 4px 14px rgba(124, 77, 255, 0.5); }
  100% { box-shadow: 0 6px 24px rgba(124, 77, 255, 0.9); }
}

.ll-btn-shuffle {
  background: #ff7a45;
  color: #ffffff;
}
.ll-btn-shuffle:hover { background: #ff9266; }

.ll-btn-recall {
  background: #ff7a45;
  color: #ffffff;
}
.ll-btn-recall:hover { background: #ff9266; }

/* ─── Flying Recall Tile Animation ─────────────────────────────────── */
.tile.flying-recall-tile {
  background: #ff7a45;
  color: #ffffff;
  border: 1.5px solid #ff9266;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 0 #9c3c13;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  margin: 0;
  box-sizing: border-box;
  transform-origin: center center;
  transition: top 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
              left 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
              width 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
              height 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
              transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1),
              opacity 0.28s ease;
}
.tile.flying-recall-tile .tile-letter {
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
}
.tile.flying-recall-tile .tile-value {
  font-size: 0.65rem;
  font-weight: 800;
  position: absolute;
  top: 3px;
  right: 5px;
  opacity: 0.9;
}

/* ─── Tactile Wooden Clay Rack Tray with 7 Slots ───────────────────── */
.rack-tray-wrapper {
  background: rgba(45, 34, 28, 0.94);
  backdrop-filter: blur(8px);
  border: 3px solid #5a463c;
  border-radius: 18px;
  padding: 0.5rem 0.75rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  transition: all 0.2s ease;
}
.rack-tray-wrapper.tray-dragover {
  border-color: var(--ll-purple) !important;
  box-shadow: 0 0 22px rgba(124, 77, 255, 0.7), inset 0 0 12px rgba(124, 77, 255, 0.45) !important;
  transform: scale(1.02);
}

/* Touch Drag Ghost for Mobile/Tablet Drag & Drop */
.touch-drag-ghost {
  position: fixed;
  z-index: 1000000;
  pointer-events: none;
  width: 52px;
  height: 56px;
  background: #ff7a45;
  color: #ffffff;
  border: 1.5px solid #ff9266;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65), 0 3px 0 #9c3c13;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(1.15);
  user-select: none;
}
.touch-drag-ghost .tile-letter {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
}
.touch-drag-ghost .tile-value {
  font-size: 0.65rem;
  font-weight: 800;
  position: absolute;
  top: 3px;
  right: 5px;
  opacity: 0.9;
}
.rack-row {
  display: flex;
  gap: 0.45rem;
  direction: rtl;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

.rack-tile {
  width: 52px;
  height: 56px;
  background: #ff7a45;
  color: #ffffff;
  border-radius: 10px;
  border: 1px solid #ff9266;
  box-shadow: 0 4px 0 #9c3c13, 0 6px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: grab;
  position: relative;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.rack-tile:active, .rack-tile.dragging {
  cursor: grabbing;
  transform: translateY(3px) scale(0.96);
  box-shadow: 0 1px 0 #9c3c13;
  opacity: 0.7;
}
.rack-tile.selected {
  transform: translateY(-8px);
  box-shadow: 0 0 0 3px var(--ll-purple), 0 10px 20px rgba(0, 0, 0, 0.5);
  background: #ff9266;
}
.tile-letter {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
}
.tile-value {
  font-size: 0.65rem;
  font-weight: 800;
  position: absolute;
  top: 3px;
  right: 5px;
  opacity: 0.9;
}

/* Empty Recessed Rack Slot (matching Image 4 & 5) */
.rack-slot.empty-slot {
  width: 52px;
  height: 56px;
  background: rgba(22, 17, 14, 0.85);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
  transition: all 0.15s;
}
.rack-slot.empty-slot.slot-dragover {
  border-color: var(--ll-purple);
  background: rgba(124, 77, 255, 0.25);
  box-shadow: inset 0 0 10px rgba(124, 77, 255, 0.5);
}

.reactions-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(26, 36, 56, 0.85);
  backdrop-filter: blur(10px);
  padding: 4px 14px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.reaction-btn {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 2px 4px !important;
  margin: 0 !important;
  font-size: 1.65rem !important; /* Larger & crystal clear */
  line-height: 1 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  transition: transform 0.16s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.16s ease !important;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.reaction-btn:hover {
  transform: scale(1.35) translateY(-3px) !important;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55)) !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.reaction-btn:active {
  transform: scale(0.92) !important;
}

/* ─── Bottom-Right Players Drawer ───────────────────────────────────── */
.ll-players-drawer {
  position: fixed !important;
  right: 1.5rem !important;
  bottom: 1.25rem !important;
  width: 250px !important;
  background: rgba(36, 47, 76, 0.95) !important;
  backdrop-filter: blur(8px);
  border: 2px solid #3b4b74;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  z-index: 50 !important;
  overflow: hidden;
  pointer-events: auto !important;
}
.ll-players-drawer-header {
  background: var(--ll-purple);
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.ll-players-drawer-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}
.ll-player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a233a;
  border-radius: 10px;
  padding: 6px 8px;
}
.ll-player-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
}
.ll-player-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ll-player-item-name {
  font-weight: 800;
  font-size: 0.85rem;
}
.ll-player-item-score {
  font-size: 0.75rem;
  color: var(--ll-orange);
  font-weight: 800;
}

/* ─── Lexicon / Word Meanings Sidebar ───────────────────────────────── */
.lexicon-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  background: #182035;
  border-right: 2px solid var(--border);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.6);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.lexicon-sidebar.open {
  transform: translateX(0);
}
.lexicon-header {
  padding: 1rem 1.25rem;
  background: var(--ll-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lexicon-title {
  font-weight: 900;
  font-size: 1.1rem;
}
.lexicon-body {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.lexicon-word-card {
  background: #222f4c;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lexicon-word-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--ll-orange);
  font-family: 'Amiri', serif;
}
.lexicon-word-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.lexicon-word-meaning {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ─── Swap Modal (Select Letters to Swap with Tile Bag) ──────────────── */
.swap-modal-tiles-grid {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin: 1rem 0;
}
.swap-tile-choice {
  width: 52px;
  height: 56px;
  border-radius: 10px;
  background: #242f4c;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.15s;
}
.swap-tile-choice.selected {
  border-color: var(--ll-orange);
  background: rgba(255, 122, 69, 0.25);
  transform: translateY(-4px);
}

/* ─── Toast Notifications ───────────────────────────────────────────── */
.game-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 0.75rem 1.6rem;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  z-index: 99;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes toast-in {
  0% { transform: translate(-50%, 40px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

/* Modal Framework */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none !important; }
.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.7);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1.35rem; font-weight: 900; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-input {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  text-align: right;
}

/* ─── Modal: Tile Bag & Definitions (Exact Discord Letter League UI) ─── */
.tile-bag-modal-card {
  max-width: 660px;
  width: 95vw;
  padding: 0 !important;
  overflow: hidden;
  background: #1e2433;
  border: 2px solid #334155;
  border-radius: 20px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.7);
}

.ll-modal-tabs {
  display: flex;
  align-items: center;
  background: #141824;
  border-bottom: 2px solid #2a344d;
  padding: 0;
  position: relative;
}

.ll-tab-btn {
  flex: 1;
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.ll-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.ll-tab-btn.active {
  background: #7c4dff !important; /* Letter League Purple */
  color: #ffffff !important;
  border-bottom: 3px solid #facc15;
}

.ll-modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.25rem;
  padding: 0 18px;
  cursor: pointer;
  transition: color 0.15s;
}
.ll-modal-close-btn:hover { color: #ffffff; }

.ll-tab-content {
  padding: 1.25rem 1.25rem 1.5rem 1.25rem;
  max-height: 75vh;
  overflow-y: auto;
}

.tile-bag-header-info {
  background: rgba(15, 20, 34, 0.6);
  border: 1px solid #2d3b5b;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.tile-bag-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.bag-meta-label {
  font-weight: 800;
  font-size: 0.95rem;
  color: #e2e8f0;
}
.bag-meta-count {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ll-orange);
  background: rgba(255, 122, 69, 0.15);
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 122, 69, 0.3);
}
.tile-bag-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Bag Letters Grid (Image 2 Replica) */
.ll-bag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 10px;
  direction: rtl;
  margin-bottom: 1.25rem;
  padding: 4px;
}

.bag-tile-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bag-tile-card {
  width: 44px;
  height: 48px;
  background: #ff7a45;
  color: #ffffff;
  border-radius: 10px;
  border: 1px solid #ff9266;
  box-shadow: 0 3px 0 #9c3c13, 0 4px 8px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  transition: transform 0.15s;
}
.bag-tile-card:hover {
  transform: translateY(-2px);
}

.bag-tile-letter {
  font-size: 1.4rem;
  font-weight: 900;
  font-family: 'Amiri', 'Tajawal', serif;
  line-height: 1;
}

.bag-tile-points {
  font-size: 0.65rem;
  font-weight: 800;
  position: absolute;
  top: 3px;
  right: 5px;
  opacity: 0.95;
}

.bag-tile-count-badge {
  font-size: 0.75rem;
  font-weight: 900;
  color: #ef4444;
  background: #ffffff;
  border-radius: 8px;
  padding: 1px 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  min-width: 20px;
  text-align: center;
}

/* Depleted Tile: 0 remaining in bag (Greyed out) */
.bag-tile-item.depleted .bag-tile-card {
  background: #475569 !important;
  border-color: #64748b !important;
  box-shadow: 0 2px 0 #334155 !important;
  opacity: 0.45;
}
.bag-tile-item.depleted .bag-tile-letter,
.bag-tile-item.depleted .bag-tile-points {
  color: #cbd5e1 !important;
}
.bag-tile-item.depleted .bag-tile-count-badge {
  color: #94a3b8;
  background: #334155;
}

/* Swap Section inside Tile Bag */
.tile-bag-swap-section {
  background: rgba(15, 20, 34, 0.7);
  border: 1px solid #2d3b5b;
  border-radius: 14px;
  padding: 1rem;
}
.swap-section-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

/* Definitions Tab Styling */
.definitions-filter-bar {
  margin-bottom: 1rem;
}
.definitions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.def-word-card {
  background: #182035;
  border: 1.5px solid #2d3b5b;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.2s;
}
.def-word-card:hover {
  border-color: var(--ll-purple);
  background: #1e2945;
}
.def-word-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.def-word-arabic {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ll-orange);
  font-family: 'Amiri', 'Tajawal', serif;
}
.def-word-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.def-word-score-tag {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px;
}
.def-word-meaning {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .tile-bag-character-wrapper { bottom: 0.5rem; left: 0.5rem; transform: scale(0.85); }
  .ll-players-drawer { display: none; }
  .left-toolbar { left: 0.5rem; }
  #board-grid { width: 98vw; height: auto; }
}

/* ─── Score Float Animation ─────────────────────────────────────────────── */
@keyframes score-float-anim {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  60% {
    opacity: 1;
    transform: translateX(-50%) translateY(-60px) scale(1.3);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-110px) scale(0.8);
  }
}

/* ─── Floating Reaction Animation (Discord Style) ───────────────────────── */
@keyframes reaction-float {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.5) rotate(0deg);
  }
  20% {
    opacity: 1;
    transform: translateY(-30px) scale(1.2) rotate(-10deg);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-100px) scale(1) rotate(5deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-200px) scale(0.6) rotate(-15deg);
  }
}

/* ─── Animate Pop (tile entrance) ───────────────────────────────────────── */
@keyframes pop-in {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
.animate-pop {
  animation: pop-in 0.2s ease-out;
}

/* ─── Floating Word Definition Celebration Banner ────────────────────────── */
.word-definition-banner {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 9990;
  max-width: 520px;
  width: 90%;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.35s;
}

.word-definition-banner.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.word-def-banner-inner {
  position: relative;
  background: linear-gradient(135deg, rgba(24, 32, 53, 0.98), rgba(15, 23, 42, 0.98));
  border: 2px solid var(--ll-purple);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(139, 92, 246, 0.35);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.word-def-close-btn {
  position: absolute;
  top: 8px;
  left: 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.word-def-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.word-def-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffd54f;
  background: rgba(255, 213, 79, 0.12);
  border: 1px solid rgba(255, 213, 79, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
  align-self: flex-start;
}

.word-def-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.word-def-vocalized {
  font-family: 'Amiri', 'Tajawal', serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ll-orange);
  letter-spacing: 0.5px;
}

.word-def-root {
  font-size: 0.85rem;
  font-weight: 700;
  color: #80d8ff;
  background: rgba(128, 216, 255, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
}

.word-def-score {
  font-size: 0.9rem;
  font-weight: 900;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 8px;
  margin-right: auto;
}

.word-def-player {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.word-def-text {
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.6;
  margin: 0;
  max-height: 110px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.4rem;
}

/* Badge pulse on Left Toolbar Eye button when new word definition is recorded */
.left-tool-btn.has-new-def {
  position: relative;
  animation: eye-pulse 1.5s infinite alternate;
}

@keyframes eye-pulse {
  0% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.8); border-color: #f59e0b; }
}

/* ─── Spectator Mode ──────────────────────────────────────────────────────── */
.spectator-banner {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: rgba(18, 14, 33, 0.95);
  border: 1px solid var(--ll-purple);
  box-shadow: 0 8px 32px rgba(124, 77, 255, 0.45);
  backdrop-filter: blur(14px);
  padding: 0.6rem 1.4rem;
  border-radius: 30px;
  display: flex;
  align-items: center;
  animation: slideDownFade 0.3s ease;
  pointer-events: auto;
}

.spectator-banner[hidden] {
  display: none !important;
}

.spectator-banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.spectator-pulse {
  font-size: 1.3rem;
  animation: pulse 1.5s infinite;
}

.spectator-exit-btn {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  border-radius: 20px;
  padding: 0.25rem 0.85rem;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.2s;
}

.spectator-exit-btn:hover {
  background: #ef4444;
  color: #fff;
}

#game-screen.spectator-mode-active .ll-bottom-deck {
  display: none !important;
}

#game-screen.spectator-mode-active #btn-spectator-mode {
  background: var(--ll-purple) !important;
  box-shadow: 0 0 16px rgba(124, 77, 255, 0.9) !important;
  border-color: #a78bfa !important;
}

/* ─── Auth Modal Tabs & Elements ─────────────────────────────────────────── */
.auth-tabs .tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: 'Tajawal', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tabs .tab-btn.active {
  background: var(--ll-purple);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 77, 255, 0.35);
}

