* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #12121f;
  --card: #1c1c30;
  --card2: #24243c;
  --texto: #eee;
  --texto2: #9a9ab8;
  --verde: #2ecc71;
  --roxo: #8b5cf6;
  --dourado: #f5c542;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 20%, #2a1a4a 0%, var(--bg) 60%);
  padding: 24px; z-index: 50;
}
.login-card {
  width: 100%; max-width: 340px;
  background: var(--card);
  border: 1px solid #33335a;
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-card .logo { font-size: 56px; }
.login-card h1 { margin: 8px 0 4px; font-size: 26px; }
.login-card p { color: var(--texto2); font-size: 14px; margin-bottom: 20px; }
.login-card input {
  width: 100%; padding: 14px; border-radius: 12px;
  border: 1px solid #3a3a66; background: var(--bg);
  color: var(--texto); font-size: 16px; text-align: center;
  margin-bottom: 12px;
}
.login-card button {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--roxo), #6d28d9);
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}
.erro { color: #ff6b6b; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- APP ---------- */
.app { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: 72px; }

header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.titulo { font-size: 20px; font-weight: 800; }
.sair {
  background: none; border: 1px solid #3a3a66; color: var(--texto2);
  border-radius: 20px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}

main { padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.aba { display: none; flex-direction: column; gap: 14px; }
.aba.ativa { display: flex; }

.card {
  background: var(--card);
  border: 1px solid #2c2c4a;
  border-radius: 18px;
  padding: 18px;
}

.msg {
  background: linear-gradient(135deg, #241a45, #1c1c30);
  border: 1px solid #3b2f6e;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.4;
}

/* stats */
.guardado { text-align: center; padding: 6px 0 12px; }
.guardado-topo { display: flex; align-items: center; justify-content: center; gap: 8px; }
.olho { background: none; border: none; font-size: 16px; cursor: pointer; padding: 4px; color: var(--texto2); }
.rotulo { display: block; color: var(--texto2); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.guardado .valor { font-size: 40px; font-weight: 900; background: linear-gradient(135deg, var(--dourado), #fff3b0); -webkit-background-clip: text; background-clip: text; color: transparent; }

.barra {
  height: 14px; background: #2a2a44; border-radius: 10px; overflow: hidden;
  margin-bottom: 14px;
}
.barra-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--verde), #1abc9c);
  border-radius: 10px;
  transition: width .8s cubic-bezier(.22,1,.36,1);
}
.stats-linha { display: flex; justify-content: space-between; text-align: center; }
.stats-linha span { display: block; }
.stats-linha .rotulo { margin-bottom: 2px; }
.stats-linha div > span:last-child { font-weight: 700; font-size: 15px; }

/* próximo */
.destaque { text-align: center; }
.proximo-label { color: var(--texto2); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
.proximo-num { font-size: 64px; font-weight: 900; color: var(--verde); line-height: 1.1; }
.sequencia { color: var(--texto2); font-size: 13px; margin-top: 4px; }

.conquista-proxima { display: flex; align-items: center; gap: 12px; }
.conquista-proxima .icone { font-size: 30px; }
.conquista-proxima .info { flex: 1; }
.conquista-proxima .nome { font-weight: 700; font-size: 14px; }
.conquista-proxima .mini-barra { height: 8px; background: #2a2a44; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.conquista-proxima .mini-fill { height: 100%; background: linear-gradient(90deg, var(--roxo), #a78bfa); border-radius: 6px; }

.mini { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--texto2); }
.ultimos { font-size: 12px; }

/* cartela */
.legenda { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texto2); }
.chip { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.marcado-chip { background: var(--verde); }

.cartela {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  background: var(--card);
  border: 1px solid #2c2c4a;
  border-radius: 18px;
  padding: 14px;
}
.cartela button {
  aspect-ratio: 1;
  border: 1px solid #33335a;
  border-radius: 8px;
  background: var(--card2);
  color: var(--texto2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s;
}
.cartela button:active { transform: scale(.92); }
.cartela button.marcado {
  background: linear-gradient(135deg, var(--verde), #16a34a);
  border-color: var(--verde);
  color: #fff;
}

/* marcar */
.rapido { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.rapido input {
  flex: 1; padding: 12px; border-radius: 12px;
  border: 1px solid #3a3a66; background: var(--bg); color: var(--texto);
  font-size: 16px; text-align: center;
}
.rapido span { color: var(--texto2); }
button.grande {
  width: 100%; padding: 15px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--verde), #16a34a);
  color: #fff; font-size: 17px; font-weight: 800; cursor: pointer;
}
.dica { color: var(--texto2); font-size: 12px; margin-top: 10px; text-align: center; }
.como { padding-left: 18px; color: var(--texto2); font-size: 13px; line-height: 1.8; }

/* conquistas */
.conquistas { display: flex; flex-direction: column; gap: 10px; }
.conquista {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid #2c2c4a;
  border-radius: 16px;
  padding: 14px 16px;
}
.conquista .icone { font-size: 32px; filter: grayscale(1) opacity(.4); }
.conquista.desbloqueada .icone { filter: none; }
.conquista .info { flex: 1; }
.conquista .nome { font-weight: 700; font-size: 14px; }
.conquista .sub { color: var(--texto2); font-size: 12px; margin-top: 2px; }
.conquista .status { font-size: 22px; }
.conquista.desbloqueada { border-color: #3b6e4a; background: linear-gradient(135deg, #14331f, var(--card)); }

/* tabs */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  background: rgba(20,20,34,.96);
  border-top: 1px solid #2c2c4a;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; background: none; border: none; color: var(--texto2);
  font-size: 11px; font-weight: 700; padding: 8px 2px; cursor: pointer;
  border-radius: 12px;
}
.tab.ativa { color: var(--verde); background: rgba(46,204,113,.12); }

/* toast + confete */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--card2); border: 1px solid #3a3a66; color: var(--texto);
  padding: 12px 18px; border-radius: 14px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  max-width: 90vw; text-align: center; z-index: 30;
  animation: sobe .3s ease;
}
@keyframes sobe { from { transform: translateX(-50%) translateY(20px); opacity: 0; } }

#confete { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.papel {
  position: absolute; top: -20px;
  width: 10px; height: 14px; border-radius: 2px;
  animation: cai linear forwards;
}
@keyframes cai {
  to { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}
