* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; background: #0f172a; color: #e2e8f0; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

.center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.muted { color: #94a3b8; font-size: 14px; margin: 4px 0; }
.small { font-size: 13px; }
.error { color: #f87171; margin-top: 8px; }
.badge { display: inline-block; background: #f59e0b; color: #1e293b; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; }

/* ============ Card ============ */
.card { background: #1e293b; border-radius: 16px; padding: 32px 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.card h1 { margin: 0 0 4px; text-align: center; font-size: 28px; }
.card label { display: block; margin: 16px 0 6px; font-size: 13px; color: #cbd5e1; }
.card input { width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid #334155; background: #0f172a; color: #fff; font-size: 16px; }
.card input:focus { outline: none; border-color: #3b82f6; }

/* ============ Buttons ============ */
.btn { border: none; padding: 12px 18px; border-radius: 8px; font-size: 15px; font-weight: 600; transition: transform 0.05s, opacity 0.2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: #3b82f6; color: #fff; }
.btn.primary:hover { background: #2563eb; }
.btn.success { background: #10b981; color: #fff; }
.btn.success:hover { background: #059669; }
.btn.danger { background: #ef4444; color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.ghost { background: transparent; color: #e2e8f0; border: 1px solid #334155; }
.btn.ghost:hover { background: #1e293b; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn.big { font-size: 20px; padding: 16px 28px; }
.btn.small { padding: 6px 12px; font-size: 13px; }

/* ============ Topbar ============ */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #1e293b; border-bottom: 1px solid #334155; gap: 8px; }
.brand { font-weight: 700; font-size: 17px; }
.topbar-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.credits-badge { font-size: 13px; color: #cbd5e1; }
.credits-badge strong { color: #10b981; font-size: 15px; }

/* ============ Game ============ */
.game-area { flex: 1; padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.user-greeting { font-size: 14px; }
.wheel-wrap { position: relative; width: 320px; height: 320px; max-width: 90vw; max-height: 90vw; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; }
.wheel-pointer { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); color: #ef4444; font-size: 32px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }

.bet-area { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bet-label { font-size: 13px; color: #94a3b8; }
.bet-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.bet-buttons button { padding: 8px 14px; background: #1e293b; color: #e2e8f0; border: 2px solid #334155; border-radius: 8px; font-weight: 600; }
.bet-buttons button.selected { border-color: #3b82f6; background: #1e3a8a; }

.spin-result { min-height: 24px; font-size: 16px; font-weight: 600; text-align: center; }
.spin-result.win { color: #10b981; }
.spin-result.lose { color: #f87171; }

/* ============ Modal PIX ============ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-content { background: #1e293b; border-radius: 16px; padding: 24px 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal-content h2 { margin: 0 0 4px; }
.modal-content label { display: block; margin: 14px 0 6px; font-size: 13px; color: #cbd5e1; }
.modal-content input[type=text], .modal-content input[type=tel] { width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid #334155; background: #0f172a; color: #fff; font-size: 16px; }
.modal-content input[type=text]:focus, .modal-content input[type=tel]:focus { outline: none; border-color: #3b82f6; }
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.quick-amounts button.selected { border-color: #3b82f6; background: #1e3a8a; color: #fff; }
.custom-amount { display: flex; gap: 8px; margin-top: 12px; }
.custom-amount input { flex: 1; padding: 12px; border: 1px solid #334155; background: #0f172a; color: #fff; border-radius: 8px; font-size: 16px; }

.pix-amount-display { font-size: 32px; font-weight: 700; color: #10b981; text-align: center; margin: 16px 0; }
.pix-payload-box { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 12px; }
.pix-payload-box code { display: block; word-break: break-all; font-size: 11px; max-height: 100px; overflow-y: auto; color: #cbd5e1; margin-bottom: 12px; font-family: ui-monospace, "SF Mono", monospace; }
.pix-hint { font-size: 13px; color: #94a3b8; margin: 12px 0; text-align: center; }
.pix-actions { display: flex; gap: 10px; margin-top: 16px; }
.pix-actions .btn { flex: 1; }

/* ============ Receipt ============ */
.receipt-actions { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
#receipt-preview { margin-top: 12px; }
#receipt-img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 8px; background: #0f172a; }

.done-icon { font-size: 64px; text-align: center; margin: 16px 0; }

/* ============ Admin ============ */
.admin-area { padding: 20px 16px; max-width: 800px; margin: 0 auto; width: 100%; }
.admin-area h2 { font-size: 18px; margin: 8px 0 16px; }
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-card { background: #1e293b; border: 1px solid #334155; border-radius: 12px; padding: 16px; }
.admin-card.pending { border-left: 4px solid #f59e0b; }
.admin-card.approved { border-left: 4px solid #10b981; opacity: 0.7; }
.admin-card.rejected { border-left: 4px solid #ef4444; opacity: 0.6; }
.admin-card.cancelled { opacity: 0.4; }
.admin-card-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.admin-card-amount { font-size: 20px; font-weight: 700; color: #10b981; }
.admin-card-user { font-size: 14px; color: #cbd5e1; }
.admin-card-id { font-family: ui-monospace, monospace; font-size: 11px; color: #64748b; }
.admin-card-receipt img { width: 100%; max-height: 250px; object-fit: contain; border-radius: 8px; margin: 12px 0; background: #0f172a; }
.admin-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.admin-card-actions .btn { flex: 1; }
.status-pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; text-transform: uppercase; }
.status-pending { background: #f59e0b22; color: #f59e0b; }
.status-awaiting_approval { background: #f59e0b22; color: #f59e0b; }
.status-approved { background: #10b98122; color: #10b981; }
.status-rejected { background: #ef444422; color: #f87171; }
.status-cancelled { background: #64748b22; color: #94a3b8; }

/* ============ Toast ============ */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast-msg { background: #1e293b; border: 1px solid #334155; padding: 12px 18px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: toast 3s ease forwards; max-width: 90vw; }
.toast-msg.success { border-color: #10b981; }
.toast-msg.error { border-color: #ef4444; }
@keyframes toast {
  0% { opacity: 0; transform: translateY(10px); }
  10%, 80% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .credits-badge { order: -1; width: 100%; text-align: center; padding-bottom: 4px; }
}
