/* ============================================================
   Majlis Al-Alab — V2 Luxury Arabic Theme
   مجلس الألعاب — منصة الألعاب الصوتية العربية
   ============================================================ */

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

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  --bg: #1a1a2e;
  --card: #16213e;
  --gold: #d4a853;
  --goldl: #e8c97a;
  --green: #4ade80;
  --rose: #e94560;
  --purple: #8b5cf6;
  --txt: #eaeaea;
  --txt2: #a0a0a0;
  --inp: #0f3460;
  --brd: rgba(212,168,83,0.3);
  --r: 16px;
  --rs: 10px;
  --rp: 99px;
  --shadow-gold: 0 0 20px rgba(212,168,83,0.15);
  --shadow-lift: 0 8px 32px rgba(0,0,0,0.4);
  --glass: rgba(22,33,62,0.85);
  --glass-border: rgba(212,168,83,0.18);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --nav-h: 60px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
  direction: rtl;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--goldl); }
button { font-family: 'Cairo', sans-serif; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(212,168,83,0.3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,168,83,0.5); }
* { scrollbar-width: thin; scrollbar-color: rgba(212,168,83,0.3) transparent; }

/* ── Typography ── */
.mono, .num { font-family: 'Montserrat', sans-serif; }
.gold-text { color: var(--gold); }

/* ============================================================
   Navigation
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: var(--nav-h);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
.nav-left, .nav-center, .nav-right {
  display: flex; align-items: center; gap: 12px;
}
.nav-right { gap: 16px; }

.brand {
  display: flex; align-items: center; gap: 8px;
}
.brand-icon { font-size: 1.5rem; }
.brand-text {
  font-size: 1.2rem; font-weight: 900;
  color: var(--txt);
}
.brand-text .gold-text {
  background: linear-gradient(135deg, var(--gold), var(--goldl));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--rs);
  border: 1px solid var(--brd);
  background: transparent;
  color: var(--txt);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: rgba(212,168,83,0.1); border-color: var(--gold); }

.online-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--green);
  padding: 4px 14px; border-radius: var(--rp);
  background: rgba(74,222,128,0.1);
  border: 1px solid rgba(74,222,128,0.2);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

.coin-display {
  display: flex; align-items: center; gap: 4px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 0.95rem; color: var(--goldl);
  padding: 5px 14px; border-radius: var(--rp);
  background: rgba(212,168,83,0.1);
  border: 1px solid rgba(212,168,83,0.2);
  white-space: nowrap;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
}

.user-menu {
  position: absolute; top: calc(var(--nav-h) - 4px); inset-inline-end: 0;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  padding: 8px 0;
  box-shadow: var(--shadow-lift);
  z-index: 1001;
}
.user-menu a {
  display: block; padding: 10px 20px;
  color: var(--txt); font-size: 0.88rem;
  cursor: pointer;
  transition: background var(--transition);
}
.user-menu a:hover { background: rgba(212,168,83,0.1); color: var(--gold); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px;
  border: none; border-radius: var(--rs);
  font-family: 'Cairo', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b8912e);
  color: #1a1a2e;
  box-shadow: 0 4px 16px rgba(212,168,83,0.3);
}
.btn-gold:hover {
  box-shadow: 0 6px 24px rgba(212,168,83,0.5);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gold);
  color: var(--gold);
}
.btn-outline:hover { background: rgba(212,168,83,0.1); }

.btn-green {
  background: var(--green);
  color: #0d0d1a;
}
.btn-green:hover { filter: brightness(1.1); }

.btn-rose {
  background: var(--rose);
  color: #fff;
}
.btn-rose:hover { filter: brightness(1.1); }

.btn-purple {
  background: var(--purple);
  color: #fff;
}
.btn-purple:hover { filter: brightness(1.1); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn-lg { padding: 14px 36px; font-size: 1.1rem; }
.btn-full { width: 100%; }

/* ============================================================
   Inputs
   ============================================================ */
.input, .input-field {
  width: 100%;
  padding: 12px 16px;
  background: var(--inp);
  border: 1.5px solid transparent;
  border-radius: var(--rs);
  color: var(--txt);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  direction: rtl;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}
.input::placeholder, .input-field::placeholder { color: var(--txt2); }
.input:focus, .input-field:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,0.15);
}
textarea.input, textarea.input-field { resize: vertical; min-height: 80px; }

select.input-field {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px;
}
select.input-field option {
  background: var(--card);
  color: var(--txt);
}

.input-group {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 16px;
}
.input-label {
  font-size: 0.85rem; font-weight: 600; color: var(--txt2);
}

.search-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--inp);
  border: 1.5px solid transparent;
  border-radius: var(--rp);
  color: var(--txt);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  direction: rtl;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,0.15);
}

/* ============================================================
   Avatar System
   ============================================================ */
.av {
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  background: var(--inp);
  color: var(--txt);
}
.av.as { width: 28px; height: 28px; font-size: 0.65rem; }
.av.am { width: 40px; height: 40px; font-size: 0.85rem; }
.av.al { width: 60px; height: 60px; font-size: 1.3rem; }
.av.ag { border: 2px solid var(--gold); }
.av.ae { border: 2px solid var(--green); }
.av.ap { border: 2px solid var(--purple); }
.av.ar { border: 2px solid var(--rose); }

.av .dot, .av-wrap .dot {
  position: absolute; bottom: 1px; inset-inline-end: 1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.av .dot.dg, .av-wrap .dot.dg { background: var(--green); }
.av .dot.dr, .av-wrap .dot.dr { background: var(--txt2); }
.av .dot.dv, .av-wrap .dot.dv { background: var(--purple); }
.av .dot.dh, .av-wrap .dot.dh { background: var(--gold); animation: pulse 2s infinite; }

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 100px 24px 60px;
  background: linear-gradient(180deg, #0d0d1a 0%, var(--bg) 40%, var(--card) 100%);
  overflow: hidden;
}

.hero-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 30% 40%, rgba(212,168,83,0.1), transparent),
    radial-gradient(ellipse 400px 300px at 70% 60%, rgba(212,168,83,0.07), transparent);
  pointer-events: none;
}

.hero-pattern {
  position: absolute; inset: 0;
  opacity: 0.03;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(212,168,83,0.5) 40px, rgba(212,168,83,0.5) 41px),
    repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(212,168,83,0.5) 40px, rgba(212,168,83,0.5) 41px);
  pointer-events: none;
}

.hero-content {
  position: relative; z-index: 1;
  max-width: 700px;
}

.hero-title {
  font-size: 2.8rem; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--goldl), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  line-height: 1.15;
}

.hero-sub {
  font-size: 1.15rem; color: var(--txt2);
  margin-bottom: 36px; max-width: 500px; margin-inline: auto;
}

.hero-stats {
  display: flex; gap: 48px; justify-content: center;
  margin-top: 48px;
}

.hero-stat-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.2rem; font-weight: 800;
  color: var(--gold);
}

.hero-stat-lbl {
  font-size: 0.85rem; color: var(--txt2);
}

/* ============================================================
   Features Bar
   ============================================================ */
.features-bar {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center;
  padding: 0 24px;
  position: relative; z-index: 1;
  margin-top: 48px;
}

.feat {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border-radius: var(--rp);
  background: rgba(212,168,83,0.08);
  border: 1px solid rgba(212,168,83,0.15);
  font-size: 0.85rem; color: var(--goldl);
  transition: all var(--transition);
}
.feat:hover {
  background: rgba(212,168,83,0.15);
  transform: translateY(-1px);
}
.feat-icon { font-size: 1.1rem; }

/* ============================================================
   Lobby Layout
   ============================================================ */
.lobby {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 80px 24px 40px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.lobby-sidebar {
  position: sticky; top: 80px;
  align-self: start;
  display: flex; flex-direction: column; gap: 8px;
}

.sidebar-user {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 20px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.sidebar-name { font-weight: 700; font-size: 0.95rem; }
.sidebar-coins {
  font-family: 'Montserrat', sans-serif;
  color: var(--gold); font-weight: 700;
  font-size: 0.9rem;
}

.sidebar-section-title {
  font-size: 0.75rem; font-weight: 700;
  color: var(--txt2); padding: 8px 12px 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: var(--rs);
  color: var(--txt2);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(212,168,83,0.1);
  color: var(--gold);
}

.lobby-main {
  display: flex; flex-direction: column; gap: 20px;
}

.lobby-topbar {
  display: flex; gap: 12px; align-items: center;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ============================================================
   Room Cards
   ============================================================ */
.rc {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.rc:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-gold);
  border-color: var(--gold);
}

.rc-title {
  font-weight: 700; font-size: 1rem;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}

.rc-info { font-size: 0.8rem; color: var(--txt2); margin-bottom: 12px; }

.tg {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--rp);
  font-size: 0.72rem; font-weight: 700;
}
.tgg { background: rgba(212,168,83,0.15); color: var(--goldl); }
.tgr { background: rgba(74,222,128,0.15); color: var(--green); }
.tgp { background: rgba(139,92,246,0.15); color: var(--purple); }
.tgrs { background: rgba(233,69,96,0.15); color: var(--rose); }

.rc-avatars {
  display: flex;
}
.rc-avatars .av {
  margin-inline-start: -8px;
  border: 2px solid var(--card);
}
.rc-avatars .av:first-child { margin-inline-start: 0; }

/* ============================================================
   Game Cards (compact)
   ============================================================ */
.gcc {
  width: 140px;
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.gcc::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform var(--transition);
}
.gcc:hover::before { transform: scaleX(1); }
.gcc:hover { border-color: var(--gold); transform: translateY(-2px); }
.gcc-icon { font-size: 2rem; margin-bottom: 6px; }
.gcc-name { font-size: 0.8rem; font-weight: 700; }

/* ============================================================
   Room Page
   ============================================================ */
.room-page {
  display: flex; flex-direction: column;
  min-height: 100vh;
  padding-top: var(--nav-h);
}

.room-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.room-name {
  font-weight: 700; font-size: 1.05rem;
  color: var(--gold);
}

.room-code {
  font-size: 0.8rem; color: var(--txt2);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--rp);
  background: rgba(212,168,83,0.08);
  transition: all var(--transition);
}
.room-code:hover { background: rgba(212,168,83,0.15); color: var(--gold); }

.room-settings {
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--rs);
  transition: all var(--transition);
}
.room-settings:hover { background: rgba(255,255,255,0.05); }

.room-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 16px 24px;
}

.room-seats {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center;
  align-content: start;
  padding: 20px 0;
}

.room-game-area {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
}

.room-bottom {
  padding: 12px 24px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-border);
  display: flex; flex-direction: column; gap: 8px;
}

/* ── Seats ── */
.seat {
  width: 100px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 10px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1px solid var(--brd);
  transition: all var(--transition);
  position: relative;
}
.seat.speaking {
  border-color: var(--green);
  box-shadow: 0 0 16px rgba(74,222,128,0.25);
  animation: speakPulse 1.5s infinite;
}
.seat-empty {
  opacity: 0.4;
  border-style: dashed;
}
.seat-name {
  font-size: 0.72rem; font-weight: 600;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; width: 100%;
}
.seat-host {
  position: absolute; top: -6px; inset-inline-end: -6px;
  font-size: 0.8rem;
}

/* ── Chat Area ── */
.room-chat {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 200px; overflow-y: auto;
  padding: 8px;
  min-height: 60px;
}

.bub {
  max-width: 80%;
  padding: 8px 14px;
  border-radius: var(--r);
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeInUp 0.2s ease;
}
.bub-self {
  align-self: flex-start;
  background: var(--gold);
  color: #1a1a2e;
  border-end-start-radius: 4px;
}
.bub-other {
  align-self: flex-end;
  background: var(--inp);
  color: var(--txt);
  border-end-end-radius: 4px;
}
.bub-system {
  align-self: center;
  background: rgba(139,92,246,0.15);
  color: var(--purple);
  font-size: 0.8rem;
  text-align: center;
  max-width: 90%;
  border-radius: var(--rp);
  padding: 6px 16px;
}

.room-chat-input {
  display: flex; gap: 8px; align-items: center;
}
.room-chat-input input {
  flex: 1;
  padding: 10px 16px;
  background: var(--inp);
  border: 1.5px solid transparent;
  border-radius: var(--rp);
  color: var(--txt);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  direction: rtl;
  outline: none;
  transition: border-color var(--transition);
}
.room-chat-input input:focus { border-color: var(--gold); }

/* ── Gift Bar ── */
.room-gifts {
  display: flex; gap: 6px; align-items: center;
  padding: 6px 0;
  overflow-x: auto;
}

.gift-item {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  padding: 6px 8px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}
.gift-item:hover {
  border-color: var(--gold);
  transform: scale(1.1);
}
.gift-icon { font-size: 1.3rem; }
.gift-price {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.6rem; font-weight: 700;
  color: var(--txt2);
}
.gift-balance {
  margin-inline-start: auto;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem; font-weight: 700;
  color: var(--goldl);
  white-space: nowrap;
}

/* ── Voice Bar ── */
.room-voice-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: var(--rp);
  border: 1px solid var(--brd);
}

.voice-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--rose);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
}
.voice-btn.active { background: var(--green); }
.voice-btn:hover { filter: brightness(1.15); }

.voice-status {
  font-size: 0.8rem; color: var(--txt2);
}

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 2000;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal-panel {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  width: 100%; max-width: 440px;
  max-height: 85vh; overflow-y: auto;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  animation: modalIn 0.25s ease;
}
.modal-wide { max-width: 600px; }

.modal-title {
  font-size: 1.2rem; font-weight: 800;
  text-align: center;
  padding: 20px 20px 0;
}

.modal-close {
  position: absolute; top: 12px; inset-inline-end: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--txt2);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  z-index: 1;
}
.modal-close:hover { background: rgba(233,69,96,0.2); color: var(--rose); }

.modal-tabs {
  display: flex; gap: 4px;
  padding: 12px 20px 0;
}
.modal-tab {
  flex: 1;
  padding: 10px 16px;
  border: none; background: none;
  color: var(--txt2);
  font-family: 'Cairo', sans-serif;
  font-weight: 600; font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.modal-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.modal-tab:hover { color: var(--goldl); }

.modal-divider {
  text-align: center; color: var(--txt2);
  font-size: 0.8rem; padding: 16px 20px;
}

.auth-form {
  padding: 20px;
}

.forgot-link {
  display: block; text-align: center;
  font-size: 0.82rem; color: var(--txt2);
  margin-top: 12px; cursor: pointer;
}
.forgot-link:hover { color: var(--gold); }

/* ── Toggle ── */
.toggle {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--inp);
  border-radius: 12px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute; top: 2px; inset-inline-end: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--txt2);
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider {
  background: var(--gold);
}
.toggle input:checked + .toggle-slider::before {
  inset-inline-end: auto;
  inset-inline-start: 2px;
  background: #1a1a2e;
}

/* ============================================================
   Game Selects
   ============================================================ */
.game-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.game-opt {
  padding: 14px 8px;
  text-align: center;
  border-radius: var(--rs);
  background: var(--inp);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.game-opt:hover { border-color: var(--gold); }
.game-opt.selected {
  border-color: var(--gold);
  background: rgba(212,168,83,0.15);
  color: var(--gold);
}
.go-icon { font-size: 1.5rem; }

.num-select {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.num-opt {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--inp);
  border: 1.5px solid transparent;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
}
.num-opt:hover { border-color: var(--gold); }
.num-opt.selected {
  border-color: var(--gold);
  background: var(--gold);
  color: #1a1a2e;
}

/* ============================================================
   Wallet
   ============================================================ */
.wallet-balance {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, rgba(212,168,83,0.1), rgba(212,168,83,0.05));
  border-radius: var(--r);
  border: 1px solid var(--brd);
  margin: 16px 20px;
}
.wallet-coins {
  font-family: 'Montserrat', sans-serif;
  font-size: 2.5rem; font-weight: 800;
  color: var(--gold);
}
.wallet-label { color: var(--txt2); font-size: 0.9rem; margin-top: 4px; }

.section-title {
  font-size: 1rem; font-weight: 700;
  padding: 16px 20px 8px;
  color: var(--txt2);
}

.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}
.coin-pack {
  background: var(--card);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.coin-pack:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
  border-color: var(--gold);
}
.coin-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem; font-weight: 800;
  color: var(--gold);
}
.coin-price {
  font-size: 0.85rem; color: var(--txt2);
  margin-top: 4px;
}
.coin-desc {
  font-size: 0.72rem; color: var(--txt2);
  margin-top: 4px; line-height: 1.4;
}
.coin-badge {
  position: absolute; top: -1px; inset-inline-end: -1px;
  background: var(--rose);
  color: #fff;
  font-size: 0.6rem; font-weight: 700;
  padding: 2px 8px;
  border-radius: 0 var(--r) 0 var(--r);
}

.vip-pack {
  background: linear-gradient(135deg, var(--card), rgba(139,92,246,0.08));
  border-color: rgba(139,92,246,0.3);
}
.vip-pack:hover {
  border-color: var(--purple);
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
}

/* ============================================================
   Leaderboard
   ============================================================ */
.lb-tabs {
  display: flex; gap: 4px;
  padding: 12px 20px;
}
.lb-tab {
  padding: 8px 16px;
  border: none; background: var(--card);
  color: var(--txt2);
  border-radius: var(--rs);
  font-family: 'Cairo', sans-serif;
  font-weight: 600; font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}
.lb-tab.active { background: var(--gold); color: #1a1a2e; }
.lb-tab:hover:not(.active) { background: rgba(212,168,83,0.1); }

.lb-list {
  padding: 0 20px 20px;
}
.lb-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1px solid transparent;
  margin-bottom: 8px;
  transition: all var(--transition);
}
.lb-row:hover { border-color: var(--brd); }
.lb-rank {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800; font-size: 1.1rem;
  width: 36px; text-align: center;
}
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-row:nth-child(2) .lb-rank { color: #c0c0c0; }
.lb-row:nth-child(3) .lb-rank { color: #cd7f32; }
.lb-name { flex: 1; font-weight: 600; }
.lb-score {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; color: var(--goldl);
}

/* ============================================================
   Siniyah Game (Cups)
   ============================================================ */
.cups-area {
  display: flex; gap: 20px; justify-content: center;
  padding: 40px 0;
}
.cup {
  width: 52px; height: 66px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #e0e0e0, #a0a0a0);
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  transform-origin: bottom center;
  position: relative;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
.cup:hover { transform: translateY(-8px); }
.cup.flipped { animation: cupFlip 0.5s ease; }
.cup.revealed { transform: translateY(-40px) rotateX(180deg); }
.cup.revealed::after {
  content: '🪙';
  position: absolute;
  bottom: -30px; left: 50%; transform: translateX(-50%);
  font-size: 1.4rem;
}

.scoreboard {
  display: flex; gap: 16px; justify-content: center;
  margin-top: 24px;
}
.score-bar {
  height: 8px; border-radius: 4px;
  background: var(--inp);
  flex: 1; max-width: 200px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--goldl));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.timer {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800; font-size: 2rem;
  color: var(--rose);
  text-align: center;
  animation: timerPulse 1s infinite;
}

/* ============================================================
   Spy Game
   ============================================================ */
.spy-role {
  background: var(--card);
  border: 2px solid var(--purple);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
  width: 100%; max-width: 340px;
}
.spy-role h3 { color: var(--purple); margin-bottom: 8px; }
.spy-role .word {
  font-size: 1.5rem; font-weight: 900;
  color: var(--gold);
}
.spy-role .role-label {
  font-size: 0.85rem; color: var(--txt2);
  margin-top: 4px;
}

.spy-players {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  padding: 16px 0;
}
.spy-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 10px 14px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1.5px solid var(--brd);
  cursor: pointer;
  transition: all var(--transition);
}
.spy-btn:hover { border-color: var(--rose); }
.spy-btn.voted {
  border-color: var(--rose);
  background: rgba(233,69,96,0.1);
}

/* ============================================================
   Werewolf Game
   ============================================================ */
.ww-role {
  background: var(--card);
  border: 2px solid var(--rose);
  border-radius: var(--r);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
  width: 100%; max-width: 340px;
}
.ww-role h3 { color: var(--rose); margin-bottom: 8px; }
.ww-role .role-label {
  font-size: 0.85rem; color: var(--txt2);
  margin-top: 4px;
}

.ww-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  width: 100%;
}
.ww-slot {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 8px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1px solid var(--brd);
  transition: all var(--transition);
}
.ww-slot.dead {
  opacity: 0.3;
  filter: grayscale(1);
  border-style: dashed;
}
.ww-phase {
  padding: 12px 20px;
  border-radius: var(--rs);
  text-align: center;
  font-weight: 700;
  width: 100%;
}
.ww-phase.night {
  background: rgba(15,52,96,0.5);
  color: var(--purple);
  border: 1px solid rgba(139,92,246,0.3);
}
.ww-phase.day {
  background: rgba(212,168,83,0.1);
  color: var(--gold);
  border: 1px solid rgba(212,168,83,0.2);
}

/* ============================================================
   Drawing Game Area
   ============================================================ */
.draw-area {
  width: 100%;
  padding: 20px;
  text-align: center;
}
.word-display {
  font-size: 1.6rem; font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px;
  padding: 16px;
  background: rgba(212,168,83,0.08);
  border-radius: var(--rs);
  border: 1px solid var(--brd);
  margin-bottom: 16px;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  top: 80px; inset-inline-end: 20px;
  z-index: 3000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--rs);
  background: var(--card);
  border: 1px solid var(--brd);
  color: var(--txt);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lift);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 200px;
}
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--rose); }
.toast-info { border-color: var(--purple); }

/* ============================================================
   FAB
   ============================================================ */
.fab {
  position: fixed;
  bottom: 24px; inset-inline-end: 24px;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: #1a1a2e;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212,168,83,0.4);
  transition: all var(--transition);
  z-index: 900;
}
.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212,168,83,0.6);
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

@keyframes speakPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(74,222,128,0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(74,222,128,0.4);
  }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes cupFlip {
  0% { transform: translateY(0) rotateX(0); }
  50% { transform: translateY(-30px) rotateX(90deg); }
  100% { transform: translateY(0) rotateX(0); }
}

@keyframes giftFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  30% {
    opacity: 1;
    transform: translate(0, -60px) scale(1.2) rotate(10deg);
  }
  70% {
    opacity: 0.7;
    transform: translate(0, -120px) scale(0.9) rotate(-5deg);
  }
  100% {
    opacity: 0;
    transform: translate(0, -180px) scale(0.5) rotate(15deg);
  }
}

.gift-fly {
  animation: giftFly 1.2s ease-out forwards;
}

/* ============================================================
   Responsive — Mobile ≤ 768px
   ============================================================ */
@media (max-width: 768px) {
  :root { --nav-h: 52px; }

  .nav { padding: 0 12px; height: 52px; }
  .brand-text { font-size: 1rem; }
  .online-badge { font-size: 0.7rem; padding: 3px 10px; }
  .coin-display { font-size: 0.8rem; padding: 4px 10px; }

  /* Hero */
  .hero { padding: 80px 16px 40px; }
  .hero-title { font-size: 1.8rem; }
  .hero-sub { font-size: 0.95rem; }
  .hero-stats { gap: 24px; }
  .hero-stat-num { font-size: 1.6rem; }
  .features-bar { gap: 8px; }
  .feat { padding: 6px 12px; font-size: 0.78rem; }

  /* Lobby */
  .lobby {
    grid-template-columns: 1fr;
    padding: 70px 12px 20px;
    gap: 16px;
  }
  .lobby-sidebar {
    position: static;
    display: flex; flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
  }
  .sidebar-user {
    min-width: 140px;
    padding: 14px;
  }
  .sidebar-section-title { display: none; }
  .sidebar-link { white-space: nowrap; padding: 8px 12px; font-size: 0.8rem; }
  .room-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .lobby-topbar { flex-direction: column; gap: 8px; }
  .lobby-topbar .btn { width: 100%; }

  /* Room */
  .room-body {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .room-seats { gap: 8px; }
  .seat { width: 80px; padding: 8px; }
  .room-bar { padding: 8px 12px; gap: 8px; }
  .room-name { font-size: 0.9rem; }
  .room-bottom { padding: 8px 12px; }

  /* Gift bar */
  .room-gifts { gap: 4px; }
  .gift-item { padding: 4px 6px; }
  .gift-icon { font-size: 1.1rem; }

  /* Modals */
  .modal-overlay { padding: 12px; }
  .modal-panel { max-width: 100%; }
  .modal-wide { max-width: 100%; }
  .coin-grid { grid-template-columns: repeat(2, 1fr); }

  /* Game selects */
  .game-select { grid-template-columns: repeat(2, 1fr); }

  /* Cups */
  .cups-area { gap: 12px; padding: 20px 0; }
  .cup { width: 42px; height: 54px; }

  /* Werewolf slots */
  .ww-slots { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }

  /* Leaderboard */
  .lb-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .lb-tab { white-space: nowrap; }

  /* Spy players */
  .spy-players { gap: 8px; }
  .spy-btn { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.5rem; }
  .hero-stats { flex-direction: column; gap: 16px; }
  .game-select { grid-template-columns: repeat(2, 1fr); }
  .coin-grid { grid-template-columns: 1fr 1fr; }
}