/* ============================================================================
   Simulado RPPS — Vocabulário visual dos componentes (components.css)
   Complementa theme.css. Mobile-first, full-width, sem libs externas.
   Usa exclusivamente os tokens var(--*) definidos em theme.css.
   ============================================================================ */

/* ============================ Página / layout ============================ */
.page {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding: clamp(16px, 3vw, 32px) var(--pad-x) clamp(40px, 6vw, 72px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.4vw, 28px);
}
.page--narrow { max-width: 1100px; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; color: var(--brand-900); }
.page-sub { color: var(--text-mute); font-size: var(--fs-sm); margin-top: 2px; }

/* ============================ Topbar (componente) ============================ */
.topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar__brand-name { font-weight: 800; letter-spacing: -.01em; font-size: var(--fs-lg); white-space: nowrap; }
.topbar__brand-name .brand-text { font-weight: 800; }
.topbar__sair { margin-left: 4px; }

/* ============================ Grade de estatísticas ============================ */
.stat-grid {
  display: grid;
  gap: clamp(12px, 1.8vw, 18px);
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: clamp(16px, 2.4vw, 22px);
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.stat-card::before {
  content: "";
  position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--_accent, var(--brand-600));
}
.stat-card__icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--_accent, var(--brand-600)) 13%, var(--surface));
  color: var(--_accent, var(--brand-700));
}
.stat-card__icon svg { width: 20px; height: 20px; }
.stat-card__body { min-width: 0; }
.stat-card__value { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: var(--brand-900); }
.stat-card__label { font-size: var(--fs-sm); color: var(--text-mute); margin-top: 2px; }
.stat-card--brand   { --_accent: var(--brand-600); }
.stat-card--accent  { --_accent: var(--accent-600); }
.stat-card--success { --_accent: var(--success-600); }
.stat-card--warn    { --_accent: var(--warn-600); }
.stat-card--danger  { --_accent: var(--danger-600); }
.stat-card--gold    { --_accent: var(--gold-500); }

/* ============================ HUD (faixa de status) ============================ */
.hud {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 20px);
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 12px clamp(14px, 2.4vw, 20px);
}
.hud__item { display: flex; flex-direction: column; gap: 2px; }
.hud__item-label { font-size: var(--fs-xs); color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; }
.hud__item-value { font-size: var(--fs-lg); font-weight: 800; }
.hud__spacer { flex: 1; }

/* ============================ Quiz ============================ */
.quiz-shell {
  width: 100%;
  max-width: 920px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.4vw, 24px);
}
.quiz-progress {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border);
}
.quiz-progress__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-600);
  transition: width var(--t-slow) var(--ease);
}
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.quiz-counter { font-weight: 700; color: var(--text-soft); font-size: var(--fs-sm); }

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  padding: clamp(20px, 3.4vw, 36px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.4vw, 22px);
}
.q-topico {
  align-self: flex-start;
}
.q-text {
  font-size: clamp(1.05rem, 1.6vw, var(--fs-xl));
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -.01em;
  color: var(--text);
}
.q-opts { display: flex; flex-direction: column; gap: 12px; }

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), transform var(--t-fast) var(--ease), box-shadow var(--t);
}
.opt:hover { border-color: var(--brand-400); background: var(--brand-50); }
.opt:active { transform: scale(.995); }
.opt__key {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-soft);
  font-weight: 800;
  transition: background var(--t), color var(--t);
}
.opt__text { flex: 1; min-width: 0; }
.opt__mark { flex: 0 0 auto; width: 22px; height: 22px; opacity: 0; transition: opacity var(--t); }
.opt--selected { border-color: var(--brand-600); background: var(--brand-50); box-shadow: var(--ring); }
.opt--selected .opt__key { background: var(--brand-600); color: var(--on-brand); }
.opt--correct { border-color: var(--success-600); background: var(--success-50); }
.opt--correct .opt__key { background: var(--success-600); color: #fff; }
.opt--correct .opt__mark { opacity: 1; color: var(--success-600); }
.opt--wrong { border-color: var(--danger-600); background: var(--danger-50); }
.opt--wrong .opt__key { background: var(--danger-600); color: #fff; }
.opt--wrong .opt__mark { opacity: 1; color: var(--danger-600); }
.opt:disabled { cursor: default; }
.opt:disabled:hover { border-color: var(--border-strong); background: var(--surface); }
.opt--correct:hover, .opt--wrong:hover { background: inherit; }

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.quiz-nav .btn { flex: 1 1 auto; min-width: 130px; }

/* ============================ Timer / cronômetro ============================ */
.timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-lg);
  box-shadow: inset 0 0 0 1px var(--brand-100);
}
.timer svg { width: 18px; height: 18px; }
.timer--warn { background: var(--warn-50); color: var(--warn-700); box-shadow: inset 0 0 0 1px #fde68a; }
.timer--danger {
  background: var(--danger-50);
  color: var(--danger-700);
  box-shadow: inset 0 0 0 1px #fecaca;
  animation: pulse-danger 1s var(--ease) infinite;
}
@keyframes pulse-danger {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ============================ Resultado ============================ */
.result-hero {
  position: relative;
  overflow: hidden;
  background: var(--brand-800);
  color: var(--on-brand);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
  padding: clamp(20px, 4vw, 40px);
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 44px);
  flex-wrap: wrap;
  justify-content: center;
  text-align: center;
}
.result-hero__info { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.result-hero__title { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.02em; }
.result-hero__sub { color: color-mix(in srgb, #fff 82%, transparent); font-size: var(--fs-lg); }
.result-hero__badges { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.score-ring { display: grid; place-items: center; }

.result-list { display: flex; flex-direction: column; gap: 12px; }
.result-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left-width: 5px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-xs);
}
.result-item__num {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  font-weight: 800; font-size: var(--fs-sm);
  background: var(--surface-3); color: var(--text-soft);
}
.result-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.result-item__q { font-weight: 700; line-height: 1.45; }
.result-item__ans { font-size: var(--fs-sm); color: var(--text-soft); }
.result-item__ans b { color: var(--text); }
.result-item--ok { border-left-color: var(--success-600); }
.result-item--ok .result-item__num { background: var(--success-50); color: var(--success-700); }
.result-item--bad { border-left-color: var(--danger-600); }
.result-item--bad .result-item__num { background: var(--danger-50); color: var(--danger-700); }

/* ============================ Medalhas / gamificação ============================ */
.medal-grid {
  display: grid;
  gap: clamp(12px, 1.8vw, 18px);
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.medal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: 18px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.medal:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }
.medal__icon {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-faint);
  border: 1px solid var(--border);
}
.medal__icon svg { width: 24px; height: 24px; }
.medal__name { font-weight: 800; font-size: var(--fs-sm); color: var(--text); }
.medal__desc { font-size: var(--fs-xs); color: var(--text-mute); line-height: 1.4; }

/* Conquistada → em destaque dourado */
.medal:not(.medal--locked) {
  border-color: var(--gold-400);
  background: #fdfaf1;
  box-shadow: 0 3px 12px rgba(176, 127, 34, .16);
}
.medal:not(.medal--locked) .medal__icon { background: var(--gold-500); color: #fff; border-color: var(--gold-500); }
.medal:not(.medal--locked) .medal__name { color: #8a6311; }

/* Bloqueada → neutra/apagada */
.medal--locked { opacity: .62; }

/* ============================ XP / barra de nível ============================ */
.xp-bar { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.xp-bar__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.xp-bar__label { font-size: var(--fs-sm); font-weight: 700; color: var(--text-soft); }
.xp-bar__pct { font-size: var(--fs-sm); font-weight: 800; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.xp-bar__track {
  height: 14px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border);
}
.xp-bar__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-600);
  transition: width var(--t-slow) var(--ease);
}

/* ============================ Tabela de dados ============================ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
}
.data-table thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text-mute);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: var(--fs-xs);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table--card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.data-table .cell-actions { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; }
.data-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-soft); }

/* ============================ Barra de filtro / toolbar ============================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px clamp(12px, 2vw, 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 160px; flex: 1 1 160px; }
.filter-bar__grow { flex: 1; }

/* Campos de data: compactos e fininhos (não esticam na vertical) */
.filter-bar .field { flex: 0 0 auto; min-width: 0; gap: 3px; }
.filter-bar .field .hint { font-size: var(--fs-xs); color: var(--text-mute); padding-left: 2px; }
.filter-bar input[type="date"] {
  flex: 0 0 auto; width: 150px; min-width: 0;
  padding: 7px 10px; height: 36px;
}
@media (max-width: 480px) {
  .filter-bar .field { flex: 1 1 calc(50% - 6px); }
  .filter-bar input[type="date"] { width: 100%; }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.toolbar__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================ Abas ============================ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-mute);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.tab:hover { color: var(--text-soft); }
.tab--active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--sh-sm);
}

/* ============================ Admin: shell estilo sistema (sidebar navy) ============================ */
.admin-shell { width: 100%; min-height: 100dvh; }
.admin-layout { display: flex; align-items: stretch; width: 100%; min-height: 100dvh; }

/* ----- Sidebar escura, colada à lateral, altura total ----- */
.admin-sidebar {
  flex: 0 0 250px; width: 250px;
  position: sticky; top: 0; height: 100dvh; align-self: flex-start;
  background: var(--brand-900); color: #fff;
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px 12px; overflow-y: auto;
  transition: flex-basis var(--t) var(--ease), width var(--t) var(--ease);
}
.admin-layout.collapsed .admin-sidebar { flex-basis: 74px; width: 74px; }

.admin-brand { text-align: center; padding: 6px 4px 14px; }
.admin-brand__name { font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; color: #fff; }
.admin-brand__sub { font-size: var(--fs-xs); color: rgba(255,255,255,.62); margin-top: 3px; }
.admin-user {
  text-align: center; padding: 12px 6px; margin-bottom: 10px;
  border-top: 1px solid rgba(255,255,255,.12);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.admin-user__hello { font-size: var(--fs-xs); color: rgba(255,255,255,.6); }
.admin-user__name { font-weight: 700; color: #fff; margin-top: 2px; word-break: break-word; }

.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav__item {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 11px 14px; border: 0; border-radius: var(--r-md); background: transparent;
  color: rgba(255,255,255,.82); font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
  white-space: nowrap; text-align: left; transition: background var(--t), color var(--t);
}
.admin-nav__item svg { flex: 0 0 auto; }
.admin-nav__item:hover { background: rgba(255,255,255,.10); color: #fff; }
.admin-nav__item.is-active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 var(--brand-400); }

.admin-sidebar__spacer { flex: 1; min-height: 12px; }
.admin-sidebar__sair {
  justify-content: center; gap: 8px; background: var(--danger-600); color: #fff; margin-top: 8px;
}
.admin-sidebar__sair:hover { background: var(--danger-700); color: #fff; }

.admin-layout.collapsed .admin-nav__label,
.admin-layout.collapsed .admin-brand__sub,
.admin-layout.collapsed .admin-user,
.admin-layout.collapsed .admin-sidebar__sair span { display: none; }
.admin-layout.collapsed .admin-brand__name { font-size: .8rem; }
.admin-layout.collapsed .admin-nav__item { justify-content: center; padding: 12px; }

/* ----- Área de conteúdo ----- */
.admin-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.admin-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  min-height: 58px; padding: 0 clamp(14px, 2.4vw, 26px);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.admin-topbar__title { font-weight: 700; font-size: var(--fs-lg); color: var(--brand-900); }
.admin-menu-btn {
  flex: 0 0 auto; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-soft); cursor: pointer; transition: background var(--t);
}
.admin-menu-btn:hover { background: var(--surface-3); color: var(--text); }
.admin-content {
  padding: clamp(16px, 3vw, 26px) clamp(14px, 2.4vw, 26px);
  display: flex; flex-direction: column; gap: clamp(14px, 2.2vw, 22px);
}
.admin-overlay { display: none; }

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; z-index: 70;
    flex-basis: 260px; width: 260px;
    transform: translateX(-100%); transition: transform var(--t) var(--ease);
    box-shadow: var(--sh-lg);
  }
  .admin-layout.drawer-open .admin-sidebar { transform: none; }
  .admin-layout.drawer-open .admin-overlay {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px);
  }
  /* no celular o menu vira gaveta — nunca "só ícones" */
  .admin-layout.collapsed .admin-sidebar { flex-basis: 260px; width: 260px; }
  .admin-layout.collapsed .admin-nav__label,
  .admin-layout.collapsed .admin-brand__sub,
  .admin-layout.collapsed .admin-user,
  .admin-layout.collapsed .admin-sidebar__sair span { display: block; }
  .admin-layout.collapsed .admin-brand__name { font-size: 1.15rem; }
  .admin-layout.collapsed .admin-nav__item { justify-content: flex-start; padding: 11px 14px; }
}

/* ============================ Modal ============================ */
.modal__overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: clamp(12px, 4vw, 32px);
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  animation: fadeIn var(--t) var(--ease) both;
}
.modal__box {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: pop var(--t) var(--ease) both;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(18px, 3vw, 26px);
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.01em; }
.modal__close {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-soft);
  cursor: pointer; font-size: 1.2rem;
  transition: background var(--t), color var(--t);
}
.modal__close:hover { background: var(--danger-50); color: var(--danger-600); }
.modal__body {
  padding: clamp(18px, 3vw, 26px);
  overflow-y: auto;
}
.modal--lg .modal__box { max-width: 860px; }
.modal--sm .modal__box { max-width: 420px; }

/* ============================ Estado vazio ============================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: clamp(32px, 6vw, 64px) clamp(16px, 4vw, 40px);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}
.empty-state__icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-mute);
}
.empty-state__icon svg { width: 26px; height: 26px; }
.xp-bar__pct { color: var(--brand-700); }
.empty-state__title { font-size: var(--fs-xl); font-weight: 800; }
.empty-state__text { color: var(--text-mute); max-width: 46ch; }

/* ============================ Anel de progresso (SVG) ============================ */
.progress-ring { display: inline-grid; place-items: center; position: relative; }
.progress-ring__track { stroke: var(--surface-3); }
.progress-ring__bar {
  stroke: var(--brand-600);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset var(--t-slow) var(--ease);
}
.progress-ring__center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
}
.progress-ring__value { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.progress-ring__label { font-size: var(--fs-xs); color: var(--text-mute); margin-top: 2px; }

/* ============================ Confete (canvas) ============================ */
.confetti-canvas {
  position: fixed; inset: 0; z-index: 200;
  pointer-events: none;
}

/* ============================ Gráficos (charts.js) ============================ */
.chart-donut { display: inline-grid; place-items: center; position: relative; }
.chart-donut__center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.chart-donut__value { font-size: var(--fs-xl); font-weight: 800; line-height: 1; }
.chart-donut__label { font-size: var(--fs-xs); color: var(--text-mute); }
.chart-bars { width: 100%; }
.chart-bars__bar { transition: width var(--t-slow) var(--ease); }

/* ============================ Ranking ============================ */
.rank-hero {
  display: flex; align-items: center; gap: clamp(16px, 4vw, 40px); flex-wrap: wrap;
  background: var(--brand-800); color: #fff;
  border-radius: var(--r-xl); box-shadow: var(--sh-md);
  padding: clamp(18px, 3.4vw, 30px);
}
.rank-hero__pos { display: flex; align-items: baseline; gap: 6px; line-height: 1; }
.rank-hero__hash { font-size: 1.6rem; font-weight: 700; opacity: .6; }
.rank-hero__num { font-size: clamp(2.4rem, 8vw, 4rem); font-weight: 800; }
.rank-hero__of { font-size: var(--fs-sm); opacity: .75; }
.rank-hero__info { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rank-hero__name { font-size: var(--fs-xl); font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rank-hero__sub { color: rgba(255,255,255,.8); font-size: var(--fs-sm); }
.rank-hero__stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 6px; }
.rank-hero__stats span { font-size: var(--fs-sm); color: rgba(255,255,255,.85); display: inline-flex; align-items: center; gap: 5px; }
.rank-hero__stats strong { font-size: var(--fs-lg); color: #fff; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 20px); padding: 8px 0 0; }
.podium__col { flex: 1 1 0; max-width: 190px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium__badge { width: 44px; height: 44px; border-radius: var(--r-pill); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: var(--fs-lg); box-shadow: var(--sh-sm); }
.podium__name { font-weight: 700; font-size: var(--fs-sm); text-align: center; }
.podium__xp { font-size: var(--fs-xs); color: var(--text-mute); display: inline-flex; align-items: center; gap: 4px; }
.podium__step { width: 100%; border-radius: var(--r-md) var(--r-md) 0 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: var(--fs-xl); }
.podium__col--1 .podium__badge, .podium__col--1 .podium__step { background: var(--gold-500); }
.podium__col--2 .podium__badge, .podium__col--2 .podium__step { background: #9aa3b2; }
.podium__col--3 .podium__badge, .podium__col--3 .podium__step { background: #b0825a; }
.podium__col--1 .podium__step { height: 92px; }
.podium__col--2 .podium__step { height: 70px; }
.podium__col--3 .podium__step { height: 54px; }
.podium__col--me .podium__name { color: var(--brand-700); }

.rank-table th, .rank-table td { white-space: nowrap; }
.rank-pos { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-soft); font-weight: 800; font-size: var(--fs-xs); }
.rank-pos--1 { background: var(--gold-500); color: #fff; }
.rank-pos--2 { background: #9aa3b2; color: #fff; }
.rank-pos--3 { background: #b0825a; color: #fff; }
.rank-medals { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--gold-500); }
.rank-medals .muted { color: var(--text-faint); font-weight: 600; }
.rank-name { font-weight: 600; }
.rank-row--me td { background: #fdfaf1 !important; }
.rank-row--me .rank-name { color: var(--brand-800); font-weight: 800; }
.rank-criterios { margin: 10px 0 0; padding-left: 20px; color: var(--text-soft); font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 4px; }

/* ============================ Certificado (impressão) ============================ */
.cert-page {
  font-family: Georgia, 'Times New Roman', serif;
  color: #0f172a;
  background: #fff;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}
.cert-frame {
  border: 3px solid #1d4fd0;
  outline: 1px solid #93b9fd;
  outline-offset: 6px;
  padding: 54px 60px;
  text-align: center;
  position: relative;
}
.cert-logo { height: 60px; margin: 0 auto 18px; }
.cert-kicker { letter-spacing: .35em; text-transform: uppercase; color: #2563eb; font-size: 14px; font-weight: 700; }
.cert-title { font-size: 44px; font-weight: 800; color: #1e3a8a; margin: 6px 0 4px; letter-spacing: .02em; }
.cert-rule { width: 120px; height: 3px; background: #f59e0b; margin: 14px auto 26px; border: 0; }
.cert-lead { font-size: 18px; color: #334155; }
.cert-name { font-size: 34px; font-weight: 800; color: #0f172a; margin: 14px 0; }
.cert-text { font-size: 17px; color: #334155; line-height: 1.7; max-width: 60ch; margin: 0 auto; }
.cert-stats { display: flex; justify-content: center; gap: 48px; margin: 30px 0; flex-wrap: wrap; }
.cert-stat__value { font-size: 30px; font-weight: 800; color: #1d4fd0; }
.cert-stat__label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; }
.cert-footer { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 44px; gap: 24px; }
.cert-sign { text-align: center; flex: 1; }
.cert-sign__line { border-top: 1.5px solid #0f172a; margin-bottom: 6px; }
.cert-sign__name { font-weight: 700; font-size: 14px; }
.cert-sign__role { font-size: 12px; color: #64748b; }
.cert-seal {
  width: 96px; height: 96px; border-radius: 50%;
  border: 3px double #f59e0b; color: #b45309;
  display: grid; place-items: center; text-align: center;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  line-height: 1.3; margin: 0 auto;
}

/* ============================ Responsivo ============================ */
@media (max-width: 640px) {
  .quiz-nav .btn { flex: 1 1 100%; }
  .result-hero { flex-direction: column; }
  .cert-frame { padding: 30px 22px; }
  .cert-title { font-size: 30px; }
  .cert-name { font-size: 26px; }
}
