:root {
  --bg-dark: #0d0d1a;
  --bg-card: #161630;
  --bg-panel: #1a1a2e;
  --gold: #c9a84c;
  --gold-light: #d4af37;
  --gold-dim: #8a7533;
  --navy: #1e2a5a;
  --text: #ffffff;
  --text-dim: #a0a0b0;
  --text-muted: #6a6a7a;
  --border: rgba(201, 168, 76, 0.2);
  --glow-gold: rgba(201, 168, 76, 0.15);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overscroll-behavior: none;
}

/* ============ PROMO SCREEN ============ */

#promo-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 24px 32px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(201, 168, 76, 0.05) 0%, transparent 50%),
    linear-gradient(180deg, #0d0d1a 0%, #111128 50%, #0d0d1a 100%);
  overflow-y: auto;
}

.logo-container {
  width: 88px;
  height: 88px;
  background: #ffffff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 40px var(--glow-gold);
  margin-bottom: 24px;
  flex-shrink: 0;
}

.logo-container img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.promo-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.promo-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 28px;
}

.promo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gold-light);
  margin-bottom: 28px;
  flex-shrink: 0;
}

.promo-badge::before {
  content: '\2605';
  font-size: 14px;
}

.install-btn {
  width: 100%;
  max-width: 320px;
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  color: #0d0d1a;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow:
    0 4px 16px rgba(201, 168, 76, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.install-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(201, 168, 76, 0.2);
}

.install-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 32px;
  text-align: center;
}

/* Welcome bonus banner */
.bonus-banner {
  width: 100%;
  max-width: 340px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.bonus-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.bonus-amount {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.bonus-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Games grid */
.games-section {
  width: 100%;
  max-width: 340px;
  margin-bottom: 20px;
}

.games-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-dim);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.game-card {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

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

.game-card .game-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

/* Stats bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.promo-footer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
  padding-top: 16px;
  flex-shrink: 0;
}

/* ============ GAME SCREEN ============ */

#game-screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--bg-panel) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 48px;
}

.game-header img {
  height: 28px;
  object-fit: contain;
}

.game-iframe-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.game-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

/* ============ LOADING OVERLAY ============ */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.4s;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 64px;
  height: 64px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1.5s ease-in-out infinite;
  margin-bottom: 20px;
}

.loading-logo img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-panel);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ IOS INSTALL GUIDE ============ */

#ios-guide {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999;
  padding: 40px 24px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ios-guide.visible {
  display: flex;
}

.ios-guide-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 320px;
  text-align: center;
}

.ios-guide-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.ios-guide-step {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 14px;
  color: var(--text-dim);
}

.ios-guide-step:last-child {
  border-bottom: none;
}

.ios-guide-step .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.ios-guide-close {
  margin-top: 16px;
  padding: 12px 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}

/* ============ UTILS ============ */

.hidden { display: none !important; }

@media (min-width: 480px) {
  #promo-screen {
    padding-top: 60px;
  }
  .logo-container {
    width: 100px;
    height: 100px;
  }
  .logo-container img {
    width: 80px;
    height: 80px;
  }
  .promo-title {
    font-size: 28px;
  }
}
