* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f6fb;
  color: #172033;
}
.container {
  width: min(920px, 92%);
  margin: 28px auto;
}
.card {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(20, 30, 60, 0.08);
  margin-bottom: 18px;
}
h1 {
  margin: 0 0 8px;
  font-size: 28px;
}
p {
  line-height: 1.45;
}
.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 20px;
}
a,
button {
  cursor: pointer;
}
.nav a,
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 15px;
  background: #172033;
  color: white;
  text-decoration: none;
  font-weight: 700;
}
.btn.secondary {
  background: #e8edf7;
  color: #172033;
}
.btn.danger {
  background: #b42318;
}
.btn.success {
  background: #067647;
}
.btn.is-loading {
  cursor: wait;
  opacity: 0.9;
}
.btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
  vertical-align: -0.12em;
}
@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}
main[data-ui-loading="1"] {
  cursor: wait;
}
label {
  display: block;
  margin-top: 14px;
  font-weight: 700;
}
input,
select {
  width: 100%;
  padding: 13px;
  border: 1px solid #ccd5e1;
  border-radius: 12px;
  margin-top: 6px;
  font-size: 16px;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 700;
}
.check input {
  width: 22px;
  height: 22px;
  margin: 0;
}
#formCampos {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.form-fechado {
  opacity: 0.72;
  pointer-events: none;
}
form[data-ui-loading="1"] fieldset,
form[data-ui-loading="1"] input:not([type="submit"]),
form[data-ui-loading="1"] select,
form[data-ui-loading="1"] textarea {
  pointer-events: none;
}
form[data-ui-loading="1"] {
  cursor: wait;
}
.alert {
  padding: 12px;
  border-radius: 12px;
  margin-top: 12px;
  background: #e8f7ee;
  color: #075e35;
  font-weight: 700;
}
.alert.error {
  background: #ffe8e6;
  color: #9b1c13;
}
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eef2f6;
  padding: 12px 0;
}
.name {
  font-weight: 800;
}
.badges {
  text-align: right;
}
.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f6;
  margin: 2px;
  font-size: 13px;
  font-weight: 700;
}
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.summary.summary-4 {
  grid-template-columns: repeat(4, 1fr);
}
.stat {
  background: #f7f9fc;
  border-radius: 14px;
  padding: 14px;
}
.stat strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}
@media (max-width: 700px) {
  .row,
  .summary,
  .summary.summary-4 {
    grid-template-columns: 1fr;
  }
  .list-item {
    display: block;
  }
  .badges {
    text-align: left;
    margin-top: 6px;
  }
}

.sorteador-display {
  margin: 18px 0;
  padding: 32px 18px 28px;
  border-radius: 22px;
  background: radial-gradient(circle at top, #2a3658 0%, #172033 55%, #0f1628 100%);
  color: #fff;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sorteador-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sorteador-orbit,
.sorteador-orbit-2,
.sorteador-spark {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
}

.sorteador-orbit {
  width: 140%;
  height: 140%;
  top: -20%;
  left: -20%;
  border: 2px dashed rgba(134, 239, 172, 0.15);
}

.sorteador-orbit-2 {
  width: 110%;
  height: 110%;
  top: -5%;
  left: -5%;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sorteador-spark {
  width: 220px;
  height: 220px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(22, 163, 74, 0.25) 0%, transparent 70%);
}

.sorteador-display.sorteando .sorteador-orbit {
  opacity: 1;
  animation: sorteador-giro 2.4s linear infinite;
}

.sorteador-display.sorteando .sorteador-orbit-2 {
  opacity: 1;
  animation: sorteador-giro-rev 1.8s linear infinite;
}

.sorteador-display.sorteando .sorteador-spark {
  opacity: 1;
  animation: sorteador-spark 0.9s ease-in-out infinite alternate;
}

@keyframes sorteador-giro-rev {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes sorteador-spark {
  from {
    transform: translate(-50%, -50%) scale(0.85);
    opacity: 0.5;
  }
  to {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }
}

.sorteador-barra {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 2;
}

.sorteador-barra span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #16a34a, #86efac);
  transition: width 0.12s linear;
  box-shadow: 0 0 12px rgba(134, 239, 172, 0.65);
}

.sorteador-display::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.1) 40deg,
    transparent 80deg
  );
  opacity: 0;
  transition: opacity 0.2s;
}

.sorteador-display.sorteando::before {
  opacity: 1;
  animation: sorteador-giro 1.2s linear infinite;
}

@keyframes sorteador-giro {
  to {
    transform: rotate(360deg);
  }
}

.sorteador-display.sorteando {
  animation: sorteador-pulse 0.45s ease-in-out infinite alternate;
  box-shadow:
    0 0 0 2px rgba(22, 163, 74, 0.45),
    0 20px 50px rgba(23, 32, 51, 0.35);
}

.sorteador-numero-wrap {
  position: relative;
  z-index: 1;
  min-width: 120px;
  padding: 8px 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}

.sorteador-numero-wrap.flash {
  animation: sorteador-num-flash 0.18s ease;
}

@keyframes sorteador-num-flash {
  0% {
    transform: scale(0.92);
    filter: brightness(1.4);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.sorteador-status {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #86efac;
  min-height: 18px;
}

@keyframes sorteador-pulse {
  from {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
  }
  to {
    transform: scale(1.01);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.12);
  }
}

.sorteador-status,
.sorteador-numero,
.sorteador-nome {
  position: relative;
  z-index: 1;
}

.sorteador-numero {
  font-size: clamp(56px, 16vw, 84px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.sorteador-nome {
  font-size: clamp(16px, 4.5vw, 22px);
  font-weight: 700;
  opacity: 0.95;
  word-break: break-word;
  max-width: 100%;
  padding: 0 8px;
}

.sorteador-info {
  margin: 0 0 8px;
  color: #475467;
}

.sorteador-historico {
  margin-top: 20px;
}

.sorteador-historico h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.sorteador-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f9fc;
  margin-bottom: 8px;
}

.sorteador-item-numero {
  min-width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #172033;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.sorteador-item-nome {
  font-weight: 700;
}

.modal-sorteado {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.modal-sorteado[hidden] {
  display: none !important;
}

body.modal-aberto {
  overflow: hidden;
  touch-action: none;
}

.modal-sorteado-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.88);
  backdrop-filter: blur(8px);
  animation: modal-overlay-in 0.3s ease;
}

@keyframes modal-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-sorteado-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
  border-radius: 28px;
  padding: 36px 22px 24px;
  text-align: center;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: scale(0.7) translateY(30px);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

.modal-sorteado.aberto .modal-sorteado-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal-sorteado-fechar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: #172033;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.modal-sorteado-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-cair linear forwards;
}

@keyframes confetti-cair {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(420px) rotate(720deg);
    opacity: 0;
  }
}

.modal-sorteado-emoji {
  font-size: 52px;
  animation: modal-emoji-bounce 0.8s ease infinite alternate;
}

@keyframes modal-emoji-bounce {
  from {
    transform: translateY(0) scale(1);
  }
  to {
    transform: translateY(-8px) scale(1.08);
  }
}

.modal-sorteado-titulo {
  margin: 8px 0 4px;
  font-size: clamp(28px, 8vw, 38px);
  color: #067647;
  letter-spacing: 0.04em;
}

.modal-sorteado-subtitulo {
  margin: 0 0 20px;
  color: #475467;
  font-weight: 600;
  font-size: clamp(15px, 4vw, 17px);
  line-height: 1.45;
}

.modal-sorteado-box {
  background: linear-gradient(180deg, #172033 0%, #24304d 100%);
  color: #fff;
  border-radius: 22px;
  padding: 24px 18px;
  margin-bottom: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: modal-box-glow 1.2s ease infinite alternate;
}

@keyframes modal-box-glow {
  from {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 0 rgba(22, 163, 74, 0);
  }
  to {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 28px rgba(22, 163, 74, 0.35);
  }
}

.modal-sorteado-numero {
  font-size: clamp(44px, 14vw, 64px);
  font-weight: 900;
  line-height: 1;
  color: #86efac;
}

.modal-sorteado-nome {
  margin-top: 12px;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 800;
  word-break: break-word;
  line-height: 1.25;
}

.modal-sorteado-btn {
  margin-top: 18px;
  width: 100%;
  min-height: 52px;
  font-size: 17px;
}

@media (max-width: 700px) {
  #painelSorteador .nav {
    flex-direction: column;
  }

  #painelSorteador .nav .btn {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
  }

  .sorteador-display {
    min-height: 240px;
  }
}
