*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:      #0a0a0f;
  --surface: #12121a;
  --surface2:#1a1a26;
  --border:  #2a2a3d;
  --text:    #e8e8ff;
  --muted:   #7a7a9a;
  --gold:    #ffd700;
  --gold2:   #ffb300;
  --green:   #22c55e;
  --red:     #ef4444;
  --accent:  #a78bfa;
  --mono: 'SFMono-Regular', Consolas, monospace;
}
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.gold { color: var(--gold); }
#main { flex: 1; }
.page { display: none; }
.page.active { display: block; }

/* Header */
.header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.hdr-inner { display: flex; align-items: center; gap: 16px; height: 58px; }
.logo-link { display: flex; align-items: center; gap: 9px; text-decoration: none; flex-shrink: 0; }
.logo-img { width: 34px; height: 34px; }
.logo-text { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.nav { display: flex; gap: 2px; }
.nav-link { color: var(--muted); text-decoration: none; padding: 5px 12px; border-radius: 6px; font-size: 0.875rem; transition: color .12s, background .12s; }
.nav-link:hover, .nav-link.active { color: var(--gold); background: rgba(255,215,0,.08); }
.player-bar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.addr-label { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.addr-input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 5px 10px; border-radius: 6px; font-size: 0.78rem; font-family: var(--mono); width: 200px; outline: none; }
.addr-input:focus { border-color: var(--gold); }
.btn-sm { background: var(--gold); color: #0a0a0f; border: none; padding: 5px 12px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; cursor: pointer; }

/* Hero */
.hero { background: linear-gradient(135deg, #1a0a2e 0%, #0a1a3e 50%, #1a1a0a 100%); padding: 36px 0 28px; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 6px; }
.hero p { color: rgba(255,255,255,.55); font-size: 0.95rem; }
.stats-bar { display: flex; gap: 0; margin-top: 24px; background: rgba(0,0,0,.3); border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.stat { flex: 1; padding: 14px 20px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-val { font-size: 1.3rem; font-weight: 700; }
.stat-lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* Game grid */
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 32px 0; }
.game-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; display: flex; flex-direction: column; }
.game-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.game-img-wrap { position: relative; }
.game-img-wrap img { width: 100%; height: 180px; object-fit: cover; display: block; }
.game-badge { position: absolute; top: 10px; right: 10px; background: var(--gold); color: #0a0a0f; font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.game-info { padding: 14px 16px; }
.game-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.game-info p { font-size: 0.82rem; color: var(--muted); }

/* Provably fair box */
.fair-box { background: rgba(167,139,250,.06); border: 1px solid rgba(167,139,250,.2); border-radius: 10px; padding: 18px 20px; margin-bottom: 32px; }
.fair-box h4 { color: var(--accent); margin-bottom: 6px; font-size: 0.9rem; }
.fair-box p { font-size: 0.83rem; color: var(--muted); line-height: 1.6; }
.fair-box code { font-family: var(--mono); font-size: 0.78rem; background: var(--surface2); padding: 1px 5px; border-radius: 3px; color: var(--text); }

/* Game page */
.game-page { padding: 24px 0 40px; }
.gp-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.back-link:hover { color: var(--gold); }
.gp-header h2 { font-size: 1.4rem; font-weight: 700; }
.gp-body { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }

/* Bet panel */
.bet-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.field-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.bet-input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 9px 13px; border-radius: 7px; font-size: 1rem; outline: none; width: 100%; }
.bet-input:focus { border-color: var(--gold); }
.bet-select { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 9px 13px; border-radius: 7px; font-size: 0.9rem; outline: none; width: 100%; cursor: pointer; }
.btn-play { background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #0a0a0f; border: none; padding: 12px; border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity .12s; }
.btn-play:hover { opacity: .88; }
.btn-play:disabled { opacity: .4; cursor: not-allowed; }
.bet-status { font-size: 0.82rem; line-height: 1.55; }
.bet-status.pending { color: var(--muted); }
.bet-status.win { color: var(--green); }
.bet-status.lose { color: var(--red); }
.bet-status.error { color: var(--red); }
.game-msg { text-align: center; font-size: 1.1rem; font-weight: 700; min-height: 28px; margin-top: 10px; }
.game-msg.win { color: var(--green); }
.game-msg.lose { color: var(--red); }
.game-msg.push { color: var(--gold); }

/* Slots */
.machine { background: linear-gradient(135deg, #1a0a2e, #12121a); border: 2px solid var(--gold); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.reels { display: flex; gap: 12px; }
.reel { width: 90px; height: 90px; background: var(--surface2); border: 2px solid var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 3rem; transition: transform .15s; }
.reel.spin { animation: reel-spin .4s ease-out; }
@keyframes reel-spin { 0%{transform:translateY(-20px);opacity:0} 100%{transform:translateY(0);opacity:1} }
.pay-table { background: var(--surface2); border-radius: 8px; padding: 10px 14px; }
.pt-row { display: flex; justify-content: space-between; gap: 20px; font-size: 0.85rem; padding: 3px 0; }
.pt-row span:last-child { color: var(--gold); font-weight: 700; }

/* Blackjack */
.bj-table { background: radial-gradient(ellipse at 50% 40%, #0d3d1a 0%, #051509 100%); border: 2px solid #2d5a1b; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 20px; min-height: 380px; }
.bj-zone { display: flex; flex-direction: column; gap: 8px; }
.zone-lbl { font-size: 0.75rem; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .08em; }
.card-row { display: flex; gap: 8px; flex-wrap: wrap; min-height: 70px; }
.card { width: 52px; height: 72px; background: white; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 700; color: #111; box-shadow: 0 2px 8px rgba(0,0,0,.5); flex-shrink: 0; }
.card.hearts, .card.diamonds { color: #c0392b; }
.card.back { background: linear-gradient(135deg, #1a237e, #311b92); color: white; font-size: 1.4rem; }
.score { font-size: 0.85rem; color: rgba(255,255,255,.6); }
.bj-actions { display: flex; gap: 12px; }
.btn-bj { flex: 1; background: var(--gold); color: #0a0a0f; border: none; padding: 10px; border-radius: 7px; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.btn-bj.btn-stand { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-bj:hover { opacity: .85; }

/* Roulette */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
#wheelCanvas { border-radius: 50%; border: 3px solid var(--gold); }
.wheel-result { font-size: 1.6rem; font-weight: 800; min-height: 40px; }
.rt-value-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.rt-val-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text); padding: 7px 4px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; text-align: center; transition: background .1s, border-color .1s; }
.rt-val-btn:hover, .rt-val-btn.sel { background: var(--gold); color: #0a0a0f; border-color: var(--gold); }
.rt-val-btn.red-btn { color: var(--red); }
.rt-val-btn.black-btn { color: #aaa; }

/* ═══════════════════ SLOT MACHINE ═══════════════════ */
.slot-wrap { display: flex; flex-direction: column; align-items: center; background: #06060e; min-height: calc(100vh - 58px); padding-bottom: 40px; }

/* Top bar */
.sl-topbar { width: 100%; max-width: 780px; display: flex; align-items: center; padding: 10px 16px; gap: 10px; }
.sl-tb-item { flex: 1; }
.sl-tb-center { text-align: center; flex: 2; }
.sl-tb-right { text-align: right; }
.sl-tb-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.sl-tb-val { font-size: 1rem; font-weight: 700; }
.sl-machine-title { font-size: 1rem; font-weight: 800; letter-spacing: .08em; color: var(--gold); text-shadow: 0 0 12px rgba(255,215,0,.5); }
.back-link-sm { font-size: 0.75rem; color: var(--muted); text-decoration: none; display: block; margin-bottom: 2px; }
.back-link-sm:hover { color: var(--gold); }

/* Machine body */
.sl-machine-body {
  width: 100%; max-width: 780px;
  background: url('../img/slot_frame.jpg') center/cover no-repeat, linear-gradient(135deg, #1a0a3e, #0a0a1a);
  border: 3px solid var(--gold);
  border-radius: 20px;
  padding: 18px 18px 14px;
  box-shadow: 0 0 40px rgba(255,215,0,.15), inset 0 0 60px rgba(0,0,0,.7);
  position: relative;
}

/* Banner (free spins / bonus) */
.sl-banner {
  background: linear-gradient(90deg, #7c3aed, #a855f7, #7c3aed);
  text-align: center; padding: 6px 20px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 800; letter-spacing: .08em;
  margin-bottom: 12px; text-transform: uppercase;
  animation: banner-pulse 1s ease-in-out infinite;
}
.sl-banner-count { margin-left: 10px; color: var(--gold); }
@keyframes banner-pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

/* Viewport */
.sl-viewport-wrap { position: relative; }
.sl-viewport {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  background: #000;
  border: 2px solid rgba(255,215,0,.3);
  border-radius: 10px;
  overflow: hidden;
  height: 270px;
}
.sl-cell {
  display: flex; align-items: center; justify-content: center;
  background: #0d0d1a;
  overflow: hidden; position: relative;
  border-right: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .15s;
}
.sl-cell img { width: 82%; height: 82%; object-fit: contain; display: block; transition: transform .15s; }
.sl-cell.spinning img { animation: sl-blur .12s linear infinite; }
@keyframes sl-blur { 0%{transform:translateY(-100%)} 100%{transform:translateY(100%)} }
.sl-cell.win-glow { background: rgba(255,215,0,.12); box-shadow: inset 0 0 14px rgba(255,215,0,.4); }
.sl-cell.win-glow img { transform: scale(1.08); filter: drop-shadow(0 0 8px var(--gold)); }

/* Payline canvas overlay */
.sl-lines-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; border-radius: 10px;
}

/* Big win overlay */
.sl-bigwin {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px; z-index: 10;
  animation: bigwin-in .3s ease-out;
}
@keyframes bigwin-in { from{opacity:0;transform:scale(.8)} to{opacity:1;transform:scale(1)} }
.sl-bigwin-label { font-size: 2.2rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 30px var(--gold); letter-spacing: .06em; animation: bigwin-text 1s ease-in-out infinite; }
@keyframes bigwin-text { 0%,100%{text-shadow:0 0 30px var(--gold)} 50%{text-shadow:0 0 60px #fff,0 0 100px var(--gold)} }
.sl-bigwin-amount { font-size: 1.5rem; font-weight: 700; color: #fff; margin-top: 6px; }

/* Bonus round overlay */
.sl-bonus-overlay {
  position: absolute; inset: 0;
  background: rgba(10,0,30,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 10px; z-index: 11;
}
.sl-bonus-title { font-size: 1.3rem; font-weight: 900; color: var(--gold); letter-spacing: .08em; text-shadow: 0 0 20px var(--gold); }
.sl-bonus-chests { display: flex; gap: 10px; }
.sl-chest-btn {
  width: 72px; height: 72px;
  background: var(--surface2); border: 2px solid var(--border);
  border-radius: 10px; cursor: pointer; overflow: hidden;
  transition: transform .15s, border-color .15s;
  padding: 4px;
}
.sl-chest-btn img { width: 100%; height: 100%; object-fit: contain; }
.sl-chest-btn:hover { transform: scale(1.08); border-color: var(--gold); }
.sl-chest-btn.opened { border-color: var(--gold); background: rgba(255,215,0,.15); }
.sl-chest-btn.winner { border-color: #0f0; box-shadow: 0 0 16px #0f0; }
.sl-bonus-result { font-size: 1.1rem; font-weight: 700; color: var(--green); min-height: 28px; text-align: center; }

/* Paylines strip */
.sl-paylines-strip {
  display: flex; gap: 5px; flex-wrap: wrap;
  padding: 8px 4px 4px; justify-content: center;
}
.sl-line-num {
  width: 22px; height: 22px; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  cursor: default; transition: background .1s, color .1s;
}
.sl-line-num.active { background: rgba(255,215,0,.15); border-color: var(--gold); color: var(--gold); }
.sl-line-num.win { background: var(--gold); color: #000; border-color: var(--gold); }

/* Controls */
.sl-controls {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.5); border-radius: 10px;
  padding: 10px 14px; margin-top: 8px;
}
.sl-ctrl-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.sl-ctrl-spin { flex: 1; flex-direction: row; justify-content: center; gap: 10px; }
.sl-ctrl-sound { margin-left: auto; }
.sl-ctrl-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sl-stepper { display: flex; align-items: center; gap: 8px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
.sl-stepper span { font-size: 1rem; font-weight: 700; min-width: 28px; text-align: center; }
.sl-step-btn { background: none; border: none; color: var(--gold); font-size: 1.1rem; font-weight: 700; cursor: pointer; padding: 0 3px; line-height: 1; }
.sl-step-btn:hover { color: #fff; }
.sl-max-btn { background: var(--surface2); border: 1px solid var(--gold); color: var(--gold); border-radius: 8px; padding: 8px 16px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: background .1s; }
.sl-max-btn:hover { background: rgba(255,215,0,.15); }
.sl-spin-btn {
  background: linear-gradient(135deg, #b8860b, var(--gold), #b8860b);
  border: none; color: #0a0a0f; border-radius: 10px;
  padding: 12px 36px; font-size: 1.1rem; font-weight: 900;
  cursor: pointer; letter-spacing: .05em;
  box-shadow: 0 4px 16px rgba(255,215,0,.35);
  transition: opacity .1s, transform .1s;
}
.sl-spin-btn:hover { opacity: .9; transform: scale(1.02); }
.sl-spin-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.sl-sound-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 1.1rem; cursor: pointer; transition: border-color .1s; }
.sl-sound-btn:hover { border-color: var(--gold); }

/* Paytable */
.sl-paytable-wrap { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; flex-wrap: wrap; }
.sl-paytable { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; flex: 1; min-width: 280px; }
.sl-pt-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 10px; font-weight: 700; }
.sl-pt-grid { display: flex; flex-direction: column; gap: 6px; }
.sl-pt-row { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; }
.sl-pt-row:hover { background: var(--surface2); }
.sl-pt-sym { display: flex; align-items: center; gap: 6px; width: 90px; flex-shrink: 0; }
.sl-pt-sym img { width: 28px; height: 28px; object-fit: contain; border-radius: 4px; }
.sl-pt-sym span { font-size: 0.8rem; color: var(--muted); }
.sl-pt-pays { font-size: 0.78rem; color: var(--text); flex: 1; }
.sl-pt-pays span { color: var(--muted); font-size: 0.68rem; margin-right: 2px; margin-left: 6px; }
.sl-pt-pays span:first-child { margin-left: 0; }
.sl-pt-x { color: var(--gold) !important; margin: 0 0 0 1px !important; font-size: 0.72rem !important; }
.sl-pt-special .sl-pt-pays { color: var(--accent); font-size: 0.76rem; }
.sl-status-box { flex: 0 0 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; font-size: 0.82rem; line-height: 1.6; min-height: 80px; }

/* Remove old machine styles that conflict */
.machine, .reels, .reel, .pay-table, .pt-row { display: none !important; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 16px 0; margin-top: 32px; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* Responsive */
@media (max-width: 900px) {
  .game-grid { grid-template-columns: 1fr; }
  .gp-body { grid-template-columns: 1fr; }
  .stats-bar { flex-wrap: wrap; }
  .stat { min-width: 50%; }
}
@media (max-width: 640px) {
  .hdr-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; }
  .player-bar { order: 3; width: 100%; }
  .addr-input { width: 100%; flex: 1; }
}
