:root {
  --quadra: #1E5A3C;
  --bola: #D7F04A;
  --tinta: #13201A;
  --fundo: #F4F5EF;
  --card: #FFFFFF;
  --borda: #DDE2D8;
  --borda-forte: #C9D0C4;
  --suave: #55625B;
  --texto2: #3D4A43;
  --verde-claro: #E3EDE6;
  --claro-no-verde: #D9E6DE;
  --perda: #9A3F17;
  --perda-claro: #F0C9B6;
  --display: 'Barlow Condensed', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fundo);
  color: var(--tinta);
  font: 400 15px/1.4 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--quadra); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #3B82F6; outline-offset: 2px; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fundo);
}
.carregando { padding: 40vh 0; text-align: center; color: var(--suave); }

/* Faixa do modo demonstração */
.demo {
  background: var(--tinta); color: #fff; font-size: 12px; padding: 6px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.demo button { background: none; border: 0; color: var(--bola); font-weight: 600; font-size: 12px; min-height: 32px; }

/* Topo verde */
.topo { background: var(--quadra); color: #fff; padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.topo-linha { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topo-sub { font-size: 13px; font-weight: 500; color: var(--claro-no-verde); }
.titulo { margin: 0; font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1; letter-spacing: .5px; text-transform: uppercase; }
.titulo-p { font-size: 30px; }

.icone-btn {
  width: 44px; height: 44px; border: 0; border-radius: 22px; background: rgba(255,255,255,.12); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; position: relative; text-decoration: none;
}
.icone-btn .contador {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--bola); color: var(--tinta); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* Cabeçalho das telas internas */
.cabecalho { padding: 16px 12px 4px; display: flex; align-items: center; gap: 4px; }
.cabecalho h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: .5px; text-transform: uppercase; line-height: 1.05; }
.voltar { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--tinta); flex: none; }

.conteudo { flex: 1; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; }

/* Chips de filtro */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; font-size: 13px; font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--bola); border-color: var(--bola); color: var(--tinta); font-weight: 600; }
.chips-claro .chip { border-color: var(--borda-forte); background: var(--card); color: var(--tinta); }
.chips-claro .chip[aria-pressed="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }

/* Cartões */
.card { background: var(--card); border: 1px solid var(--borda); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card-flutuante { margin: 0 16px; transform: translateY(14px); border: 0; box-shadow: 0 6px 20px rgba(19,32,26,.10); border-radius: 16px; }
.rotulo { font-size: 12px; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .6px; margin: 0; }
.rotulo-linha { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px; }

.linha {
  background: var(--card); border: 1px solid var(--borda); border-radius: 12px; min-height: 58px; padding: 8px 14px;
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
}
a.linha:hover { border-color: var(--borda-forte); }
.linha.sou-eu { border-color: var(--quadra); box-shadow: inset 3px 0 0 var(--quadra); }
.pos { width: 22px; font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--suave); }
.avatar {
  width: 34px; height: 34px; border-radius: 17px; background: var(--verde-claro); color: var(--quadra); flex: none;
  font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.avatar-g { width: 56px; height: 56px; border-radius: 28px; background: var(--bola); color: var(--tinta); font-size: 18px; }
.nome { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nome b { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nome small, .sub { font-size: 12px; color: var(--suave); }
.nivel { display: flex; flex-direction: column; align-items: flex-end; }
.nivel b { font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1; }
.nivel small { font-size: 12px; color: var(--suave); }
.grande { font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; }

/* Barras */
.barra { position: relative; height: 8px; border-radius: 4px; background: #E3E7DF; overflow: hidden; }
.barra > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--quadra); border-radius: 4px; }
.barra > i { position: absolute; left: 20%; top: 0; bottom: 0; width: 2px; background: var(--perda); }
.barra-vd { background: var(--perda-claro); height: 6px; }

/* Estatísticas */
.grade-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grade-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grade-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--borda); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat b { font-family: var(--display); font-weight: 700; font-size: 24px; }
.stat small { font-size: 11px; color: var(--suave); text-align: center; }

/* Botões */
.btn {
  min-height: 52px; border-radius: 14px; border: 0; padding: 0 18px; font-weight: 600; font-size: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-bola { background: var(--bola); color: var(--tinta); }
.btn-escuro { background: var(--tinta); color: #fff; }
.btn-claro { background: var(--card); color: var(--tinta); border: 1px solid var(--borda-forte); }
.btn-pequeno { min-height: 44px; font-size: 14px; border-radius: 10px; padding: 0 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-texto { background: none; border: 0; color: var(--quadra); font-weight: 600; font-size: 13px; min-height: 32px; padding: 0; text-decoration: none; display: inline-flex; align-items: center; }

/* Formulários */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo label, .campo .label { font-size: 13px; font-weight: 600; }
.campo input, .campo select {
  height: 48px; border: 1px solid var(--borda-forte); border-radius: 12px; padding: 0 12px; background: var(--card); font-size: 16px; width: 100%;
}
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #E3E7DF; border-radius: 12px; padding: 4px; }
.seg button {
  min-height: 52px; border: 0; border-radius: 9px; background: transparent; padding: 6px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.seg button b { font-size: 14px; font-weight: 600; }
.seg button small { font-size: 11px; color: var(--suave); }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(19,32,26,.12); }

.placar { padding: 0; gap: 0; overflow: hidden; }
.placar-linha { display: grid; grid-template-columns: minmax(0, 1fr) 56px 56px 56px; align-items: center; gap: 6px; padding: 10px 14px; }
.placar-linha + .placar-linha { border-top: 1px solid #EEF1EA; }
.placar-cab { font-size: 12px; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--borda); }
.placar-cab span:not(:first-child) { text-align: center; }
.placar input {
  width: 100%; height: 48px; text-align: center; border: 1px solid var(--borda-forte); border-radius: 10px;
  font-family: var(--display); font-weight: 700; font-size: 26px; background: var(--fundo);
}
.placar input:disabled { visibility: hidden; }

.previa { background: var(--tinta); color: #fff; border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.previa .grande { color: var(--bola); font-size: 26px; }
.previa .barra { background: rgba(255,255,255,.18); height: 6px; }
.previa .barra > span { background: var(--bola); }
.ganho { color: var(--bola); font-weight: 700; }
.perda { color: var(--perda-claro); font-weight: 700; }
.erro { color: var(--perda); font-size: 13px; font-weight: 500; }

.aviso { background: var(--verde-claro); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--texto2); line-height: 1.45; }
.aviso b { color: var(--quadra); }

/* Opções do questionário */
.opcao {
  min-height: 60px; text-align: left; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--borda-forte);
  background: var(--card); font-weight: 500; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.opcao:hover { border-color: var(--quadra); }

/* Tela verde cheia (login, resultado) */
.tela-verde { flex: 1; background: var(--quadra); color: #fff; padding: 64px 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.tela-verde p { margin: 0; color: var(--claro-no-verde); font-size: 16px; line-height: 1.5; }
.folha { background: var(--fundo); border-radius: 24px 24px 0 0; padding: 28px 24px 36px; display: flex; flex-direction: column; gap: 14px; }

/* Navegação inferior */
.nav {
  position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: space-around; padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav a {
  width: 72px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--suave); text-decoration: none; font-size: 11px; font-weight: 500;
}
.nav a[aria-current="page"] { color: var(--quadra); font-weight: 600; }
.nav a.mais { width: 56px; height: 56px; border-radius: 28px; background: var(--bola); color: var(--tinta); }

/* Tabelas simples */
.tabela-linha { display: grid; align-items: center; padding: 10px 14px; border-top: 1px solid #EEF1EA; font-size: 14px; }
.tabela-linha:first-child { border-top: 0; }

#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: 90vw;
  background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 10;
}
.vazio { text-align: center; color: var(--suave); padding: 24px 12px; font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
