/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green-50: #0a3d1e;
  --green-100: #0d4f26;
  --green-200: #116330;
  --green-300: #15773b;
  --green-400: #1a8a47;
  --green-500: #1f9d52;
  --green-bg: #0a2a14;
  --green-surface: #0d3b1f;
  --green-surface-light: #11502a;
  --green-border: #1a6330;

  --gold-400: #d6a000;
  --gold-500: #f5b800;
  --gold-600: #ffc107;
  --gold-700: #ffd24a;

  --red: #e74c3c;
  --blue: #3498db;
  --orange: #ff6b35;

  --white: #ffffff;
  --n0: #ffffff;
  --n50: #e8e8e8;
  --n100: #d0d0d0;
  --n200: #a0a0a0;
  --n300: #707070;
  --n800: #121212;
  --n900: #0a0a0a;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 4px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.35);
  --shadow-gold: 0 2px 8px rgba(255,193,7,0.4);
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--green-bg);
  color: var(--n0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ===== Views ===== */
.view { display: none; flex: 1; flex-direction: column; padding-bottom: 70px; }
.view.active { display: flex; }

/* ===== Header ===== */
.app-header {
  background: var(--green-surface);
  padding: 12px 20px 16px;
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; z-index: 100;
}

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

.logo { font-size: 28px; font-weight: 800; letter-spacing: 1px; }
.logo-white { color: var(--n0); }
.logo-gold { color: var(--gold-600); }

.stars-badge {
  display: flex; align-items: center;
  background: var(--green-100);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold-500);
}
.star-icon { color: var(--gold-600); font-size: 14px; margin-right: 4px; }
.stars-text { color: var(--gold-700); font-size: 14px; font-weight: 700; }

.header-titles h1 { font-size: 22px; font-weight: 700; color: var(--n0); }
.header-titles p { font-size: 13px; color: var(--n200); margin-top: 2px; }

/* ===== Game Header ===== */
.game-header .header-top { margin-bottom: 8px; }
.back-btn {
  width: 36px; height: 36px; border-radius: 18px;
  background: var(--green-200); color: var(--n0);
  border: none; font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.game-title { font-size: 18px; font-weight: 700; color: var(--n0); flex: 1; text-align: center; }

.game-timer-row { display: flex; justify-content: center; }
.timer-badge {
  background: var(--red); color: #fff;
  padding: 4px 16px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 700;
}

/* ===== Content ===== */
.content { flex: 1; padding: 20px; }

/* ===== Live Ticker ===== */
.live-ticker {
  display: flex; align-items: center;
  background: var(--green-surface);
  border-radius: var(--radius-pill);
  padding: 8px 16px; margin-bottom: 24px;
  border: 1px solid var(--green-border);
}
.live-dot { color: var(--red); font-size: 10px; margin-right: 8px; animation: blink 1.5s infinite; }
.live-text { color: var(--n100); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ===== Sections ===== */
.section-title { font-size: 18px; font-weight: 700; color: var(--n0); margin-bottom: 12px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-count { font-size: 13px; color: var(--gold-600); font-weight: 600; }

/* ===== Promos ===== */
.promo-row { display: flex; gap: 8px; margin-bottom: 24px; }
.promo-card {
  flex: 1; background: var(--green-surface);
  border-radius: var(--radius-md); padding: 14px;
  text-align: center; border: 1px solid var(--green-border);
}
.promo-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.promo-title { font-size: 13px; font-weight: 700; color: var(--gold-600); }
.promo-subtitle { font-size: 11px; color: var(--n200); margin-top: 2px; }

/* ===== Games Grid ===== */
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card {
  background: var(--green-surface-light);
  border-radius: var(--radius-lg); padding: 16px;
  text-align: center; border: 1px solid var(--green-border);
  position: relative; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
}
.game-card:active { transform: scale(0.96); box-shadow: var(--shadow-sm); }
.game-badge {
  position: absolute; top: 8px; right: 8px;
  padding: 2px 6px; border-radius: var(--radius-sm);
  color: #fff; font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
}
.game-icon-wrap {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  background: var(--green-200); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 8px; border: 1.5px solid var(--gold-500);
}
.game-icon { font-size: 18px; font-weight: 800; color: var(--gold-600); }
.game-name { font-size: 14px; font-weight: 700; color: var(--n0); }
.game-sub { font-size: 11px; color: var(--n200); margin-top: 2px; min-height: 28px; }
.game-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.game-timer { background: var(--green-100); padding: 3px 6px; border-radius: var(--radius-sm); color: var(--n0); font-size: 11px; font-weight: 600; }
.game-play { background: var(--gold-600); padding: 4px 8px; border-radius: var(--radius-pill); color: var(--n900); font-size: 11px; font-weight: 700; }

/* ===== Leaderboard Mini ===== */
.leaderboard-mini {
  background: var(--green-surface); border-radius: var(--radius-lg);
  padding: 16px; border: 1px solid var(--green-border); box-shadow: var(--shadow-sm);
}
.leader-row { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--green-border); }
.leader-row:last-child { border-bottom: none; }
.leader-rank { font-size: 15px; font-weight: 700; color: var(--gold-600); width: 36px; }
.leader-name { font-size: 15px; color: var(--n100); flex: 1; font-weight: 600; }
.leader-score { font-size: 15px; color: var(--gold-600); font-weight: 700; }

/* ===== Footer ===== */
.footer { margin-top: 32px; text-align: center; padding: 0 20px; }
.footer-title { font-size: 15px; font-weight: 700; color: var(--gold-600); margin-bottom: 4px; }
.footer-text { font-size: 11px; color: var(--n200); line-height: 18px; }

/* ===== Bottom Nav ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: var(--green-surface);
  border-top: 1px solid var(--green-border);
  display: flex; height: 60px; z-index: 200;
}
.nav-btn {
  flex: 1; background: none; border: none; color: var(--n200);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; transition: color 0.2s;
}
.nav-btn span { font-size: 11px; font-weight: 600; }
.nav-btn.active { color: var(--gold-600); }

/* ===== Leaderboard Full ===== */
.leader-card {
  display: flex; align-items: center;
  background: var(--green-surface); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 8px; border: 1px solid var(--green-border);
}
.leader-card.top { border-color: var(--gold-500); border-width: 2px; box-shadow: var(--shadow-gold); }
.rank-badge {
  width: 40px; height: 40px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin-right: 16px; font-size: 15px; font-weight: 800; color: var(--n900);
}
.leader-info { flex: 1; }
.leader-info .name { font-size: 15px; font-weight: 700; color: var(--n0); }
.leader-info .game { font-size: 12px; color: var(--n200); margin-top: 2px; }
.leader-score-big { font-size: 18px; font-weight: 800; color: var(--gold-600); }

/* ===== Rewards ===== */
.total-card {
  background: var(--green-surface); border-radius: var(--radius-xl);
  padding: 32px; text-align: center; margin-bottom: 24px;
  border: 2px solid var(--gold-500); box-shadow: var(--shadow-gold);
}
.total-label { font-size: 15px; color: var(--n200); font-weight: 600; }
.total-value { font-size: 34px; font-weight: 800; color: var(--gold-600); margin: 4px 0; }
.total-note { font-size: 11px; color: var(--n200); }

.reward-card {
  display: flex; align-items: center;
  background: var(--green-surface); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 8px; border: 1px solid var(--green-border);
}
.reward-icon-wrap {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--green-200); display: flex; align-items: center; justify-content: center;
  margin-right: 16px; font-size: 24px;
}
.reward-info { flex: 1; }
.reward-info .title { font-size: 15px; font-weight: 700; color: var(--n0); }
.reward-info .sub { font-size: 12px; color: var(--n200); margin-top: 2px; }
.reward-info .amount { font-size: 13px; color: var(--gold-600); font-weight: 700; margin-top: 4px; }
.claim-btn {
  background: var(--gold-600); color: var(--n900);
  padding: 8px 16px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 700; border: none; cursor: pointer;
}
.claim-btn.claimed { background: var(--n300); color: var(--n50); }
.claim-btn:disabled { cursor: default; }

/* ===== Game Content ===== */
.game-content { display: flex; flex-direction: column; align-items: center; }
.game-tagline { font-size: 13px; color: var(--n200); text-align: center; margin-bottom: 20px; line-height: 20px; }

/* Slot Machine */
.slot-machine {
  background: var(--green-100); border-radius: var(--radius-xl);
  padding: 16px; border: 3px solid var(--gold-500); width: 100%;
  text-align: center; box-shadow: var(--shadow-lg);
}
.slot-machine-title { font-size: 28px; font-weight: 900; color: var(--gold-600); letter-spacing: 2px; margin-bottom: 8px; }
.reels-container { display: flex; justify-content: center; background: var(--n900); border-radius: var(--radius-lg); padding: 16px; }
.reel {
  width: 70px; height: 90px; margin: 0 4px;
  background: var(--n800); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gold-500); font-size: 42px; transition: opacity 0.3s;
}
.reel.spinning { opacity: 0.3; }
.slot-bottom { display: flex; justify-content: space-between; margin-top: 8px; }
.slot-label { font-size: 11px; color: var(--gold-600); font-weight: 700; }

/* Result area */
.result-area { margin-top: 20px; text-align: center; min-height: 50px; }
.result-text { font-size: 16px; font-weight: 700; color: var(--n100); }
.result-text.win { color: var(--gold-600); }
.result-placeholder { font-size: 14px; color: var(--n200); }
.win-amount { font-size: 24px; font-weight: 800; color: var(--gold-600); margin-top: 4px; }
.result-area.pop { animation: pop 0.4s ease; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* Bet selector */
.bet-row { display: flex; align-items: center; margin-top: 20px; margin-bottom: 12px; flex-wrap: wrap; gap: 4px; }
.bet-label { font-size: 13px; color: var(--n100); font-weight: 600; margin-right: 8px; }
.bet-option {
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--green-surface); border: 1px solid var(--green-border);
  color: var(--n100); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.bet-option.active { background: var(--gold-600); border-color: var(--gold-600); color: var(--n900); font-weight: 700; }

/* Action buttons */
.spin-btn, .draw-btn, .deal-btn {
  background: var(--gold-600); color: var(--n900);
  padding: 14px 40px; border-radius: var(--radius-pill);
  font-size: 20px; font-weight: 800; letter-spacing: 2px;
  border: none; cursor: pointer; margin-top: 12px; box-shadow: var(--shadow-gold); transition: opacity 0.2s;
}
.spin-btn:disabled, .draw-btn:disabled, .deal-btn:disabled { opacity: 0.5; }

/* Cards */
.cards-row { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.card {
  width: 70px; height: 100px; background: #fff; border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid var(--gold-500); box-shadow: var(--shadow-sm); position: relative;
  transition: transform 0.2s;
}
.card.red { color: var(--red); }
.card.black { color: var(--n900); }
.card-back {
  width: 70px; height: 100px; background: var(--green-200); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gold-500); box-shadow: var(--shadow-sm);
  font-size: 28px; color: var(--gold-600);
}
.card-top { font-size: 16px; font-weight: 800; position: absolute; top: 4px; left: 6px; }
.card-suit-big { font-size: 30px; }
.card-bottom { font-size: 16px; font-weight: 800; position: absolute; bottom: 4px; right: 6px; transform: rotate(180deg); }

.card.selectable { cursor: pointer; }
.card.selected { border-color: var(--gold-600); border-width: 3px; transform: translateY(-8px); }

/* Choice buttons */
.choice-row { display: flex; gap: 8px; width: 100%; margin-bottom: 20px; }
.choice-btn {
  flex: 1; background: var(--green-surface); border-radius: var(--radius-md);
  padding: 14px 0; text-align: center; border: 2px solid var(--green-border);
  cursor: pointer; transition: all 0.2s;
}
.choice-btn.active { border-color: transparent; }
.choice-btn .label { font-size: 14px; font-weight: 700; color: var(--n0); }
.choice-btn.active .label { color: var(--n900); }
.choice-btn .sub { font-size: 11px; color: var(--n200); margin-top: 2px; }
.choice-btn.active .sub { color: var(--n900); }

/* Total display */
.total-display { text-align: center; margin: 12px 0; }
.total-display .label { font-size: 11px; color: var(--n200); }
.total-display .value { font-size: 28px; font-weight: 800; color: var(--gold-600); }

/* VS divider */
.vs-divider { display: flex; align-items: center; margin: 8px 0; width: 60%; margin-left: auto; margin-right: auto; }
.vs-line { flex: 1; height: 1px; background: var(--green-border); }
.vs-text { color: var(--gold-600); font-size: 13px; font-weight: 800; margin: 0 8px; }

/* Side selector */
.side-row { display: flex; gap: 6px; width: 100%; margin-bottom: 16px; }
.side-btn {
  flex: 1; background: var(--green-surface); border-radius: var(--radius-md);
  padding: 10px 0; text-align: center; border: 2px solid var(--green-border);
  cursor: pointer; transition: all 0.2s;
}
.side-btn.active { border-color: transparent; }
.side-btn .label { font-size: 12px; font-weight: 700; color: var(--n0); }
.side-btn.active .label { color: var(--n900); }
.side-btn .sub { font-size: 11px; color: var(--n200); margin-top: 2px; }
.side-btn.active .sub { color: var(--n900); }

/* Secondary buttons */
.action-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn-secondary {
  background: var(--green-surface); border: 1.5px solid var(--gold-500);
  color: var(--gold-600); padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 700; border: none; cursor: pointer;
}
.btn-primary-sm {
  background: var(--gold-600); color: var(--n900);
  padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 800; border: none; cursor: pointer; box-shadow: var(--shadow-gold);
}

/* Hand area */
.hand-area { width: 100%; margin-bottom: 8px; }
.hand-list { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.selected-info { font-size: 12px; color: var(--gold-600); font-weight: 600; margin-top: 4px; }
.empty-hand { text-align: center; padding: 40px 0; color: var(--n200); font-size: 15px; }

/* Alert toast */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: var(--green-surface); color: var(--gold-600);
  padding: 12px 24px; border-radius: var(--radius-pill);
  border: 1px solid var(--gold-500); box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 600; z-index: 999;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Responsive */
@media (max-width: 360px) {
  .games-grid { gap: 8px; }
  .game-card { padding: 12px; }
  .reel { width: 60px; height: 80px; font-size: 36px; }
  .card, .card-back { width: 60px; height: 90px; }
  .card-suit-big { font-size: 26px; }
}
