/* ------------------------------------------------------------------
   Roleta Hello Júlia — design system do produto (violeta + ciano, dark premium).
   Sem fontes ou CSS externos: o estande roda offline.
------------------------------------------------------------------- */

:root {
  --bg: hsl(230 40% 4%);
  --bg-2: hsl(230 35% 6%);
  --card: hsl(230 30% 9%);
  --card-2: hsl(230 30% 11%);
  --fg: hsl(220 20% 96%);
  --muted: hsl(220 12% 65%);
  --border: hsl(230 25% 16%);
  --primary: hsl(258 90% 66%);
  --primary-glow: hsl(268 95% 72%);
  --accent: hsl(190 95% 55%);
  --success: hsl(152 70% 48%);
  --danger: hsl(0 84% 62%);
  --radius: 1rem;

  --gradient-primary: linear-gradient(135deg, hsl(258 90% 66%) 0%, hsl(280 90% 65%) 50%, hsl(190 95% 55%) 100%);
  --gradient-card: linear-gradient(145deg, hsl(230 30% 11%) 0%, hsl(230 30% 8%) 100%);
  --gradient-text: linear-gradient(135deg, hsl(220 20% 98%) 0%, hsl(258 90% 82%) 48%, hsl(190 95% 72%) 100%);
  --shadow-card: 0 8px 32px -8px hsl(230 50% 2% / 0.7), 0 0 0 1px hsl(230 25% 16%);
  --shadow-glow: 0 0 60px hsl(258 90% 66% / 0.35);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* O brilho da roleta vaza de proposito para fora do aro: sem cortar no html,
   a pagina desliza de lado no toque (o overflow-x do body nao segura isso). */
html, body { height: 100%; overflow-x: hidden; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fundo animado — os dois orbes da marca */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% -8%, hsl(258 90% 66% / 0.28), transparent 70%),
    radial-gradient(ellipse 60% 45% at 88% 100%, hsl(190 95% 55% / 0.18), transparent 70%),
    radial-gradient(ellipse 50% 40% at 5% 80%, hsl(280 90% 65% / 0.14), transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  animation: auroraDrift 18s ease-in-out infinite alternate;
}

@keyframes auroraDrift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.08) translateY(-14px); }
}

/* ---------------------------------------------------------------- */
/* Topbar                                                            */
/* ---------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 34px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand__mark {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 2px 14px hsl(258 90% 66% / 0.55));
}

.brand__kicker {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 12px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.topbar__controls { display: flex; align-items: center; gap: 10px; }

.lang {
  display: flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: hsl(230 30% 9% / 0.8);
  backdrop-filter: blur(10px);
}

.lang__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.lang__btn[aria-pressed="true"] {
  color: hsl(0 0% 100%);
  background: var(--gradient-primary);
  box-shadow: 0 4px 18px hsl(258 90% 66% / 0.4);
}

.icon-btn {
  appearance: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: hsl(230 30% 9% / 0.8);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.icon-btn:active { transform: scale(0.94); }
.icon-btn[aria-pressed="false"] { opacity: 0.55; }

/* ---------------------------------------------------------------- */
/* Telas                                                             */
/* ---------------------------------------------------------------- */
.stage {
  position: relative;
  z-index: 2;
  /* Ocupa a altura que sobra da topbar, sem depender de um valor fixo:
     com 78px chutados, tablet em retrato estourava a tela em alguns pixels. */
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: start center;
  padding: clamp(4px, 2vh, 20px) clamp(16px, 4vw, 28px) 34px;
}

.screen {
  display: none;
  width: 100%;
  max-width: 560px;
  flex-direction: column;
  align-items: center;
}

.screen--active { display: flex; animation: riseIn 0.55s cubic-bezier(0.4, 0, 0.2, 1) both; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------- */
/* Hero + formulário                                                 */
/* ---------------------------------------------------------------- */
.hero { text-align: center; margin-bottom: clamp(18px, 3vh, 28px); }

.hero__title {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 6.4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__subtitle {
  margin: 0 auto;
  max-width: 44ch;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  line-height: 1.55;
}

.card {
  width: 100%;
  padding: clamp(22px, 5vw, 30px);
  border-radius: calc(var(--radius) * 1.4);
  background: var(--gradient-card);
  box-shadow: var(--shadow-card);
}

.card__title {
  margin: 0 0 20px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.field { display: block; margin-bottom: 16px; }

.field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.field__input {
  width: 100%;
  padding: 15px 16px;
  font: inherit;
  font-size: 1.02rem;
  color: var(--fg);
  background: hsl(230 25% 14% / 0.9);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field__input::placeholder { color: hsl(220 12% 48%); }

.field__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px hsl(258 90% 66% / 0.18);
}

.field__select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 21px) 23px, calc(100% - 15px) 23px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.field__select option { background: var(--card); color: var(--fg); }

/* DDI + número lado a lado */
.field__row { display: flex; gap: 10px; }
.field__row > .field__input { flex: 1; min-width: 0; }

.ddi { position: relative; flex: 0 0 auto; }

.ddi__plus {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.02rem;
  color: var(--muted);
  pointer-events: none;
}

.ddi__input {
  width: 84px;
  padding-left: 28px;
  font-variant-numeric: tabular-nums;
}

.field--invalid .field__input { border-color: var(--danger); }

.field__error {
  display: none;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--danger);
}

.field--invalid .field__error, .field__error--shown { display: block; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 4px 0 6px;
  cursor: pointer;
}

.consent input { position: absolute; opacity: 0; width: 0; height: 0; }

.consent__box {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: hsl(230 25% 14%);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.consent__box::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid hsl(0 0% 100%);
  border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s var(--ease-spring);
}

.consent input:checked + .consent__box {
  background: var(--gradient-primary);
  border-color: transparent;
}

.consent input:checked + .consent__box::after { transform: rotate(45deg) scale(1); }

.consent input:focus-visible + .consent__box { box-shadow: 0 0 0 4px hsl(258 90% 66% / 0.22); }

.consent__text { font-size: 0.86rem; line-height: 1.5; color: var(--muted); }

.form__privacy {
  margin: 14px 0 0;
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: center;
  color: hsl(220 12% 52%);
}

/* ---------------------------------------------------------------- */
/* Botões                                                            */
/* ---------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 0.9rem;
  padding: 17px 26px;
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), box-shadow 0.2s, opacity 0.2s;
}

.btn--block { display: block; width: 100%; }

.btn--primary {
  color: hsl(0 0% 100%);
  background: var(--gradient-primary);
  box-shadow: 0 10px 34px -10px hsl(258 90% 66% / 0.75);
  font-size: 1.03rem;
}

.btn--ghost {
  color: var(--fg);
  background: hsl(230 25% 16% / 0.7);
  border: 1px solid var(--border);
}

.btn:active { transform: scale(0.975); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }

/* ---------------------------------------------------------------- */
/* Roleta                                                            */
/* ---------------------------------------------------------------- */
.greeting {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hint {
  margin: 0 0 clamp(16px, 3.4vh, 32px);
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

.wheel-stage {
  position: relative;
  /* Maior possivel sem colar no titulo nem estourar a altura da tela. */
  width: min(92vw, 520px, 58vh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.wheel-glow {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(258 90% 66% / 0.34) 0%, transparent 62%);
  animation: pulseGlow 3.4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.55; transform: scale(0.97); }
  50% { opacity: 1; transform: scale(1.03); }
}

/* Aro externo com as luzinhas da roleta */
.wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 3.2%;
  background:
    conic-gradient(from 0deg, hsl(258 90% 66%), hsl(190 95% 55%), hsl(280 90% 65%), hsl(258 90% 66%));
  box-shadow:
    0 0 0 2px hsl(230 25% 16%),
    0 24px 70px -18px hsl(230 60% 2% / 0.9),
    inset 0 0 30px hsl(230 60% 2% / 0.5);
}

.wheel-rotor {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-2);
  will-change: transform;
}

#wheelSvg { display: block; width: 100%; height: 100%; }

/* Ponteiro no topo */
.wheel-pointer {
  position: absolute;
  top: -2.5%;
  left: 50%;
  width: 34px;
  height: 46px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, hsl(0 0% 100%), hsl(220 20% 84%));
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 6px 12px hsl(230 60% 2% / 0.8));
  z-index: 4;
}

/* Botão central = RODAR */
.hub {
  position: absolute;
  z-index: 5;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 5px solid hsl(230 35% 6%);
  background: var(--gradient-primary);
  color: hsl(0 0% 100%);
  font: inherit;
  font-weight: 900;
  font-size: clamp(0.85rem, 3.1vw, 1.15rem);
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 0 0 4px hsl(258 90% 66% / 0.28), 0 14px 40px -8px hsl(258 90% 66% / 0.8);
  animation: hubPulse 2.2s ease-in-out infinite;
  transition: transform 0.15s var(--ease-spring);
}

.hub__label { display: block; padding: 0 4px; line-height: 1.05; }

@keyframes hubPulse {
  0%, 100% { box-shadow: 0 0 0 4px hsl(258 90% 66% / 0.28), 0 14px 40px -8px hsl(258 90% 66% / 0.7); }
  50% { box-shadow: 0 0 0 14px hsl(258 90% 66% / 0.12), 0 14px 46px -6px hsl(258 90% 66% / 0.95); }
}

.hub:active { transform: scale(0.94); }

.hub[disabled] { animation: none; opacity: 0.75; cursor: default; }

.wheel-stage--spinning .hub { animation: none; }

.spins {
  margin: clamp(14px, 3vh, 26px) 0 0;
  min-height: 1.2em;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}

/* ---------------------------------------------------------------- */
/* Resultado                                                         */
/* ---------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 22px;
  background: hsl(230 45% 3% / 0.82);
  backdrop-filter: blur(14px);
}

.overlay--open { display: grid; animation: fadeIn 0.3s ease both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.result {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: clamp(26px, 6vw, 38px) clamp(22px, 5vw, 34px);
  text-align: center;
  border-radius: calc(var(--radius) * 1.6);
  background: var(--gradient-card);
  box-shadow: var(--shadow-card);
  animation: popIn 0.5s var(--ease-spring) both;
}

/* Sem medalha, é o brilho do card que marca a vitória. */
.result--win { box-shadow: var(--shadow-card), var(--shadow-glow); }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.88) translateY(18px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.result__eyebrow {
  margin: 0 0 8px;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.result__title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 5.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.result__desc {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.result__code {
  display: block;
  margin: 0 0 24px;
  padding: 16px;
  border-radius: 0.9rem;
  border: 1px dashed hsl(190 95% 55% / 0.45);
  background: hsl(190 95% 55% / 0.07);
}

.result__codeLabel {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.result__codeValue {
  display: block;
  margin: 4px 0 8px;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.result__codeHelp { display: block; font-size: 0.78rem; line-height: 1.45; color: var(--muted); }

.result__actions { display: grid; gap: 10px; }

.result__idle {
  margin: 16px 0 0;
  min-height: 1.1em;
  font-size: 0.74rem;
  color: hsl(220 12% 48%);
}

/* ---------------------------------------------------------------- */
/* Toast                                                             */
/* ---------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 40;
  transform: translate(-50%, 24px);
  max-width: min(90vw, 420px);
  padding: 14px 20px;
  border-radius: 0.9rem;
  background: hsl(0 84% 62% / 0.16);
  border: 1px solid hsl(0 84% 62% / 0.45);
  color: hsl(0 92% 88%);
  font-size: 0.9rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast--show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- */
/* Tablet em paisagem: roleta ao lado do texto                       */
/* ---------------------------------------------------------------- */
/* Celular estreito: menos respiro lateral para a roleta caber maior. */
@media (max-width: 420px) {
  .stage { padding-left: 10px; padding-right: 10px; }
}

@media (min-width: 820px) and (orientation: landscape) {
  .stage { place-items: center; }
  .screen { max-width: 620px; }
  #screenWheel { max-width: 900px; }

  /* Em paisagem a altura e o recurso escasso: encolhe o topo para a roleta
     crescer sem empurrar o botao de girar para fora da tela. */
  .topbar { padding-top: 10px; padding-bottom: 10px; }
  .greeting { margin-bottom: 2px; font-size: clamp(1.2rem, 2.6vh, 1.7rem); }
  .hint { margin-bottom: clamp(18px, 3.2vh, 30px); font-size: 0.88rem; }
  .spins { margin-top: clamp(8px, 1.6vh, 16px); }
  .wheel-stage { width: min(66vh, 560px); }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .wheel-glow, .hub { animation: none; }
}
