:root {
  --brand: #e8332e;
  --brand-dark: #b3211d;
  --gold: #ffd24c;
  --gold-deep: #f5a623;
  --ink: #1d1320;
  --bg-1: #2b0a3d;
  --bg-2: #6a0f2e;
  --white: #ffffff;
  --radius: 22px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 50% -10%, var(--bg-2), var(--bg-1) 60%, #170622 100%);
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
  overflow-x: hidden;
  position: relative;
}

/* ---- background decoration ---- */
.bg-decor { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.orb-1 { width: 340px; height: 340px; background: #ff5a5f; top: -80px; left: -60px; }
.orb-2 { width: 300px; height: 300px; background: #ffd24c; bottom: -90px; right: -70px; opacity: .35; }
.orb-3 { width: 260px; height: 260px; background: #8b2be0; top: 40%; left: 60%; opacity: .3; }

/* tia sáng toả ra như sân khấu */
.rays {
  position: absolute; top: -25vh; left: 50%; transform: translateX(-50%);
  width: 150vmax; height: 150vmax;
  background: repeating-conic-gradient(
    from 0deg at 50% 0%,
    rgba(255,210,76,.10) 0deg 7deg,
    transparent 7deg 18deg
  );
  opacity: .55;
  animation: spinRays 60s linear infinite;
}
@keyframes spinRays { to { transform: translateX(-50%) rotate(360deg); } }

/* đốm sáng bokeh */
.bokeh i {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.9), rgba(255,255,255,0));
  animation: twinkle 4s ease-in-out infinite;
}
.bokeh i:nth-child(1){ width:6px;height:6px;  top:18%; left:12%; animation-delay:.2s }
.bokeh i:nth-child(2){ width:10px;height:10px; top:30%; left:80%; animation-delay:1.1s }
.bokeh i:nth-child(3){ width:5px;height:5px;  top:55%; left:25%; animation-delay:.6s }
.bokeh i:nth-child(4){ width:8px;height:8px;  top:70%; left:70%; animation-delay:1.8s }
.bokeh i:nth-child(5){ width:7px;height:7px;  top:12%; left:55%; animation-delay:2.3s }
.bokeh i:nth-child(6){ width:5px;height:5px;  top:82%; left:40%; animation-delay:.9s }
.bokeh i:nth-child(7){ width:9px;height:9px;  top:45%; left:90%; animation-delay:1.4s }
.bokeh i:nth-child(8){ width:6px;height:6px;  top:60%; left:8%;  animation-delay:2.7s }
.bokeh i:nth-child(9){ width:7px;height:7px;  top:25%; left:42%; animation-delay:3.2s }
.bokeh i:nth-child(10){width:5px;height:5px;  top:88%; left:62%; animation-delay:.4s }
.bokeh i:nth-child(11){width:8px;height:8px;  top:38%; left:5%;  animation-delay:2s }
.bokeh i:nth-child(12){width:6px;height:6px;  top:8%;  left:30%; animation-delay:1.6s }
@keyframes twinkle { 0%,100%{ opacity:.2; transform:scale(.6) } 50%{ opacity:1; transform:scale(1.2) } }

/* icon sản phẩm Doscom bay lơ lửng */
.float-icons { position: absolute; inset: 0; }
.fi {
  position: absolute; bottom: -60px; left: var(--x);
  font-size: 26px; opacity: 0; filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
  animation: floatUp var(--t, 15s) linear infinite;
  animation-delay: var(--d, 0s);
}
@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg);     opacity: 0; }
  10%  { opacity: .55; }
  90%  { opacity: .55; }
  100% { transform: translateY(-115vh) rotate(40deg); opacity: 0; }
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---- brand ---- */
.brand { text-align: center; }
.brand-logo {
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 4px;
  color: var(--white);
  text-shadow: 0 2px 0 var(--brand-dark), 0 6px 18px rgba(0,0,0,.4);
}
.brand-tag {
  margin-top: 4px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---- card / screens ---- */
.card {
  width: 100%;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px 28px;
  text-align: center;
}
.screen { display: none; animation: pop .4s ease; }
.screen.active { display: block; }

@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.title { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.subtitle { margin-top: 10px; font-size: 15px; color: #5a5060; line-height: 1.55; }
.subtitle strong { color: var(--brand-dark); }

/* ---- form ---- */
.form { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field input {
  font-family: inherit;
  font-size: 16px;
  padding: 14px 16px;
  border: 2px solid #ece6f0;
  border-radius: 14px;
  background: #faf8fc;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(232,51,46,.12); background: #fff; }
.field input.invalid { border-color: #e8332e; background: #fff5f5; }
.error { font-size: 12.5px; color: #e8332e; min-height: 14px; font-weight: 500; }
.form-note { font-size: 12px; color: #9089a0; text-align: center; margin-top: 2px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-weight: 800; font-size: 17px;
  padding: 15px 22px; border: none; border-radius: 16px; cursor: pointer;
  text-decoration: none; width: 100%;
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s;
}
.btn-primary {
  color: #4a1d00;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  box-shadow: 0 8px 20px rgba(245,166,35,.45), inset 0 1px 0 rgba(255,255,255,.6);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---- wheel ---- */
.wheel-wrap {
  position: relative;
  width: min(86vw, 380px);
  aspect-ratio: 1;
  margin: 24px auto 8px;
}

/* viền vàng có chiều sâu + vòng đèn LED */
.wheel-ring {
  position: absolute; inset: -16px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, #ffe79a, #f5a623, #ffd24c, #d98a00, #ffe79a, #f5a623, #ffd24c);
  box-shadow:
    0 0 0 5px #fff8e6,
    0 14px 36px rgba(0,0,0,.45),
    inset 0 0 18px rgba(120,60,0,.5);
  z-index: 1;
}
.bulbs { position: absolute; inset: 0; }
.bulbs i {
  position: absolute; top: 50%; left: 50%;
  width: 11px; height: 11px; margin: -5.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #fff6cf 40%, #ffd24c 75%);
  box-shadow: 0 0 8px 2px rgba(255,236,150,.9);
  animation: bulbBlink 1s ease-in-out infinite;
}
@keyframes bulbBlink {
  0%, 100% { opacity: 1;   box-shadow: 0 0 9px 3px rgba(255,236,150,.95); }
  50%      { opacity: .35; box-shadow: 0 0 3px 1px rgba(255,236,150,.4); }
}

#wheel {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  border-radius: 50%;
  display: block;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.9), 0 8px 22px rgba(0,0,0,.3);
  transition: transform 6.2s cubic-bezier(.12,.78,.22,1);
}
.wheel-pointer {
  position: absolute;
  top: -22px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 34px solid var(--brand);
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.45));
  z-index: 7;
}
.wheel-pointer::after {
  content: ""; position: absolute; left: -9px; top: -34px;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--gold) 70%);
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.spin-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 92px; height: 92px; border-radius: 50%;
  border: 6px solid #fff;
  background: radial-gradient(circle at 50% 32%, #ff5a55, var(--brand) 55%, var(--brand-dark));
  color: #fff; font-weight: 900; font-size: 19px; letter-spacing: 1px;
  cursor: pointer; z-index: 8; overflow: hidden;
  box-shadow: 0 8px 18px rgba(0,0,0,.45), inset 0 2px 6px rgba(255,255,255,.4);
  transition: transform .12s;
  animation: pulse 1.6s ease-in-out infinite;
}
.spin-center span:last-child { position: relative; z-index: 2; }
.spin-glow {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.55), transparent 60%);
  opacity: 0; animation: shine 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 18px rgba(0,0,0,.45), inset 0 2px 6px rgba(255,255,255,.4), 0 0 0 0 rgba(232,51,46,.5); }
  50%      { box-shadow: 0 8px 18px rgba(0,0,0,.45), inset 0 2px 6px rgba(255,255,255,.4), 0 0 0 14px rgba(232,51,46,0); }
}
@keyframes shine { 0%,100% { opacity: 0; } 50% { opacity: .8; } }
.spin-center:hover { transform: translate(-50%, -50%) scale(1.06); }
.spin-center:active { transform: translate(-50%, -50%) scale(.96); }
.spin-center:disabled { opacity: .8; cursor: not-allowed; animation: none; }
.spin-hint { margin-top: 34px; font-size: 14px; color: #6a6076; }

/* ---- done screen ---- */
.done-badge {
  width: 64px; height: 64px; margin: 0 auto 8px;
  border-radius: 50%; background: #1faa59; color: #fff;
  font-size: 34px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(31,170,89,.4);
}

/* ---- voucher box ---- */
.voucher-box {
  margin: 18px auto;
  max-width: 320px;
  padding: 20px 18px;
  border-radius: 18px;
  color: #4a1d00;
  background:
    radial-gradient(circle at 0 50%, transparent 10px, var(--gold) 11px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 10px, var(--gold-deep) 11px) right / 51% 100% no-repeat;
  position: relative;
  box-shadow: 0 10px 24px rgba(245,166,35,.4);
}
.voucher-amount { font-size: 44px; font-weight: 900; line-height: 1; }
.voucher-amount small { font-size: 22px; }
.voucher-label { margin-top: 6px; font-size: 12px; font-weight: 800; letter-spacing: 1px; }
.voucher-code { margin-top: 10px; font-size: 14px; }
.voucher-code strong { letter-spacing: 1px; }

/* ---- modal ---- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(12, 4, 20, .72); backdrop-filter: blur(4px);
  padding: 20px;
}
.modal.show { display: flex; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; overflow: hidden;
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 24px;
  padding: 28px 24px 26px; text-align: center;
  box-shadow: var(--shadow);
  animation: pop .45s cubic-bezier(.2,.9,.3,1.2);
}
.modal-trophy { font-size: 52px; }
.modal-title { font-size: 26px; font-weight: 900; color: var(--brand); margin-top: 4px; }
.modal-sub { font-size: 15px; color: #5a5060; margin-top: 4px; }
.modal-note { font-size: 13px; color: #6a6076; margin: 4px 0 16px; line-height: 1.5; }
.confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-layer i {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(520px) rotate(720deg); opacity: .9; }
}
