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

:root {
  --bg: #f4f7f6;
  --bg-card: #ffffff;
  --text: #333333;
  --text-muted: #666666;
  --border: #dddddd;
  --accent: #27ae60;
  --accent-dark: #219150;
  --radius: 15px;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);

  --cor-lotofacil: #009c3b;
  --cor-quina: #1f4e79;
  --cor-megasena: #2e7d32;
}

html {
  font-size: 16px;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 20px 12px calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 500px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  padding-top: env(safe-area-inset-top);
  text-align: center;
}

.logo-ball {
  display: none;
}

.logo h1 {
  color: var(--accent);
  font-size: 1.9rem;
  letter-spacing: 1px;
  line-height: 1;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-align: left;
}

/* Modalidades */
.modalidade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 0;
}

.modalidade-btn {
  padding: 12px 10px;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: 0.3s;
  font-weight: bold;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.modalidade-btn:hover {
  border-color: var(--accent);
}

.modalidade-btn:active {
  transform: scale(0.97);
}

.modalidade-btn.ativo {
  border-color: var(--accent);
  background: #e8f5e9;
  color: var(--accent);
}

.modalidade-name {
  font-size: 0.88rem;
  color: var(--text);
  text-align: center;
}

.modalidade-btn.ativo .modalidade-name {
  color: var(--accent);
}

.modalidade-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: normal;
}

/* Regras */
.regras {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 1.2rem 1.5rem;
  text-align: left;
}

.regra-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text);
}

.regra-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8f5e9;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Gerar */
.gerar {
  text-align: center;
}

.gerar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.gerar-header h2 {
  margin-bottom: 0;
}

.contador {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f4f7f6;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.btn-gerar {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
  font-family: inherit;
}

.btn-gerar:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-gerar:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-gerar:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aviso {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 12px;
  font-weight: 600;
  display: none;
}

.aviso.visivel {
  display: block;
}

/* Resultado */
.resultado-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.resultado-header h2 {
  margin-bottom: 0;
}

.btn-limpar {
  border: 2px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: 0.3s;
}

.btn-limpar:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.jogo {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 10px;
}

.jogo-rotulo {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  margin-bottom: 4px;
}

.jogo-nome {
  font-weight: bold;
  font-size: 0.82rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ball {
  width: 30px;
  height: 30px;
  background: #ddd;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  color: #333;
  border: 1px solid #bbb;
}

/* Instalação */
.instalacao-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  text-align: left;
}

.instalacao-header h2 {
  margin-bottom: 4px;
}

.instalacao-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.instalacao-icone {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #e8f5e9;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.btn-instalar {
  width: 100%;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  border-radius: 8px;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: 0.3s;
}

.btn-instalar:hover {
  background: var(--accent);
  color: #fff;
}

.btn-instalar:active {
  transform: scale(0.99);
}

.guia {
  margin-top: 14px;
  background: #f9f9f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.6;
  text-align: left;
}

.guia ol {
  padding-left: 18px;
  margin-top: 6px;
}

.guia li {
  margin-bottom: 4px;
}

/* Footer */
.app-footer {
  text-align: center;
  color: #888;
  font-size: 0.82rem;
  padding: 8px 0;
}

/* Tablet e desktop */
@media (min-width: 700px) {
  .app {
    max-width: 560px;
  }
}
