:root {
  --bg: #140b2e; --bg2: #1f1245; --card: #251654; --card2: #2e1d66; --line: rgba(255,255,255,.09);
  --text: #f6f2ff; --muted: #b7aad8; --gold: #ffc83d; --gold2: #ff9f1c; --green: #2ee59d; --red: #ff5470; --amber: #ffb020;
  --radius: 16px; --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #3a1f86 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text); min-height: 100vh; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--gold); }
button { font: inherit; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(20,11,46,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; white-space: nowrap; }
.brand-dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; font-size: 16px; }
#nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
#nav a, #nav button { color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: 999px; font-size: 14px; background: none; border: 0; cursor: pointer; }
#nav a.active { color: var(--text); background: var(--card2); }
#nav .install { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; font-weight: 700; }
.demo-banner { background: #3b2a00; color: #ffd98a; text-align: center; font-size: 13px; padding: 6px 12px; }
main { max-width: 980px; margin: 0 auto; padding: 18px 14px 20px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { height: 10px; }

/* Buttons & inputs */
.btn { text-decoration: none; display: inline-block; border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; cursor: pointer; background: var(--card2); color: var(--text); transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; }
.btn.green { background: var(--green); color: #002b1a; }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input, textarea, select {
  width: 100%; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 16px; outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.error { color: var(--red); font-size: 14px; min-height: 18px; margin: 4px 0 8px; }

/* Auth */
.auth { max-width: 420px; margin: 20px auto; }
.tabs { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tabs button { flex: 1; border: 0; padding: 10px; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--card2); color: var(--text); }

/* Prize */
.prize { display: grid; grid-template-columns: 180px 1fr; gap: 18px; align-items: center; }
.prize-img { width: 100%; aspect-ratio: 1; border-radius: 14px; background: rgba(0,0,0,.25) center/cover no-repeat; display: grid; place-items: center; font-size: 64px; }
.prize .label { color: var(--gold); font-weight: 800; letter-spacing: .08em; font-size: 12px; text-transform: uppercase; }
.prize h1 { margin: 4px 0 6px; font-size: 28px; line-height: 1.15; }
@media (max-width: 560px) { .prize { grid-template-columns: 1fr; } .prize-img { aspect-ratio: 16/10; } .prize h1 { font-size: 24px; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: rgba(0,0,0,.22); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat small { color: var(--muted); font-size: 12px; }
.progress { height: 10px; border-radius: 99px; background: rgba(0,0,0,.3); overflow: hidden; margin-top: 12px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .4s; }

/* Whish */
.whish { display: flex; gap: 12px; align-items: center; background: rgba(255, 60, 90, .1); border: 1px dashed rgba(255,84,112,.5); border-radius: 14px; padding: 12px 14px; }
.whish .logo { width: 42px; height: 42px; border-radius: 10px; background: #e6003d; color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 13px; flex: none; }
.whish b { font-size: 18px; letter-spacing: .03em; }

/* Number grid */
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 4px; }
.numgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
@media (max-width: 420px) { .numgrid { grid-template-columns: repeat(8, 1fr); gap: 5px; } }
.num {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text);
  font-weight: 800; font-size: 15px; cursor: pointer; display: grid; place-items: center; padding: 0; transition: transform .08s, background .15s;
}
.num:active { transform: scale(.92); }
.num.sel { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; border-color: transparent; box-shadow: 0 0 0 2px rgba(255,200,61,.35); }
.num.pending { background: rgba(255,176,32,.18); color: var(--amber); cursor: not-allowed; }
.num.taken { background: #e0425f; color: #fff; border-color: transparent; cursor: not-allowed; }
.num.mine { background: var(--green); color: #00301c; border-color: transparent; cursor: default; }

.buybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20,11,46,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); transform: translateY(110%); visibility: hidden; transition: transform .25s, visibility .25s;
}
.buybar.show { transform: none; visibility: visible; }
.buybar .inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { white-space: nowrap; background: var(--card2); border-radius: 99px; padding: 3px 10px; font-size: 13px; font-weight: 700; }
.chip.green { background: rgba(46,229,157,.18); color: var(--green); }
.chip.amber { background: rgba(255,176,32,.18); color: var(--amber); }
.chip.red { background: rgba(255,84,112,.18); color: var(--red); }

.banner { text-align: center; padding: 22px; }
.banner h2 { font-size: 22px; }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5,2,15,.72); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; background: linear-gradient(180deg, var(--card2), var(--bg2)); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); animation: pop .25s; }
.modal h3 { margin: 0 0 8px; font-size: 20px; }
.steps { counter-reset: s; padding: 0; margin: 10px 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding-left: 34px; margin-bottom: 10px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #2a1300; font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 8px 0 12px; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 1px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #000c; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Wheel */
.wheel-wrap { position: relative; width: min(92vw, 560px); aspect-ratio: 1; margin: 6px auto 10px; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 18px 40px rgba(0,0,0,.5)); }
.pointer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid var(--gold); filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); z-index: 2; }
.hub { position: absolute; left: 50%; top: 50%; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6cf, var(--gold) 45%, var(--gold2)); box-shadow: 0 4px 14px rgba(0,0,0,.5), inset 0 -3px 6px rgba(0,0,0,.2); display: grid; place-items: center; font-size: clamp(14px, 4vw, 26px); color: #2a1300; font-weight: 900; }
.now-name { text-align: center; font-size: 22px; font-weight: 800; min-height: 32px; margin-bottom: 6px; }
.now-name .n { color: var(--gold); }
.draw-status { text-align: center; }
.countdown { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.countdown div { background: rgba(0,0,0,.28); border-radius: 12px; padding: 8px 10px; min-width: 64px; }
.countdown b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.countdown small { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.start-btn { font-size: 22px; padding: 16px 46px; border-radius: 999px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,200,61,.6); } 50% { box-shadow: 0 0 0 16px rgba(255,200,61,0); } }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.player { display: flex; gap: 10px; align-items: center; background: rgba(0,0,0,.2); border-radius: 12px; padding: 8px 10px; }
.player .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.player .nums { color: var(--muted); font-size: 12px; }
.player.win { outline: 2px solid var(--gold); }

.winner-modal { text-align: center; }
.winner-modal .trophy { font-size: 70px; line-height: 1; margin: 4px 0; animation: pop .5s; }
.winner-modal .wname { font-size: 30px; font-weight: 900; margin: 6px 0; }
.winner-modal .wnum { display: inline-block; background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; font-weight: 900; font-size: 28px; padding: 6px 20px; border-radius: 14px; }
.congrats { font-size: 26px; font-weight: 900; background: linear-gradient(90deg, var(--gold), #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

/* Admin */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.pill.paid { background: rgba(46,229,157,.18); color: var(--green); }
.pill.pending { background: rgba(255,176,32,.18); color: var(--amber); }
.empty { color: var(--muted); text-align: center; padding: 16px; font-size: 14px; }
.badge { background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; margin-left: 4px; }
@media (max-width: 520px) {
  .topbar { padding-left: 12px; padding-right: 10px; }
  #brandName { display: none; }
  #nav { flex-wrap: nowrap; gap: 2px; }
  #nav a, #nav button { padding: 7px 9px; font-size: 13.5px; }
}
/* multi-wheel */
.page-title { margin: 0; font-size: 26px; }
.wheel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.wheel-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--text); margin: 0; transition: transform .12s; }
.wheel-card:active { transform: scale(.98); }
.wheel-card .prize-img { aspect-ratio: 16/10; font-size: 54px; }
.wheel-card h2 { margin: 8px 0 2px; font-size: 20px; }
.wheel-tabs { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.wheel-tabs a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.wheel-tabs a.on { background: var(--card2); color: var(--text); }
.wheel-tabs a.back { padding-left: 0; }

/* v3: no accounts */
.hero { text-align: center; padding: 26px 6px 20px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 38px); line-height: 1.15; }
.hero p { margin: 0 auto; max-width: 520px; }
.section-title { margin: 0; font-size: 20px; }
.wc-cta { margin-top: 12px; color: var(--gold); font-weight: 800; font-size: 15px; }
.req { background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.req .busy, .btn.busy { opacity: .5; pointer-events: none; }
.chip.gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #2a1300; }
.chip.red { background: rgba(255,84,112,.2); color: #ff8aa0; }
.okbtn { min-width: 110px; font-size: 18px; }
.numgrid.admin .num.taken, .numgrid.admin .num.pending { cursor: pointer; }
.foot { text-align: center; padding: 10px 0 120px; font-size: 13px; }
.foot a { color: var(--muted); text-decoration: none; opacity: .7; }
