:root {
  color-scheme: dark;
  --bg: #15121c;
  --card: #211b29;
  --card-edge: #3a3045;
  --text: #f7f0e8;
  --muted: #b9abba;
  --gold: #f6c76b;
  --gold-light: #ffe5a3;
  --plum: #693b72;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-width: 290px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 14%, #513358 0, transparent 36%),
    linear-gradient(180deg, #1c1724 0, #120f18 100%);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }

.app {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px
    max(28px, env(safe-area-inset-bottom));
}

.masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid #ae769b;
  border-radius: 14px;
  background: linear-gradient(135deg, #6e3e6e, #2b2037);
  box-shadow: 0 8px 24px #0e0a14aa;
  color: var(--gold-light);
  font-size: 23px;
}

.eyebrow {
  margin: 0;
  color: #d7abd1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.eyebrow.accent { color: var(--gold); }

.masthead h1 {
  margin: 1px 0 0;
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -.03em;
}

.day-chip {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid #765271;
  border-radius: 999px;
  background: #36283e;
  color: #f9d9ee;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 24px;
  padding: 24px 18px 22px;
  border: 1px solid #654b68;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 48%, #754a74 0, transparent 44%),
    linear-gradient(160deg, #38273f, #241d2d 57%, #201925);
  box-shadow: 0 20px 50px #09070c88, inset 0 1px #ffffff1e;
  text-align: center;
}

.hero::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 45% -10%, #ffffff19, transparent 46%);
  content: "";
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 1; }

.hero h2 {
  margin: 9px 0 8px;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: -.05em;
}

.hero-copy p:last-child {
  max-width: 430px;
  margin: 0 auto;
  color: #decddd;
  font-size: 13px;
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 350px);
  aspect-ratio: 1;
  margin: 16px auto 4px;
}

.wheel-glow {
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: #f3b55c;
  filter: blur(38px);
  opacity: .2;
}

.wheel-rim {
  position: relative;
  width: 92%;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe8aa, #b77b37 50%, #ffe7a2 75%, #a86b32);
  box-shadow: 0 12px 30px #100b15aa, inset 0 2px 4px #fff8d2;
}

.wheel-rim::after {
  position: absolute;
  inset: 5px;
  border: 1px solid #fff2bd9c;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.wheel {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border: 4px solid #4c2e42;
  border-radius: 50%;
  background: conic-gradient(from -90deg, #71426f 0 72deg, #c88f50 72deg 144deg,
    #83476b 144deg 216deg, #d49d58 216deg 288deg, #5b426f 288deg 360deg);
  box-shadow: inset 0 0 14px #190c25bb;
  transform: rotate(0deg);
  will-change: transform;
}

.wheel::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from -90deg,
    #fff9d6a6 0 1deg, transparent 1deg var(--sector-angle, 72deg));
  content: "";
  pointer-events: none;
}

.wheel-pointer {
  position: absolute;
  z-index: 4;
  top: -1%;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 31px solid var(--gold-light);
  filter: drop-shadow(0 3px 3px #170f1b);
  transform: translateX(-50%);
}

.wheel-sectors {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
}

.wheel-sector {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 78px;
  color: #fff8e9;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 3px #281624, 0 -1px 3px #281624;
  transform: translate(-50%, -50%);
}

.sector-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(39px, 13vw, 54px);
  height: clamp(39px, 13vw, 54px);
  overflow: hidden;
  border: 2px solid #fff4d1;
  border-radius: 50%;
  background: #f9e9c1;
  box-shadow: 0 3px 9px #190c25aa;
  color: #4a2851;
  font-size: 20px;
  font-weight: 900;
  text-shadow: none;
}

.sector-avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; background: #f9e9c1; }
.sector-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wheel[data-crowded="true"] .sector-name { display: none; }
.wheel[data-crowded="true"] .sector-avatar {
  width: var(--crowded-avatar-size, 36px);
  height: var(--crowded-avatar-size, 36px);
  font-size: var(--crowded-avatar-font-size, 15px);
  border-width: min(2px, calc(var(--crowded-avatar-size, 36px) / 10));
}

.wheel-hub {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 26%;
  aspect-ratio: 1;
  border: 4px solid #f9dc9d;
  border-radius: 50%;
  background: linear-gradient(145deg, #281d32, #4e3153);
  box-shadow: 0 5px 14px #1b1025b8, inset 0 1px 3px #ffffff5c;
  color: #ffe0a1;
  font-size: clamp(13px, 4vw, 18px);
  line-height: 1.05;
  text-align: center;
  transform: translate(-50%, -50%);
}

.wheel-hub small { font-size: 7px; font-weight: 850; letter-spacing: .18em; }

.hero-action { position: relative; z-index: 1; }

.spin-button {
  display: block;
  width: min(100%, 320px);
  min-height: 54px;
  margin: 0 auto;
  border: 1px solid #fff1b9;
  border-radius: 17px;
  background: linear-gradient(180deg, #ffe09b, #f0b85b);
  box-shadow: 0 6px 0 #ae7435, 0 13px 24px #10091380;
  color: #382331;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 850;
  transition: filter .2s ease, transform .2s ease, box-shadow .2s ease;
}

.spin-button:not(:disabled):active {
  box-shadow: 0 3px 0 #ae7435, 0 7px 12px #10091380;
  transform: translateY(3px);
}

.spin-button:disabled { cursor: default; filter: saturate(.55); opacity: .72; }
.spin-button:focus-visible, .item-list a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.ticket {
  width: min(100%, 330px);
  margin: 20px auto 0;
  padding: 15px 18px;
  border: 1px dashed #ffe3a2;
  border-radius: 16px;
  background: linear-gradient(145deg, #593c58, #36283d);
  box-shadow: 0 9px 24px #10091366, inset 0 1px #ffffff24;
}
.ticket[hidden] { display: none; }
.ticket-caption { display: block; color: #e6c4dd; font-size: 10px; font-weight: 850; letter-spacing: .19em; }
.ticket-number { display: block; margin: 3px 0; color: #ffe5a3; font-size: clamp(22px, 6vw, 29px); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.ticket-note { display: block; color: #e7d5e3; font-size: 11px; }

.previous-ticket {
  margin-top: 16px;
  padding: 17px 19px;
  border: 1px solid #5b4661;
  border-radius: 18px;
  background: linear-gradient(145deg, #30243b, #201a2b);
}
.previous-ticket[hidden] { display: none; }
.previous-ticket strong { display: block; margin-top: 5px; color: var(--gold-light); font-size: 17px; }
.previous-ticket p { margin: 5px 0 0; color: #d8c8d8; font-size: 13px; }

.status { min-height: 22px; margin: 17px 0 0; color: var(--gold-light); font-weight: 650; }
.countdown { min-height: 18px; margin: 4px 0 0; color: #c6b5c6; font-size: 12px; }

.details { display: grid; gap: 12px; margin-top: 16px; }

.panel {
  padding: 18px;
  border: 1px solid var(--card-edge);
  border-radius: 20px;
  background: linear-gradient(150deg, #2b2232, #1e1927);
  box-shadow: 0 8px 20px #09070c55;
}

.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; background: #60415b; }
.panel-help { margin: 9px 0 0; color: var(--muted); font-size: 12px; }

.item-list { display: grid; gap: 9px; margin: 13px 0 0; padding: 0; list-style: none; }
.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 45px;
  padding: 9px 12px;
  border: 1px solid #44364b;
  border-radius: 12px;
  background: #211b2b;
  color: #f6ecf3;
}
.item-list small { color: #ccbad0; text-align: right; }
.item-list a { color: #f9d697; font-weight: 700; text-decoration: none; }
.item-list li.prize-item { align-items: flex-start; flex-direction: column; gap: 2px; }
.prize-item strong { font-size: 14px; font-weight: 750; overflow-wrap: anywhere; }
.prize-item small { text-align: left; }
.claim-instructions { margin: 7px 0 0; color: #f4dcae; font-size: 12px; overflow-wrap: anywhere; white-space: pre-line; }

footer { margin: 18px 8px 0; color: #aa9ba9; font-size: 11px; text-align: center; }

@media (min-width: 560px) {
  .app { padding-right: 28px; padding-left: 28px; }
  .hero { padding-right: 32px; padding-left: 32px; }
  .details { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
