:root {
  --red: #c0190e;
  --red2: #e02010;
  --yellow: #f5c400;
  --green: #1a7a2e;
  --green2: #22a03c;
  --dark: #1a0a00;
  --bg: #1f0d02;
  --card: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.13);
  --white: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  font-family: "Nunito", sans-serif;
  min-height: 100vh;
  padding-bottom: 80px;
  background-image:
    radial-gradient(
      ellipse 90% 50% at 50% 0%,
      rgba(240, 120, 0, 0.13) 0%,
      transparent 65%
    ),
    radial-gradient(
      ellipse 60% 40% at 90% 100%,
      rgba(192, 25, 14, 0.15) 0%,
      transparent 60%
    ),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M30 0L31 29H60L35 47L44 75L30 58L16 75L25 47L0 29H29Z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.bandeirolas {
  width: 100%;
  overflow: hidden;
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    var(--red) 0px,
    var(--red) 28px,
    var(--yellow) 28px,
    var(--yellow) 56px,
    var(--green) 56px,
    var(--green) 84px,
    #1428cc 84px,
    #1428cc 112px
  );
  opacity: 0.85;
  position: relative;
}
.bandeirolas::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--bg);
  clip-path: polygon(
    0% 0%,
    1% 100%,
    2% 0%,
    3% 100%,
    4% 0%,
    5% 100%,
    6% 0%,
    7% 100%,
    8% 0%,
    9% 100%,
    10% 0%,
    11% 100%,
    12% 0%,
    13% 100%,
    14% 0%,
    15% 100%,
    16% 0%,
    17% 100%,
    18% 0%,
    19% 100%,
    20% 0%,
    21% 100%,
    22% 0%,
    23% 100%,
    24% 0%,
    25% 100%,
    26% 0%,
    27% 100%,
    28% 0%,
    29% 100%,
    30% 0%,
    31% 100%,
    32% 0%,
    33% 100%,
    34% 0%,
    35% 100%,
    36% 0%,
    37% 100%,
    38% 0%,
    39% 100%,
    40% 0%,
    41% 100%,
    42% 0%,
    43% 100%,
    44% 0%,
    45% 100%,
    46% 0%,
    47% 100%,
    48% 0%,
    49% 100%,
    50% 0%,
    51% 100%,
    52% 0%,
    53% 100%,
    54% 0%,
    55% 100%,
    56% 0%,
    57% 100%,
    58% 0%,
    59% 100%,
    60% 0%,
    61% 100%,
    62% 0%,
    63% 100%,
    64% 0%,
    65% 100%,
    66% 0%,
    67% 100%,
    68% 0%,
    69% 100%,
    70% 0%,
    71% 100%,
    72% 0%,
    73% 100%,
    74% 0%,
    75% 100%,
    76% 0%,
    77% 100%,
    78% 0%,
    79% 100%,
    80% 0%,
    81% 100%,
    82% 0%,
    83% 100%,
    84% 0%,
    85% 100%,
    86% 0%,
    87% 100%,
    88% 0%,
    89% 100%,
    90% 0%,
    91% 100%,
    92% 0%,
    93% 100%,
    94% 0%,
    95% 100%,
    96% 0%,
    97% 100%,
    98% 0%,
    99% 100%,
    100% 0%
  );
}

#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.4s;
}
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#loading-screen p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  letter-spacing: 1px;
}

.online-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.online-bar.online {
  color: #86efac;
}
.online-bar.offline {
  color: #fca5a5;
}
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
.online .online-dot {
  background: #4ade80;
}
.offline .online-dot {
  background: #f87171;
  animation: none;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

header {
  text-align: center;
  padding: 10px 20px 18px;
}
.deco {
  font-size: 26px;
  letter-spacing: 8px;
  margin-bottom: 6px;
  opacity: 0.9;
}
header h1 {
  font-family: "Abril Fatface", serif;
  font-size: clamp(2.4rem, 10vw, 5rem);
  color: var(--yellow);
  line-height: 1;
  text-shadow:
    4px 4px 0 var(--red),
    8px 8px 0 rgba(0, 0, 0, 0.4);
  letter-spacing: 2px;
}
header .year {
  font-family: "Abril Fatface", serif;
  font-size: clamp(1rem, 4vw, 1.6rem);
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 8px;
  margin-top: 4px;
}
header .subtitle {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 680px;
  margin: 16px auto;
  padding: 0 16px;
}
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  flex: 1;
  min-width: 130px;
  text-align: center;
  color: var(--white);
}
.info-card .lbl {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 5px;
}
.info-card .val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--yellow);
  line-height: 1.1;
}
.info-card .sub {
  font-size: 11px;
  opacity: 0.65;
  margin-top: 3px;
}
.prize-card {
  background: linear-gradient(
    135deg,
    rgba(245, 196, 0, 0.15),
    rgba(245, 196, 0, 0.04)
  );
  border: 1px solid rgba(245, 196, 0, 0.35);
  border-radius: 16px;
  padding: 16px 20px;
  flex: 2;
  min-width: 200px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 14px;
}
.prize-icon {
  font-size: 2.6rem;
  flex-shrink: 0;
}
.prize-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 4px;
}
.prize-name {
  font-size: 17px;
  font-weight: 900;
  color: var(--yellow);
  line-height: 1.3;
}

.stats-wrap {
  max-width: 680px;
  margin: 0 auto 6px;
  padding: 0 16px;
}
.stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 30px;
  padding: 7px 14px;
  color: white;
  font-size: 13px;
  font-weight: 700;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-free {
  background: var(--red);
  border: 2px solid rgba(255, 255, 255, 0.2);
}
.dot-taken {
  background: var(--green2);
}
.progress-bg {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  height: 9px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  border-radius: 20px;
  transition: width 0.5s ease;
}
.progress-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  text-align: right;
}

.sorteio-wrap {
  max-width: 680px;
  margin: 14px auto 0;
  padding: 0 16px;
}
.btn-sorteio {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--yellow), #d4a000);
  color: var(--dark);
  border: none;
  border-radius: 16px;
  font-family: "Nunito", sans-serif;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 1px;
  transition:
    transform 0.15s,
    opacity 0.15s;
  box-shadow: 0 4px 24px rgba(245, 196, 0, 0.35);
  text-transform: uppercase;
}
.btn-sorteio:hover {
  transform: scale(1.02);
  opacity: 0.92;
}
.btn-sorteio:active {
  transform: scale(0.97);
}

.grid-wrap {
  max-width: 680px;
  margin: 16px auto 0;
  padding: 0 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.num-btn {
  aspect-ratio: 1;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: clamp(8px, 1.8vw, 12px);
  color: var(--white);
  transition:
    transform 0.12s,
    background 0.2s;
  background: var(--red);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.num-btn:hover {
  transform: scale(1.15);
  background: var(--red2);
  z-index: 2;
}
.num-btn:active {
  transform: scale(0.92);
}
.num-btn.taken {
  background: var(--green);
}
.num-btn.taken:hover {
  background: var(--green2);
}
.num-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.legend {
  max-width: 680px;
  margin: 14px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 700;
}
.legend-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

footer {
  text-align: center;
  padding: 30px 20px 0;
  color: rgba(255, 255, 255, 0.25);
  font-size: 11px;
  letter-spacing: 1px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: #fff;
  border-radius: 22px;
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.2s;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.modal-overlay.open .modal {
  transform: scale(1);
}
.modal .num-display {
  font-family: "Abril Fatface", serif;
  font-size: 3.8rem;
  color: var(--red);
  line-height: 1;
  margin-bottom: 6px;
}
.modal-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 14px;
}
.modal-status.free {
  background: #fef3c7;
  color: #92400e;
}
.modal-status.taken {
  background: #dcfce7;
  color: #166534;
}
.modal p {
  color: #444;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.name-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-family: "Nunito", sans-serif;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.name-input:focus {
  border-color: var(--red);
}
.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}
.btn {
  padding: 11px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 13px;
  transition:
    transform 0.1s,
    opacity 0.1s;
  flex: 1;
  min-width: 110px;
}
.btn:active {
  transform: scale(0.97);
}
.btn-confirm {
  background: var(--green);
  color: white;
}
.btn-confirm:hover {
  opacity: 0.88;
}
.btn-unmark {
  background: #dc2626;
  color: white;
}
.btn-unmark:hover {
  opacity: 0.88;
}
.btn-cancel {
  background: #f1f5f9;
  color: #334155;
}
.btn-cancel:hover {
  background: #e2e8f0;
}
.btn-gold {
  background: linear-gradient(135deg, var(--yellow), #d4a000);
  color: var(--dark);
}
.btn-gold:hover {
  opacity: 0.88;
}

#roulette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 8, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#roulette-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.roulette-deco {
  font-size: 20px;
  letter-spacing: 8px;
  margin-bottom: 8px;
  opacity: 0.8;
}
.roulette-title {
  font-family: "Abril Fatface", serif;
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  color: var(--yellow);
  margin-bottom: 4px;
  text-align: center;
  text-shadow: 3px 3px 0 var(--red);
}
.roulette-subtitle {
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
  letter-spacing: 0.5px;
  min-height: 20px;
  transition: color 0.3s;
}
.roulette-subtitle.active {
  color: rgba(255, 255, 255, 0.85);
}

.raffle-stage {
  width: min(360px, 92vw);
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#raffle-canvas {
  border-radius: 18px;
  background: #0a0500;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(245, 196, 0, 0.08);
  width: min(320px, 88vw);
  height: auto;
}
.prize-label-top {
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--yellow);
  opacity: 0;
  margin-bottom: 10px;
  transition: opacity 0.3s;
  min-height: 16px;
}
.prize-label-top.show {
  opacity: 1;
}

.roulette-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: min(360px, 92vw);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e0a00;
  color: white;
  border: 1px solid rgba(245, 196, 0, 0.3);
  padding: 11px 22px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 300;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes winner-flash {
  0% {
    background: rgba(245, 196, 0, 0);
  }
  30% {
    background: rgba(245, 196, 0, 0.3);
  }
  100% {
    background: rgba(245, 196, 0, 0);
  }
}
.flash-overlay {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  pointer-events: none;
  z-index: 3;
  animation: winner-flash 1.2s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(120px) rotate(720deg);
    opacity: 0;
  }
}
.confetti-piece {
  position: absolute;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-in forwards;
  pointer-events: none;
  z-index: 10;
}
