/* OyinHub Core CSS - Dark Mode, Mobile-First */
/* Uzbek-inspired palette: deep indigo + gold + teal accent */

:root {
  --bg-base:      #0e0e18;
  --bg-card:      #181828;
  --bg-card2:     #1e1e32;
  --bg-nav:       #131320;
  --accent:       #c8a84b;   /* Samarkand gold */
  --accent2:      #2dd4bf;   /* teal */
  --accent3:      #8b5cf6;   /* purple */
  --danger:       #ef4444;
  --success:      #22c55e;
  --text-primary: #f0ece4;
  --text-secondary:#9b97a8;
  --text-muted:   #5c5872;
  --border:       #2a2a40;
  --border2:      #3a3a55;
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
  --radius:       14px;
  --radius-sm:    8px;
  --font-main:    'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition:   0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ─── Typography ─── */
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p  { line-height: 1.6; color: var(--text-secondary); }

/* ─── Layout ─── */
.container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 16px;
}

.page {
  display: none;
  padding-bottom: 80px; /* nav height */
  min-height: 100vh;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── Top Header ─── */
.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-header .logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.top-header .header-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card2);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--accent2);
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ─── Bottom Navigation ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition);
  font-size: 0.68rem;
  font-weight: 500;
  background: none;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); }
.nav-item:active { opacity: 0.7; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 10px; }

/* ─── Game Grid ─── */
.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 0;
}
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.game-card:active { transform: scale(0.96); }
.game-card:hover { border-color: var(--border2); }
.game-card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  position: relative;
}
.game-card-thumb.bomba       { background: linear-gradient(135deg, #1a0a00, #3d1a00); }
.game-card-thumb.quiz        { background: linear-gradient(135deg, #001a0e, #003322); }
.game-card-thumb.life        { background: linear-gradient(135deg, #0a001a, #1a0040); }
.game-card-thumb.puzzle      { background: linear-gradient(135deg, #001a1a, #003344); }
.game-card-thumb.sultan      { background: linear-gradient(135deg, #0a0800, #2a1f00); }
.game-card-thumb.ritmouz     { background: linear-gradient(135deg, #1a0014, #3d0030); }
.game-card-thumb.tanovar     { background: linear-gradient(135deg, #1a0a00, #3d2200); }
.game-card-thumb.qovunim     { background: linear-gradient(135deg, #001a00, #003300); }
.game-card-thumb.oshustasi   { background: linear-gradient(135deg, #1a0800, #3d1800); }
.game-card-thumb.qahramonlar { background: linear-gradient(135deg, #1a0000, #3d0000); }
.game-card-thumb.choyxona    { background: linear-gradient(135deg, #001400, #002800); }
.game-card-info { padding: 10px 12px; }
.game-card-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.game-card-desc  { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  outline: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  width: 100%;
}
.btn:active { opacity: 0.8; transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #000; }
.btn-secondary { background: var(--bg-card2); color: var(--text-primary); border: 1px solid var(--border2); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-teal    { background: var(--accent2); color: #000; }
.btn-ghost   { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; width: auto; }

/* ─── Wallet / Balance ─── */
.wallet-hero {
  background: linear-gradient(135deg, #1a1530 0%, #0e1a2e 100%);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.wallet-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: var(--accent);
  opacity: 0.06;
  border-radius: 50%;
}
.wallet-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.08em; }
.wallet-amount { font-size: 2.2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.wallet-unit   { font-size: 0.9rem; color: var(--accent); opacity: 0.7; margin-left: 4px; }
.wallet-stats  { display: flex; justify-content: center; gap: 24px; margin-top: 14px; }
.wallet-stat-item { text-align: center; }
.wallet-stat-val  { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.wallet-stat-lbl  { font-size: 0.68rem; color: var(--text-muted); }

/* ─── Ranking ─── */
.rank-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.rank-tab {
  flex: 1;
  padding: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.rank-tab.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.rank-item.me { border-color: var(--accent); background: rgba(200,168,75,0.08); }
.rank-num  { width: 24px; text-align: center; font-weight: 700; font-size: 0.85rem; }
.rank-num.gold   { color: #ffd700; }
.rank-num.silver { color: #c0c0c0; }
.rank-num.bronze { color: #cd7f32; }
.rank-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card2); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.rank-name  { flex: 1; font-size: 0.85rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-size: 0.85rem; font-weight: 700; color: var(--accent2); }

/* ─── Profile ─── */
.profile-header {
  text-align: center;
  padding: 20px 0 16px;
}
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bg-card2);
  border: 3px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 10px;
}
.profile-name { font-size: 1.1rem; font-weight: 700; }
.profile-level { font-size: 0.78rem; color: var(--accent); margin-top: 2px; }
.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.profile-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.profile-stat-val { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.profile-stat-lbl { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

/* ─── Referral Box ─── */
.referral-box {
  background: linear-gradient(135deg, #1a1030, #0e1530);
  border: 1px solid var(--accent3);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 10px;
}
.referral-code-display {
  background: var(--bg-base);
  border: 1px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
}
.referral-code-text { font-size: 1.2rem; font-weight: 800; letter-spacing: 0.1em; color: var(--accent); }

/* ─── Withdraw ─── */
.withdraw-option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
  margin-bottom: 8px;
  -webkit-tap-highlight-color: transparent;
}
.withdraw-option:hover, .withdraw-option.selected { border-color: var(--accent); }
.withdraw-option-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.withdraw-option-info { flex: 1; }
.withdraw-option-name { font-size: 0.9rem; font-weight: 600; }
.withdraw-option-detail { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

/* ─── Language Switcher ─── */
.lang-switcher {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lang-btn {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.lang-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 700; }

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: calc(100% - 32px);
  max-width: 400px;
}
.toast {
  background: var(--bg-card2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  text-align: center;
  animation: toastIn 0.2s ease, toastOut 0.2s ease 2.5s forwards;
  box-shadow: var(--shadow);
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
.toast.info    { border-color: var(--accent2); color: var(--accent2); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ─── Game iframe ─── */
.game-view {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  flex-direction: column;
}
.game-view.active { display: flex; }
.game-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.game-topbar-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.game-topbar-title { font-size: 0.95rem; font-weight: 700; flex: 1; }
.game-topbar-pts { font-size: 0.8rem; color: var(--accent); font-weight: 700; background: var(--bg-card); border: 1px solid var(--border); padding: 3px 9px; border-radius: 20px; }
.game-frame { flex: 1; border: none; width: 100%; background: #000; }

/* ─── Banners / Promo ─── */
.promo-banner {
  background: linear-gradient(135deg, #1a1020 0%, #0d1a10 100%);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.promo-icon { font-size: 1.8rem; }
.promo-text { flex: 1; }
.promo-title { font-size: 0.85rem; font-weight: 700; }
.promo-desc  { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.promo-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* ─── Section Headers ─── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 18px;
}
.section-title { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }
.section-link  { font-size: 0.75rem; color: var(--accent2); cursor: pointer; }

/* ─── Login Modal ─── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-sheet {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  width: 100%;
  max-width: 440px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.modal-desc  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 18px; }
.login-options { display: flex; flex-direction: column; gap: 8px; }
.login-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card2);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.login-option:hover { border-color: var(--border2); }
.login-option svg, .login-option span.icon { font-size: 1.2rem; width: 24px; text-align: center; }

/* ─── Input ─── */
.input-group { margin-bottom: 12px; }
.input-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.input-field {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}
.input-field:focus { border-color: var(--accent); }

/* ─── Badges / Tags ─── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
}
.badge-gold    { background: rgba(200,168,75,0.15); color: var(--accent); }
.badge-teal    { background: rgba(45,212,191,0.12); color: var(--accent2); }
.badge-purple  { background: rgba(139,92,246,0.12); color: var(--accent3); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--danger);  }

/* ─── Divider ─── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ─── Utility ─── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); font-size: 0.8rem; }
.text-accent { color: var(--accent); }
.text-teal   { color: var(--accent2); }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ─── Pulse animation for live elements ─── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
  display: inline-block;
}

/* ─── Responsive: tablet and up ─── */
@media (min-width: 480px) {
  body { background: #070710; }
  .platform-wrapper {
    max-width: 440px;
    margin: 0 auto;
    background: var(--bg-base);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
  }
  .bottom-nav { max-width: 440px; left: 50%; transform: translateX(-50%); }
  .toast-container { max-width: 440px; }
}
