/* Fonte global e reset leve */
* { box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #0b2e31;
  /* Fundo com imagem fornecida (coloque o arquivo como background.jpg na mesma pasta) */
  background-color: #ffffff; /* fallback */
  background-image: url('background.jpg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover; /* cobre 1080x1920 */
}

:root {
  /* Cor base fornecida */
  --brand: #00727A;
  /* Paleta derivada (tints/shades) mantendo identidade */
  --brand-50: #e6f3f4;
  --brand-100: #cfe8ea;
  --brand-200: #a6d6d8;
  --brand-300: #7ec4c6;
  --brand-400: #55b2b4;
  --brand-500: #2ca0a2;
  --brand-600: #138990;
  --brand-700: #0a6f74;
  --brand-800: #08595d;
  --brand-900: #064347;
}

/* Layout centralizado para totem 1080x1920 (portrait) */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.title {
  margin: 0 0 8px;
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 700;
  color: var(--brand-900);
  letter-spacing: 0.5px;
}

.below {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wheel-wrapper {
  position: relative;
  width: min(90vw, 800px);
  aspect-ratio: 1 / 1; /* mantém o canvas quadrado */
  display: grid;
  place-items: center;
}

/* Canvas responsivo (mantendo resolução alta) */
#wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.15));
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

/* Ponteiro no topo */
.pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 24px solid var(--brand);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.25));
}

.result {
  min-height: 28px;
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 600;
  color: var(--brand-900);
  text-align: center;
}

.logo {
  width: clamp(160px, 30vw, 320px);
  height: auto;
  opacity: 0.9;
  margin-top: 4px;
}

/* Popup */
.popup {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  padding: 20px;
}
.popup[aria-hidden="false"] { display: flex; }

.popup-box {
  width: min(90vw, 520px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 24px;
  text-align: center;
  border: 4px solid var(--brand-600);
}
.popup-text {
  font-size: clamp(20px, 3.2vw, 28px);
  font-weight: 700;
  color: var(--brand-900);
  margin-bottom: 16px;
}
.popup-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand));
  cursor: pointer;
}
.popup-btn:active { transform: scale(0.98); }

/* ----- Lead Modal ----- */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  padding: 20px;
}
.modal[aria-hidden="false"] { display: flex; }

.modal-dialog {
  width: min(92vw, 520px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 24px;
  border: 4px solid var(--brand-600);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 22px;
  line-height: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--brand-800);
}
.modal-sub { color: #333; margin: 8px 0 16px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-weight: 600; color: var(--brand-900); }
.field > input {
  appearance: none;
  border: 2px solid var(--brand-200);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
}

.btn-primary {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand));
  cursor: pointer;
}
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

.form-error { color: #b00020; min-height: 20px; margin-top: 8px; }

@media (min-width: 600px) and (max-width: 1024px) {
  .app { padding: 16px; gap: 12px; }
  .wheel-wrapper { width: min(75vw, 560px); }
  .pointer {
    top: -10px;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 18px solid var(--brand);
  }
  .result { font-size: clamp(16px, 2.2vw, 20px); }
  .logo { width: clamp(140px, 22vw, 260px); }
  .popup-box { width: min(86vw, 460px); padding: 20px; }
  .popup-text { font-size: clamp(18px, 2.8vw, 24px); }
}

@media (max-height: 820px) and (orientation: landscape) {
  .wheel-wrapper { width: min(60vw, 520px); }
}
