:root {
  --primary: #FFD700; /* Golden */
  --primary-rgb: 255, 215, 0;
  --bg-dark: #0F1218;
  --card-bg: #1E222B;
  --text-white: #FFFFFF;
  --text-muted: #8E96A3;
  --accent-red: #FF4D4F;
  --accent-green: #52C41A;
  --accent-violet: #9254DE;
  --border-color: #2D343F;
  --gradient-gold: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
  --gradient-dark: linear-gradient(180deg, #1E222B 0%, #0F1218 100%);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Typography */
.gold-text {
  color: var(--primary);
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
}

/* Layout */
.app-container {
  width: 100%;
  max-width: 500px; /* Mobile focused max width */
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  padding-bottom: calc(70px + var(--safe-area-bottom));
}

/* Navbar */
.top-nav {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
}

.logo span {
  color: var(--text-white);
}

.logo span.hub {
  color: var(--primary);
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: 70px;
  background: #161A21;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border-color);
  z-index: 1000;
  padding-bottom: var(--safe-area-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  transition: 0.3s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 4px;
}

/* Cards & Sections */
.balance-card {
  margin: 16px;
  padding: 24px;
  background: var(--gradient-gold);
  border-radius: 16px;
  color: #000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 10px 20px rgba(184, 134, 11, 0.2);
}

.balance-label {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-amount {
  font-size: 32px;
  font-weight: 800;
}

.balance-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  transition: 0.2s;
}

.btn-white {
  background: #fff;
  color: #000;
}

.btn-dark {
  background: #000;
  color: #fff;
}

.btn-gold {
  background: var(--gradient-gold);
  color: #000;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-white);
}

/* Game Grid */
.section-title {
  padding: 0 16px;
  margin: 24px 0 16px;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}

.game-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1/1.2;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.game-card:active {
  transform: scale(0.96);
}

.game-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #1E222B, #2D343F);
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.game-name {
  font-weight: 700;
  font-size: 16px;
}

.game-tag {
  font-size: 10px;
  background: var(--primary);
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  width: fit-content;
  margin-bottom: 4px;
}

/* Wingo Specific Styles */
.wingo-header {
  background: var(--card-bg);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.timer-box {
  text-align: center;
}

.timer-label {
  font-size: 12px;
  color: var(--text-muted);
}

.timer-countdown {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-red);
  font-family: monospace;
}

.wingo-tabs {
  display: flex;
  background: var(--card-bg);
  padding: 8px;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.wingo-tab {
  padding: 8px 16px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: #2D343F;
  cursor: pointer;
  text-decoration: none;
}

.wingo-tab.active {
  background: var(--primary);
  color: #000;
}

.bet-options {
  padding: 16px;
  background: var(--card-bg);
  margin-top: 1px;
}

.color-bet-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.bet-btn {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  color: white;
  cursor: pointer;
}

.bet-green { background: var(--accent-green); }
.bet-violet { background: var(--accent-violet); }
.bet-red { background: var(--accent-red); }

.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.num-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #2D343F;
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
}

.size-bet-row {
  display: flex;
  gap: 10px;
}

.bet-big { background: #FF9900; }
.bet-small { background: #4D79FF; }

/* History Table */
.history-section {
  padding: 16px;
}

.history-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.history-tab {
  padding: 12px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
}

.history-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-size: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

/* Aviator UI */
.aviator-canvas {
  width: 100%;
  height: 240px;
  background: #05070A;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  margin: 16px;
  width: calc(100% - 32px);
  border: 2px solid #1e222b;
}

.plane-path {
  position: absolute;
  bottom: 20px;
  left: 20px;
}

.multiplier-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: #fff;
}

/* Popup/Modal */
.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: 2000;
}

.result-popup {
  width: 85%;
  max-width: 400px;
  border-radius: 24px;
  overflow: hidden;
  text-align: center;
  animation: popup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popup {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.result-popup.win {
  background: var(--gradient-gold);
  color: #000;
}

.result-popup.loss {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid var(--border-color);
}

.popup-content {
  padding: 32px 24px;
}

.popup-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 16px;
}

.popup-amount {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px;
  background: #2D343F;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Profile Section */
.profile-header {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-large {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--gradient-gold);
  border: 3px solid #fff;
}

.user-id {
  font-size: 14px;
  color: var(--text-muted);
}

/* Utils */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-16 { margin-top: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }

/* Admin Styles */
.admin-sidebar {
  width: 260px;
  background: #111419;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  border-right: 1px solid var(--border-color);
}

.admin-content {
  margin-left: 260px;
  padding: 32px;
}

.stat-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pending { background: #FF9900; color: #000; }
.badge-success { background: var(--accent-green); color: #fff; }
.badge-danger { background: var(--accent-red); color: #fff; }
