* {
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --panel: #172033;
  --panel-2: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent2: #16a34a;
  --danger: #ef4444;
  --number-bg: #f8fafc;
  --number-text: #111827;
  --yellow: #facc15;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, #1e3a5f 0, #0f172a 48%, #09101f 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.app {
  width: min(1700px, 98%);
  margin: 0 auto;
  padding: 14px 0 22px;
}

.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.titulo h1 {
  margin: 0;
  font-size: clamp(26px, 3.2vw, 46px);
  line-height: 1;
}

.titulo p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.painel-status {
  display: flex;
  gap: 10px;
}

.status-card {
  min-width: 115px;
  padding: 9px 14px;
  background: rgba(30, 41, 59, .92);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
}

.status-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-card strong {
  display: block;
  margin-top: 2px;
  font-size: 28px;
}

.status-card.ultimo strong {
  color: var(--yellow);
}

.linha-superior {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}

.controles {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  padding: 10px;
  background: rgba(23,32,51,.68);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
}

.btn {
  border: 0;
  border-radius: 11px;
  background: #334155;
  color: #fff;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
}

.btn-sortear {
  background: var(--accent2);
}

.btn-limpar {
  background: var(--danger);
}

.sorteio-box {
  min-width: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 14px;
  background: rgba(30, 41, 59, .88);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
}

.sorteio-box span {
  color: var(--muted);
  font-size: 14px;
  font-weight: bold;
}

#numeroSorteado {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: #111827;
  border-radius: 50%;
  font-weight: 900;
  font-size: 32px;
  box-shadow: 0 0 20px rgba(250, 204, 21, .3);
}

.ultimos-wrapper {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(255,255,255,.07);
}

.ultimos-titulo {
  margin-bottom: 7px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  letter-spacing: .3px;
}

.ultimos-seis {
  display: grid;
  grid-template-columns: repeat(6, minmax(70px, 1fr));
  gap: 8px;
}

.bola-historico {
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50px;
  background: #334155;
  border: 2px solid #475569;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.03);
}

.bola-historico.primeira {
  background: var(--yellow);
  border-color: #fde68a;
  color: #111827;
  transform: scale(1.04);
  box-shadow: 0 0 18px rgba(250,204,21,.34);
}

.bola-historico.vazia {
  opacity: .28;
}

.grade {
  display: grid;
  grid-template-columns: repeat(11, minmax(58px, 1fr));
  gap: 6px;
}

.numero {
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 3px solid transparent;
  border-radius: 11px;
  background: var(--number-bg);
  color: var(--number-text);
  font-size: clamp(22px, 2vw, 34px);
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 3px 9px rgba(0,0,0,.18);
  transition: .12s ease;
}

.numero:hover {
  transform: scale(1.035);
}

.numero.marcado {
  background: linear-gradient(145deg, #22c55e, #15803d);
  color: #fff;
  border-color: #86efac;
  box-shadow: 0 0 15px rgba(34, 197, 94, .38);
}

.numero.ultimo-marcado {
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(250, 204, 21, .65);
}

footer {
  margin-top: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .76);
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(500px, 94vw);
  text-align: center;
  padding: 26px;
  border-radius: 24px;
  background: #111827;
  border: 2px solid rgba(255,255,255,.12);
  box-shadow: 0 20px 80px rgba(0,0,0,.6);
}

.modal-label {
  color: #cbd5e1;
  font-size: 20px;
  font-weight: 800;
}

.modal-numero {
  width: 220px;
  height: 220px;
  margin: 22px auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--yellow);
  color: #111827;
  font-size: 108px;
  font-weight: 900;
  border: 9px solid #fff3a3;
  box-shadow: 0 0 50px rgba(250, 204, 21, .35);
}

@media (min-width: 1400px) and (min-height: 800px) {
  .numero {
    min-height: 72px;
    font-size: 35px;
  }
}

@media (max-width: 1150px) {
  .grade {
    grid-template-columns: repeat(9, 1fr);
  }
}

@media (max-width: 800px) {
  .topo {
    align-items: stretch;
    flex-direction: column;
  }

  .painel-status {
    width: 100%;
  }

  .status-card {
    flex: 1;
  }

  .linha-superior {
    grid-template-columns: 1fr;
  }

  .sorteio-box {
    min-width: 0;
  }

  .ultimos-seis {
    grid-template-columns: repeat(3, 1fr);
  }

  .grade {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .numero {
    min-height: 58px;
  }
}

@media (max-width: 480px) {
  .grade {
    grid-template-columns: repeat(5, 1fr);
  }

  .ultimos-seis {
    grid-template-columns: repeat(3, 1fr);
  }

  .numero {
    min-height: 54px;
    font-size: 22px;
  }
}
