/* ==========================================================================
   CROWNIXBET MOBILE APP UI
   ========================================================================== */

/* Responsive baseline: every element sizes itself including padding/border,
   and the page can never scroll horizontally on any phone width. This is
   what makes the layout adapt to each device instead of assuming one
   reference screen size. */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

:root {
  --bg-main: #0b0a1a;
  --bg-panel: #16132b;
  --bg-card: #201a3e;
  --bg-card-hover: #2a2250;
  --bg-header: #131024;

  --text-main: #ffffff;
  --text-muted: #8c89a7;

  --accent-yellow: #fcd535;
  --accent-blue: #2563eb;
  --accent-purple: #7c3aed;

  --border-radius: 12px;
  --border-radius-lg: 24px;
}

body.app-mode {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, sans-serif;
  overflow: hidden;
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Custom Scrollbar */
.app-mode ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.app-mode ::-webkit-scrollbar-track {
  background: transparent;
}

.app-mode ::-webkit-scrollbar-thumb {
  background: #322b5e;
  border-radius: 10px;
}

.app-mode ::-webkit-scrollbar-thumb:hover {
  background: #4a4185;
}

/* Promo Boxes */
.promo-row {
  display: flex;
  gap: 8px;
}

.promo-box {
  flex: 1;
  border-radius: 12px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.promo-box.blue {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}

.promo-box.orange {
  background: linear-gradient(180deg, #f97316, #c2410c);
}

.promo-box.purple {
  background: linear-gradient(180deg, #d946ef, #9333ea);
}

.promo-box img {
  width: 35px;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.refer-earn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, rgba(252, 213, 53, 0.15), rgba(252, 213, 53, 0.05));
  border: 1px solid rgba(252, 213, 53, 0.4);
  color: var(--accent-yellow);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.refer-earn:hover {
  background: rgba(252, 213, 53, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(252, 213, 53, 0.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-panel);
  border-radius: 20px;
  width: 90%;
  max-width: 450px;
  padding: 30px;
  position: relative;
  border: 1px solid rgba(252, 213, 53, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(252, 213, 53, 0.1);
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

/* Refer Modal Specifics */
.refer-header {
  text-align: center;
  margin-bottom: 24px;
}

.refer-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 15px rgba(252, 213, 53, 0.4));
}

.refer-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 8px 0;
}

.text-gold {
  color: var(--accent-yellow);
}

.refer-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.4;
}

.refer-tiers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.tier {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tier-friends {
  font-weight: 700;
  font-size: 0.95rem;
}

.tier-reward {
  color: var(--accent-yellow);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-vip {
  background: linear-gradient(90deg, #f97316, #c2410c);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
}

.refer-link-box {
  margin-bottom: 24px;
}

.link-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.link-input-group {
  display: flex;
  gap: 8px;
}

.link-input-group input {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: none;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.2);
}

.refer-share-btn {
  width: 100%;
  display: block;
  text-align: center;
  background: #25D366;
  color: white;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.refer-share-btn:hover {
  background: #1ebc5a;
}

/* Nav Menu (Sidebar Drawer) */
.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-nav-item:hover {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.sidebar-nav-item.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-left: 4px solid var(--accent-yellow);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 1.1rem;
}

.nav-badge {
  background: var(--accent-yellow);
  color: #000;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
}

.nav-chevron {
  font-size: 0.7rem;
  color: #555;
  transition: transform 0.3s;
}

.sidebar-nav-item[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.sidebar-dropdown {
  display: none;
  flex-direction: column;
  padding-left: 36px;
  margin-top: -2px;
  margin-bottom: 8px;
  gap: 6px;
}

.sidebar-dropdown.show {
  display: flex;
}

.dropdown-item {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
}

.dropdown-item:hover {
  color: var(--accent-yellow);
  background: var(--bg-card);
}

.sidebar-heading {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 10px;
  padding-left: 14px;
}

/* Bottom Nav (used by game-detail.html) */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0b0f19;
  border-top: 1px solid #1f253a;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 65px;
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #6a6f8a;
  font-size: 0.7rem;
  gap: 4px;
}

.nav-icon-wrapper {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.nav-item.active .nav-icon-wrapper {
  background: #00f0ff;
  color: #000;
}

/* ==========================================================================
   HOME PAGE (INDEX) MOBILE APP UI
   ========================================================================== */

.mobile-only-home {
  display: block;
  background-color: #05040a;
  height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
  padding-bottom: 120px;
  color: white;
  font-family: "Inter", sans-serif;
}

/* Mobile Header */
.mobile-home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #05040a;
}

.hamburger-icon,
.notification-bell svg {
  color: white;
}

.notification-bell {
  position: relative;
}

.bell-dot {
  position: absolute;
  top: -2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #05040a;
}

/* Wallet Card */
.mobile-wallet-card {
  margin: 0 15px 20px 15px;
  background: rgba(22, 19, 43, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.wallet-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-greeting {
  font-size: 0.75rem;
  color: #a0a0b8;
  margin-bottom: -4px;
}

.wallet-name {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.wallet-vip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(180, 83, 9, 0.2);
  color: #d97706;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  width: max-content;
}

.wallet-right {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: right;
  align-items: flex-end;
}

.wallet-balance-label {
  font-size: 0.75rem;
  color: #a0a0b8;
  margin-bottom: -4px;
}

.wallet-balance-amount {
  font-size: 1.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.coin-icon {
  font-size: 1.1rem;
}

.wallet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  width: 130px;
}

.wallet-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
}

.btn-deposit-gold {
  background: linear-gradient(90deg, #eab308, #d97706);
  color: white;
}

.btn-withdraw-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

/* Hero Banner */
.mobile-hero-banner {
  margin: 0 15px 20px 15px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(30, 10, 60, 1) 0%, rgba(60, 20, 100, 1) 100%);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  right: -20px;
  width: 60%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.5;
  mask-image: linear-gradient(to right, transparent, black);
  -webkit-mask-image: linear-gradient(to left, black, transparent);
  z-index: 1;
  transition: background-image 0.5s ease-in-out;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 65%;
}

.hero-text-large {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 8px;
}

.highlight-gold {
  color: #fcd535;
}

.hero-desc {
  font-size: 0.75rem;
  color: #d1d5db;
  margin-bottom: 16px;
  line-height: 1.4;
}

.hero-btn {
  background: linear-gradient(90deg, #fcd535, #f59e0b);
  color: black;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.75rem;
}

.hero-dots,
.games-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.dot.active {
  background: #fcd535;
  width: 12px;
  border-radius: 4px;
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 15px 30px 15px;
  background: rgba(22, 19, 43, 0.4);
  padding: 15px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  color: #a0a0b8;
  font-weight: 600;
}

.action-icon {
  width: 48px;
  height: 48px;
  background: rgba(252, 213, 53, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 15px 15px 15px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
}

.section-header a {
  color: #a0a0b8;
  font-size: 0.8rem;
  text-decoration: none;
}

/* Popular Games Grid */
.mobile-games-grid {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: calc(25% - 6px);
  /* Show 4 columns at once */
  gap: 8px;
  overflow-x: auto;
  margin: 0 0 10px 15px;
  padding-right: 15px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

.mobile-games-grid::-webkit-scrollbar {
  display: none;
}

.mobile-game-card {
  background: #12101f;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  scroll-snap-align: start;
}

.game-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.45rem;
  font-weight: 800;
  color: white;
  z-index: 2;
}

.game-badge.hot {
  background: #ef4444;
}

.game-badge.new {
  background: #10b981;
}

.img-wrapper {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
}

.img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-info {
  padding: 6px 4px;
  text-align: center;
}

.card-info .title {
  font-size: 0.6rem;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-info .subtitle {
  font-size: 0.45rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stats Footer */
.mobile-stats-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 30px 15px 20px 15px;
  background: rgba(22, 19, 43, 0.4);
  padding: 15px 0;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
  border-right: none;
}

.stat-value {
  font-size: 0.85rem;
  font-weight: 800;
}

.stat-label {
  font-size: 0.6rem;
  color: #a0a0b8;
}

/* V2 Bottom Nav */
.v2-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(9, 8, 18, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px 24px 0 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 15px);
  height: calc(65px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
}

.v2-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 0.65rem;
  font-weight: 600;
  text-decoration: none;
  gap: 4px;
  width: 20%;
  transition: color 0.25s ease;
}

.v2-bottom-nav .nav-item.active {
  color: #fcd535;
  font-weight: 700;
}

.v2-bottom-nav .nav-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.v2-bottom-nav .nav-icon-badge svg {
  width: 20px;
  height: 20px;
  transition: fill 0.25s ease;
}

.v2-bottom-nav .nav-item.active .nav-icon-badge {
  background: linear-gradient(135deg, #fcd535, #d97706);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.45);
  transform: translateY(-2px);
}

.v2-bottom-nav .nav-item.active .nav-icon-badge svg {
  fill: #fff;
}

.v2-bottom-nav .center-btn {
  position: relative;
  top: -15px;
}

.wallet-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fcd535, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 -5px 20px rgba(217, 119, 6, 0.4);
  border: 4px solid #090812;
  transition: transform 0.2s ease;
}

.v2-bottom-nav .nav-item:active .nav-icon-badge,
.v2-bottom-nav .center-btn:active .wallet-orb {
  transform: scale(0.9);
}

.v2-bottom-nav .nav-item.active:active .nav-icon-badge {
  transform: translateY(-2px) scale(0.9);
}

/* Mobile Sidebar */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: #110e26;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: left 0.3s ease;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.mobile-sidebar.open {
  left: 0;
}

.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.mobile-sidebar .sidebar-logo {
  height: 70px;
  object-fit: contain;
}

.sidebar-close {
  font-size: 28px;
  color: white;
  cursor: pointer;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-links a {
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-links a.active {
  color: #d8b4fe;
}


/* Notification Sidebar */
.notification-sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: 100%;
  background: #110e26;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: right 0.3s ease;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.notification-sidebar.open {
  right: 0;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.notif-header h2 {
  color: white;
  font-size: 18px;
  margin: 0;
}

.notif-close {
  font-size: 28px;
  color: white;
  cursor: pointer;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
}

.notif-item {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.notif-title {
  color: #d8b4fe;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.notif-desc {
  color: #a0a0b8;
  font-size: 12px;
  line-height: 1.4;
}

.notif-time {
  color: rgba(255, 255, 255, 0.3);
  font-size: 10px;
  margin-top: 6px;
  text-align: right;
}

/* Standardized Mobile Header */
.mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-header .menu-icon {
  cursor: pointer;
}

.mobile-header .menu-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.mobile-header .logo-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-header .logo-container img {
  height: 40px;
  object-fit: contain;
}

.mobile-header .bell-icon {
  position: relative;
  cursor: pointer;
}

.mobile-header .bell-icon svg {
  width: 24px;
  height: 24px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

.mobile-header .bell-icon .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-danger, #ef4444);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-bottom-nav .nav-item svg { fill: currentColor; }
