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

/* ===== LOGIN ===== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #EDE7F6 0%, #F3F0FF 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(124,77,255,.2);
}
.login-logo { font-size: 64px; margin-bottom: 16px; line-height: 1; }
.login-titulo { font-size: 22px; font-weight: 800; color: #1A1A2E; margin-bottom: 8px; }
.login-sub { font-size: 14px; color: #777; line-height: 1.6; margin-bottom: 28px; }
.g_id_signin { display: flex; justify-content: center; margin-bottom: 16px; }
.login-erro { font-size: 13px; color: #E53935; margin-bottom: 12px; }
.login-hint { font-size: 12px; color: #B0B0B0; line-height: 1.6; margin-top: 20px; }

/* ===== INSTALL / LOGOUT ===== */
.install-btn {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.4);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s;
}
.install-btn:hover { background: rgba(255,255,255,.3); }
.logout-btn {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.logout-btn:hover { background: rgba(255,255,255,.35); }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F3F0FF;
  color: #1A1A2E;
  min-height: 100vh;
  padding-bottom: 72px;
  overscroll-behavior: none;
}

/* ===== HEADER ===== */
header {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 16px rgba(109,40,217,.35);
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-emoji { font-size: 26px; }
h1 { color: #fff; font-size: 16px; font-weight: 800; line-height: 1.2; }
.student-name {
  color: rgba(255,255,255,.75);
  font-size: 11px;
  margin-top: 2px;
}

/* ===== MAIN ===== */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 14px 0;
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #7C3AED;
  margin: 18px 0 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.section-title:first-child { margin-top: 4px; }

/* ===== MODO SELECT ===== */
.modo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.modo-card {
  background: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 6px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,77,255,.1);
  font-family: inherit;
  transition: transform .12s, box-shadow .12s;
}
.modo-card:active { transform: scale(.95); }
.modo-card .modo-emoji { font-size: 24px; display: block; margin-bottom: 4px; }
.modo-card .modo-label { font-size: 13px; font-weight: 800; color: #1A1A2E; }
.modo-card .modo-best {
  font-size: 10px;
  color: #F59E0B;
  font-weight: 700;
  margin-top: 3px;
  min-height: 13px;
}
.modo-card.contas-card { grid-column: span 1; }
#grid-contas .modo-card { padding: 18px 8px; }
#grid-contas { grid-template-columns: repeat(3, 1fr); }

/* ===== GAME SCREEN ===== */
.game-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  margin-bottom: 14px;
}
.game-quit {
  background: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.game-progress {
  flex: 1;
  height: 10px;
  background: #E8DEFA;
  border-radius: 99px;
  overflow: hidden;
}
.game-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8B5CF6, #7C3AED);
  border-radius: 99px;
  transition: width .25s;
}
.game-timer {
  font-size: 13px;
  font-weight: 700;
  color: #7C3AED;
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}
.game-score {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #6D6D80;
  margin-bottom: 14px;
}
.question-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(124,77,255,.12);
  margin-bottom: 18px;
}
.question-text {
  font-size: 40px;
  font-weight: 800;
  color: #1A1A2E;
  margin-bottom: 14px;
}
.answer-display {
  font-size: 28px;
  font-weight: 800;
  color: #7C3AED;
  min-height: 38px;
  border-bottom: 3px solid #E8DEFA;
  display: inline-block;
  min-width: 80px;
  padding: 0 10px 4px;
}
.feedback {
  min-height: 22px;
  font-size: 14px;
  font-weight: 700;
  margin-top: 10px;
}
.feedback.ok { color: #10B981; }
.feedback.erro { color: #E53935; }

/* ===== KEYPAD ===== */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.key-btn {
  background: #fff;
  border: none;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 700;
  color: #1A1A2E;
  padding: 16px 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(124,77,255,.1);
  font-family: inherit;
  transition: transform .1s, background .1s;
}
.key-btn:active { transform: scale(.93); background: #F3F0FF; }
.key-btn.key-clear { color: #E53935; font-size: 16px; }
.key-btn.key-ok { background: #7C3AED; color: #fff; font-size: 16px; }
.key-btn.key-ok:active { background: #6D28D9; }

/* ===== RESULT SCREEN ===== */
.result-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(124,77,255,.12);
  margin-top: 30px;
}
.result-emoji { font-size: 56px; margin-bottom: 10px; }
.result-recorde {
  background: #FEF3C7;
  color: #B45309;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 12px;
}
.result-score { font-size: 34px; font-weight: 800; color: #7C3AED; }
.result-tempo { font-size: 13px; color: #999; margin-top: 4px; margin-bottom: 22px; }
.result-btns { display: flex; flex-direction: column; gap: 10px; }
.btn-result {
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-result-again { background: #7C3AED; color: #fff; }
.btn-result-again:active { background: #6D28D9; }
.btn-result-back { background: #F3F0FF; color: #7C3AED; }

/* ===== RECORDES ===== */
.recordes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
.recorde-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px 6px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(124,77,255,.1);
}
.recorde-card .recorde-label { font-size: 12px; font-weight: 700; color: #1A1A2E; margin-bottom: 6px; }
.recorde-card .recorde-score { font-size: 18px; font-weight: 800; color: #7C3AED; }
.recorde-card .recorde-score.vazio { color: #C9C9D6; font-size: 14px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid #EDE7F6;
  display: flex;
  z-index: 50;
  box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .1s;
}
.nav-item:active { background: #F3F0FF; }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 500; color: #9E9E9E; margin-top: 2px; }
.nav-item.active .nav-label { color: #7C3AED; font-weight: 700; }

@media (max-width: 360px) {
  .question-text { font-size: 32px; }
  .key-btn { padding: 14px 0; font-size: 19px; }
}
