/* ===== GLOW Together — guest pages (mobile-first 9:16) ===== */
@font-face { font-family: 'CPN'; src: url('/fonts/CPN-Light.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'CPN'; src: url('/fonts/CPN-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'CPN'; src: url('/fonts/CPN-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --night: #070b1e;
  --night-2: #0c1230;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.72);
  --ink-3: rgba(255, 255, 255, 0.5);
  --cyan: #29c5ff;
  --blue: #1f6bff;
  --pink: #ff3fd0;
  --green: #6dff5c;
  --yellow: #fff35c;
  --err: #ff6b7d;
  --glow-cyan: 0 0 6px rgba(41, 197, 255, 0.9), 0 0 18px rgba(41, 197, 255, 0.55), 0 0 36px rgba(31, 107, 255, 0.35);
  --glow-white: 0 0 4px rgba(255, 255, 255, 0.9), 0 0 14px rgba(140, 200, 255, 0.55);
  --font: 'CPN', 'Noto Sans Thai', 'Prompt', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: #03050f;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
button, input { font: inherit; }
.hidden { display: none !important; }

/* ---------- stage ---------- */
.stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--night) url('/img/bg.webp') center top / cover no-repeat;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  container-type: inline-size;
}
@media (min-width: 481px) {
  .stage { box-shadow: 0 0 80px rgba(41, 120, 255, 0.18); }
}

/* fireworks in the corners (decorative) */
.fw { position: absolute; pointer-events: none; z-index: -1; opacity: 0.9; user-select: none; }
.fw-tl { top: -2%; left: -9%; width: 31%; animation: twinkle 4.2s ease-in-out infinite; }
.fw-tr { top: -1%; right: -8%; width: 30%; animation: twinkle 5s ease-in-out 0.8s infinite; }
.fw-cl { top: 40%; left: -12%; width: 28%; animation: twinkle 4.6s ease-in-out 1.6s infinite; }
.fw-bl { bottom: 7%; left: -3%; width: 20%; animation: twinkle 3.8s ease-in-out 0.4s infinite; }
.fw-br { bottom: 4%; right: -10%; width: 38%; animation: twinkle 5.4s ease-in-out 1.2s infinite; }
@keyframes twinkle {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .fw { animation: none; }
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(28px, env(safe-area-inset-top)) 9cqw 20px;
  gap: 20px;
}

/* Page heading size. The title logo is sized from it so the logo spans exactly the width of
   "ลงทะเบียนเพื่อเข้าสู่กิจกรรม" (11.87em of CPN Bold; artwork fills 641/650 px of the file). */
.stage { --title-fs: clamp(1.15rem, 6cqw, 1.6rem); }
.title-logo { width: calc(var(--title-fs) * 12.04); max-width: 100%; height: auto; margin-top: 2vh; filter: drop-shadow(0 0 14px rgba(120, 60, 255, 0.25)); }
.title-logo.small { margin-top: 0; }

/* sponsor logos */
.sponsors {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 7cqw max(16px, env(safe-area-inset-bottom));
}
.sponsors img { height: auto; }
.sponsors .cr { width: 21cqw; }
.sponsors .cp { width: 24cqw; }
.sponsors .ct { width: 14cqw; }

/* ---------- neon text ---------- */
.neon-title {
  margin: 4px 0 0;
  font-weight: 700;
  font-size: var(--title-fs);
  color: #bfefff;
  text-shadow: 0 0 4px #29c5ff, 0 0 12px #29c5ff, 0 0 24px #1f6bff;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ---------- form ---------- */
.form { width: 100%; display: grid; gap: 14px; }
.field {
  width: 100%;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 11px 20px;
  font-size: 1rem;
  outline: none;
  box-shadow: 0 0 8px rgba(160, 210, 255, 0.35), inset 0 0 6px rgba(160, 210, 255, 0.12);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.field::placeholder { color: rgba(255, 255, 255, 0.55); }
.field:focus { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.field[aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 10px rgba(255, 107, 125, 0.6); }

.consent {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  padding: 2px 4px;
}
.consent input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  background: #000;
  box-shadow: 0 0 6px rgba(160, 210, 255, 0.4);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.consent input:checked { border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.consent input:checked::after { content: ''; width: 7px; height: 13px; border: solid var(--cyan); border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.consent input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.consent a { color: #bfefff; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.msg { border-radius: 14px; padding: 10px 16px; font-size: 0.92rem; text-align: center; }
.msg-err { background: rgba(255, 60, 90, 0.15); border: 1px solid rgba(255, 107, 125, 0.6); color: #ffd0d6; }

/* ---------- neon buttons ---------- */
.btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 52cqw;
  padding: 9px 26px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--glow-white);
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.btn-neon:active { transform: scale(0.97); }
.btn-neon:hover { box-shadow: 0 0 6px #fff, 0 0 20px rgba(140, 200, 255, 0.8); }
.btn-neon svg { width: 24px; height: 24px; flex: none; }
.btn-neon[disabled], .btn-neon.done {
  cursor: default;
  color: rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(120, 120, 130, 0.35);
  box-shadow: none;
}
.btn-neon .tag { font-size: 0.72rem; font-weight: 400; border-radius: 99px; padding: 1px 8px; background: rgba(255, 255, 255, 0.18); }

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(90deg, #ff3fd0, #7a4bff 50%, #29c5ff);
  box-shadow: 0 0 14px rgba(255, 63, 208, 0.45), 0 0 24px rgba(41, 197, 255, 0.35);
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.55; cursor: progress; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 7px 22px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 0 12px rgba(31, 107, 255, 0.7);
  cursor: pointer;
  text-decoration: none;
}
.btn-back svg { width: 20px; height: 20px; }

/* ---------- cards ---------- */
.card-neon {
  width: 100%;
  border-radius: 18px;
  border: 2px solid var(--cyan);
  background: rgba(0, 0, 0, 0.82);
  box-shadow: var(--glow-cyan);
  padding: 22px 18px;
  text-align: center;
}
.name-card .nm { font-weight: 700; font-size: clamp(1.1rem, 5.2cqw, 1.4rem); line-height: 1.3; }
.name-card .co { color: var(--ink-2); font-size: 0.85rem; margin-top: 6px; }

.prize-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: clamp(1.4rem, 7cqw, 1.9rem);
  color: #bfefff;
  text-shadow: 0 0 4px #29c5ff, 0 0 14px #1f6bff;
}
.prize-head svg { width: 1.25em; height: 1.25em; filter: drop-shadow(0 0 4px #29c5ff); }

.qr-card { display: grid; gap: 8px; justify-items: center; padding: 18px 18px 22px; }
.qr-card .nm { font-weight: 700; font-size: 1.15rem; line-height: 1.3; }
.qr-card .co { color: var(--ink-2); font-size: 0.8rem; }
.qr-card .pz { font-weight: 700; font-size: 1.2rem; margin-top: 2px; }
.qr-box { position: relative; width: 62cqw; max-width: 280px; aspect-ratio: 1; margin-top: 8px; background: #fff; border-radius: 10px; overflow: hidden; }
.qr-box img { width: 100%; height: 100%; }
.qr-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.12em; color: var(--ink-3); font-size: 0.82rem; }
.qr-done {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  background: rgba(7, 11, 30, 0.86);
  color: var(--green);
  font-weight: 700;
  font-size: 1.2rem;
  text-shadow: 0 0 10px rgba(109, 255, 92, 0.6);
}
.qr-done .ck { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--green); display: grid; place-items: center; font-size: 2rem; box-shadow: 0 0 16px rgba(109, 255, 92, 0.6); }
.qr-done small { color: var(--ink-2); font-weight: 400; font-size: 0.8rem; text-shadow: none; }
.souv-card { display: grid; gap: 12px; justify-items: center; padding: 24px 20px; width: min(100%, 380px); text-align: center; }
.souv-card .pz { font-weight: 700; font-size: clamp(1.3rem, 6.5cqw, 1.7rem); line-height: 1.3; }
.souv-card img.pz-img { width: 140px; height: 140px; object-fit: contain; border-radius: 12px; background: #fff; }
.hint { color: var(--ink-2); font-size: 0.88rem; text-align: center; line-height: 1.5; margin: 0; }

/* ---------- splash ---------- */
.splash { justify-content: center; gap: 4vh; }
.splash .title-logo { width: 74cqw; max-width: 360px; margin-top: 0; }
.splash .date { width: 46cqw; max-width: 220px; height: auto; }
.reveal { animation: reveal 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.reveal.d2 { animation-delay: 0.35s; }
@keyframes reveal {
  from { opacity: 0; transform: translateY(14px) scale(0.96); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
.flicker { animation: reveal 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both, flicker 3.2s linear 1.2s infinite; }
@keyframes flicker {
  0%, 18%, 22%, 25%, 53%, 57%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.78; }
}

/* ---------- wheel ---------- */
.wheel-wrap { position: relative; width: 84cqw; max-width: 400px; aspect-ratio: 1; container-type: inline-size; }
.wheel-hub {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font: 700 5cqw/1 var(--font);
  color: #fff;
  white-space: nowrap;
}
#wheel { width: 100%; height: 100%; display: block; cursor: pointer; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

.result-pop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 5, 15, 0.7);
  backdrop-filter: blur(3px);
  animation: fade 0.25s ease both;
}
.result-pop .card-neon { max-width: 380px; display: grid; gap: 14px; justify-items: center; padding: 26px 20px; animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.result-pop .congrats { color: var(--yellow); font-weight: 700; font-size: 1.1rem; text-shadow: 0 0 10px rgba(255, 243, 92, 0.6); }
.result-pop .pz { font-weight: 700; font-size: clamp(1.4rem, 7cqw, 1.9rem); line-height: 1.25; }
.result-pop img.pz-img { width: 120px; height: 120px; object-fit: contain; border-radius: 12px; background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

.loading { display: grid; place-items: center; min-height: 30vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dialog ---------- */
dialog.sheet {
  border: 2px solid var(--cyan);
  border-radius: 18px;
  background: #050816;
  color: #fff;
  width: min(440px, calc(100% - 32px));
  padding: 22px;
  box-shadow: var(--glow-cyan);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.sheet h2 { margin: 0 0 10px; font-size: 1.15rem; }
dialog.sheet p, dialog.sheet li { color: var(--ink-2); font-size: 0.9rem; line-height: 1.6; }
dialog.sheet ul { padding-left: 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(10, 14, 40, 0.95);
  border: 1px solid var(--cyan);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.92rem;
  z-index: 100;
  max-width: calc(100% - 32px);
  box-shadow: var(--glow-cyan);
}
