/* =========================================================================
   Suprize: design system
   ========================================================================= */

:root {
  --font-display: 'Bricolage Grotesque', ui-rounded, system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --text: #f8f5ff;
  --muted: rgba(248, 245, 255, 0.7);
  --faint: rgba(248, 245, 255, 0.45);
  --card: rgba(255, 255, 255, 0.055);
  --card-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --field: rgba(10, 6, 30, 0.45);
  --success: #2fe0a4;
  --danger: #ff6b86;
  --warning: #ffcb5c;

  --radius-lg: 28px;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.7);
  --gutter: 16px;

  /* theme: party (default) */
  --bg-0: #0b0722;
  --bg-1: #160a3a;
  --glow-1: rgba(255, 61, 127, 0.38);
  --glow-2: rgba(63, 169, 245, 0.3);
  --glow-3: rgba(139, 92, 246, 0.45);
  --accent: #ff3d7f;
  --accent-2: #ffb020;
  --accent-3: #3fa9f5;
  --btn-grad: linear-gradient(135deg, #ff3d7f 0%, #ff5e3a 100%);
  --btn-ink: #ffffff;
  --btn-glow: rgba(255, 61, 127, 0.55);
  --rim-a: #fff4c7;
  --rim-b: #ffc53d;
  --rim-c: #b7791f;
  --hub-ink: #3a1d00;
}

[data-theme='festive'] {
  --bg-0: #03140e;
  --bg-1: #08281c;
  --glow-1: rgba(214, 40, 57, 0.36);
  --glow-2: rgba(242, 193, 78, 0.22);
  --glow-3: rgba(27, 127, 91, 0.45);
  --accent: #e23a4b;
  --accent-2: #f2c14e;
  --accent-3: #3baf7f;
  --btn-grad: linear-gradient(135deg, #e23a4b 0%, #b5172b 100%);
  --btn-glow: rgba(226, 58, 75, 0.5);
  --rim-a: #fff0c2;
  --rim-b: #e5b53a;
  --rim-c: #8a6512;
}

[data-theme='birthday'] {
  --bg-0: #19061f;
  --bg-1: #2a0a33;
  --glow-1: rgba(255, 79, 154, 0.4);
  --glow-2: rgba(255, 201, 60, 0.24);
  --glow-3: rgba(62, 193, 211, 0.32);
  --accent: #ff4f9a;
  --accent-2: #ffc93c;
  --accent-3: #3ec1d3;
  --btn-grad: linear-gradient(135deg, #ff4f9a 0%, #a855f7 100%);
  --btn-glow: rgba(255, 79, 154, 0.5);
  --rim-a: #ffffff;
  --rim-b: #ffc0e0;
  --rim-c: #d9468f;
  --hub-ink: #5a0f36;
}

[data-theme='luxe'] {
  --bg-0: #070709;
  --bg-1: #131119;
  --glow-1: rgba(212, 175, 55, 0.22);
  --glow-2: rgba(140, 100, 40, 0.22);
  --glow-3: rgba(70, 60, 110, 0.35);
  --accent: #d4af37;
  --accent-2: #f3e5c0;
  --accent-3: #b8893b;
  --btn-grad: linear-gradient(135deg, #f6dc8c 0%, #c9a227 100%);
  --btn-ink: #1d1606;
  --btn-glow: rgba(212, 175, 55, 0.45);
  --rim-a: #fff6d8;
  --rim-b: #d4af37;
  --rim-c: #6b5113;
  --hub-ink: #2a1f05;
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg-0);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-0);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main { flex: 1; }

img, svg, canvas { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
}

p { margin: 0; }

a { color: inherit; }

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 10px;
}

::selection { background: var(--accent); color: #fff; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left));
}

.center { text-align: center; }

/* -------------------------------------------------------------- backdrop */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 700px at 8% -8%, var(--glow-1), transparent 60%),
    radial-gradient(800px 640px at 108% 12%, var(--glow-2), transparent 58%),
    radial-gradient(900px 700px at 50% 115%, var(--glow-3), transparent 62%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  transition: background 0.6s ease;
}

.backdrop .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: orb-float 22s ease-in-out infinite alternate;
}
.backdrop .orb-1 { width: 340px; height: 340px; left: -80px; top: 30%; background: var(--accent); opacity: 0.18; }
.backdrop .orb-2 { width: 280px; height: 280px; right: -60px; top: 55%; background: var(--accent-3); opacity: 0.16; animation-delay: -8s; }
.backdrop .orb-3 { width: 220px; height: 220px; left: 45%; top: -60px; background: var(--accent-2); opacity: 0.12; animation-delay: -14s; }

.backdrop .stars {
  position: absolute;
  inset: -200px;
  background-image:
    radial-gradient(1.6px 1.6px at 30px 40px, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 120px 160px, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.8px 1.8px at 210px 80px, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1px 1px at 260px 220px, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1.4px 1.4px at 80px 260px, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 180px 300px, rgba(255, 255, 255, 0.5), transparent 60%);
  background-size: 320px 320px;
  opacity: 0.45;
  animation: stars-drift 160s linear infinite, twinkle 6s ease-in-out infinite;
}

@keyframes orb-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(60px, -40px, 0) scale(1.15); }
}
@keyframes stars-drift { to { transform: translate3d(-320px, -320px, 0); } }
@keyframes twinkle { 50% { opacity: 0.25; } }

/* ---------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.brand-mark { width: 36px; height: 36px; filter: drop-shadow(0 6px 14px var(--btn-glow)); }
.brand-mark .s1 { stop-color: var(--accent); }
.brand-mark .s2 { stop-color: var(--accent-2); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------- buttons */

.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h);
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--btn-grad);
  color: var(--btn-ink);
  box-shadow: 0 10px 30px -10px var(--btn-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
  z-index: -1;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 40px -12px var(--btn-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn-primary:hover:not(:disabled)::after { transform: translateX(120%); }

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-ghost:hover:not(:disabled) { background: var(--card-strong); border-color: var(--line-strong); }

.btn-danger { background: rgba(255, 107, 134, 0.12); border-color: rgba(255, 107, 134, 0.35); color: #ffc2cd; }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 134, 0.22); }

.btn-sm { --h: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn-lg { --h: 56px; padding: 0 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label { opacity: 0; }
.btn.is-loading::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.icon-btn:hover { background: var(--card-strong); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.round { border-radius: 50%; }

.link-btn {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
  cursor: pointer;
}
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }

/* ----------------------------------------------------------------- cards */

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  padding: 20px;
}
@media (min-width: 640px) { .card { padding: 26px; } }

.card-title { font-size: 1.25rem; font-weight: 800; }
.card-sub { color: var(--muted); margin-top: 6px; font-size: 0.95rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.section-title { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
.section-sub { color: var(--muted); margin-top: 8px; }

/* ----------------------------------------------------------------- forms */

.field { display: grid; gap: 8px; margin-top: 18px; }
.field:first-of-type { margin-top: 0; }
.field > label, .label { font-weight: 700; font-size: 0.9rem; }
.opt { color: var(--faint); font-weight: 500; font-size: 0.8rem; margin-left: 4px; }
.hint { color: var(--faint); font-size: 0.85rem; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.input:disabled { opacity: 0.6; }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }

select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-opacity='.6' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
select.input option { background: #1b1433; color: #fff; }

input[type='number'].input { -moz-appearance: textfield; }
input[type='number'].input::-webkit-outer-spin-button,
input[type='number'].input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[type='datetime-local'].input { color-scheme: dark; }

.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 134, 0.18); }

/* switch row */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.switch-row:first-of-type { border-top: 0; }
.switch-row b { display: block; font-size: 0.95rem; }
.switch-row small { display: block; color: var(--faint); font-size: 0.83rem; margin-top: 2px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--line);
  transition: background 0.25s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.switch-row input:checked + .switch { background: var(--btn-grad); border-color: transparent; }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent-2); outline-offset: 3px; }

/* segmented control */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--line);
}
.seg-btn {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--card-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* stepper */
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper .input { width: 96px; text-align: center; font-weight: 800; font-size: 1.25rem; font-family: var(--font-display); }
.stepper .icon-btn { width: 48px; height: 48px; border-radius: 14px; font-size: 1.4rem; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.chip:hover { background: var(--card-strong); border-color: var(--line-strong); transform: translateY(-1px); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--card-strong);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill-live { color: #b8ffe4; background: rgba(47, 224, 164, 0.14); border-color: rgba(47, 224, 164, 0.35); }
.pill-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulse-dot 1.6s ease-in-out infinite; }
.pill-off { color: #ffd4dc; background: rgba(255, 107, 134, 0.14); border-color: rgba(255, 107, 134, 0.35); }
.pill-done { color: #ffe9b8; background: rgba(255, 203, 92, 0.14); border-color: rgba(255, 203, 92, 0.35); }

@keyframes pulse-dot { 50% { opacity: 0.4; } }

/* ----------------------------------------------------------- wheel stage */

.stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  container-type: inline-size;
}
.stage::before {
  content: '';
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent) 0%, transparent 66%);
  filter: blur(24px);
  opacity: 0.75;
  animation: breathe 5s ease-in-out infinite;
}
.stage canvas { position: relative; z-index: 1; width: 100%; height: 100%; }

.pointer {
  position: absolute;
  z-index: 3;
  top: -1.5%;
  left: 50%;
  width: 10.5%;
  margin-left: -5.25%;
  transform-origin: 50% 30%;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}
.pointer .pg-a { stop-color: var(--rim-a); }
.pointer .pg-b { stop-color: var(--rim-c); }

.hub {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 23%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.6cqi;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0%, var(--rim-a) 22%, var(--rim-b) 58%, var(--rim-c) 100%);
  box-shadow:
    0 0 0 1.1cqi rgba(255, 255, 255, 0.16),
    0 1.6cqi 4cqi rgba(0, 0, 0, 0.55),
    inset 0 -1cqi 2cqi rgba(0, 0, 0, 0.28),
    inset 0 0.6cqi 1cqi rgba(255, 255, 255, 0.6);
  color: var(--hub-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 4.6cqi;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.3s ease;
  -webkit-user-select: none;
  user-select: none;
}
.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 .hub-lock { font-size: 5cqi; line-height: 1; }
.hub .hub-text { line-height: 1; }
.hub.is-locked { filter: saturate(0.55) brightness(0.86); }
.hub.is-locked .hub-text { font-size: 3cqi; opacity: 0.75; }
.hub:not(.is-locked) .hub-lock { display: none; }
.hub.is-ready { animation: hub-pulse 1.5s ease-in-out infinite; }
.hub-static { cursor: default; font-size: 9cqi; }

@keyframes breathe { 50% { opacity: 0.45; transform: scale(0.97); } }
@keyframes hub-pulse {
  0%, 100% { box-shadow: 0 0 0 1.1cqi rgba(255, 255, 255, 0.16), 0 0 0 0 color-mix(in srgb, var(--accent-2) 70%, transparent), 0 1.6cqi 4cqi rgba(0, 0, 0, 0.55), inset 0 -1cqi 2cqi rgba(0, 0, 0, 0.28), inset 0 0.6cqi 1cqi rgba(255, 255, 255, 0.6); }
  50% { box-shadow: 0 0 0 1.1cqi rgba(255, 255, 255, 0.3), 0 0 0 4cqi transparent, 0 1.6cqi 4cqi rgba(0, 0, 0, 0.55), inset 0 -1cqi 2cqi rgba(0, 0, 0, 0.28), inset 0 0.6cqi 1cqi rgba(255, 255, 255, 0.6); }
}

/* ------------------------------------------------------------------ hero */

.hero {
  display: grid;
  gap: 40px;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 56px;
}
.hero-copy { display: grid; gap: 22px; justify-items: start; }
.hero-title {
  font-size: clamp(2.5rem, 7.4vw, 4.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.shine {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 45%, var(--accent-3) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 200% auto;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 200% center; } }
.hero-sub { font-size: clamp(1.02rem, 2.2vw, 1.18rem); color: var(--muted); max-width: 540px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-points {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: var(--muted);
  font-size: 0.9rem;
}
.hero-points li { display: flex; align-items: center; gap: 8px; }
.hero-points b { color: var(--text); }

.hero-visual { position: relative; width: 100%; max-width: 480px; margin-inline: auto; padding: 18px; }
.float-badge {
  position: absolute;
  z-index: 4;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(20, 12, 45, 0.72);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  animation: bob 5s ease-in-out infinite;
}
.float-badge code { font-family: var(--font-mono); letter-spacing: 0.08em; color: var(--accent-2); }
.badge-1 { left: -4px; bottom: 16%; }
.badge-2 { right: -4px; top: 10%; animation-delay: -2.5s; }
@keyframes bob { 50% { transform: translateY(-10px); } }

@media (min-width: 960px) {
  .hero { grid-template-columns: 1.05fr 1fr; padding-top: 40px; padding-bottom: 80px; }
  .hero-visual { max-width: 520px; }
  .badge-1 { left: -30px; }
  .badge-2 { right: -10px; }
}

/* ------------------------------------------------------------------- how */

.how { padding-bottom: 64px; }
.how .section-title { text-align: center; }
.steps {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 16px;
}
.step h3 { font-size: 1.2rem; margin-top: 14px; }
.step p { color: var(--muted); margin-top: 8px; font-size: 0.95rem; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--btn-grad);
  color: var(--btn-ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 10px 24px -8px var(--btn-glow);
}
.step-icon { position: absolute; right: 20px; top: 18px; font-size: 2rem; opacity: 0.9; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

/* --------------------------------------------------------------- builder */

.builder { padding-bottom: 72px; scroll-margin-top: 12px; }
.section-head { margin-bottom: 24px; }

.builder-grid { display: grid; gap: 20px; align-items: start; }
.builder-preview { min-width: 0; }

@media (min-width: 1000px) {
  .builder-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; }
  .builder-preview { position: sticky; top: 20px; }
}

.form-card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.form-card-head h3 { font-size: 1.2rem; }
.form-card-head p { color: var(--faint); font-size: 0.88rem; margin-top: 3px; }
.step-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--btn-grad);
  color: var(--btn-ink);
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 8px 18px -8px var(--btn-glow);
}

.field-row { display: grid; gap: 0 14px; }

/* theme picker */
.theme-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .theme-picker { grid-template-columns: repeat(4, 1fr); } }
.theme-opt { position: relative; cursor: pointer; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--field);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.theme-swatch:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.theme-dots { display: flex; height: 34px; border-radius: 10px; overflow: hidden; }
.theme-dots span { flex: 1; }
.theme-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.88rem; }
.theme-opt input:checked + .theme-swatch { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.theme-opt input:focus-visible + .theme-swatch { outline: 3px solid var(--accent-2); outline-offset: 2px; }

/* prize list */
.prize-head {
  display: none;
  grid-template-columns: 52px minmax(0, 1fr) 84px 132px 40px;
  gap: 10px;
  padding: 0 4px 8px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.prize-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.prize-row {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 40px;
  grid-template-areas:
    'emoji label remove'
    'emoji pair pair';
  gap: 8px 10px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  animation: row-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.prize-row .emoji-btn { grid-area: emoji; }
.prize-row .prize-label { grid-area: label; }
.prize-row .remove { grid-area: remove; }

/* mobile: qty + chance share the second line */
.prize-row .mini-pair { grid-area: pair; display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

.prize-row .mini-field { position: relative; display: block; }
.prize-row .mini-field .input { padding-top: 20px; padding-bottom: 6px; min-height: 48px; }
.m-label {
  position: absolute;
  left: 14px;
  top: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  pointer-events: none;
}

.emoji-btn {
  width: 52px;
  height: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: var(--field);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.emoji-btn:hover { background: var(--card-strong); transform: scale(1.04); }
.prize-row .remove { width: 40px; height: 48px; color: var(--faint); font-size: 1.3rem; }
.prize-row .remove:hover { color: var(--danger); border-color: rgba(255, 107, 134, 0.4); }
.prize-row[data-kind='nothing'] { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 10px, rgba(255, 255, 255, 0.055) 10px 20px); }
.kind-tag {
  position: absolute;
  top: -9px;
  right: 56px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2a2147;
  border: 1px solid var(--line-strong);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

@media (min-width: 700px) {
  .prize-head { display: grid; }
  .prize-row {
    grid-template-columns: 52px minmax(0, 1fr) 84px 132px 40px;
    grid-template-areas: 'emoji label qty chance remove';
    align-items: center;
  }
  .prize-row .mini-pair { display: contents; }
  .prize-row .qty { grid-area: qty; }
  .prize-row .chance { grid-area: chance; }
  .prize-row .mini-field .input { padding-top: 12px; padding-bottom: 12px; }
  .prize-row .m-label { display: none; }
  .prize-row .emoji-btn { height: 48px; }
}

@keyframes row-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

.prize-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.suggestions { display: grid; gap: 8px; margin-top: 16px; }
.summary {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--field);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.summary b { color: var(--text); }

/* emoji popover */
.emoji-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: min(320px, calc(100vw - 48px));
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  border-radius: 18px;
  background: #1c1536;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.8);
  animation: pop-in 0.18s ease-out;
}
.emoji-pop button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0;
}
.emoji-pop button:hover, .emoji-pop button:focus-visible { background: rgba(255, 255, 255, 0.1); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }

/* codes card */
.code-pane { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.code-pane textarea { width: 100%; }
.code-sample {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--field);
  border: 1px dashed var(--line-strong);
}
.code-sample code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  color: var(--accent-2);
}
.code-sample .icon-btn { width: 34px; height: 34px; margin-left: auto; }
.callout {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent-3) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-3) 35%, transparent);
  font-size: 0.88rem;
  color: var(--muted);
}
.callout b { color: var(--text); }

.submit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), rgba(255, 255, 255, 0.04));
}
.submit-bar b { display: block; font-size: 1.05rem; }
.submit-bar small { color: var(--faint); }
@media (max-width: 559px) { .submit-bar .btn { width: 100%; } }

.form-error {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 107, 134, 0.12);
  border: 1px solid rgba(255, 107, 134, 0.4);
  color: #ffd0d9;
  font-weight: 600;
  font-size: 0.92rem;
}

/* preview */
.preview-card { text-align: center; overflow: hidden; }
.preview-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulse-dot 1.6s infinite; }
.preview-title { font-size: 1.4rem; margin-top: 10px; overflow-wrap: anywhere; }
.preview-host { color: var(--muted); font-size: 0.88rem; margin-top: 4px; min-height: 1.3em; }
.stage-preview { max-width: 340px; margin-top: 16px; margin-bottom: 12px; }
@media (max-width: 999px) { .stage-preview { max-width: min(320px, 78vw, 46svh); } }

/* my wheels */
.my-wheels { padding-bottom: 72px; }
.wheel-list { list-style: none; padding: 0; margin: 20px 0 12px; display: grid; gap: 12px; }
@media (min-width: 760px) { .wheel-list { grid-template-columns: repeat(2, 1fr); } }
.wheel-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.wheel-item .wi-emoji { font-size: 1.8rem; }
.wheel-item .wi-body { flex: 1; min-width: 0; }
.wheel-item h3 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wheel-item p { color: var(--faint); font-size: 0.82rem; }
.wheel-item .wi-actions { display: flex; gap: 6px; flex: none; }

/* ---------------------------------------------------------------- footer */

.footer {
  padding: 28px 0 max(28px, env(safe-area-inset-bottom));
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}
.footer a { color: var(--muted); font-weight: 700; text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ------------------------------------------------------------- spin page */

.spin-main { padding-bottom: 40px; }
.event-head { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 4px 0 22px; }
.event-title {
  font-size: clamp(2rem, 6.4vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  max-width: 900px;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.event-message { color: var(--muted); max-width: 620px; font-size: 1.02rem; white-space: pre-line; overflow-wrap: anywhere; }
.event-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.event-stats .pill { font-size: 0.8rem; padding: 6px 12px; }

.spin-grid { display: grid; gap: 22px; align-items: start; }
.wheel-col { min-width: 0; }
.side-col { display: grid; gap: 16px; min-width: 0; }
.stage-main { max-width: min(560px, 100%, 64vh); }
@supports (height: 1svh) { .stage-main { max-width: min(560px, 100%, 64svh); } }

@media (min-width: 960px) {
  .spin-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 40px; }
  .wheel-col { position: sticky; top: 16px; }
  .event-head { padding-bottom: 32px; }
}

.play-card { overflow: hidden; }
.play-step { display: grid; gap: 4px; animation: step-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.play-step .btn-block { margin-top: 16px; }
.play-step:not([data-step='ready']) { text-align: center; }
@keyframes step-in { from { opacity: 0; transform: translateY(10px); } }

.how-list { list-style: none; counter-reset: how; padding: 0; margin: 14px 0 2px; display: grid; gap: 10px; }
.how-list li { counter-increment: how; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.95rem; }
.how-list li::before {
  content: counter(how);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--card-strong);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-weight: 800;
  font-size: 0.8rem;
}
.how-list b { color: var(--text); }

.tap-hint { text-align: center; color: var(--muted); margin-top: 14px; font-size: 0.92rem; animation: bob 2.4s ease-in-out infinite; }
.tap-hint b { color: var(--text); }

.code-input {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.35rem, 6vw, 1.7rem) !important;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  min-height: 64px;
  padding-inline: 8px;
}
.code-input::placeholder { letter-spacing: 0.22em; opacity: 0.5; }

.feedback { min-height: 1.4em; margin-top: 10px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.feedback.is-error { color: #ffb3c1; }
.feedback.is-success { color: #a6ffd9; }

.shake { animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.big-badge {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  border-radius: 24px;
  font-size: 2.2rem;
  background: var(--card-strong);
  border: 1px solid var(--line);
  animation: badge-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop { from { transform: scale(0.4) rotate(-12deg); opacity: 0; } }

.countdown {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}

.done-emoji { font-size: 4rem; line-height: 1; margin-bottom: 8px; animation: badge-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }
.proof {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--field);
  border: 1px dashed var(--line-strong);
  font-size: 0.82rem;
  color: var(--faint);
}
.proof code { font-family: var(--font-mono); color: var(--text); letter-spacing: 0.08em; }

.dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 14px; }
.dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: dot-bounce 1s ease-in-out infinite; }
.dots span:nth-child(2) { background: var(--accent-2); animation-delay: 0.15s; }
.dots span:nth-child(3) { background: var(--accent-3); animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-10px); opacity: 1; } }

.past-result {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 30%, transparent);
  font-size: 0.85rem;
  color: var(--muted);
}

.list-card h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.winners { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; max-height: 360px; overflow-y: auto; }
.winners li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}
.winners li.is-new { animation: winner-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.winners .w-emoji { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--card-strong); font-size: 1.2rem; }
.winners .w-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.winners .w-text b { color: var(--text); }
.winners time { color: var(--faint); font-size: 0.78rem; }
.empty { color: var(--faint); font-size: 0.9rem; padding: 10px 0 2px; }
@keyframes winner-in { from { opacity: 0; transform: translateX(-12px); background: color-mix(in srgb, var(--accent) 30%, transparent); } }

.legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-size: 0.92rem; }
.legend .swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.legend .l-emoji { width: 24px; text-align: center; font-size: 1.1rem; }
.legend .l-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.legend .l-meta { color: var(--faint); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.legend li.is-gone .l-label { text-decoration: line-through; color: var(--faint); }

.state-card { max-width: 520px; margin: 40px auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.state-card .state-emoji { font-size: 3.4rem; }

.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 3, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.3s ease;
}
.modal-card {
  position: relative;
  width: min(440px, 100%);
  padding: 34px 26px 26px;
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(180deg, #241a48, #150f2e);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  animation: modal-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme='festive'] .modal-card { background: linear-gradient(180deg, #123b2b, #07201a); }
[data-theme='birthday'] .modal-card { background: linear-gradient(180deg, #3c1347, #200828); }
[data-theme='luxe'] .modal-card { background: linear-gradient(180deg, #1f1b26, #0d0c11); }

.result-rays {
  position: absolute;
  left: 50%;
  top: 92px;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent-2) 26%, transparent) 0deg 10deg, transparent 10deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  animation: spin 18s linear infinite;
  pointer-events: none;
}
.result-card.is-nothing .result-rays { opacity: 0.25; }
.result-emoji {
  position: relative;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  margin: 0 auto 18px;
  border-radius: 36px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line-strong);
  font-size: 3.8rem;
  line-height: 1;
  animation: prize-pop 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.1s;
}
.result-kicker { position: relative; color: var(--accent-2); font-weight: 800; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.8rem; }
.result-title { position: relative; font-size: clamp(1.8rem, 7vw, 2.4rem); margin-top: 8px; overflow-wrap: anywhere; }
.result-sub { position: relative; color: var(--muted); margin-top: 10px; }
.result-actions { position: relative; display: grid; gap: 10px; margin-top: 24px; }
@media (min-width: 420px) { .result-actions { grid-template-columns: 1fr 1fr; } .result-actions .btn:only-child { grid-column: 1 / -1; } }

.confirm-card { text-align: left; }
.confirm-card h2 { font-size: 1.4rem; }
.confirm-card p { color: var(--muted); margin-top: 10px; }
.confirm-card .result-actions { margin-top: 22px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(30px) scale(0.92); } }
@keyframes prize-pop { from { transform: scale(0.2) rotate(-25deg); opacity: 0; } }

/* ---------------------------------------------------------------- manage */

.manage-main { padding-bottom: 48px; }
.manage-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 8px 0 20px; }
.manage-head-main { display: grid; justify-items: start; gap: 10px; min-width: 0; }
.manage-head h1 { font-size: clamp(1.9rem, 5.5vw, 3rem); font-weight: 800; overflow-wrap: anywhere; }
.manage-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.manage-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--faint); font-size: 0.88rem; }

.welcome {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent-3) 14%, transparent));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.welcome h2 { font-size: 1.4rem; }
.welcome p { color: var(--muted); font-size: 0.95rem; }

.manage-grid { display: grid; gap: 18px; align-items: start; }
.manage-col { display: grid; gap: 18px; min-width: 0; }
@media (min-width: 1040px) { .manage-grid { grid-template-columns: 420px minmax(0, 1fr); gap: 24px; } }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }

.link-field { display: flex; gap: 8px; }
.link-field .input { font-family: var(--font-mono); font-size: 0.85rem; min-width: 0; text-overflow: ellipsis; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.qr-wrap { display: flex; gap: 16px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.qr { width: 120px; height: 120px; flex: none; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6); }
.qr svg { width: 100%; height: 100%; }
.qr-wrap p { color: var(--muted); font-size: 0.88rem; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px 12px; border-radius: 18px; background: var(--field); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: clamp(1.4rem, 5vw, 1.9rem); line-height: 1.1; }
.stat span { color: var(--faint); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.progress { height: 8px; border-radius: 999px; background: var(--field); overflow: hidden; margin-top: 14px; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--btn-grad); transition: width 0.6s ease; }

.prize-stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.prize-stats li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.prize-stats .ps-emoji { font-size: 1.3rem; grid-row: span 2; text-align: center; }
.prize-stats .ps-label { font-weight: 700; font-size: 0.92rem; overflow-wrap: anywhere; }
.prize-stats .ps-meta { color: var(--faint); font-size: 0.8rem; text-align: right; white-space: nowrap; }
.prize-stats .progress { grid-column: 2 / 4; margin-top: 0; height: 6px; }

.codes-toolbar { display: grid; gap: 10px; margin-bottom: 14px; }
.codes-toolbar .seg { font-size: 0.85rem; }
@media (min-width: 640px) { .codes-toolbar { grid-template-columns: minmax(0, 1fr) auto; } }
.codes-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.code-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.code-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s;
}
.code-item:hover { border-color: var(--line-strong); }
.code-item.is-used { background: color-mix(in srgb, var(--accent-3) 7%, transparent); }
.code-item.is-revoked { opacity: 0.5; }
.ci-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.ci-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  background: none;
  border: 0;
  padding: 0;
  cursor: copy;
}
.code-item.is-used .ci-code, .code-item.is-revoked .ci-code { color: var(--faint); }
.code-item.is-revoked .ci-code { text-decoration: line-through; }
.ci-assignee { font-weight: 700; font-size: 0.9rem; }
.ci-result { grid-column: 1 / -1; color: var(--muted); font-size: 0.86rem; overflow-wrap: anywhere; }
.ci-result b { color: var(--text); }
.ci-actions { display: flex; gap: 6px; }
.ci-actions .icon-btn { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }
.code-more { display: flex; justify-content: center; margin-top: 14px; }

.add-codes { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.add-codes .input { width: 100px; }
details.named { margin-top: 12px; }
details.named summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
details.named textarea { margin-top: 10px; }
details.named .btn { margin-top: 10px; }

.danger-zone { display: grid; gap: 12px; }
.danger-zone .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.danger-zone p { color: var(--faint); font-size: 0.85rem; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(24, 18, 48, 0.92);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 600;
  font-size: 0.92rem;
  animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.is-error { border-color: rgba(255, 107, 134, 0.5); }
.toast.is-leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 60; pointer-events: none; }

/* ----------------------------------------------------------------- print */

.print-area { display: none; }

@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; color: #111 !important; }
  body > *:not(.print-area) { display: none !important; }
  .print-area {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 8mm;
  }
  .print-card {
    break-inside: avoid;
    border: 1.5px dashed #999;
    border-radius: 6mm;
    padding: 6mm;
    display: grid;
    grid-template-columns: 1fr 26mm;
    gap: 4mm;
    align-items: center;
    font-family: var(--font-body);
  }
  .print-card h3 { font-size: 13pt; margin: 0 0 2mm; color: #111; }
  .print-card .pc-label { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.12em; color: #666; }
  .print-card .pc-code { font-family: var(--font-mono); font-size: 18pt; font-weight: 700; letter-spacing: 0.12em; margin: 1mm 0 2mm; color: #000; }
  .print-card .pc-for { font-size: 9pt; color: #333; }
  .print-card .pc-url { font-size: 8pt; color: #444; word-break: break-all; }
  .print-card .pc-qr svg { width: 26mm; height: 26mm; }
}

/* -------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* raised while a popover inside it is open, so it paints above later cards */
.card.has-pop { z-index: 20; }
.wheel-item { flex-wrap: wrap; }
.wheel-item .wi-actions { margin-left: auto; }
.winners li.empty, .code-list li.empty { display: block; background: none; border: 0; padding: 6px 2px; }

/* =========================================================================
   Wizard (builder)
   ========================================================================= */

.wizard { display: grid; gap: 14px; min-width: 0; }

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.ws {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--faint);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.ws:hover { color: var(--text); }
.ws-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 0.78rem;
  transition: background 0.25s, border-color 0.25s;
}
.ws.is-done { color: var(--muted); }
.ws.is-done .ws-num { background: rgba(47, 224, 164, 0.16); border-color: rgba(47, 224, 164, 0.5); color: #b8ffe4; }
.ws.is-active { background: var(--card-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ws.is-active .ws-num { background: var(--btn-grad); border-color: transparent; color: var(--btn-ink); }
@media (max-width: 559px) {
  .ws { flex-direction: column; gap: 4px; min-height: 58px; font-size: 0.72rem; }
}

.wizard-panel { animation: step-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.panel-head { margin-bottom: 20px; }
.panel-head h3 { font-size: clamp(1.3rem, 3.6vw, 1.6rem); }
.panel-head p { color: var(--faint); margin-top: 6px; font-size: 0.92rem; }

.wizard-nav {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg-1) 86%, transparent);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.wizard-count { color: var(--faint); font-size: 0.85rem; font-weight: 600; }
.wizard-nav .btn { min-height: 50px; }
.wizard-nav .btn-primary { padding: 0 24px; }
@media (max-width: 460px) {
  .wizard-count { display: none; }
  .wizard-nav .btn-primary { flex: 1; }
  .hide-xs { display: none; }
}

.templates {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 18px;
  background: var(--field);
  border: 1px dashed var(--line-strong);
}
.chip-template { min-height: 38px; font-size: 0.88rem; }

details.suggestions { margin-top: 16px; }
details.suggestions summary, details.named summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  list-style: none;
}
details.suggestions summary::-webkit-details-marker, details.named summary::-webkit-details-marker { display: none; }
details.suggestions summary::after, details.named summary::after { content: ' ▾'; color: var(--faint); }
details[open].suggestions summary::after, details[open].named summary::after { content: ' ▴'; }
details.suggestions .chips { margin-top: 12px; }

/* choice cards */
.choice-grid { display: grid; gap: 12px; margin-bottom: 20px; }
@media (min-width: 560px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; cursor: pointer; display: block; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  height: 100%;
  padding: 18px 18px 20px;
  border-radius: 20px;
  border: 1.5px solid var(--line);
  background: var(--field);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.choice:hover .choice-body { border-color: var(--line-strong); transform: translateY(-2px); }
.choice-icon { font-size: 1.9rem; line-height: 1.2; }
.choice-body b { font-size: 1.05rem; }
.choice-body small { color: var(--faint); font-size: 0.86rem; line-height: 1.45; padding-right: 22px; }
.choice-tag {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #b8ffe4;
  background: rgba(47, 224, 164, 0.14);
  border: 1px solid rgba(47, 224, 164, 0.35);
}
.choice input:checked + .choice-body {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--field));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}
.choice input:checked + .choice-body::after {
  content: '✓';
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--btn-grad);
  color: var(--btn-ink);
  font-weight: 800;
  font-size: 0.85rem;
}
.choice input:focus-visible + .choice-body { outline: 3px solid var(--accent-2); outline-offset: 3px; }
.choice-grid.compact { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.choice-grid.compact .choice-body { padding: 14px; }
.choice-grid.compact .choice-icon { font-size: 1.5rem; }

.access-pane { display: grid; gap: 12px; }
.access-pane .code-pane { margin-top: 2px; }
.access-pane .code-sample, .access-pane .callout { margin-top: 4px; }

/* review */
.review-title {
  margin-top: 24px;
  color: var(--faint);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.review { margin: 10px 0 0; border-radius: 18px; background: var(--field); border: 1px solid var(--line); overflow: hidden; }
.review-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.review-row:first-child { border-top: 0; }
.review dt { color: var(--faint); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.review dd { margin: 0; font-weight: 600; font-size: 0.92rem; overflow-wrap: anywhere; }

/* live preview: sticky column on desktop, pop-up panel on phones and tablets */
.preview-top { position: relative; display: flex; align-items: center; justify-content: center; min-height: 28px; }
.preview-close { display: none; position: absolute; right: -4px; top: -6px; border-radius: 50%; }
/* the Preview button in the wizard bar is only needed where the preview is not on screen */
.preview-toggle { display: none; }
@media (max-width: 999px) {
  .preview-toggle { display: inline-flex; }
  .wizard-count { display: none; }
}

@media (max-width: 999px) {
  .builder-preview {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(5, 3, 15, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
  }
  .builder-preview.is-open { opacity: 1; visibility: visible; }
  .builder-preview .preview-card {
    width: min(440px, 100%);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-1) 90%, #ffffff 6%), var(--bg-0));
    transform: translateY(40px);
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  }
  .builder-preview.is-open .preview-card { transform: none; }
  .preview-close { display: inline-grid; }

}
body.sheet-open, body.modal-open { overflow: hidden; }

/* =========================================================================
   Spin page: play pop-up
   ========================================================================= */

.modal { overflow-y: auto; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; border-radius: 50%; z-index: 2; }
.play-modal { padding-top: 34px; }
.play-modal-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 26px;
  font-size: 2.3rem;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line-strong);
  animation: badge-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.play-modal-title { font-size: clamp(1.5rem, 6vw, 1.85rem); }
.play-modal-sub { color: var(--muted); margin-top: 8px; font-size: 0.95rem; }
.play-fields { text-align: left; margin-top: 20px; }
.play-fields .field { margin-top: 14px; }
.play-fields .field:not([hidden]) ~ .field { margin-top: 14px; }
.play-fields > .field:first-child { margin-top: 0; }
.play-modal .feedback { margin-top: 12px; }
.play-modal .btn-block { margin-top: 10px; }
.play-modal-foot { margin-top: 14px; color: var(--faint); font-size: 0.8rem; }
.play-locked { margin-top: 16px; }

/* =========================================================================
   Dashboard: tabs, results, edit
   ========================================================================= */

.tabs {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-1) 84%, transparent);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--card-strong); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--btn-grad);
  color: var(--btn-ink);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
}
.tab-count:empty { display: none; }
/* phones: all four tabs fit, icon above label */
@media (max-width: 560px) {
  .tab {
    position: relative;
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    min-height: 56px;
    padding: 6px 2px;
    font-size: 0.74rem;
  }
  .tab-count { position: absolute; top: 4px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 0.62rem; }
}
.tab-panel { animation: step-in 0.3s ease; }

@media (min-width: 1040px) {
  .manage-grid-codes { grid-template-columns: minmax(0, 1fr) 360px; }
  .edit-form .manage-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
}

.info-card { display: grid; justify-items: center; gap: 6px; margin-bottom: 18px; text-align: center; }
.info-card .card-sub { max-width: 560px; }

.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.result-list li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.result-list li.empty { display: block; background: none; border: 0; padding: 6px 2px; color: var(--faint); }
.r-emoji { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--card-strong); font-size: 1.25rem; }
.r-text { color: var(--muted); font-size: 0.92rem; overflow-wrap: anywhere; }
.r-text b { color: var(--text); }
.r-code { display: inline-block; margin-left: 4px; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--faint); }
.result-list time { color: var(--faint); font-size: 0.78rem; white-space: nowrap; }

.prize-stats li.is-gone .ps-label { text-decoration: line-through; color: var(--faint); }
.prize-stats .ps-meta b { color: var(--text); }
.prize-stats .ps-chance { grid-column: 2 / 4; color: var(--faint); font-size: 0.8rem; }
.progress-label { margin-top: 8px; }

.edit-gifts-sub { margin: -6px 0 16px; font-size: 0.88rem; }
.access-note { margin-top: 12px; }
#e-open-options { display: grid; gap: 8px; }
.add-codes { margin-top: 14px; }

.save-bar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px 12px 18px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-1) 90%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.save-text { font-weight: 700; font-size: 0.92rem; }
.save-actions { display: flex; gap: 8px; margin-left: auto; }
.field-row { margin-top: 18px; }
/* keep toasts above sticky bottom bars (wizard nav, save bar) */
.toasts { bottom: calc(var(--toast-lift, 0px) + max(20px, env(safe-area-inset-bottom))); }
body:has(#builder) { --toast-lift: 76px; }
body:has(#save-bar:not([hidden])) { --toast-lift: 76px; }
