:root {
  --bg: #0c2218;
  --bg-2: #071810;
  --panel: #123326;
  --line: #2a5540;
  --gold: #c9a227;
  --gold-2: #e8d48b;
  --ink: #e8e0c8;
  --muted: #9aaa9a;
  --red: #fc1111;
  --black: #1e1e1e;
  --zero: #37ff00;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  height: auto;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  overscroll-behavior: none;
  user-select: none;
  overflow-x: hidden;
}

body {
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 4px);
}

#app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  background: var(--bg);
}

.tela {
  display: none;
  flex-direction: column;
}

.tela.ativa {
  display: flex;
  min-height: 100svh;
  min-height: -webkit-fill-available;
}

.escondido {
  display: none !important;
}

#tela-inicio,
#tela-licenca {
  padding: calc(24px + var(--safe-t)) 22px calc(24px + var(--safe-b));
  justify-content: flex-start;
  gap: 28px;
}

#input-licenca {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: Consolas, "Courier New", monospace;
}

.licenca-msg {
  margin: 0;
  min-height: 1.2em;
  color: #ffb4b4;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.inicio-marca {
  text-align: center;
  padding-top: 36px;
}

.inicio-selo {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: var(--panel);
  color: var(--gold-2);
  font: 700 42px/88px Georgia, serif;
}

.inicio-marca h1 {
  margin: 0;
  color: var(--gold-2);
  letter-spacing: 0.08em;
  font-size: 1.7rem;
}

.inicio-marca p {
  margin: 10px auto 0;
  max-width: 260px;
  color: var(--muted);
  font-size: 0.95rem;
}

.cartao {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 18px;
  padding: 18px;
}

.inicio-form {
  display: grid;
  gap: 12px;
}

.inicio-form label,
.resultado-real {
  display: grid;
  gap: 6px;
  color: var(--gold-2);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 1.05rem;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.btn-ouro,
.btn-ghost,
.btn-icon {
  min-height: 48px;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-ouro {
  background: var(--gold);
  color: #1a1408;
}

.btn-ouro:disabled {
  opacity: 0.35;
}

.btn-ghost {
  background: transparent;
  color: var(--gold-2);
  border: 1px solid var(--gold);
}

.btn-ghost.perigo {
  color: #ffb4b4;
  border-color: #8a3030;
  width: 100%;
}

.btn-icon {
  min-width: 48px;
  background: var(--panel);
  color: var(--gold-2);
  border: 1px solid var(--line);
}

#tela-app {
  height: 100dvh;
  height: 100svh;
}

.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 12px 8px;
  gap: 10px;
}

.topo strong {
  display: block;
  color: var(--gold-2);
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.topo span {
  color: var(--muted);
  font-size: 0.75rem;
}

.topo-acoes {
  display: flex;
  gap: 6px;
}

.chip {
  background: var(--panel);
  color: var(--gold-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.75rem;
}

.chip[aria-pressed="true"] {
  background: var(--gold);
  color: #1a1408;
  border-color: var(--gold-2);
}

.painel {
  display: none;
  pointer-events: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 0 12px;
}

.painel.ativo {
  display: flex;
  pointer-events: auto;
  padding-bottom: 0;
}

.fita {
  display: flex;
  gap: 6px;
  min-height: 42px;
  overflow: hidden;
  margin-bottom: 8px;
}

.bola {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid #8d7028;
  flex: 0 0 36px;
}

.bola.vermelha { background: var(--red); }
.bola.preta { background: var(--black); }
.bola.verde { background: var(--zero); color: #000; }
.bola.recente { box-shadow: 0 0 0 2px var(--gold-2); }

.sugestao {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 12px 14px 14px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sugestao.vazia {
  border-color: var(--line);
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
}

.sugestao.vazia .sugestao-kicker,
.sugestao.vazia #sugestao-titulo,
.sugestao.vazia #sugestao-detalhe,
.sugestao.vazia #sugestao-conf {
  display: none;
}

.sugestao.alta,
.sugestao.sinal {
  box-shadow: 0 0 0 1px var(--gold-2), 0 0 18px rgba(201, 162, 39, 0.28);
}

.sugestao.confirmada {
  border-color: var(--zero);
  box-shadow: 0 0 0 1px var(--zero), 0 0 18px rgba(55, 255, 0, 0.28);
}

.sugestao-kicker,
.conf {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

#sugestao-titulo {
  font-size: 1.45rem;
  line-height: 1.1;
}

#sugestao-detalhe {
  color: var(--muted);
  font-size: 0.82rem;
}

.conf.alta { color: var(--zero); }
.conf.media { color: var(--gold-2); }
.conf.fraca { color: #ffb14a; }

.acoes-sugestao {
  display: grid;
  grid-template-columns: 1fr 1fr 48px;
  gap: 8px;
  margin: 8px 0;
}

.acoes-sugestao.uma {
  grid-template-columns: 1fr;
}

.mesa {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 0.7fr repeat(12, 1fr);
  gap: 4px;
  padding-bottom: 0;
}

.mesa button {
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  border: 2px solid #8d7028;
}

.mesa .n-0 {
  grid-column: 1 / -1;
  background: var(--zero);
  color: #000;
}

.mesa .n-vermelho { background: var(--red); }
.mesa .n-preto { background: var(--black); }

.mesa.entrada button {
  background: #123326;
  color: #6a7a6a;
  border-color: #2a5540;
}
.mesa.entrada .n-0 {
  background: #123326;
  color: #6a7a6a;
}
.mesa.entrada .aceso {
  background: #37ff00;
  color: #000;
  border-color: #8d7028;
  box-shadow: 0 0 10px rgba(55, 255, 0, 0.35);
}
.mesa.entrada .repetido {
  box-shadow: 0 0 12px rgba(0, 13, 255, 0.45);
}
.mesa .ultimo {
  outline: 2px solid var(--gold-2);
}

.colunas-pct {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 6px 0 calc(10px + var(--safe-b));
}

.colunas-pct span {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-2);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 0;
}

.colunas-pct span.topo {
  background: var(--gold);
  color: #1a1408;
  border-color: var(--gold-2);
}

.nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 12px calc(10px + var(--safe-b));
  background: #071810;
  border-top: 1px solid var(--line);
}

.nav-btn {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 42px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-btn.ativo {
  background: var(--gold);
  color: #1a1408;
  border-color: var(--gold-2);
}

.radar-wrap {
  position: relative;
  width: min(92vw, 420px);
  margin: 8px auto 0;
  aspect-ratio: 1;
}

.racer {
  position: absolute;
  inset: 0;
}

.racer span {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  border: 1px solid #8d7028;
  z-index: 1;
}

.racer .r-vermelho { background: var(--red); }
.racer .r-preto { background: var(--black); }
.racer .r-zero { background: var(--zero); color: #000; }

.racer.entrada span {
  background: #123326;
  color: #6a7a6a;
  border-color: #2a5540;
}
.racer.entrada .aceso {
  background: #37ff00;
  color: #000;
  box-shadow: 0 0 0 2px #37ff00;
  z-index: 3;
}
.racer.entrada .repetido {
  transform: scale(1.12);
  z-index: 4;
}
.racer .ultimo {
  animation: pulso 1s ease;
  z-index: 4;
}

.radar-centro {
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: radial-gradient(circle at center, #123326, #071810 72%);
  border: 4px solid #1f5a3a;
  box-shadow: 0 0 0 2px var(--gold);
  display: grid;
  place-items: center;
  align-content: center;
}

.radar-centro span {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-2);
}

.radar-centro small {
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.radar-legenda {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0 18px;
}

.caixa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.stat, .taxa {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.stat span, .taxa span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat strong, .taxa strong {
  font-size: 1.4rem;
  color: var(--gold-2);
}

.taxa {
  margin: 8px 0 14px;
}

@keyframes pulso {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

