/* ======================= views ======================= */
.view { min-height: 100vh; min-height: 100dvh; }
.view[hidden] { display: none !important; }
.view.is-entering { animation: view-in .6s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.enter { animation: rise .8s var(--ease-out) both; }
.enter-2 { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px clamp(16px, 4vw, 48px);
}
.topbar-tools { display: flex; align-items: center; gap: 8px; }
.on-dark { color: #fff; }
.on-dark .icon-btn { color: #fff; }
.on-dark .icon-btn:hover { background: rgba(255,255,255,0.1); }

.eyebrow {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red);
}
.on-dark .eyebrow { color: var(--gold); }
h1, h2 { font-stretch: 86%; letter-spacing: -0.015em; }

/* ======================= 1. form ======================= */
.view-form { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--paper); overflow-x: clip; }

.form-stage {
  position: relative; overflow: hidden;
  background: var(--green-900);
  padding-bottom: 40px;
}
.form-stage::before {
  /* faint light behind the wheel */
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 120%; aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(233,196,106,0.16), rgba(233,196,106,0) 70%);
  pointer-events: none;
}
.stage-copy { position: relative; z-index: 1; padding: 12px clamp(16px, 4vw, 48px) 0; max-width: 640px; }
.stage-copy h1 {
  margin: 0;
  font-size: clamp(42px, 9vw, 84px); line-height: 0.96; font-weight: 800;
}
.stage-copy .lead { margin: 20px 0 0; max-width: 30em; font-size: 18px; line-height: 1.5; color: rgba(255,255,255,0.78); }

.prize-head { margin: 34px 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.55); }
.prize-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.prize-strip li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  font-size: 15px; font-weight: 600;
  transition: background-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.prize-strip li:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.prize-strip .dot {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 999px;
  background: rgba(255,255,255,0.1); overflow: hidden;
}
.prize-strip .dot img { width: 100%; height: 100%; object-fit: cover; }
.prize-strip .dot svg { width: 16px; height: 16px; }

.stage-wheel { display: none; }

/* phones: prizes become one swipeable row so the form shows on the first screen */
@media (max-width: 959px) {
  .stage-copy h1 { font-size: clamp(36px, 10.5vw, 64px); }
  .stage-copy .lead { margin-top: 14px; font-size: 16px; }
  .prize-head { margin-top: 22px; }
  .prize-strip {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-right: calc(-1 * clamp(16px, 4vw, 48px)); padding-right: 16px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
            mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .prize-strip::-webkit-scrollbar { display: none; }
  .prize-strip li { flex: none; font-size: 14px; }
  .form-stage { padding-bottom: 44px; }
}

.form-side { display: flex; align-items: flex-start; justify-content: center; padding: 0 16px 48px; }
.entry-form {
  width: 100%; max-width: 480px;
  margin-top: -20px; position: relative; z-index: 2;
  padding: 28px 22px 24px;
  background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}

.field { margin-bottom: 20px; }
.field > label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 15px; }
.field input[type="text"], .phone {
  width: 100%; min-height: 56px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--paper);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out), background-color .2s;
}
.field input[type="text"] { padding: 0 16px; font-size: 17px; }
.field input::placeholder { color: #98A39C; }
.field input[type="text"]:hover, .phone:hover { border-color: rgba(20,38,28,0.45); }
.field input[type="text"]:focus, .phone:focus-within {
  outline: none; border-color: var(--green-700); background: #fff;
  box-shadow: 0 0 0 4px rgba(11, 107, 53, 0.14);
}
.phone { display: flex; align-items: stretch; overflow: hidden; }
.phone-cc {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px; font-weight: 700; font-size: 17px;
  border-right: 1.5px solid var(--line); background: rgba(20,38,28,0.03);
}
.flag-at {
  width: 20px; height: 14px; border-radius: 2px;
  background: linear-gradient(#ED2939 0 33.3%, #fff 33.3% 66.6%, #ED2939 66.6%);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12);
}
.phone input {
  flex: 1; min-width: 0; padding: 0 16px; border: 0; background: transparent;
  font-size: 17px; letter-spacing: 0.02em;
}
.phone input:focus { outline: none; }
.hint { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.error { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--red-700); }
.error:empty { display: none; }
.field.has-error input[type="text"], .field.has-error .phone { border-color: var(--red); }
.field.has-error .phone:focus-within, .field.has-error input[type="text"]:focus { box-shadow: 0 0 0 4px rgba(212,20,27,0.14); }

.field > .check { display: grid; margin: 0; font-weight: 400; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; cursor: pointer; font-size: 15px; line-height: 1.45; }
.check input { position: absolute; opacity: 0; width: 26px; height: 26px; margin: 0; cursor: pointer; }
.check .box {
  display: grid; place-items: center; width: 26px; height: 26px; margin-top: -1px;
  border: 1.5px solid var(--line-strong); border-radius: 7px; background: var(--paper); color: transparent;
  transition: background-color .18s var(--ease-out), border-color .18s, color .18s, transform .18s var(--ease-spring);
}
.check:hover .box { border-color: rgba(20,38,28,0.5); }
.check input:checked + .box { background: var(--green-700); border-color: var(--green-700); color: #fff; transform: scale(1.06); }
.check input:focus-visible + .box { outline: 3px solid var(--focus); outline-offset: 2px; }
.check a { font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.check a:hover { color: var(--green-700); }
.field.has-error .box { border-color: var(--red); }

.btn-block { width: 100%; }
.form-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }

@media (min-width: 960px) {
  .view-form { grid-template-columns: minmax(0, 1.15fr) minmax(440px, 0.85fr); }
  .form-stage { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: 0; }
  .stage-copy { padding-top: clamp(16px, 5vh, 64px); max-width: 760px; }
  /* the wheel rises from the bottom edge like a horizon */
  .stage-wheel {
    display: block; position: absolute; z-index: 0;
    width: min(86%, 780px); aspect-ratio: 1;
    left: 50%; top: calc(100% - 21vh);
    transform: translateX(-50%);
    animation: wheel-rise 1.2s .2s var(--ease-out) both;
  }
  .stage-wheel canvas { width: 100%; height: 100%; }
  @keyframes wheel-rise { from { opacity: 0; transform: translate(-50%, 60px); } to { opacity: 1; transform: translateX(-50%); } }
  .form-side { align-items: center; padding: 48px clamp(24px, 4vw, 64px); }
  .entry-form { margin-top: 0; padding: 40px 36px 32px; }
}
@media (min-width: 960px) and (max-height: 780px) {
  .stage-wheel { display: none; }
}

/* ======================= 2. wheel ======================= */
.view-wheel {
  display: flex; flex-direction: column;
  background:
    radial-gradient(60% 50% at 50% 55%, rgba(233,196,106,0.13), rgba(233,196,106,0) 70%),
    var(--green-900);
}
.wheel-layout {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(16px, 3vh, 32px);
  padding: 0 16px 32px; text-align: center;
}
.wheel-copy .hello { margin: 0; font-size: clamp(30px, 5.4vw, 52px); line-height: 1.02; font-weight: 800; }
.wheel-copy .lead { margin: 10px auto 0; max-width: 36em; color: rgba(255,255,255,0.72); font-size: 17px; }

.wheel-wrap {
  position: relative;
  width: min(94vw, 66vh, 640px); aspect-ratio: 1;
}
.wheel-wrap canvas { width: 100%; height: 100%; filter: drop-shadow(0 30px 50px rgba(0,0,0,0.38)); }
.pointer {
  position: absolute; z-index: 3; left: 50%; top: -3%;
  width: 11%; transform: translateX(-50%); transform-origin: 50% 32%;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.35));
}
.pointer.tick { animation: tick .14s ease-out; }
@keyframes tick { 0% { transform: translateX(-50%) rotate(0); } 40% { transform: translateX(-50%) rotate(-14deg); } 100% { transform: translateX(-50%) rotate(0); } }

.hub {
  position: absolute; z-index: 2; left: 50%; top: 50%;
  width: 20%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 0; border-radius: 999px; cursor: pointer;
  background: radial-gradient(circle at 50% 35%, #fff 0%, var(--cream) 70%);
  color: var(--green-900);
  font-weight: 800; font-stretch: 86%; font-size: clamp(14px, 2.4vw, 22px); letter-spacing: 0.04em; text-transform: uppercase;
  box-shadow: 0 0 0 6px var(--gold), 0 0 0 10px rgba(10,61,36,0.9), 0 12px 28px rgba(0,0,0,0.4);
  transition: transform .2s var(--ease-spring), box-shadow .2s;
}
.hub:hover:not([disabled]) { transform: translate(-50%, -50%) scale(1.05); }
.hub:active:not([disabled]) { transform: translate(-50%, -50%) scale(0.96); }
.hub[disabled] { cursor: default; }
.hub::after {
  content: ""; position: absolute; inset: -10px; border-radius: inherit;
  border: 2px solid rgba(233,196,106,0.7);
  animation: ring 2.4s var(--ease-out) infinite;
}
.hub[disabled]::after { display: none; }
@keyframes ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }

.wheel-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.btn-spin { min-width: min(320px, 100%); min-height: 60px; font-size: 19px; text-transform: uppercase; letter-spacing: 0.06em; font-stretch: 90%; }
.status { min-height: 1.5em; margin: 0; color: rgba(255,255,255,0.72); font-size: 15px; }

.sound-btn .off { display: none; }
.sound-btn[aria-pressed="false"] .on { display: none; }
.sound-btn[aria-pressed="false"] .off { display: block; }

/* ======================= win card ======================= */
/* sits below the confetti canvas (z-index 9999) so the burst falls over the card */
.win-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 72px 16px 24px;
  background: rgba(4, 22, 14, 0.62); backdrop-filter: blur(4px);
  animation: fade .3s var(--ease-out) both;
}
.win-overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.win {
  width: min(440px, 100%);
  padding: 34px 28px 28px; border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink); text-align: center;
  box-shadow: 0 40px 90px -20px rgba(0,0,0,0.55);
  animation: pop .55s var(--ease-spring) both;
}
@keyframes pop { from { opacity: 0; transform: scale(0.86) translateY(20px); } to { opacity: 1; transform: none; } }
.win-img {
  width: 104px; height: 104px; margin: -86px auto 18px; border-radius: 999px;
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 6px var(--paper), 0 0 0 8px var(--gold), 0 16px 30px -10px rgba(0,0,0,0.4);
}
.win-img img { width: 100%; height: 100%; object-fit: cover; }
.win-img svg { width: 50%; height: 50%; }
.win h2 { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 800; }
.win-you { margin: 18px 0 2px; color: var(--muted); }
.win-prize { margin: 0; font-size: clamp(30px, 8vw, 40px); line-height: 1.05; font-weight: 800; font-stretch: 86%; color: var(--green-700); }
.win-desc { margin: 10px 0 24px; color: var(--muted); }
/* the button fills up while the automatic redirect counts down */
#win-next { overflow: hidden; isolation: isolate; }
#win-next .btn-fill {
  position: absolute; inset: 0; z-index: -1;
  background: rgba(0, 0, 0, 0.18);
  transform: scaleX(0); transform-origin: left center;
}
#win-next.is-counting .btn-fill { animation: fill-up var(--redirect, 6s) linear forwards; }
@keyframes fill-up { to { transform: scaleX(1); } }
.win-countdown { margin: 12px 0 0; min-height: 1.4em; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.win .eyebrow { margin-bottom: 8px; }

/* ======================= 2b. bank selection ======================= */
.view-bank {
  display: flex; flex-direction: column;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(233,196,106,0.1), rgba(233,196,106,0) 70%),
    var(--green-900);
}
.bank-layout { flex: 1; width: 100%; max-width: 1060px; margin: 0 auto; padding: 4px clamp(16px, 4vw, 48px) 56px; }
.bank-head { text-align: center; max-width: 660px; margin: 0 auto 26px; }
.bank-head h1 { margin: 0; font-size: clamp(26px, 4.6vw, 42px); line-height: 1.06; font-weight: 800; }
.bank-won {
  display: inline-flex; align-items: baseline; gap: 6px;
  margin: 16px 0 0; padding: 8px 16px; border-radius: 999px;
  background: rgba(233,196,106,0.14); color: var(--gold); font-size: 15px; font-weight: 600;
}
.bank-won strong { font-size: 18px; font-weight: 800; font-stretch: 90%; }
.bank-head .lead { margin: 14px auto 0; max-width: 40em; color: rgba(255,255,255,0.74); font-size: 16px; }

.bank-grid {
  display: grid; gap: 12px; margin: 0; padding: 0; list-style: none;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 560px) { .bank-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .bank-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.bank-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: 100%; height: 100%; min-height: 132px; padding: 18px 10px;
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-md);
  background: rgba(255,255,255,0.06); color: #fff; cursor: pointer; text-align: center;
  transition: transform .18s var(--ease-out), background-color .2s var(--ease-out), border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.bank-card:hover { background: rgba(255,255,255,0.11); transform: translateY(-3px); border-color: rgba(255,255,255,0.24); }
.bank-card:active { transform: translateY(-1px) scale(0.99); }
.bank-card.is-selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); background: rgba(233,196,106,0.12); }
.bank-logo {
  display: flex; align-items: center; justify-content: center; width: 124px; height: 66px; padding: 4px; border-radius: 12px; overflow: hidden; flex: none;
  box-shadow: 0 6px 16px -8px rgba(0,0,0,0.5);
}
.bank-logo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.bank-logo span { font-size: 20px; }
.bank-name { font-size: 14px; font-weight: 600; line-height: 1.25; }

.bank-note {
  max-width: 640px; margin: 26px auto 0; padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-md);
  background: rgba(255,255,255,0.04);
  text-align: center; font-size: 14px; color: rgba(255,255,255,0.68); line-height: 1.5;
}

/* ======================= 3. waiting ======================= */
.view-wait { display: flex; flex-direction: column; background: var(--cream); }
.wait-layout { flex: 1; display: grid; place-items: center; padding: 8px 16px 48px; }
.wait-card {
  width: 100%; max-width: 560px;
  padding: 40px 24px 32px; text-align: center;
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
}
.wait-mark {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 22px;
  border-radius: 999px; background: var(--green-700); color: #fff;
  animation: pop .6s .1s var(--ease-spring) both;
}
.wait-card h1 { margin: 0; font-size: clamp(28px, 5vw, 40px); line-height: 1.06; font-weight: 800; }
.wait-card .lead { margin: 14px auto 0; max-width: 30em; color: var(--muted); }

.wait-prize {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px 16px; align-items: center;
  margin: 28px 0 26px; padding: 16px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--r-md); background: #fff;
}
.wait-prize-img { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; }
.wait-prize-img img { width: 100%; height: 100%; object-fit: cover; }
.wait-prize-img svg { width: 55%; height: 55%; }

.wait-bank { grid-template-columns: 156px 1fr; margin-bottom: 14px; }
.wait-bank .wait-prize-img { display: flex; align-items: center; justify-content: center; width: 156px; height: 76px; padding: 5px; }
.wait-bank .wait-prize-img img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }

.wait-prize .label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.wait-prize .value { margin: 2px 0 0; font-size: 20px; font-weight: 800; font-stretch: 90%; }
.wait-code { grid-column: 1 / -1; padding-top: 14px; border-top: 1px dashed var(--line-strong); display: flex; justify-content: space-between; align-items: baseline; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.08em; }

.progress { position: relative; height: 6px; border-radius: 999px; background: rgba(20,38,28,0.1); overflow: hidden; }
.progress span {
  position: absolute; inset: 0 auto 0 0; width: 38%; border-radius: inherit;
  background: linear-gradient(90deg, var(--green-700), #2E9B5B);
  animation: slide 1.8s var(--ease-out) infinite;
}
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(290%); } }
.progress-label { margin: 12px 0 0; font-size: 14px; color: var(--muted); }

@media (min-width: 640px) {
  .wait-card { padding: 52px 48px 40px; }
}
