:root {
  /* Paleta "roxo" (padrão / nível 1-2, Aprendiz). [data-tier] abaixo troca
     essas mesmas variáveis para as outras faixas de nível — os nomes ficam
     genéricos ("purple") de propósito, o valor real muda por faixa. */
  --brand-accent: #f08a1c;
  --purple: #7c5cfc;
  --purple-dark: #6845e8;
  --purple-light: #efeaff;
  --purple-2: #a084ff;
  --purple-rgb: 124, 92, 252;
  --bg: #f6f5fb;
  --surface: #ffffff;
  --ink: #241f3d;
  --ink-soft: #6b6483;
  --border: #ece9f7;
  --green: #2fa96a;
  --green-bg: #e5f7ee;
  --amber: #d99a1f;
  --amber-bg: #fdf3de;
  --red: #d34b4b;
  --red-bg: #fbe9e9;
  --radius: 16px;
  --shadow: 0 14px 32px -12px rgba(60, 40, 130, 0.22);
  --shadow-lg: 0 20px 45px -14px rgba(76, 49, 168, 0.45);
  --font: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== PALETA POR FAIXA DE NÍVEL ===== */
/* Nível 3-4, Estudante — azul */
[data-tier="estudante"] {
  --purple: #2f8fe0;
  --purple-dark: #1f6fb8;
  --purple-light: #e5f2fd;
  --purple-2: #6ec3ff;
  --purple-rgb: 47, 143, 224;
}
/* Nível 5-6, Focado — verde */
[data-tier="focado"] {
  --purple: #1fa971;
  --purple-dark: #0f8759;
  --purple-light: #e2f7ee;
  --purple-2: #5fdba0;
  --purple-rgb: 31, 169, 113;
}
/* Nível 7-9, Gênio — laranja */
[data-tier="genio"] {
  --purple: #ea8a1f;
  --purple-dark: #c26e0f;
  --purple-light: #fdf0dd;
  --purple-2: #ffb457;
  --purple-rgb: 234, 138, 31;
}
/* Nível 10+, Lenda — rosa/magenta */
[data-tier="lenda"] {
  --purple: #e0447a;
  --purple-dark: #b82c5f;
  --purple-light: #fde8f0;
  --purple-2: #ff7fac;
  --purple-rgb: 224, 68, 122;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.app-shell { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
}
.icon { display: block; flex-shrink: 0; }

.brand { padding: 0 6px 10px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px -2px rgba(var(--purple-rgb), 0.55);
}
.brand-logo { font-weight: 800; font-size: 1.3rem; }
.brand-logo .accent { color: var(--brand-accent); }
.brand-tagline { font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; margin-top: 4px; }

.nav-section-label { font-size: 0.68rem; letter-spacing: 0.08em; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; margin: 22px 10px 8px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-list a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--ink-soft); font-weight: 600; font-size: 0.92rem;
}
.nav-list a:hover { background: var(--purple-light); color: var(--ink); }
.nav-list a.active { background: var(--purple); color: #fff; box-shadow: 0 6px 14px -4px rgba(var(--purple-rgb), 0.55); }
.nav-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.sidebar-promo {
  margin-top: auto;
  background: var(--purple-light);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.85rem;
}
.sidebar-promo-icon {
  width: 30px; height: 30px; border-radius: 9px; margin-bottom: 8px;
  background: var(--surface); color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px -1px rgba(60, 40, 130, 0.15);
}
.sidebar-promo strong { display: block; margin-bottom: 4px; }

.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.avatar-chip {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--purple-light); color: var(--purple-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; flex-shrink: 0;
}
.sidebar-profile .who { flex: 1; min-width: 0; }
.sidebar-profile .name { font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .level { font-size: 0.72rem; color: var(--ink-soft); }
.logout-link { color: var(--ink-soft); background: none; border: none; display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 8px; }
.logout-link:hover { background: var(--bg); color: var(--red); }

/* ===== MAIN ===== */
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 32px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.breadcrumb { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--ink-soft); }
.breadcrumb strong { color: var(--ink); }
.topbar-badges { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.badge { border-radius: 100px; padding: 7px 14px; font-weight: 800; font-size: 0.82rem; display: inline-flex; align-items: center; gap: 5px; }
.badge-xp { background: var(--purple-light); color: var(--purple-dark); }
.badge-level { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.header-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }

.hamburger-btn {
  display: none; background: none; border: none; font-size: 1.5rem;
  color: var(--ink); padding: 4px 6px; flex-shrink: 0; line-height: 1;
}
.sidebar-backdrop { display: none; }
.bottom-nav { display: none; }

.page { padding: 28px 32px 60px; max-width: 1160px; margin: 0 auto; }
.page-eyebrow { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--purple); font-weight: 800; text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-size: 1.7rem; font-weight: 800; margin: 0 0 6px; }
.page-subtitle { color: var(--ink-soft); margin: 0 0 24px; }

/* ===== CARDS ===== */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card img { max-width: 100%; height: auto; border-radius: 8px; display: block; }

.hero-card {
  background: linear-gradient(135deg, var(--purple), var(--purple-2) 70%);
  color: #fff; border-radius: 20px; padding: 30px; position: relative; overflow: hidden;
  margin-bottom: 24px; box-shadow: var(--shadow-lg);
}
.hero-card::before, .hero-card::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.10); pointer-events: none;
}
.hero-card::before { width: 260px; height: 260px; right: -80px; top: -110px; }
.hero-card::after { width: 160px; height: 160px; right: 40px; bottom: -90px; background: rgba(255, 255, 255, 0.08); }
.hero-card .eyebrow { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 800; opacity: 0.85; position: relative; z-index: 1; }
.hero-card h2 { font-size: 1.5rem; margin: 10px 0 8px; font-weight: 800; max-width: 60%; position: relative; z-index: 1; }
.hero-card p { opacity: 0.92; max-width: 55%; margin: 0 0 18px; position: relative; z-index: 1; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--purple-dark);
  font-weight: 800; padding: 11px 20px; border-radius: 100px; border: none; font-size: 0.92rem;
  position: relative; z-index: 1; box-shadow: 0 10px 22px -8px rgba(20, 10, 50, 0.35);
}
.hero-icon-badge {
  position: absolute; top: 26px; right: 28px; z-index: 1;
  width: 56px; height: 56px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.18); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.hero-icon-badge .icon { width: 26px; height: 26px; }
.hero-spark {
  position: absolute; z-index: 1; opacity: 0.85;
}

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (min-width: 901px) { .stats-grid.stats-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.achv-list.achv-list-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 480px) { .achv-list.achv-list-2 { grid-template-columns: 1fr; } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.stat-icon { color: var(--purple); }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-hint { font-size: 0.78rem; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.two-col > * { min-width: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.section-title { font-weight: 800; font-size: 1rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

.goal-bar-track { background: var(--bg); border-radius: 100px; height: 10px; overflow: hidden; margin: 10px 0; }
.goal-bar-fill { background: var(--purple); height: 100%; border-radius: 100px; }
.goal-bar-fill.empty { background: var(--border); }

.progress-list { display: flex; flex-direction: column; gap: 14px; }
.progress-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.85rem; }
.progress-row-label { font-weight: 700; }
.progress-row-value { color: var(--ink-soft); font-size: 0.8rem; white-space: nowrap; }
.progress-row .goal-bar-track { margin: 6px 0 0; }
.subject-fill-matematica { background: #3866d6; }
.subject-fill-portugues { background: #d43c7c; }
.subject-fill-geografia { background: var(--green); }
.subject-fill-historia { background: var(--amber); }

.progress-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.progress-summary-item { background: var(--bg); border-radius: 12px; padding: 12px 8px; text-align: center; }
.progress-summary-value { font-weight: 800; font-size: 1.25rem; }
.progress-summary-label { font-size: 0.72rem; color: var(--ink-soft); margin-top: 2px; }
@media (max-width: 480px) {
  .progress-summary-value { font-size: 1.05rem; }
  .progress-summary-label { font-size: 0.65rem; }
}
.goal-dots { display: flex; gap: 8px; margin-top: 14px; }
.goal-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: var(--ink-soft); }
.goal-dot.met { background: var(--purple); color: #fff; border-color: var(--purple); }
.goal-dot.today { box-shadow: 0 0 0 2px var(--purple-light); }

.achv-list { display: flex; flex-direction: column; gap: 10px; }
.achv-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; }
.achv-item.unlocked { background: var(--green-bg); }
.achv-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; background: #fff; flex-shrink: 0; }
.achv-item.unlocked .achv-icon { background: var(--green); color: #fff; }
.achv-item.locked { opacity: 0.55; }
.achv-title { font-weight: 700; font-size: 0.88rem; }
.achv-desc { font-size: 0.76rem; color: var(--ink-soft); }
.achv-check { margin-left: auto; color: var(--green); font-weight: 800; }

.reminder-box { background: var(--purple-light); border-radius: var(--radius); padding: 18px; margin-top: 20px; }
.reminder-box .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--purple-dark); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.reminder-link { display: inline-flex; align-items: center; gap: 4px; color: var(--purple-dark); font-weight: 800; margin-top: 4px; }

/* ===== GRIDS OF CARDS (simulados, temas) ===== */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 800px) { .card-grid { grid-template-columns: 1fr; } }
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.item-card-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.item-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--purple-light); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.item-icon-solid { background: var(--purple); color: #fff; }
.subject-icon-ciencias { background: var(--purple-light); color: var(--purple-dark); }
.subject-icon-matematica { background: #e3edff; color: #3866d6; }
.subject-icon-portugues { background: #fde3ec; color: #d43c7c; }
.subject-icon-geografia { background: var(--green-bg); color: var(--green); }
.subject-icon-historia { background: var(--amber-bg); color: var(--amber); }
.item-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.item-card .item-meta { font-size: 0.8rem; color: var(--ink-soft); }
.tag { display: inline-block; background: var(--purple-light); color: var(--purple-dark); font-size: 0.68rem; font-weight: 800; padding: 3px 9px; border-radius: 100px; letter-spacing: 0.03em; }
.item-facts { display: flex; gap: 16px; font-size: 0.82rem; color: var(--ink-soft); margin: 12px 0 16px; }
.item-facts span { display: inline-flex; align-items: center; gap: 5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--purple); color: #fff; font-weight: 800; padding: 10px 18px; border-radius: 10px; border: none; font-size: 0.88rem; width: 100%; }
.btn:hover { background: var(--purple-dark); }
.btn-outline { background: #fff; color: var(--purple-dark); border: 1.5px solid var(--purple); }
.btn-secondary { background: var(--bg); color: var(--ink); }
.btn-sm { width: auto; padding: 8px 14px; }

.topic-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.topic-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: left; }
.topic-card .item-icon { margin-bottom: 12px; }
.topic-card .count { color: var(--ink-soft); font-size: 0.82rem; }

/* ===== VÍDEOS ===== */
.video-player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.video-player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-now-playing { margin-top: 12px; font-weight: 700; font-size: 0.92rem; }
.video-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 20px; }
.video-card { position: relative; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; overflow: hidden; text-align: left; cursor: pointer; }
.video-card.active { border-color: var(--purple); }
.video-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.video-card-play {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.video-card-title { font-size: 0.82rem; font-weight: 700; padding: 8px 10px 2px; }
.video-card-channel { font-size: 0.74rem; color: var(--ink-soft); padding: 0 10px 10px; }

/* ===== FILTER CHIPS ===== */
.filter-group { margin-bottom: 14px; }
.filter-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--ink-soft); margin-bottom: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 7px 15px; font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.chip.active { background: var(--purple); color: #fff; border-color: var(--purple); }

.form-input, .form-select {
  display: block; width: 100%; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; font-family: inherit; color: var(--ink);
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--purple); }
.form-select { cursor: pointer; }

/* ===== QUESTION ===== */
.support-box { background: #fdf9e9; border: 1px solid #f0e3ac; border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; font-size: 0.92rem; }
.support-box .label { font-weight: 800; font-size: 0.78rem; color: #a3780f; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.qfigure img, .support-box img { max-width: 100%; border-radius: 8px; }
.question-statement { font-weight: 700; font-size: 1.02rem; margin: 18px 0; }
.options-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 13px 16px; font-size: 0.92rem; width: 100%;
}
.option-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; flex-shrink: 0; }
.option-btn.correct { border-color: var(--green); background: var(--green-bg); }
.option-btn.correct .option-letter { background: var(--green); color: #fff; }
.option-btn.wrong { border-color: var(--red); background: var(--red-bg); }
.option-btn.wrong .option-letter { background: var(--red); color: #fff; }
.option-btn.selected-only { border-color: var(--purple); }
.option-btn:has(input:checked) { border-color: var(--purple); background: var(--purple-light); }
.option-btn input[type="radio"] { accent-color: var(--purple); }
.explanation-box { background: var(--purple-light); border-radius: 12px; padding: 14px 16px; font-size: 0.88rem; margin-bottom: 20px; }
.question-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.question-progress { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }

/* ===== QUADRADINHOS DE QUESTÃO (navegação no simulado + revisão pós-simulado) ===== */
.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 8px; margin-bottom: 14px; }
.review-square {
  aspect-ratio: 1; border-radius: 9px; border: 1.5px solid var(--border); background: var(--bg);
  color: var(--ink-soft); font-weight: 800; font-size: 0.82rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.review-square.answered { background: var(--purple-light); border-color: var(--purple); color: var(--purple-dark); }
.review-square.correct { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.review-square.wrong { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.review-square.active { outline: 2px solid var(--purple); outline-offset: 2px; }
.review-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 4px; }
.review-legend span { display: inline-flex; align-items: center; gap: 6px; }
.review-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--bg); border: 1.5px solid var(--border); }
.review-dot.correct { background: var(--green-bg); border-color: var(--green); }
.review-dot.wrong { background: var(--red-bg); border-color: var(--red); }
.review-panel { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ===== FOCUS MODE (simulado em andamento) — sem sidebar, header enxuto ===== */
.app-shell-focus { background: var(--bg); }
.focus-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 32px; }
.focus-header-top { display: flex; align-items: center; gap: 14px; max-width: 760px; margin: 0 auto; }
.focus-close {
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.focus-close:hover { background: var(--border); color: var(--ink); }
.focus-title { flex: 1; min-width: 0; font-weight: 800; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-badge {
  display: inline-flex; align-items: center; gap: 5px; background: var(--purple-light); color: var(--purple-dark);
  font-weight: 800; font-size: 0.8rem; padding: 6px 12px; border-radius: 100px; flex-shrink: 0;
}
.focus-page { max-width: 760px; padding: 28px 32px 60px; }
@media (max-width: 640px) {
  .focus-header { padding: 14px 16px; }
  .focus-page { padding: 20px 16px 48px; }
}

/* ===== RANKING ===== */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 800px) { .podium { grid-template-columns: 1fr; } }
.podium-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; }
.podium-medal { font-size: 1.6rem; margin-bottom: 8px; }
.podium-avatar { width: 54px; height: 54px; border-radius: 50%; background: var(--purple-light); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; margin: 0 auto 10px; }
.podium-name { font-weight: 800; }
.podium-level { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 6px; }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: var(--surface); }
.rank-row.me { border-color: var(--purple); background: var(--purple-light); }
.rank-pos { font-weight: 800; color: var(--ink-soft); width: 24px; }
.rank-row .who { flex: 1; }
.rank-row .name { font-weight: 700; font-size: 0.92rem; }
.rank-row .meta { font-size: 0.76rem; color: var(--ink-soft); }
.you-tag { color: var(--purple); font-weight: 800; font-size: 0.75rem; margin-left: 6px; }

/* ===== ADMIN ===== */
.admin-table-wrap { overflow-x: auto; overflow-y: auto; max-height: 420px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 800; padding: 10px 14px; border-bottom: 2px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--bg); }
.admin-table .cell-name { font-weight: 700; }
.admin-table .cell-email { color: var(--ink-soft); font-size: 0.8rem; }
.admin-badge-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; }
.hardest-q-list { max-height: 420px; overflow-y: auto; }
.hardest-q { padding: 14px 0; border-bottom: 1px solid var(--border); }
.hardest-q:last-child { border-bottom: none; }
.hardest-q-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.hardest-q-pct { font-weight: 800; color: var(--red); }
.easiest-q-pct { font-weight: 800; color: var(--green); }
.analises-heading { font-size: 1.05rem; font-weight: 800; margin: 28px 0 14px; }
.hardest-q-text { font-size: 0.88rem; color: var(--ink); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 100px; background: var(--red); color: #fff; font-size: 0.68rem;
  font-weight: 800; margin-left: auto;
}
.report-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.report-row:last-child { border-bottom: none; }
.report-row.resolvido { opacity: 0.6; }
.report-row-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.report-status { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 100px; }
.report-status.aberto { background: var(--red-bg); color: var(--red); }
.report-status.resolvido { background: var(--green-bg); color: var(--green); }
.report-message { font-size: 0.88rem; color: var(--ink); white-space: pre-wrap; margin-bottom: 8px; }

/* ===== REPORTAR PROBLEMA (botão flutuante) ===== */
.bug-report-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 95;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -6px rgba(var(--purple-rgb), 0.55); cursor: pointer;
}
.bug-report-fab:hover { background: var(--purple-dark); }
.bug-report-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.bug-report-modal[hidden] { display: none; }
.bug-report-modal-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 45, 0.5); }
.bug-report-modal-card {
  position: relative; background: var(--surface); border-radius: var(--radius); padding: 22px;
  max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}
.bug-report-modal-header { display: flex; align-items: center; justify-content: space-between; font-weight: 800; margin-bottom: 10px; }
.bug-report-modal-header span { display: flex; align-items: center; gap: 8px; }

/* ===== TOAST ===== */
.app-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 0.85rem; font-weight: 700; z-index: 300; opacity: 0; transition: opacity 0.25s, transform 0.25s;
  box-shadow: var(--shadow-lg); max-width: calc(100vw - 40px); text-align: center;
}
.app-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ===== PROGRESS ===== */
.week-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; margin: 16px 0; }
.week-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.week-bar { width: 100%; max-width: 34px; background: var(--purple-light); border-radius: 8px 8px 0 0; position: relative; }
.week-bar.has-xp { background: var(--purple); }
.week-bar-label { font-size: 0.72rem; color: var(--ink-soft); margin-top: 8px; font-weight: 700; text-transform: capitalize; }
.week-bar-value { font-size: 0.68rem; color: var(--ink-soft); margin-bottom: 4px; }

/* ===== PROFILE ===== */
.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.profile-header > div:not(.profile-avatar) { min-width: 0; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--purple-light); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.6rem; }
.profile-header h2 { margin: 0; font-size: 1.2rem; }
.profile-header .sub { color: var(--ink-soft); font-size: 0.85rem; }
.level-progress-label { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-soft); font-weight: 700; margin-bottom: 6px; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.account-row:last-child { border-bottom: none; }
.account-icon { color: var(--purple); width: 20px; text-align: center; }

/* ===== LOGIN ===== */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--purple), var(--purple-2)); }
.login-card { background: #fff; border-radius: 20px; padding: 40px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.35); }
.login-card .brand-logo { font-size: 1.6rem; margin-bottom: 4px; }
.login-card p { color: var(--ink-soft); margin-bottom: 26px; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; border: 1.5px solid var(--border); border-radius: 12px; padding: 13px; font-weight: 700; font-size: 0.92rem; width: 100%; }
.google-btn:hover { background: var(--bg); }
.footer-credit { text-align: center; color: var(--ink-soft); font-size: 0.76rem; margin-top: 40px; }
.alert { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 12px 16px; font-size: 0.85rem; margin-bottom: 16px; }
.legal-disclaimer { text-align: left; color: var(--ink-soft); font-size: 0.7rem; line-height: 1.5; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.legal-disclaimer a { color: var(--purple-dark); font-weight: 700; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.ajax-loading { opacity: 0.5; pointer-events: none; transition: opacity 0.1s ease; }

/* ===== RESPONSIVO (celular/tablet) ===== */
@media (max-width: 900px) {
  .hamburger-btn { display: block; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 110;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(20, 10, 50, 0.25);
    width: 82vw; max-width: 300px;
    /* o menu é mais alto que telas pequenas: rola por dentro (sem arrastar a página junto) */
    height: 100vh; height: 100dvh;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(20, 10, 50, 0.45); z-index: 100;
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .topbar { padding: 14px 16px; flex-wrap: wrap; row-gap: 10px; }
  .topbar-badges { gap: 6px; }
  .badge { padding: 6px 10px; font-size: 0.74rem; }
  .header-avatar { width: 30px; height: 30px; font-size: 0.8rem; }

  .page { padding: 18px 16px calc(78px + env(safe-area-inset-bottom)); }
  .page-title { font-size: 1.35rem; }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px -6px rgba(60, 40, 130, 0.15);
    padding: 6px 2px calc(6px + env(safe-area-inset-bottom));
  }
  .bug-report-fab { right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 46px; height: 46px; }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px; border-radius: 10px; color: var(--ink-soft);
  }
  .bottom-nav a .icon { width: 21px; height: 21px; }
  .bottom-nav a span { font-size: 0.64rem; font-weight: 700; }
  .bottom-nav a.active { color: var(--purple); }

  .hero-card { padding: 20px; }
  .hero-card h2 { max-width: 100%; font-size: 1.2rem; }
  .hero-icon-badge { display: none; }
  .hero-card p { max-width: 100%; }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .profile-avatar { width: 52px; height: 52px; font-size: 1.3rem; flex-shrink: 0; }
  .profile-header h2 { font-size: 1.05rem; word-break: break-word; }
  .two-col { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .podium { grid-template-columns: 1fr; }

  .option-btn { padding: 11px 12px; font-size: 0.88rem; }

  .week-chart { gap: 6px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  .breadcrumb { font-size: 0.78rem; }
}

.hour-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.hour-bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.hour-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--border); }
.hour-bar.has { background: var(--purple); }
.hour-label { font-size: 0.62rem; color: var(--ink-soft); height: 14px; margin-top: 4px; }

/* ===== LGPD: páginas legais, aceite e privacidade no perfil ===== */
.footer-legal { text-align: center; font-size: 0.72rem; color: var(--ink-soft); margin: 4px 0 18px; }
.footer-legal a { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--purple-dark); }

.legal-shell { min-height: 100vh; max-width: 820px; margin: 0 auto; padding: 22px 18px 48px; }
.legal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.legal-top .brand-logo { font-size: 1.35rem; font-weight: 800; color: var(--ink); text-decoration: none; }
.legal-top .brand-logo .accent { color: var(--brand-accent); }
.legal-back { font-size: 0.85rem; font-weight: 700; color: var(--purple-dark); text-decoration: none; }

.legal-summary { background: var(--purple-light); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 20px; font-size: 0.92rem; line-height: 1.55; }
.legal-summary .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; color: var(--purple-dark); margin-bottom: 4px; }

.legal-doc { font-size: 0.92rem; line-height: 1.65; }
.legal-doc section + section { margin-top: 26px; }
.legal-doc h2 { font-size: 1.02rem; font-weight: 800; margin: 0 0 8px; }
.legal-doc p { margin: 0 0 10px; }
.legal-doc ul { margin: 0 0 10px; padding-left: 20px; }
.legal-doc li { margin-bottom: 6px; }
.legal-doc a, .legal-link { color: var(--purple-dark); font-weight: 700; }
.legal-doc code { background: var(--bg); border-radius: 6px; padding: 1px 6px; font-size: 0.85em; }
.legal-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.legal-table th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 800; padding: 8px 12px; border-bottom: 2px solid var(--border); }
.legal-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.legal-table tr:last-child td { border-bottom: none; }
.legal-table td:first-child { font-weight: 700; white-space: nowrap; }

.login-consent-hint { font-size: 0.72rem; color: var(--ink-soft); margin: 14px 0 0; }
.login-consent-hint a { color: var(--purple-dark); font-weight: 700; }
.notice { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: 12px 16px; font-size: 0.85rem; margin-bottom: 16px; }

.consent-card { max-width: 440px; text-align: left; }
.consent-card .brand-logo { text-align: center; }
.consent-title { font-size: 1.3rem; font-weight: 800; margin: 14px 0 6px; text-align: center; }
.consent-lead { font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 12px; text-align: center; }
.consent-points { list-style: none; margin: 0 0 18px; padding: 14px 16px; background: var(--bg); border-radius: 12px; font-size: 0.84rem; line-height: 1.5; }
.consent-points li + li { margin-top: 8px; }
.consent-form { display: flex; flex-direction: column; gap: 12px; }
.consent-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.84rem; line-height: 1.45; cursor: pointer; }
.consent-check input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--purple); }
.consent-check a { color: var(--purple-dark); font-weight: 700; }
.consent-decline { text-align: center; margin-top: 14px; }
.consent-decline-btn { background: none; border: none; color: var(--ink-soft); font: inherit; font-size: 0.8rem; text-decoration: underline; cursor: pointer; }

.privacy-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.delete-account-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.delete-account-form[hidden] { display: none; }
.delete-warning { margin: 0; font-size: 0.82rem; color: var(--red); }
.btn-danger { background: var(--red); color: #fff; }
.privacy-note { margin: 0 0 14px; font-size: 0.82rem; line-height: 1.55; color: var(--ink-soft); }

/* ===== Selo Platina (todas as conquistas) ===== */
.platinum-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 9px; border-radius: 100px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.03em; vertical-align: middle; color: #3a4660; background: linear-gradient(135deg, #f7f9fc 0%, #d5dbe8 55%, #eef1f7 100%); border: 1px solid #b4bdd0; box-shadow: 0 1px 2px rgba(60, 75, 110, 0.18); white-space: nowrap; }
.platinum-badge .icon { width: 12px; height: 12px; }
.podium-name .platinum-badge { display: flex; width: fit-content; margin: 6px auto 0; }
.achv-count { margin-left: auto; font-size: 0.8rem; font-weight: 800; color: var(--ink-soft); }

/* ===== Perfil: "Sobre você" e aviso de perfil incompleto no painel ===== */
.profile-form { display: flex; flex-direction: column; gap: 14px; }
.profile-field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; font-weight: 700; }
.profile-field em { font-style: normal; font-weight: 600; color: var(--ink-soft); }
.field-error { color: var(--red); font-weight: 600; font-size: 0.78rem; }

.profile-nudge { display: flex; align-items: center; gap: 14px; background: var(--purple-light); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 20px; }
.profile-nudge-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; }
.profile-nudge-text { flex: 1; font-size: 0.86rem; line-height: 1.45; }
.profile-nudge-text strong { display: block; font-size: 0.92rem; margin-bottom: 2px; }
.profile-nudge-btn { flex: 0 0 auto; white-space: nowrap; text-decoration: none; }
@media (max-width: 560px) {
  .profile-nudge { flex-wrap: wrap; }
  .profile-nudge-text { flex-basis: calc(100% - 52px); }
  .profile-nudge-btn { width: 100%; }
}
.profile-form .btn { align-self: flex-start; }

/* ===== Convite (painel) e bloqueio de usuários (admin) ===== */
.invite-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.invite-actions .btn { text-decoration: none; }
.cell-actions { white-space: nowrap; }
.inline-form { display: inline; margin-left: 8px; }
.blocked-badge { display: inline-block; background: var(--red-bg); color: var(--red); border-radius: 100px; padding: 2px 10px; font-size: 0.7rem; font-weight: 800; }
.blocked-row td { opacity: 0.6; }
.blocked-row td.cell-actions { opacity: 1; }
.cell-actions .inline-form:first-child { margin-left: 0; }

/* ===== Treino: avisos de XP e de questão já respondida ===== */
.xp-note { padding: 10px 14px; border-radius: 12px; font-size: 0.86rem; line-height: 1.45; margin: 0 0 14px; }
.xp-earned { background: var(--green-bg); color: var(--green); }
.xp-info { background: var(--purple-light); color: var(--purple-dark); }
.xp-wrong { background: var(--amber-bg); color: var(--amber); }

/* Treino: com muitas questões, a grade rola dentro do próprio bloco */
.treino-grid { max-height: 210px; overflow-y: auto; padding: 4px; margin-left: -4px; margin-right: -4px; }
.treino-grid .review-square { text-decoration: none; }

/* Celular: sem o flash azul padrão do toque; feedback suave na cor do site */
a, button, .btn, .nav-list a, .review-square { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  .btn:hover { background: var(--purple); }
  .btn-secondary:hover { background: var(--bg); }
  .bug-report-fab:hover { background: var(--purple); }
}
.btn, .hero-btn { transition: transform .1s ease; }
.btn:active, .hero-btn:active { transform: scale(0.97); }
@media (max-width: 900px) {
  .bottom-nav a:active { background: var(--purple-light); color: var(--purple); }
}

/* ===== MATÉRIAS DO VESTIBULAR (cores de barra e de ícone) ===== */
.subject-fill-ingles { background: #0e9aa7; }
.subject-fill-fisica { background: #5b5fc7; }
.subject-fill-quimica { background: #c2410c; }
.subject-fill-biologia { background: #2e9e4f; }
.subject-fill-filosofia { background: #8b5cf6; }
.subject-fill-sociologia { background: #db2777; }
.subject-icon-ingles { background: #dff5f7; color: #0e9aa7; }
.subject-icon-fisica { background: #e8e9fb; color: #5b5fc7; }
.subject-icon-quimica { background: #fdebe0; color: #c2410c; }
.subject-icon-biologia { background: #e2f5e8; color: #2e9e4f; }
.subject-icon-filosofia { background: #efe9fe; color: #8b5cf6; }
.subject-icon-sociologia { background: #fce7f1; color: #db2777; }
