:root {
  --bg: #08110d;
  --ink: #f7f3ea;
  --muted: #b7c3bb;
  --gold: #e0b85a;
  --gold-2: #f6e7c1;
  --line: rgba(224, 184, 90, 0.32);
  --card: rgba(10, 22, 17, 0.78);
  color-scheme: dark;
}

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

html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Cairo", "Geeza Pro", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  min-height: 100dvh;
}

body.lock { overflow: hidden; }

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(980px 560px at 78% -8%, rgba(224, 184, 90, 0.16), transparent 58%),
    radial-gradient(760px 520px at -12% 100%, rgba(15, 107, 82, 0.32), transparent 55%),
    linear-gradient(180deg, #0c1814 0%, #08110d 42%, #070d0b 100%);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(224, 184, 90, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224, 184, 90, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at 50% 30%, #000 10%, transparent 72%);
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 25;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 calc(36px + env(safe-area-inset-bottom));
}

.ticker {
  position: sticky;
  top: 0;
  z-index: 6;
  height: 38px;
  overflow: hidden;
  border-bottom: 1px solid rgba(224, 184, 90, 0.35);
  background: rgba(8, 17, 13, 0.92);
  padding-top: env(safe-area-inset-top);
}
.ticker-mask { overflow: hidden; height: 38px; display: flex; align-items: center; }
.ticker-track { display: flex; align-items: center; width: max-content; }
.tick {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  color: var(--gold-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.tick i {
  width: 1px;
  height: 14px;
  background: var(--gold);
  display: block;
}
.ticker.is-moving .ticker-track { animation: marquee 24s linear infinite; }
.ticker:not(.is-moving) .ticker-mask { justify-content: center; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

body.gated .atmosphere,
body.gated .shell,
body.gated .ticker,
body.gated #fx { filter: blur(18px); }
body.gated .shell,
body.gated .ticker { pointer-events: none; user-select: none; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 12, 10, 0.28);
}
.gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 22px 22px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: rgba(10, 22, 17, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.gate-card h2 { margin: 0; font-size: 36px; font-weight: 800; }
.gate-card form { display: grid; gap: 14px; }
.gate-card form[hidden] { display: none !important; }

.letterhead { text-align: center; margin-bottom: 28px; }
.letterhead h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(180deg, #fff8e8 8%, #e7c56d 46%, #9a6d2c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 0;
  color: var(--gold-2);
  font-size: 18px;
  font-weight: 600;
}
.by i {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
  display: block;
}
.by i:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.by em {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  margin-inline-end: 6px;
  color: var(--gold);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(320px, 460px);
  gap: 42px;
  align-items: center;
}

.stage { padding-top: 10px; }
.stage::after {
  content: "";
  display: block;
  width: 48%;
  height: 18px;
  margin: 10px auto 0;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5), transparent 70%);
}

.wheel-wrap {
  position: relative;
  width: min(100%, 540px);
  margin-inline: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 28px 40px rgba(0, 0, 0, 0.38));
}
#wheel { width: 100%; height: 100%; display: block; }

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 28px;
  height: 40px;
  background: linear-gradient(#fff6d8, #c5963a 70%, #8a6424);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.4));
}

.hub {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 108px;
  height: 108px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--gold-2);
  background:
    radial-gradient(circle at 50% 38%, #1b3a30, #0b1713 70%);
  box-shadow:
    0 0 0 7px #10211a,
    0 0 0 9px rgba(224, 184, 90, 0.85),
    0 12px 28px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0;
  padding: 0;
}
.hub small {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--gold);
}
.hub strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
  font-family: inherit;
}
.hub:disabled { cursor: default; }

.panel {
  background:
    linear-gradient(180deg, rgba(255, 244, 214, 0.05), transparent 26%),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  padding: 26px 24px 22px;
}
.panel-kicker, .prize-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}
.count {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.count div {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(224, 184, 90, 0.18);
  border-radius: 16px;
  padding: 12px 4px 10px;
  text-align: center;
}
.count b {
  display: block;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold-2);
  direction: ltr;
}
.count span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.until { margin: 10px 0 0; color: var(--muted); font-size: 14px; text-align: center; }

.remain {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(224, 184, 90, 0.16);
}
.remain span { color: var(--muted); font-size: 13px; }
.remain strong { color: var(--gold-2); font-size: 18px; }

.coins {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0 18px;
}
.coin {
  border: 1px solid rgba(224, 184, 90, 0.22);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  text-align: center;
  padding: 10px 4px 8px;
}
.coin b {
  display: block;
  font-size: 20px;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.coin span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.coin.jackpot {
  background: linear-gradient(180deg, rgba(240, 212, 138, 0.18), rgba(240, 212, 138, 0.04));
  border-color: rgba(224, 184, 90, 0.7);
}
.coin.jackpot b { color: var(--gold); }
.coin.gone { opacity: 0.38; }

form, .stack { display: grid; gap: 12px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-2);
  font-size: 14px;
  font-weight: 700;
}
input, select {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(224, 184, 90, 0.28);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  padding: 0 14px;
  font: 600 16px/1 "Cairo", "Geeza Pro", Tahoma, sans-serif;
}
select { appearance: none; }
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px #10211a inset;
}

.field-error {
  min-height: 1.2em;
  margin: 0;
  color: #ffb4ae;
  font-size: 13px;
}
.gold, .ghost, .text-btn, .method, .seg button, .hub {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.gold {
  appearance: none;
  border: 0;
  cursor: pointer;
  height: 56px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  color: #1b1408;
  background: linear-gradient(180deg, #f8e7b6 0%, #e0b85a 46%, #b8893d 100%);
  box-shadow: 0 10px 24px rgba(184, 137, 61, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.gold:disabled { cursor: not-allowed; filter: grayscale(0.35) brightness(0.75); box-shadow: none; }
.gold:not(:disabled):hover { filter: brightness(1.04); }
.gold:not(:disabled):active { transform: translateY(1px); }

.receipt { text-align: center; padding: 8px 4px 4px; }
.receipt h2, .done-card h2, .sheet h2 {
  margin: 6px 0 0;
  font-size: 30px;
  font-weight: 800;
}
.receipt .big, .done-amount {
  margin: 8px 0;
  font-size: 40px;
  font-weight: 800;
  color: var(--gold);
}
.muted { color: var(--muted); margin: 4px 0 0; }
.rules {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.rules li {
  position: relative;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  padding-inline-start: 16px;
}
.rules li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  inset-inline-start: 0;
  top: 0.55em;
}
.status { min-height: 1.2em; margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(4, 8, 6, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet, .done-card {
  width: min(520px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 244, 214, 0.06), transparent 18%),
    #0d1915;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px 22px 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.prize-amount {
  margin: 4px 0 0;
  line-height: 1;
}
.prize-amount b {
  font-size: 64px;
  font-weight: 800;
  background: linear-gradient(180deg, #fff8e8, #e0b85a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prize-amount span { font-size: 22px; color: var(--gold-2); margin-inline-start: 4px; }
.sheet-lead { margin: 8px 0 14px; color: var(--muted); }

.methods { display: grid; gap: 8px; margin-bottom: 14px; }
.method {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: right;
  color: inherit;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(224, 184, 90, 0.22);
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
}
.method strong, .method small { display: block; }
.method small { color: var(--muted); font-weight: 600; font-size: 12px; }
.method.active {
  border-color: var(--gold);
  background: rgba(224, 184, 90, 0.1);
}
.ico {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--gold);
  background: rgba(224, 184, 90, 0.08);
}
.ico svg { width: 26px; height: 26px; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
}
.seg button {
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.seg button.active { background: var(--gold); color: #1b1408; }

.fine { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.text-btn, .ghost {
  appearance: none;
  background: transparent;
  color: var(--gold-2);
  cursor: pointer;
}
.text-btn {
  border: 0;
  margin-top: 8px;
  font-weight: 700;
}
.done-card { text-align: center; }
.seal {
  width: 64px;
  height: 64px;
  color: var(--gold);
  margin-bottom: 8px;
}
.ghost {
  margin-top: 18px;
  height: 48px;
  min-width: 140px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 22px;
  font-weight: 800;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
::selection { background: rgba(224, 184, 90, 0.35); color: white; }

@media (max-width: 900px) {
  .shell { width: min(640px, calc(100% - 20px)); padding-top: 16px; }
  .layout { grid-template-columns: 1fr; gap: 4px; }
  .stage { order: -1; padding-top: 0; }
  .stage::after { display: none; }
  .letterhead { margin-bottom: 4px; }
  .letterhead h1 { font-size: 40px; }
  .by { margin-top: 2px; font-size: 16px; }
  .wheel-wrap { width: min(78vw, 340px); }
  .hub { width: 84px; height: 84px; }
  .hub strong { font-size: 18px; }
  .panel { padding: 16px 14px 14px; }
  .count { margin-top: 8px; }
  .count div { padding: 8px 4px 7px; }
  .remain { margin-top: 14px; padding-top: 12px; }
  .coins { margin: 8px 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .gold:active { transform: none; }
}
