:root {
  --bg: #fbf6ee;
  --card: #ffffff;
  --ink: #2a2340;
  --muted: #6d6580;
  --line: #ece3d6;
  --soft: #f6f0e7;
  --accent: #6c4cf5;
  --accent-hover: #5a3be0;
  --candy: #ff7a59;
  --ok: #15915f;
  --ok-bg: #e3f6ec;
  --bar-bg: #2a2340;
  --bar-ink: #ffffff;
  --bar-hi: #ffd34d;
  --r1: #ffd34d;
  --r2: #6ec8ff;
  --r3: #ffa3bf;
  --r4: #8ee2a8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(42, 35, 64, .06), 0 8px 24px rgba(42, 35, 64, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* keep anchor targets (#disclaimer, #cookies) clear of the sticky notice bar */
html { scroll-padding-top: 80px; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { line-height: 1.75; }

h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h2 { font-size: 20px; }
h3 { font-size: 16px; margin-top: 24px; }

.ico { width: 1.5em; height: 1em; flex: none; color: var(--candy); vertical-align: -0.12em; }
.ico-lg { width: 42px; height: 26px; }

/* Sticky notice bar: the disclaimer stays visible while scrolling */
.notice-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 18px;
  padding: 8px 16px;
  background: var(--bar-bg);
  color: var(--bar-ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.notice-bar span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 8px;
  border-radius: 50%;
  background: var(--bar-hi);
  vertical-align: 2px;
}
.notice-bar a { color: var(--bar-hi); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* Header & navigation */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 20px 0;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-icon { width: 56px; height: 33px; color: var(--candy); flex: none; }
.brand-name { display: block; font-size: 22px; font-weight: 800; line-height: 1.25; }
.brand-tag { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}
.site-nav a:hover { background: var(--soft); }
.site-nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.site-nav .lang-link { margin-inline-start: 6px; border: 1.5px solid var(--line); background: var(--card); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; }

.pill {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}
.pill.full { background: var(--ok-bg); color: var(--ok); }
.pill.bump { animation: bump .35s ease; }

/* Balance */
.balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.balance-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.balance-value {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.balance-hint { margin: 0; max-width: 420px; font-size: 13px; color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
}

/* Number picker */
.numbers {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  max-width: 400px;
}
.num {
  aspect-ratio: 1;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background-color .12s ease;
  font-variant-numeric: tabular-nums;
}
.num:hover:not(:disabled) { border-color: var(--accent); }
.num:active:not(:disabled) { transform: scale(.94); }
.num:disabled { cursor: default; }
.num[aria-pressed="true"] { background: var(--rc); border-color: rgba(42, 35, 64, .18); }
.num.drawn { border-style: dashed; border-color: var(--muted); }
.num.hit { outline: 3px solid var(--ok); outline-offset: 2px; }

.r1 { --rc: var(--r1); }
.r2 { --rc: var(--r2); }
.r3 { --rc: var(--r3); }
.r4 { --rc: var(--r4); }

.picker-actions { display: flex; gap: 8px; margin: 14px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 18px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s ease, opacity .12s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .num:focus-visible, .site-nav a:focus-visible, .link-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #3b3258; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-play {
  width: 100%;
  max-width: 400px;
  padding: 14px 18px;
  font-size: 17px;
}
.btn .ico { color: #fff; }

.amt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.play-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); max-width: 400px; }

/* Draw */
.balls { display: flex; flex-wrap: wrap; gap: 10px; min-height: 52px; }
.ball {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 42%),
    var(--rc);
  box-shadow: inset 0 -4px 0 rgba(42, 35, 64, .12);
  animation: drop .45s cubic-bezier(.3, 1.4, .5, 1);
}
.ball.hit { outline: 3px solid var(--ok); outline-offset: 2px; }
.ball.empty {
  background: var(--soft);
  box-shadow: none;
  border: 2px dashed var(--line);
  color: var(--muted);
  animation: none;
}

.result { min-height: 48px; margin: 14px 0 0; font-weight: 700; }
.result.idle { font-weight: 400; color: var(--muted); }
.result.win { color: var(--ok); }

.refill {
  margin-top: 8px;
  padding: 16px;
  border-radius: 14px;
  background: #fff4e0;
}
.refill p { margin: 4px 0 12px; font-size: 14px; color: var(--muted); }

.prize-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.prize-table th {
  text-align: start;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 8px 6px;
}
html[lang="en"] .prize-table th { text-transform: uppercase; letter-spacing: .04em; }
.prize-table td { padding: 8px; border-top: 1px solid var(--line); }
.prize-table th:nth-child(n+2), .prize-table td:nth-child(n+2) { text-align: end; }
.prize-table tr.current td { background: var(--ok-bg); font-weight: 700; }

/* Disclaimer */
.disclaimer { background: #fff7f3; border: 2px solid #ffcdbd; box-shadow: none; }
.disclaimer h2 { display: flex; align-items: center; gap: 8px; }
.disclaimer h2 .ico { width: 24px; height: 24px; color: #e2553a; }
.disclaimer ul { margin: 0; padding-inline-start: 20px; }
.disclaimer li { margin: 8px 0; }
.disclaimer p { margin: 0 0 8px; }
.disclaimer .disc-help { margin-top: 14px; font-size: 14px; color: var(--muted); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.two-col .card { margin-bottom: 0; }

.rules { margin: 0; padding-inline-start: 20px; }
.rules li { margin: 8px 0; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.stat-value { display: block; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); }

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.history li:first-child { border-top: 0; }
.history .empty-note { color: var(--muted); font-size: 14px; justify-content: flex-start; }
.mini-balls { display: flex; gap: 4px; }
.mini {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  background: var(--soft);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mini.hit { background: var(--rc); color: var(--ink); box-shadow: 0 0 0 2px var(--ok); }
.hist-res { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.hist-res.win { color: var(--ok); }

/* Text pages: about, terms, privacy */
.page { max-width: 780px; margin: 0 auto 20px; padding: 32px; }
.page h1 { font-size: 30px; margin-bottom: 6px; }
.page .updated { margin: 0 0 20px; font-size: 14px; color: var(--muted); }
.page .lead { font-size: 18px; }
.page h2 { margin: 30px 0 8px; font-size: 19px; }
.page p { margin: 0 0 12px; }
.page ul, .page ol { margin: 0 0 12px; padding-inline-start: 22px; }
.page li { margin: 6px 0; }
.page a:not(.btn) { color: var(--accent); }
.page .btn { margin-top: 12px; }
.table-scroll { overflow-x: auto; margin: 8px 0 16px; }
.data-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: start; vertical-align: top; padding: 10px 8px; border-top: 1px solid var(--line); }
.data-table th { border-top: 0; font-size: 13px; color: var(--muted); }
.data-table td:first-child { font-weight: 700; white-space: nowrap; }

/* Footer */
.site-footer { padding: 28px 0 40px; font-size: 13px; color: var(--muted); text-align: center; }
.site-footer p { margin: 0 auto; max-width: 640px; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin-bottom: 14px;
}
.footer-links a, .link-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* First-visit notice */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(42, 35, 64, .55);
}
.modal {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 60px rgba(42, 35, 64, .3);
}
.modal-icon { width: 64px; height: 38px; color: var(--candy); display: block; margin-bottom: 8px; }
.modal ul { padding-inline-start: 20px; margin: 0 0 20px; }
.modal li { margin: 8px 0; }
.modal .btn { width: 100%; padding: 13px 18px; }

/* Cookie banner */
.cookie {
  position: fixed;
  z-index: 60;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(42, 35, 64, .25);
}
.cookie-text { flex: 1 1 340px; font-size: 14px; }
.cookie-text strong { display: block; font-size: 15px; margin-bottom: 4px; }
.cookie-text p { margin: 0; color: var(--muted); }
.cookie-text a { color: var(--accent); }
.cookie-actions { display: flex; gap: 8px; flex: 1 1 280px; }
.cookie-actions .btn { flex: 1 1 0; padding: 11px 14px; }

@keyframes drop {
  from { transform: translateY(-18px) scale(.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes bump {
  0%, 100% { transform: none; }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

@media (max-width: 820px) {
  .game-grid, .two-col { grid-template-columns: minmax(0, 1fr); }
  .two-col { gap: 0; }
  .two-col .card { margin-bottom: 20px; }
}

@media (max-width: 480px) {
  .card { padding: 18px 16px; }
  .page { padding: 22px 16px; }
  .page h1 { font-size: 25px; }
  .site-header { padding: 14px 0; }
  .site-nav { margin-inline-start: -12px; }
  .site-nav a { font-size: 14px; padding: 5px 10px; }
  .brand-icon { width: 44px; height: 26px; }
  .brand-name { font-size: 19px; }
  .brand-tag { font-size: 13px; }
  .balance-value { font-size: 28px; }
  .notice-bar { font-size: 12px; gap: 0 12px; padding: 6px 12px; }
  .ball { width: 44px; height: 44px; font-size: 16px; }
  .balls { gap: 8px; }
  .cookie { left: 8px; right: 8px; bottom: 8px; padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ball, .pill.bump { animation: none; }
  .num, .btn { transition: none; }
}
