:root {
  --bg: #0f172a;
  --surface: #ffffff;
  --stage: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #cbd5e1;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 20px;
  --bs-body-font-family:
    "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-bg: transparent;
  --bs-body-color: #0f172a;
  --bs-primary: #2563eb;
  --bs-primary-rgb: 37, 99, 235;
  --bs-link-color: #2563eb;
  --bs-modal-bg: #ffffff;
  --bs-modal-color: var(--ink);
  --bs-modal-border-color: var(--line);
}
/* ---------- Ajuste do Fundo dos Modais ---------- */

.modal-content {
  background-color: #ffffff !important;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

.modal-backdrop {
  background-color: #0f172a;
}

.modal-backdrop.show {
  opacity: 0.65;
}
/* ---------- Fundo Festivo Vibrante (Body e Index) ---------- */
html {
  background: #0f172a;
}
body.festive-bg {
  background-color: #0f172a;
  background-image:
    radial-gradient(
      circle at 15% 20%,
      rgba(244, 63, 94, 0.22) 0%,
      transparent 35%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(59, 130, 246, 0.22) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(234, 179, 8, 0.2) 0%,
      transparent 45%
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpolygon points='40,0 43,12 55,15 45,22 48,34 38,27 27,33 32,21 22,14 35,12'/%3E%3Ccircle cx='10' cy='60' r='3'/%3E%3Ccircle cx='70' cy='50' r='2'/%3E%3Ccircle cx='65' cy='15' r='4'/%3E%3Cpolygon points='15,25 20,20 25,25 20,30'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 35%, #311b92 70%, #0f172a 100%);
  background-size:
    160% 160%,
    160% 160%,
    160% 160%,
    80px 80px,
    100% 100%;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  background-position:
    0% 0%,
    100% 0%,
    50% 100%,
    0 0,
    0 0;
  background-attachment: fixed;
  animation: festiveGlow 14s ease-in-out infinite alternate;
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

@keyframes festiveGlow {
  0% {
    background-position:
      0% 0%,
      100% 0%,
      50% 100%,
      0 0,
      0 0;
  }
  100% {
    background-position:
      100% 100%,
      0% 100%,
      50% 0%,
      80px 80px,
      0 0;
  }
}

button,
input,
select {
  font-family: inherit;
}
:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}
.text-muted {
  color: var(--muted) !important;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent-dark);
  --bs-btn-hover-border-color: var(--accent-dark);
  --bs-btn-active-bg: var(--accent-dark);
  --bs-btn-active-border-color: var(--accent-dark);
  font-weight: 700;
}
.form-control,
.form-select {
  background-color: #f8fafc;
  border: 1px solid var(--line);
  font-weight: 600;
  border-radius: 12px;
  color: var(--ink);
}
.form-control:focus,
.form-select:focus {
  background-color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}
.form-check-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
}

/* ---------- Estrutura do Cabeçalho Dividido ---------- */
.header-container {
  margin-bottom: 24px;
  border-radius: 22px;
  background: var(--surface);
  position: relative;
  z-index: 10;
  box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Bloco 1: Topo Festivo com Logo e Título */
.brand-hero {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='%23ffffff' fill-opacity='0.15'%3E%3Ccircle cx='20' cy='20' r='6'/%3E%3Ccircle cx='80' cy='30' r='4'/%3E%3Cpolygon points='50,15 53,23 62,25 55,30 57,38 50,33 43,38 45,30 38,25 47,23'/%3E%3Ccircle cx='30' cy='80' r='5'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(135deg, #1d4ed8 0%, #3b82f6 40%, #7c3aed 100%);
  padding: 22px 28px;
  color: #ffffff;
  position: relative;
  border-radius: 22px 22px 0 0;
}

.brand-content {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo {
  height: 56px;
  width: auto;
  object-fit: contain;
  background: #ffffff;
  padding: 6px 12px;
  border-radius: 14px;
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}

/* Bloco 2: Barra de Navegação Dedicada */
.main-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #ffffff;
  border-top: 1px solid var(--line);
  border-radius: 0 0 22px 22px;
  gap: 12px;
}

/* Menus à Esquerda */
.nav-pills-s {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px;
  max-width: 100%;
}

.nav-pill-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.nav-pill-item i {
  font-size: 1.1rem;
}

.nav-pill-item:hover {
  color: var(--accent-dark);
  background: #e2e8f0;
}

.nav-pill-item.active {
  background: var(--accent);
  color: #ffffff !important;
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.45);
}

/* E-mail / Perfil do Usuário à Direita */
.user-dropdown {
  flex-shrink: 0;
  margin-left: auto;
}

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 4px 14px 4px 4px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  transition: all 0.2s ease;
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.user-btn .who {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
}

.user-btn .bi-chevron-down {
  font-size: 0.75rem;
  color: #64748b;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.avatar.lg {
  width: 42px;
  height: 42px;
}

.user-pop {
  /* --bs-body-bg é transparent neste tema, e o dropdown herda dele: define fundo sólido */
  --bs-dropdown-bg: #ffffff;
  --bs-dropdown-color: var(--ink);
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-color: var(--ink);
  --bs-dropdown-link-hover-color: var(--accent-dark);
  --bs-dropdown-link-hover-bg: var(--accent-soft);
  --bs-dropdown-link-active-color: var(--accent-dark);
  --bs-dropdown-link-active-bg: var(--accent-soft);
  background-color: #ffffff;
  color: var(--ink);
  width: min(290px, calc(100vw - 20px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  margin-top: 8px !important;
  z-index: 1060;
  box-shadow: 0 18px 36px -10px rgba(15, 23, 42, 0.35);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.user-info div {
  min-width: 0;
}

.user-info small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.user-info b {
  display: block;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ok);
  background: #f0faf5;
  border: 1px solid #bfe6d4;
  border-radius: 999px;
  padding: 1px 8px;
}

.user-pop .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.user-pop .dropdown-item:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.user-pop .dropdown-item.danger {
  color: #b83535;
}

.user-pop .dropdown-item.danger:hover {
  background: #fff1f1;
}

/* ---------- Cartões do Conteúdo ---------- */
.card-s {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.35);
}

#layout {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  margin: 0;
  gap: 20px;
}
#layout > .card-s {
  margin: 0;
}
@media (min-width: 992px) {
  #panel {
    width: 340px;
  }
}
.panel-anim {
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Palco ---------- */
.stage {
  padding: 26px;
  margin: 0;
}
.name-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.name-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.name-row input {
  flex: 1;
  min-width: 200px;
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  font-size: 1.6rem;
  font-weight: 700;
  padding: 6px 2px 8px;
  letter-spacing: -0.01em;
  transition: border-color 0.2s;
  color: var(--ink);
}
.name-row input::placeholder {
  color: #a9b3cb;
  font-weight: 600;
}
.name-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.name-row input:disabled {
  color: var(--muted);
  border-color: transparent;
  cursor: not-allowed;
}
.btn-new {
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 13px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, 0.7);
  transition:
    background 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}
.btn-new:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 22px -12px rgba(37, 99, 235, 0.75);
}
.btn-new.ghost {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-new.ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.btn-new.confirm {
  background: #fff3f3 !important;
  color: var(--danger) !important;
  border: 1px solid var(--danger) !important;
}
.btn-new:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.id-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  flex-wrap: wrap;
}
.id-line code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--ink);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 2px 10px;
}
.id-line code.empty {
  background: #f0f3fa;
  color: var(--muted);
  font-family: inherit;
  font-weight: 600;
}
.id-line button {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}
.id-line button:hover {
  text-decoration: underline;
}

.screen {
  position: relative;
  margin-top: 20px;
  border-radius: 18px;
  background: var(--stage);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  overflow: hidden;
  text-align: center;
  transition:
    background 0.3s,
    box-shadow 0.3s;
}
.screen.live {
  background: #e1eaff;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}
.placeholder {
  color: var(--muted);
}
.placeholder i {
  font-size: 2.6rem;
  color: #9db2f5;
  display: block;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
.placeholder strong {
  display: block;
  font-size: 1.25rem;
  color: var(--ink);
}
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 600;
  font-size: 0.8rem;
}
.chip.ok {
  color: var(--ok);
  border-color: #bfe6d4;
  background: #f0faf5;
}
.single-num {
  font-size: clamp(7rem, 20vw, 13rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  text-shadow: 0 8px 0 rgba(37, 99, 235, 0.12);
  font-variant-numeric: tabular-nums;
}
.single-num.pop {
  animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.single-num.rolling {
  color: #8fa6ee;
  filter: blur(1.5px);
}
@keyframes pop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.balls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}
.ball {
  min-width: 92px;
  height: 92px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 4px solid var(--accent);
  color: var(--ink);
  font-size: 2.5rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, 0.45);
  opacity: 0;
  transform: scale(0.4) translateY(16px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-variant-numeric: tabular-nums;
}
.ball.in {
  opacity: 1;
  transform: none;
}
.ball.rolling {
  border-color: #9db2f5;
  color: var(--muted);
}
.balls.sm .ball {
  min-width: 68px;
  height: 68px;
  font-size: 1.7rem;
  border-width: 3px;
}
.balls.xs .ball {
  min-width: 54px;
  height: 54px;
  font-size: 1.3rem;
  border-width: 2px;
  padding: 0 10px;
}

/* ---------- Contagem regressiva ---------- */
.countdown {
  container-type: size;
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  overflow: hidden;
  color: #fff;
  background: radial-gradient(
    circle at 50% 42%,
    #4c7bff 0%,
    #2748c8 38%,
    #14226b 72%,
    #0b1440 100%
  );
  animation: cdIn 0.35s ease-out;
}
.countdown .cd-label {
  position: relative;
  z-index: 2;
  margin-bottom: clamp(4px, 2.5cqh, 14px);
  font-size: clamp(0.7rem, 2.2cqh + 0.35rem, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  animation: cdLabel 1.6s ease-in-out infinite;
}
.cd-glow {
  position: absolute;
  width: 130%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  margin: -65% 0 0 -65%;
  background: conic-gradient(
    from 0deg,
    transparent 0 70%,
    rgba(255, 255, 255, 0.16) 85%,
    transparent 100%
  );
  animation: cdSpin 3.2s linear infinite;
  pointer-events: none;
}
.cd-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.cd-sparks i {
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd86b;
  box-shadow: 0 0 12px 3px rgba(255, 216, 107, 0.7);
  opacity: 0;
  animation: cdRise 3.4s ease-in infinite;
}
.cd-sparks i:nth-child(1) {
  margin-left: -38%;
  animation-delay: 0s;
}
.cd-sparks i:nth-child(2) {
  margin-left: -24%;
  animation-delay: 0.7s;
  width: 5px;
  height: 5px;
}
.cd-sparks i:nth-child(3) {
  margin-left: -10%;
  animation-delay: 1.5s;
}
.cd-sparks i:nth-child(4) {
  margin-left: 6%;
  animation-delay: 0.3s;
  width: 6px;
  height: 6px;
}
.cd-sparks i:nth-child(5) {
  margin-left: 20%;
  animation-delay: 1.1s;
}
.cd-sparks i:nth-child(6) {
  margin-left: 32%;
  animation-delay: 2s;
  width: 5px;
  height: 5px;
}
.cd-sparks i:nth-child(7) {
  margin-left: -30%;
  animation-delay: 2.3s;
  width: 6px;
  height: 6px;
}
.cd-sparks i:nth-child(8) {
  margin-left: 42%;
  animation-delay: 1.8s;
}

.cd-dial {
  container-type: inline-size;
  position: relative;
  z-index: 2;
  width: min(320px, 52vw);
  width: min(320px, 86cqw, max(120px, calc(100cqh - 84px)));
  aspect-ratio: 1;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  --cd-col: #ffffff;
  --cd-glow: rgba(140, 175, 255, 0.9);
}
.cd-dial::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.04) 70%
  );
  box-shadow: 0 0 60px 8px var(--cd-glow);
}
.cd-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}
.cd-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 10;
}
.cd-prog {
  fill: none;
  stroke: var(--cd-col);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 8px var(--cd-glow));
}
.countdown.run .cd-prog {
  animation: cdRing var(--cd-total, 3s) linear forwards;
}
.cd-dial b {
  position: relative;
  font-size: clamp(4rem, 24vw, 10.5rem);
  font-size: 46cqw;
  font-weight: 800;
  line-height: 1;
  color: var(--cd-col);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  text-shadow:
    0 0 28px var(--cd-glow),
    0 8px 0 rgba(0, 0, 0, 0.18);
}
.cd-dial.tick b {
  animation: cdTick 0.85s cubic-bezier(0.2, 1.1, 0.3, 1) both;
}
.cd-ripple {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.65);
  opacity: 0;
}
.cd-dial.tick .cd-ripple {
  animation: cdRipple 1s ease-out;
}
.cd-dial.tick .cd-ripple.r2 {
  animation-delay: 0.18s;
}
.cd-dial.urgent {
  --cd-col: #ffc24a;
  --cd-glow: rgba(255, 150, 40, 0.95);
}
.cd-dial.urgent b {
  animation-name: cdTickUrgent;
}
.cd-bar {
  position: relative;
  z-index: 2;
  margin-top: clamp(8px, 4cqh, 26px);
  width: min(78%, 360px);
  height: clamp(5px, 1.6cqh, 8px);
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.cd-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fb0ff, #fff);
  transform-origin: left center;
}
.countdown.run .cd-bar i {
  animation: cdBar var(--cd-total, 3s) linear forwards;
}
.screen.counting {
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.55),
    0 18px 50px -12px rgba(39, 72, 200, 0.7);
}

@keyframes cdIn {
  from {
    opacity: 0;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes cdSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes cdLabel {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}
@keyframes cdRing {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 100;
  }
}
@keyframes cdBar {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}
@keyframes cdTick {
  0% {
    transform: scale(2.3);
    opacity: 0;
    filter: blur(10px);
  }
  30% {
    transform: scale(0.9);
    opacity: 1;
    filter: blur(0);
  }
  52% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes cdTickUrgent {
  0% {
    transform: scale(2.6) rotate(-6deg);
    opacity: 0;
    filter: blur(12px);
  }
  28% {
    transform: scale(0.88) rotate(2deg);
    opacity: 1;
    filter: blur(0);
  }
  48% {
    transform: scale(1.14) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
@keyframes cdRipple {
  from {
    transform: scale(0.75);
    opacity: 0.85;
  }
  to {
    transform: scale(1.55);
    opacity: 0;
  }
}
@keyframes cdRise {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100cqh) scale(1.2);
    opacity: 0;
  }
}

.btn-draw {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 12px 24px -12px rgba(37, 99, 235, 0.7);
  transition:
    background 0.15s,
    transform 0.15s,
    box-shadow 0.15s;
}
.btn-draw:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 16px 28px -12px rgba(37, 99, 235, 0.75);
}
.btn-draw:disabled {
  opacity: 0.6;
  cursor: wait;
}
.btn-draw.idle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.save-line {
  min-height: 22px;
  margin-top: 10px;
  text-align: center;
}

/* ---------- Configurações ---------- */
.panel {
  padding: 20px;
  margin: 0;
}
.panel h2 {
  font-size: 1rem;
  margin: 0 0 14px;
  font-weight: 700;
}
.field {
  margin-bottom: 16px;
}
.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.pill:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.lock-note {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 6px;
}
.stepper {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 6px;
}
.stepper button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  font-size: 1.1rem;
  cursor: pointer;
}
.stepper button:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.stepper .form-control {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f0f3fa;
  border-radius: 12px;
  padding: 3px;
  gap: 3px;
  position: relative;
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg label {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  margin: 0;
}
.seg input:checked + label {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(30, 42, 68, 0.12);
}
.seg input:focus-visible + label {
  outline: 3px solid rgba(37, 99, 235, 0.45);
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.toggle b {
  display: block;
  font-size: 0.88rem;
}
.toggle small {
  color: var(--muted);
  font-size: 0.75rem;
}
.toggle .secs {
  width: 84px;
  text-align: center;
  flex: none;
}
.toggle .form-switch {
  padding: 0;
  min-height: 0;
  margin: 0;
}
.toggle .form-switch .form-check-input {
  float: none;
  margin: 0;
  width: 2.75em;
  height: 1.5em;
  cursor: pointer;
}
.tools {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.btn-ghost {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost.danger:hover,
.btn-ghost.confirm {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff3f3;
}
.btn-ghost.square {
  flex: none;
  width: 44px;
}

/* ---------- Histórico ---------- */
.history {
  margin-top: 20px;
  margin-bottom: 0;
}
.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.history-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.history-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.history-tools .form-select {
  width: auto;
  padding: 7px 32px 7px 10px;
  font-size: 0.82rem;
}
.history-tools .btn-ghost {
  flex: none;
  padding: 7px 12px;
}
.btn-ghost.xls {
  color: #1d6f42;
  border-color: #bfe0ce;
  background: #f2faf6;
}
.btn-ghost.xls:hover {
  background: #e3f4eb;
  border-color: #1d6f42;
  color: #1d6f42;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat {
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}
.stat span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.stat strong {
  font-size: 1.15rem;
}
.list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 10px;
}
.round {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.round.latest {
  border-color: #a9befa;
  background: #f5f8ff;
}
.round-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  align-items: baseline;
}
.round-name {
  font-weight: 700;
}
.round-time {
  font-size: 0.78rem;
  color: var(--muted);
}
.round-id {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.round-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.num {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.95rem;
  cursor: help;
}
.num.hit {
  background: var(--accent);
  color: #fff;
}
.none {
  color: var(--muted);
  font-size: 0.82rem;
}
.round-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
}
.sel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.sel-actions > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.round-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
}
.sync {
  font-size: 0.76rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sync.ok {
  color: var(--ok);
}
.sync.new {
  color: var(--muted);
}
.sync.err {
  color: var(--warn);
}
.btn-link-s {
  border: 0;
  background: none;
  padding: 0;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-link-s:hover {
  text-decoration: underline;
}
.btn-link-s.del {
  color: var(--danger);
}
.btn-link-s.xl {
  color: #1d6f42;
}
.resume {
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  padding: 4px 12px;
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 700;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.resume:hover {
  background: var(--accent-dark);
}
.empty {
  text-align: center;
  padding: 28px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

#tip {
  position: fixed;
  z-index: 1200;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.4);
}
[data-tip] {
  cursor: help;
}
.foot {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.82rem;
  margin-top: 28px;
}

/* ---------- Regras para Dispositivos Móveis (Mobile Fix) ---------- */
@media (max-width: 768px) {
  .wrap {
    padding: 12px 10px 30px;
  }

  .brand-hero {
    padding: 16px 18px;
  }

  .brand-content {
    gap: 12px;
  }

  .brand-logo {
    height: 44px;
    padding: 4px 8px;
  }

  .brand-title {
    font-size: 1.35rem;
  }

  .brand-subtitle {
    font-size: 0.82rem;
  }

  .main-navbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .nav-pills-s {
    flex: 1 1 auto;
    min-width: 0;
    gap: 4px;
    padding: 3px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-pills-s::-webkit-scrollbar {
    display: none;
  }
  .nav-pill-item.active {
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.4);
  }

  .nav-pill-item {
    height: 36px;
    padding: 0 10px;
    font-size: 0.8rem;
    gap: 6px;
  }

  /* Oculta o texto extenso do e-mail no celular, deixando o ícone e avatar limpos */
  .user-btn {
    height: 38px;
    padding: 2px 8px 2px 2px;
  }

  .user-btn .who {
    display: none;
  }

  .user-btn .bi-chevron-down {
    margin-left: 2px;
  }
}

@media (max-width: 480px) {
  .nav-pill-item .nav-text {
    font-size: 0.78rem;
  }

  .nav-pill-item {
    padding: 0 8px;
  }
}

@media (max-width: 560px) {
  .stage {
    padding: 18px;
  }
  .screen {
    min-height: 300px;
  }
  .ball {
    min-width: 76px;
    height: 76px;
    font-size: 2rem;
  }
  .btn-new {
    width: 100%;
    justify-content: center;
  }
  .stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Botão do Google (login) */
.gbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  background: #fff;
  border: 1px solid #c9d1e3;
  color: var(--ink);
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  text-decoration: none;
}
.gbtn:hover {
  background: #f7f9fd;
  border-color: var(--accent);
  color: var(--ink);
}
.gbtn svg {
  width: 22px;
  height: 22px;
}

/* Data e local do sorteio */
.draw-meta .form-control {
  font-size: 0.95rem;
}
.round-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}
.round-meta i {
  color: var(--accent);
  margin-right: 4px;
}

/* ---------- Modo Tela Cheia ---------- */
.stage-live {
  position: relative;
}
.fs-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 8;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(30, 42, 68, 0.22);
  transition:
    transform 0.15s,
    background 0.15s;
}
.fs-toggle:hover {
  transform: scale(1.08);
  background: #fff;
}
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2000;
}
.stage-live.is-fs,
.stage-live:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(10px, 2.5vmin, 28px);
  background: var(--bg);
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.stage-live.is-fs .screen,
.stage-live:fullscreen .screen {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  border-radius: 22px;
}
.stage-live.is-fs .btn-draw,
.stage-live:fullscreen .btn-draw {
  flex: none;
  margin-top: 0;
  padding: clamp(14px, 3vmin, 26px);
  font-size: clamp(1.1rem, 3vmin, 1.8rem);
}
.stage-live.is-fs .single-num,
.stage-live:fullscreen .single-num {
  font-size: clamp(8rem, 40vmin, 26rem);
}
.stage-live.is-fs .balls,
.stage-live:fullscreen .balls {
  max-height: none;
}
.stage-live.is-fs .ball,
.stage-live:fullscreen .ball {
  min-width: clamp(92px, 15vmin, 160px);
  height: clamp(92px, 15vmin, 160px);
  font-size: clamp(2.5rem, 7vmin, 4.6rem);
}
body.fs-lock {
  overflow: hidden;
}

/* ---------- Tela de Login ---------- */
body.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background-color: #0f172a;
  background-image:
    radial-gradient(
      circle at 15% 20%,
      rgba(244, 63, 94, 0.22) 0%,
      transparent 35%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(59, 130, 246, 0.22) 0%,
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 80%,
      rgba(234, 179, 8, 0.2) 0%,
      transparent 45%
    ),
    linear-gradient(135deg, #0f172a 0%, #1e1b4b 35%, #311b92 70%, #0f172a 100%);
  background-size:
    160% 160%,
    160% 160%,
    160% 160%,
    100% 100%;
  background-repeat: no-repeat;
  background-position:
    0% 0%,
    100% 0%,
    50% 100%,
    0 0;
  background-attachment: fixed;
  color: var(--ink);
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.55);
  animation: fadeIn 0.35s ease;
}
.login-hero {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 40%, #7c3aed 100%);
  color: #fff;
  padding-left: 16px;
  padding-right: 16px;
}
.login-hero .brand-logo {
  height: 95px;
  max-width: 100%;
}
.login-hero .b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  margin: 0 5px 14px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  border: 3px solid rgba(255, 255, 255, 0.55);
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 8px 16px -6px rgba(0, 0, 0, 0.35);
  animation: float 3s ease-in-out infinite;
}
.login-hero .b:nth-child(2) {
  animation-delay: 0.35s;
}
.login-hero .b:nth-child(3) {
  animation-delay: 0.7s;
}
.login-card .btn-primary {
  box-shadow: 0 10px 20px -12px rgba(37, 99, 235, 0.7);
}
.gbtn {
  box-shadow: 0 6px 14px -8px rgba(15, 23, 42, 0.3);
}

/* ---------- Ajustes Mobile: ícones e elementos ---------- */
@media (max-width: 768px) {
  .brand-title {
    font-size: 1.25rem;
  }
  .nav-pill-item {
    min-height: 40px;
  }
  .nav-pill-item i {
    font-size: 1.2rem;
    line-height: 1;
  }
  .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  .user-btn {
    min-width: 44px;
    height: 44px;
    padding: 4px 10px 4px 4px;
    gap: 6px;
  }
  .user-pop {
    margin-top: 6px !important;
  }
  .user-pop .dropdown-item {
    min-height: 44px;
    font-size: 0.9rem;
  }
  .user-pop .dropdown-item i {
    font-size: 1.1rem;
  }
  .card-s,
  .stage,
  .panel {
    padding: 16px;
    border-radius: 18px;
  }
  .name-row input {
    font-size: 1.3rem;
    min-width: 0;
  }
  .fs-toggle {
    width: 44px;
    height: 44px;
    top: 8px;
    right: 8px;
  }
  .btn-draw {
    padding: 16px;
    font-size: 1.1rem;
  }
  .btn-draw i {
    font-size: 1.3rem;
  }
  .stepper {
    grid-template-columns: 48px 1fr 48px;
  }
  .stepper button {
    min-height: 44px;
  }
  .pill {
    padding: 6px 12px;
  }
  .btn-ghost,
  .btn-ghost.square {
    min-height: 44px;
  }
  .history-tools {
    width: 100%;
  }
  .history-tools .form-select {
    flex: 1 1 100%;
    width: 100%;
  }
  .history-tools .btn-ghost {
    flex: 1 1 calc(50% - 4px);
  }
  .single-num {
    font-size: clamp(5rem, 28vw, 9rem);
  }
  .cd-label {
    letter-spacing: 0.2em;
  }
}

@media (max-width: 480px) {
  .brand-hero {
    padding: 14px 14px;
  }
  .brand-logo {
    height: 38px;
    padding: 4px 8px;
    border-radius: 10px;
  }
  .brand-title {
    font-size: 1.15rem;
  }
  .brand-subtitle {
    font-size: 0.75rem;
  }
  /* Menu só com ícones em telas pequenas (texto continua acessível a leitores de tela) */
  .nav-pills-s {
    justify-content: space-between;
  }
  .nav-pill-item {
    width: 44px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }
  .nav-pill-item .nav-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .user-btn .bi-chevron-down {
    font-size: 0.7rem;
  }
  .balls {
    gap: 10px;
  }
  .ball {
    min-width: 64px;
    height: 64px;
    font-size: 1.7rem;
    border-width: 3px;
    padding: 0 12px;
  }
  .balls.sm .ball {
    min-width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }
  .balls.xs .ball {
    min-width: 46px;
    height: 46px;
    font-size: 1.1rem;
  }
  .toggle .secs {
    width: 72px;
  }
  .login-card {
    border-radius: 20px;
  }
}

/* ===== Módulo de eventos ===== */
.evento-card { max-width: 640px; overflow: hidden; }
.evento-card .carousel { margin-left: 0; margin-right: 0; }
