/* ==========================================================================
   1. CONTAINER GERAL E LAYOUT BASE
   ========================================================================== */
.perfil-container { 
    width: 100%; 
    max-width: 650px; 
    margin: 0 auto; 
    padding: 0 20px 40px 20px; 
}

/* --- Banner Superior --- */
.perfil-banner {
    width: 100%;
    height: 180px; 
    background-size: cover;
    background-position: center;
    border-radius: 20px;
    margin-bottom: -50px;
}

/* --- Cards Base (Perfil e Postagens) --- */
.perfil-card {
    background: #fff;
    border-radius: 20px;
    /* FIX (Fase 8 - Hotfix visual 8.2B): sombra curta e limpa, sem "neon". */
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid #f1f5f9;
    padding: 24px;
    margin-top: 20px;
}

.post-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
    width: 100%;
}

/* ==========================================================================
   2. CABEÇALHO DO PERFIL (HEADER)
   ========================================================================== */
.perfil-header-flex { 
    display: flex; 
    align-items: flex-start; 
    gap: 15px; 
    position: relative; 
}

.user-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

/* --- Bloco do Topo --- */
.user-top { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%;
    gap: 15px;
}

.usuario h1 { font-size: 1rem; color: #1e293b; margin: 0; }
.usuario p { font-size: 0.8rem; color: #64748b; margin: 0; }

/* --- Nova Tag Institucional Fixa --- */
.tag-instituicao-fixa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 5px 10px;
    border-radius: 20px;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: auto;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.035);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* FIX (Fase 2 - Etapa 2.1E): tag IF/curso sem neon no hover/touch, parecida com chip social. */
.tag-instituicao-fixa:hover,
.tag-instituicao-fixa:focus-visible {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.055);
    transform: none;
    outline: none;
}

.tag-edit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    /* FIX (Fase 2 - Etapa 2.1E): lápis quase neutro, sem gritar no touchscreen. */
    background: #f1f5f9;
    color: #64748b;
    flex-shrink: 0;
}

.tag-edit-icon svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    opacity: 0.95;
}

.icon-bio-img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    opacity: 0.7;
}
/* ==========================================================================
   3. AVATAR, ANEL DE PROGRESSO E BADGES
   ========================================================================== */
.avatar-wrapper { position: relative; display: inline-block; width: 65px; height: 65px; flex-shrink: 0; }
.progress-ring { width: 65px; height: 65px; transform: rotate(-90deg); }
.progress-ring__circle { fill: transparent; stroke: #e2e8f0; stroke-width: 5; }
.progress-ring__bar { 
    /* FIX (Fase 8 - Hotfix UX 8.3C): cor segue a patente do aluno. */
    fill: transparent; stroke: var(--patente-color, #6366f1); stroke-width: 5; 
    stroke-linecap: round; transition: stroke-dashoffset 0.5s;
}
.avatar-perfil { position: absolute; top: 6px; left: 6px; width: 53px; height: 53px; border-radius: 50%; object-fit: cover; }
/* FIX (Fase 2 - Etapa 2.3H): badge agora é troféu; ganha um pouco mais de espaço
   e drop-shadow em vez de fundo circular, para ficar 3D como no design do arquivo. */
.nivel-badge { position: absolute; bottom: 3px; right: -2px; width: 22px; height: 22px; z-index: 10; border-radius: 0; background: transparent; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.18)); }

.post-meta .avatar-wrapper { position: relative; width: 45px; height: 45px; }
.post-meta .nivel-badge { position: absolute; bottom: 1px; right: -4px; width: 15px; height: 15px; background: transparent; border-radius: 0; padding: 0; filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.18)); }

/* ==========================================================================
   4. SEÇÃO DE ESTATÍSTICAS (STATS)
   ========================================================================== */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 0.6rem; color: #94a3b8; text-transform: uppercase; font-weight: 700; }
.stat-value { font-size: 1.1rem; color: #1e293b; font-weight: 800; }
.stat-number { font: inherit; }
.stat-value-tempo {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    letter-spacing: -0.03em;
    white-space: nowrap;
}
.stat-unit { font-size: 0.75rem; color: #94a3b8; font-weight: 500; margin-left: 2px; letter-spacing: -0.01em; }
.stat-value-tempo .stat-unit { font-size: 0.76rem; color: #94a3b8; font-weight: 500; }

/* ==========================================================================
   6. POSTAGENS E FEED DO USUÁRIO
   ========================================================================== */
.timeline-section {
    position: relative;
    overflow: visible;
    margin-top: 30px;
}
.timeline-header { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 15px; padding: 0 5px; gap: 12px; }
.timeline-header h3 { font-size: 1rem; color: #64748b; margin: 0; }

/* FIX (Fase 2 - Etapa 2.1E): shell do feed sem bloco textual extra.
   A informação essencial fica em badges pequenos nas abas. */
.feed-shell {
    position: -webkit-sticky;
    position: sticky !important;
    top: 74px;
    z-index: 120;
    margin: 4px -6px 0;
    padding: 8px 6px 0;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.99) 0%, rgba(248, 250, 252, 0.94) 68%, rgba(248, 250, 252, 0) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px 20px 0 0;
    isolation: isolate;
    transform: translateZ(0);
}

.feed-shell::before {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    top: 6px;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.075);
    pointer-events: none;
    z-index: -1;
}

/* FIX (Fase 2 - Etapa 2.1G): separa visualmente a navegação do primeiro card.
   O menu continua próximo do conteúdo, mas deixa de parecer colado/quebrado. */
.feed-shell + .post-card,
.feed-shell + .feed-empty-state {
    margin-top: 12px;
}

.feed-shell + .review-filter-tabs {
    margin-top: 8px;
}

.review-filter-tabs + .post-card,
.review-filter-tabs + .feed-empty-state {
    margin-top: 10px;
}

/* FIX (Fase 2 - Etapa 2.1B): abas horizontais do feed, inspiradas em redes sociais.
   São links reais, então funcionam mesmo se o JavaScript falhar ou estiver em cache. */
.feed-tabs-wrap {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0;
    background: transparent;
}

.feed-tabs {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0;
    overflow: visible;
    border-bottom: 1px solid #e2e8f0;
    scrollbar-width: none;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.feed-tabs::-webkit-scrollbar {
    display: none;
}

.feed-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 13px 9px 12px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 800;
    border-radius: 12px 12px 0 0;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.feed-tab > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-tab:hover,
.feed-tab:focus-visible {
    color: #4338ca;
    background: #f1f5f9;
    outline: none;
}

.feed-tab.active {
    color: #4338ca;
    background: #fff;
}

.feed-tab.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #7c3aed;
}

/* FIX (Correção UX Menu Mais 2026-07-12): "Mais" é um menu auxiliar, mas precisa
   dar retorno visual quando estiver aberto. Por isso, ao clicar em "Mais", ele
   recebe a mesma barra lilás das abas, deixando claro para o aluno que o menu
   está ativo naquele momento. */
.feed-more-menu[open] .feed-more-summary::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #7c3aed;
    display: block;
}

.feed-more-menu[open] .feed-more-summary {
    color: #4338ca;
    background: #fff;
}

.feed-more-summary:hover,
.feed-more-summary:focus-visible {
    color: #64748b;
    background: #f8fafc;
    outline: none;
}

/* Quando "Mais" estiver aberto, somente "Mais" deve parecer ativo.
   As abas reais continuam escolhidas na página, mas sem barra lilás visível. */
.feed-tabs:has(.feed-more-menu[open]) > a.feed-tab.active::after,
.feed-tabs.more-open > a.feed-tab.active::after {
    content: none;
    display: none;
}

.feed-tabs:has(.feed-more-menu[open]) > a.feed-tab.active,
.feed-tabs.more-open > a.feed-tab.active {
    color: #64748b;
    background: transparent;
}

/* FIX (Fase 2 - Etapa 2.1E): badges pequenos comunicam novidade sem bloco textual poluído. */
.tab-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #dbeafe;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1;
}

/* FIX (Fase 2 - Hotfix feed 2.4A): badge fica no DOM mesmo zerado,
   permitindo atualização instantânea sem F5. */
.tab-badge.is-empty {
    display: none;
}

/* FIX (Fase 2 - Etapa 2.1E): "Mais" vira aba, não botão solto. */
.feed-more-menu {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
}

.feed-more-summary {
    list-style: none;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.feed-more-summary::-webkit-details-marker {
    display: none;
}

/* FIX (Correção UX Menu Mais 2026-07-12): quando o menu está aberto, "Mais"
   fica ativo com barra lilás para evitar a sensação de clique sem resposta. */
.feed-more-menu[open] .feed-more-summary {
    color: #4338ca;
    background: #fff;
    outline: none;
}
.feed-more-summary:hover,
.feed-more-summary:focus-visible {
    color: #334155;
    background: #f8fafc;
    outline: none;
}

.feed-more-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 9px);
    /* FIX (Correção UX Menu Mais 2026-07): largura aumentada para caber
       "Desempenho" + etiqueta "seu raio-x" na mesma linha sem colisão. */
    width: 220px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 7px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feed-more-menu[open] .feed-more-dropdown {
    animation: menuContaEntrada 0.16s ease-out;
}

@keyframes menuContaEntrada {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* FIX (Correção UX Menu Mais 2026-07): grid de duas colunas fixas para o item
   e sua etiqueta ("seu raio-x", "ao vivo"). Antes, o label ficava desalinhado
   pois o "space-between" empurrava a etiqueta pela largura variável do texto,
   fazendo Desempenho e Ranking parecerem em alturas/colunas diferentes. */
.feed-more-item {
    color: #475569;
    text-decoration: none;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 0.8rem;
    font-weight: 800;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    line-height: 1.2;
}

.feed-more-item:hover,
.feed-more-item:focus-visible {
    background: #f8fafc;
    color: #4338ca;
    outline: none;
}

.feed-more-item small {
    color: #64748b;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.6rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    justify-self: end;
    align-self: center;
    text-align: center;
    min-height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* FIX (Fase 2 - Etapa 2.3B): "ao vivo" do ranking vira sinal visual de atualização,
   sem inventar temporizador falso. */
.feed-more-item[href="ranking.php"] small {
    position: relative;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    padding-left: 15px;
}

.feed-more-item[href="ranking.php"] small::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #10b981;
    transform: translateY(-50%);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
    animation: rankingLivePulse 1.6s ease-out infinite;
}

@keyframes rankingLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.feed-more-disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.feed-more-exit {
    /* FIX (Fase 2 - Etapa 2.1H): "Sair" neutro, sem vermelho fixo,
       para não transmitir punição/perigo no menu Mais. */
    color: #64748b;
}

.feed-more-exit:hover,
.feed-more-exit:focus-visible {
    color: #334155;
}

.feed-empty-state {
    display: block;
    width: 100%;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 16px;
    margin: 8px 0 0;
    font-size: 0.86rem;
}

/* FIX (Fase 2 - Etapa 2.1G): subabas de Revisões em estilo rede social.
   Menos "botão", mais navegação por texto com marcador ativo. */
.review-filter-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 0 2px;
    margin: 0 0 4px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.86);
}

.review-filter-tabs::-webkit-scrollbar {
    display: none;
}

.review-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-height: 38px;
    padding: 10px 13px 9px;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    box-shadow: none;
}

.review-filter.active {
    color: #4338ca;
    background: transparent;
}

.review-filter.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #7c3aed;
}

.review-filter.disabled {
    color: #8a97aa;
}

.review-filter small {
    color: #94a3b8;
    font-size: 0.58rem;
    font-weight: 800;
}

.post-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.post-info h4 { font-size: 0.95rem; color: #1e293b; margin: 0; }
.post-info p { font-size: 0.75rem; color: #64748b; margin: 0; }

/* FIX (Fase 2 - Etapa 2.1E): avatar institucional usa a logo real, não letras "AK". */
.system-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.system-avatar img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.post-question-content { background: transparent !important; border: none !important; margin-top: 5px; padding: 0; }
.post-question-content, .post-question-content p { text-align: left !important; word-break: normal !important; hyphens: none !important; }

.post-card .card { background: transparent !important; padding: 0 !important; border: none !important; box-shadow: none !important; margin-bottom: 0 !important; }

/* FIX (Leitura das questões 2026-07-17): enunciado, texto-base e alternativas
   passam a usar a mesma escala. O texto longo fica justificado, mas a última
   linha permanece à esquerda para não criar buracos visuais no mobile. */
.post-question-content .enunciado-container,
.post-question-content .enunciado-container p,
.post-question-content .texto-apoio,
.post-question-content .texto-apoio p,
.post-question-content .bloco-enunciado p,
.post-question-content .alternativa,
.post-question-content .alternativa-texto,
.post-question-content .comentario-box,
.post-question-content .comentario-box p,
.post-question-content .comentario-box li,
.post-question-content .comentario-box div,
.post-question-content .comentario-box span,
.post-question-content .comentario-box strong,
.post-question-content .comentario-box em,
.post-question-content .comentario-box small,
.post-question-content .comentario-box .conteudo-comentario,
.post-question-content .comentario-box .conteudo-comentario p,
.post-question-content .comentario-box .conteudo-comentario li,
.post-question-content .comentario-box .conteudo-comentario div,
.post-question-content .comentario-box .conteudo-comentario span,
.post-question-content .comentario-box .conteudo-comentario strong,
.post-question-content .comentario-box .conteudo-comentario em,
.post-question-content .comentario-box .conteudo-comentario small {
    font-size: var(--fs-alt) !important;
    line-height: 1.58 !important;
}
.post-question-content .enunciado-container,
.post-question-content .enunciado-container p,
.post-question-content .texto-apoio,
.post-question-content .texto-apoio p,
.post-question-content .bloco-enunciado p,
.post-question-content .alternativa-texto,
.post-question-content .comentario-box,
.post-question-content .comentario-box p,
.post-question-content .comentario-box li,
.post-question-content .comentario-box div,
.post-question-content .comentario-box .conteudo-comentario,
.post-question-content .comentario-box .conteudo-comentario p,
.post-question-content .comentario-box .conteudo-comentario li,
.post-question-content .comentario-box .conteudo-comentario div {
    text-align: justify !important;
    text-align-last: left !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
}

/* FIX (Leitura das questões 2026-07-17): botões proporcionais à questão,
   mas com escala de interface — menores que enunciado/alternativas. */
.post-question-content .btn-action,
.post-question-content .btn-action span,
.post-question-content .btn-coment,
.post-question-content .btn-ver-mais {
    font-size: var(--fs-botao-questao, 14px) !important;
    line-height: 1.25 !important;
}
.post-question-content .comentario-box h1,
.post-question-content .comentario-box h2,
.post-question-content .comentario-box h3,
.post-question-content .comentario-box h4 {
    font-size: var(--fs-alt) !important;
    line-height: 1.35 !important;
}

.post-question-content .btn-coment-destaque,
.post-question-content .btn-coment.btn-ocultar-suave {
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1px solid #dbe1ee !important;
    box-shadow: none !important;
}


/* ==========================================================================
   3. AVATAR, ANEL DE PROGRESSO E BADGES (CORRIGIDO)
   ========================================================================== */
/* Wrapper principal do Avatar */
.avatar-wrapper { 
    position: relative; 
    display: inline-block; 
    width: 65px; 
    height: 65px; 
    flex-shrink: 0; 
}

/* SVG do Anel de Progresso */
.progress-ring { width: 65px; height: 65px; transform: rotate(-90deg); }
.progress-ring__circle { fill: transparent; stroke: #e2e8f0; stroke-width: 5; }
.progress-ring__bar { 
    fill: transparent; stroke: #6366f1; stroke-width: 5; 
    stroke-linecap: round; transition: stroke-dashoffset 0.5s;
}

/* Imagem do Avatar (Perfil) - Garantindo formato circular */
.avatar-perfil { 
    position: absolute; 
    top: 6px; 
    left: 6px; 
    width: 53px; 
    height: 53px; 
    border-radius: 50%; 
    object-fit: cover; 
    display: block;
}

/* Badge (Medalha) do Nível */
.nivel-badge { 
    position: absolute; 
    bottom: 3px; 
    right: -2px; 
    width: 22px; 
    height: 22px; 
    z-index: 10; 
    border-radius: 0; 
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    object-fit: contain;
    padding: 0;
    filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.18));
}

/* FIX (Fase 2 - Etapa 2.3B): avatar do perfil vira componente de patente.
   A barra circular agora mostra progresso até a próxima patente, não taxa de acerto. */
.avatar-cluster {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 94px;
    flex-shrink: 0;
}

.avatar-cluster .avatar-wrapper {
    width: 76px;
    height: 76px;
    padding: 3px;
    border-radius: 50%;
    background: conic-gradient(var(--patente-color, #b7791f) var(--patente-progress, 6%), var(--patente-track, #e2e8f0) 0);
    box-sizing: border-box;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.10);
    /* FIX (Fase 8 - Hotfix visual 8.4B): padrão igual ao ranking, sem brilho artificial. */
    filter: none;
}

.avatar-cluster .progress-ring {
    width: 76px;
    height: 76px;
    display: none;
}

.avatar-cluster .progress-ring__circle {
    stroke: #e9eef7;
    stroke-width: 4.5;
}

.avatar-cluster .progress-ring__bar {
    /* FIX (Fase 8 - Hotfix UX 8.3C): remove lilás fixo; bronze/prata/ouro etc. */
    stroke: var(--patente-color, #7c3aed);
    stroke-width: 5.5;
    filter: none;
}

.avatar-cluster .avatar-perfil {
    top: 3px;
    left: 3px;
    width: 70px;
    height: 70px;
    border: 3px solid #fff;
    box-sizing: border-box;
    box-shadow: none;
}

.avatar-cluster .nivel-badge {
    width: 24px;
    height: 24px;
    right: -4px;
    bottom: 1px;
    border: 0;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    padding: 0;
    box-shadow: none;
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.22));
}

.patente-caption {
    text-align: center;
    line-height: 1.05;
    max-width: 96px;
}

.patente-caption strong {
    display: block;
    color: #1e293b;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: -0.01em;
}

.patente-caption span {
    display: block;
    color: var(--patente-color, #7c3aed);
    font-size: 0.62rem;
    font-weight: 900;
    margin-top: 2px;
}

.patente-caption small {
    /* FIX (Fase 8 - Hotfix visual 8.2B): remove texto longo do cabeçalho do perfil.
       A meta já aparece no card de nível; aqui ficava apertado e desalinhado. */
    display: none;
    color: #94a3b8;
    font-size: 0.56rem;
    font-weight: 800;
    line-height: 1.18;
    margin-top: 4px;
}

/* FIX (Bloco 10 - Avatar 2026-07-18): edição vira ação secundária textual.
   O troféu fica como foco no avatar; o link mantém a função sem poluir a foto. */
.aki-avatar-change-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
    color: #94a3b8;
    font-size: 0.58rem;
    font-weight: 850;
    line-height: 1;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .18s ease, border-color .18s ease;
}

.aki-avatar-change-link:hover,
.aki-avatar-change-link:focus-visible {
    color: #64748b;
    border-bottom-color: #cbd5e1;
    outline: none;
}

/* ==========================================================================
   5. POSTAGENS E FEED DO USUÁRIO (AJUSTE NO AVATAR DO POST)
   ========================================================================== */
.post-meta .avatar-wrapper { 
    position: relative; 
    width: 45px; 
    height: 45px; 
    flex-shrink: 0;
    padding: 2px;
    border-radius: 50%;
    background: conic-gradient(var(--patente-color, #b7791f) var(--patente-progress, 6%), var(--patente-track, #e2e8f0) 0);
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

/* Corrigindo a imagem dentro do post para ser circular */
.post-avatar { 
    width: 100%; 
    height: 100%; 
    border-radius: 50%; 
    object-fit: cover; 
    display: block;
    border: 2px solid #fff;
    box-sizing: border-box;
}

/* Badge (Medalha) dentro dos Posts - Posicionamento circular */
.post-meta .nivel-badge { 
    position: absolute; 
    bottom: 1px; 
    right: -4px; 
    width: 15px; 
    height: 15px; 
    background: transparent; 
    border-radius: 0; 
    padding: 0;
    z-index: 5;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.18));
}

/* ==========================================================================
   7. RANKING PREMIUM (Fase 2 - Etapa 2.3I)
   ==========================================================================
   FIX (2.3I): redesign completo do ranking mantendo user.php como norte visual.
   Regra: nada aqui contradiz .post-card, .stat-value, .tag-*, .feed-tab do user.php.
   Marca AprovAKI preservada: roxo #7c3aed, texto slate, sombra curta, borda 1px + radius. */

/* Tokens locais da página de ranking. */
.ranking-page {
    --aki-purple:        #7c3aed;
    --aki-purple-dark:   #5b21b6;
    --aki-purple-soft:   #ede9fe;
    --aki-purple-border: #ddd6fe;
    --aki-gold:          #d97706;
    --aki-gold-dark:     #92400e;
    --aki-gold-soft:     #fef3c7;
    --aki-gold-border:   #fcd34d;
    --aki-ink:           #0f172a;
    --aki-ink-2:         #1e293b;
    --aki-mute:          #64748b;
    --aki-mute-2:        #94a3b8;
    --aki-line:          #e2e8f0;
    --aki-line-soft:     #f1f5f9;
    --aki-card-shadow:   0 10px 24px rgba(15, 23, 42, 0.06);
    --aki-radius-lg:     20px;
    --aki-radius-md:     16px;
    --aki-radius-sm:     12px;
    max-width: 980px;
    /* FIX (Bloco 10 - Topo 2026-07-18): ranking usa o mesmo respiro do desempenho. */
    margin-top: 12px;
}

/* ---- HERO ---- */
.ranking-hero {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--aki-line-soft);
    border-radius: var(--aki-radius-lg);
    padding: 22px 24px 24px;
    box-shadow: var(--aki-card-shadow);
    margin-top: 0;
}

/* FIX (2.3J): remove manchas decorativas do hero para manter o ranking limpo e coerente. */
.ranking-hero::before {
    content: none;
    display: none;
}
.ranking-hero::after {
    content: none;
    display: none;
}

/* "Voltar ao feed" mantém a linguagem do chip institucional (leve, neutro). */
.ranking-back {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #334155;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 6px 12px 6px 10px;
    margin-bottom: 18px;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.035);
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
.ranking-back svg { display: block; }
.ranking-back:hover,
.ranking-back:focus-visible {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateX(-1px);
    outline: none;
}

.ranking-kicker {
    position: relative;
    z-index: 1;
    color: var(--aki-mute-2);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
}

/* Título com gradiente suave — identidade viciante, sem gritar. */
.ranking-title {
    position: relative;
    z-index: 1;
    font-size: clamp(1.35rem, 3.6vw, 1.75rem);
    line-height: 1.1;
    margin: 0 0 8px;
    letter-spacing: -0.025em;
    background: linear-gradient(96deg, #1e293b 0%, #4c1d95 55%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ranking-lead {
    position: relative;
    z-index: 1;
    color: var(--aki-mute);
    font-size: 0.88rem;
    line-height: 1.55;
    /* FIX (Fase 2 - Hotfix UX 2.4I): em telas largas a frase usa melhor o card
       antes de quebrar linha, evitando a quebra visual curta mostrada no ranking. */
    max-width: none;
    margin: 0;
}

/* Compatibilidade: mantém classes antigas caso outra página ainda as use. */
.ranking-summary,
.ranking-summary-item,
.ranking-summary-item-me,
.ranking-my-card { display: none !important; }

/* ============================================================
   "SEU PLACAR" — bloco de destaque com CTA de subida no ranking
   ============================================================
   Bright pattern de retenção: mostra sua posição, seu placar e
   quantos acertos faltam para ultrapassar o próximo. */
.ranking-you {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 18px 0 22px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--aki-purple-border);
    border-radius: var(--aki-radius-lg);
    box-shadow: var(--aki-card-shadow);
    overflow: hidden;
}

.ranking-you::before {
    content: none;
    display: none;
}

.ranking-you-main {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 22px;
    align-items: center;
}

.ranking-you-position {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 130px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--aki-purple-border);
    border-radius: var(--aki-radius-md);
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.08);
}

.ranking-you-label {
    display: block;
    color: var(--aki-mute-2);
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    line-height: 1;
}

.ranking-you-number {
    display: block;
    color: var(--aki-purple-dark);
    font-size: clamp(2.2rem, 6vw, 2.8rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    margin-top: 6px;
}

.ranking-you-of {
    display: block;
    color: var(--aki-mute);
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 4px;
}

.ranking-you-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ranking-you-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-align: center;
}

.ranking-you-score strong {
    color: var(--aki-ink-2);
    font-size: clamp(1.75rem, 5vw, 2.2rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
}

.ranking-you-score span {
    color: var(--aki-mute);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ranking-you-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}

.you-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--aki-line);
    color: #475569;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: clamp(0.64rem, 1.35vw, 0.72rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.015em;
    text-align: center;
    white-space: nowrap;
}

.ranking-you-goal {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(124, 58, 237, 0.06);
    border: 1px solid var(--aki-purple-border);
    border-radius: var(--aki-radius-md);
    color: var(--aki-purple-dark);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
}

.ranking-you-goal svg {
    flex-shrink: 0;
    color: var(--aki-purple);
}

.ranking-you-goal strong {
    color: var(--aki-purple-dark);
    font-weight: 800;
}

.ranking-you-goal.is-leader {
    background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(217,119,6,.06));
    border-color: var(--aki-gold-border);
    color: var(--aki-gold-dark);
}

.ranking-you-goal.is-leader svg { color: var(--aki-gold); }
.ranking-you-goal.is-leader strong { color: var(--aki-gold-dark); }

/* Estado vazio */
.ranking-you-empty {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 26px 20px;
}
.ranking-you-empty-title {
    color: var(--aki-ink-2);
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 6px;
}
.ranking-you-empty-text {
    color: var(--aki-mute);
    font-size: 0.85rem;
    margin: 0 0 14px;
}
.ranking-you-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    background: var(--aki-purple);
    color: #fff;
    text-decoration: none;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 18px rgba(124,58,237,.28);
    transition: transform .18s ease, box-shadow .18s ease;
}
.ranking-you-cta:hover { transform: translateY(-1px); box-shadow: 0 12px 22px rgba(124,58,237,.34); }

/* ============================================================
   PÓDIO — Top 3 lado a lado no desktop (ordem 2, 1, 3)
   Mobile: trio fixo visível, sem carrossel horizontal
   ============================================================ */
.ranking-podium-section {
    margin: 0 0 24px;
}

.ranking-podium-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 4px 10px;
    gap: 10px;
}

.ranking-podium-header h2 {
    margin: 0;
    color: var(--aki-ink-2);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.ranking-podium-header span {
    color: var(--aki-mute-2);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ranking-podium {
    display: grid;
    grid-template-columns: 1fr 1.1fr 1fr;
    align-items: end;
    gap: 14px;
}

.podium-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 44px 16px 18px;
    background: #fff;
    border: 1px solid var(--aki-line);
    border-radius: var(--aki-radius-lg);
    box-shadow: var(--aki-card-shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    min-width: 0;
}

.podium-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15,23,42,.10);
}

/* #1 elevado, com halo dourado suave */
.podium-1 {
    padding-top: 52px;
    transform: translateY(-14px);
    border-color: var(--aki-gold-border);
    background: linear-gradient(180deg, #fffdf6 0%, #ffffff 55%);
    box-shadow: 0 20px 40px rgba(217,119,6,.14), 0 8px 16px rgba(15,23,42,.05);
}
.podium-1:hover { transform: translateY(-16px); }
.podium-2 { border-color: #e2e8f0; }
.podium-3 { border-color: #f1e2ce; }

/* Coroa flutuante no #1 */
.podium-crown {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #78350f;
    box-shadow: 0 8px 16px rgba(217,119,6,.28);
    border: 3px solid #fff;
    z-index: 3;
}

/* Medalha numerada (1, 2, 3) — flutuando sobre o card */
.podium-medal {
    position: absolute;
    top: 8px;
    left: 12px;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.podium-medal img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(15,23,42,.18));
}
.podium-medal-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 900;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(15,23,42,.2);
}
.podium-1 .podium-medal { width: 46px; height: 46px; top: 6px; }

/* Avatar do pódio — igual sistema do ranking, mas maior */
.podium-avatar {
    --patente-color: #b7791f;
    --patente-track: #e2e8f0;
    --patente-progress: 6%;
    position: relative;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    padding: 3px;
    background: var(--patente-track);
    box-sizing: border-box;
    box-shadow: 0 6px 14px rgba(15,23,42,.10);
}
.podium-1 .podium-avatar { width: 84px; height: 84px; }
.podium-avatar .ranking-avatar-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}
.podium-avatar .ranking-avatar-ring__track {
    fill: transparent;
    stroke: transparent;
    stroke-width: 0;
}
.podium-avatar .ranking-avatar-ring__bar {
    fill: transparent;
    stroke: var(--patente-color);
    stroke-width: 5;
    stroke-linecap: round;
}
.podium-avatar-photo {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3px solid #fff;
    box-sizing: border-box;
}
.podium-avatar-badge {
    position: absolute;
    z-index: 3;
    right: -4px;
    bottom: 1px;
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(15,23,42,.20));
}
.podium-1 .podium-avatar-badge { width: 25px; height: 25px; }

.podium-name {
    margin: 12px 0 0;
    color: var(--aki-ink-2);
    font-size: 0.96rem;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.015em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.podium-1 .podium-name { font-size: 1.05rem; }

.podium-handle {
    margin: 2px 0 0;
    color: var(--aki-mute);
    font-size: 0.7rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.podium-if {
    margin: 4px 0 12px;
    color: var(--aki-mute-2);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.podium-score {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    min-width: 86px;
    max-width: 100%;
    padding: 6px 10px;
    background: var(--aki-line-soft);
    border-radius: 999px;
    margin-bottom: 12px;
    white-space: nowrap;
}
.podium-score strong {
    color: var(--aki-purple-dark);
    font-size: clamp(1.12rem, 1.9vw, 1.28rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.025em;
}
.podium-score span {
    color: var(--aki-mute);
    font-size: clamp(0.56rem, 0.9vw, 0.64rem);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}

/* #1 usa dourado no número dos acertos */
.podium-1 .podium-score {
    background: linear-gradient(135deg, var(--aki-gold-soft) 0%, #fef9e7 100%);
    box-shadow: inset 0 0 0 1px var(--aki-gold-border);
}
.podium-1 .podium-score strong { color: var(--aki-gold-dark); }
/* #2 usa roxo (Top 2-10) — 2c */
.podium-2 .podium-score strong { color: var(--aki-purple-dark); }
/* #3 usa roxo também (Top 2-10) */
.podium-3 .podium-score strong { color: var(--aki-purple-dark); }

.podium-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}
.podium-stats span {
    background: #fff;
    border: 1px solid var(--aki-line);
    color: #475569;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.64rem;
    font-weight: 800;
    white-space: nowrap;
}

/* "Sou eu" no pódio */
.podium-me {
    border-color: var(--aki-purple);
    box-shadow: 0 0 0 3px rgba(124,58,237,.14), var(--aki-card-shadow);
}
.podium-me::after {
    content: "Você";
    position: absolute;
    top: 10px;
    right: 12px;
    padding: 3px 8px;
    background: var(--aki-purple);
    color: #fff;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================================
   LISTA #4 em diante
   ============================================================ */
.ranking-list-section {
    margin-top: 4px;
}

.ranking-list-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0 4px 10px;
    gap: 10px;
}

.ranking-list-header h2 {
    margin: 0;
    color: var(--aki-ink-2);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.ranking-list-header span {
    color: var(--aki-mute-2);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ranking-list {
    display: grid;
    gap: 10px;
}

.ranking-row {
    --rank-pill-bg:     #f8fafc;
    --rank-pill-text:   #64748b;
    --rank-pill-border: #e2e8f0;
    --rank-score-text:  #1e293b;
    position: relative;
    display: grid;
    grid-template-columns: 56px 58px minmax(0, 1fr) 96px 320px;
    grid-template-areas: "pos medal person score stats";
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--aki-line);
    border-radius: var(--aki-radius-md);
    padding: 14px 16px;
    min-height: 84px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ranking-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 16px rgba(15,23,42,.05);
    transform: translateY(-1px);
}

.ranking-row::before { content: none; }

/* Top 10 (#4–#10): pill lilás — regra "2c" */
.ranking-rank-top10 {
    --rank-pill-bg:     var(--aki-purple-soft);
    --rank-pill-text:   var(--aki-purple-dark);
    --rank-pill-border: var(--aki-purple-border);
    --rank-score-text:  var(--aki-purple-dark);
}

/* #11 em diante: cinza neutro — regra "2c" */
.ranking-rank-normal {
    --rank-pill-bg:     #f8fafc;
    --rank-pill-text:   #64748b;
    --rank-pill-border: #e2e8f0;
    --rank-score-text:  #1e293b;
}

/* "Sou eu" — halo roxo suave + borda esquerda */
.ranking-row-me {
    border-color: var(--aki-purple);
    box-shadow: 0 0 0 3px rgba(124,58,237,.12);
    background: linear-gradient(90deg, rgba(124,58,237,.05) 0%, #ffffff 20%);
}

.ranking-me-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--aki-purple);
    color: #fff;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}

.ranking-position {
    grid-area: pos;
    justify-self: center;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    min-height: 46px;
    color: var(--rank-pill-text);
    text-align: center;
    background: var(--rank-pill-bg);
    border: 1px solid var(--rank-pill-border);
    border-radius: 12px;
    padding: 6px 9px;
}

.ranking-position strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.01em;
}

.ranking-position small {
    display: block;
    margin-top: 3px;
    font-size: 0.52rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
}

/* Avatar do ranking (anel de patente) */
.ranking-avatar {
    --patente-color: #b7791f;
    --patente-track: #e2e8f0;
    --patente-progress: 6%;
    grid-area: medal;
    position: relative;
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 3px;
    background: var(--patente-track);
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .08);
}

.ranking-avatar-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}
.ranking-avatar-ring__track {
    fill: transparent;
    stroke: transparent;
    stroke-width: 0;
}
.ranking-avatar-ring__bar {
    fill: transparent;
    stroke: var(--patente-color);
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset .5s ease;
}

.ranking-avatar-photo {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #fff;
    box-sizing: border-box;
}

.ranking-patente-bronze { --patente-color: #b7791f; --patente-track: #f1e2ce; }
.ranking-patente-prata { --patente-color: #94a3b8; --patente-track: #e2e8f0; }
.ranking-patente-ouro { --patente-color: #d97706; --patente-track: #fde68a; }
.ranking-patente-esmeralda { --patente-color: #059669; --patente-track: #bbf7d0; }
.ranking-patente-rubi { --patente-color: #be123c; --patente-track: #fecdd3; }
.ranking-patente-diamante { --patente-color: #0284c7; --patente-track: #bae6fd; }
.ranking-patente-alexandrita { --patente-color: #7c3aed; --patente-track: #ddd6fe; }

.ranking-avatar-badge {
    position: absolute;
    z-index: 3;
    right: -4px;
    bottom: 1px;
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(15,23,42,.18));
}

.ranking-person {
    grid-area: person;
    min-width: 0;
}

.ranking-person h2 {
    color: var(--aki-ink);
    font-size: 0.98rem;
    margin: 0;
    line-height: 1.18;
    letter-spacing: -0.018em;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-person p {
    color: var(--aki-mute);
    font-size: 0.75rem;
    margin: 4px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.ranking-score {
    grid-area: score;
    justify-self: stretch;
    text-align: center;
    padding: 4px 6px;
}

.ranking-score strong {
    display: block;
    color: var(--rank-score-text);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.025em;
}

.ranking-score span {
    display: block;
    margin-top: 4px;
    color: var(--aki-mute-2);
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ranking-mini-stats {
    grid-area: stats;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.ranking-mini-stats span {
    background: var(--aki-line-soft);
    border: 1px solid var(--aki-line);
    color: #475569;
    border-radius: 999px;
    padding: 6px 10px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   8. RESPONSIVIDADE ADAPTATIVA (MEDIA QUERIES)
   ========================================================================== */
@media (max-width: 600px) {
    .perfil-container { padding: 0 10px 20px 10px; }
    .perfil-banner { height: 140px; border-radius: 0; margin-bottom: -40px; }
    .post-card { padding: 12px; border-radius: 12px; }
    .feed-shell { top: 68px; }
}

@media (max-width: 900px) {
    .ranking-page { max-width: 720px; }

    /* Row do ranking mais compacta no tablet. */
    .ranking-row {
        grid-template-columns: 50px 56px minmax(0, 1fr) 90px;
        grid-template-areas:
            "pos medal person score"
            ".   .     stats  stats";
        gap: 10px 12px;
        padding: 14px;
    }
    .ranking-mini-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin-top: 6px;
    }
}

@media (max-width: 760px) {
    .ranking-page { max-width: 650px; }

    /* FIX (2.3L): "SEU PLACAR" mobile mantém a experiência do desktop,
       com posição proporcional e os 3 chips sempre na mesma linha. */
    .ranking-you { padding: 18px; }
    .ranking-you-main {
        grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
        gap: 12px;
        align-items: center;
    }
    .ranking-you-body {
        display: contents;
    }
    .ranking-you-position {
        min-width: 0;
        width: auto;
        min-height: 92px;
        flex-direction: column;
        justify-content: center;
        padding: 10px 8px;
    }
    .ranking-you-label {
        font-size: clamp(0.48rem, 1.55vw, 0.56rem);
        letter-spacing: 0.09em;
        text-align: center;
    }
    .ranking-you-number {
        font-size: clamp(1.75rem, 7.5vw, 2.15rem);
        margin-top: 5px;
        max-width: 100%;
    }
    .ranking-you-of { margin-top: 4px; }
    .ranking-you-score {
        grid-column: 2;
        align-self: center;
        justify-self: stretch;
        min-width: 0;
    }
    .ranking-you-score strong { font-size: clamp(1.7rem, 7vw, 2rem); }
    .ranking-you-stats {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.08fr) minmax(0, 1.12fr);
        gap: 5px;
        width: 100%;
    }
    .you-chip {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        padding: 6px 4px;
        font-size: clamp(0.56rem, 2.05vw, 0.68rem);
        line-height: 1;
        letter-spacing: -0.03em;
        text-align: center;
        white-space: nowrap;
    }

    /* PÓDIO: trio fixo, sem carrossel. Mantém a leitura 2º | 1º | 3º como no desktop. */
    .ranking-podium {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr) minmax(0, 1fr);
        align-items: end;
        gap: 8px;
        overflow: visible;
        scroll-snap-type: none;
        padding: 8px 0 0;
        margin: 0;
    }
    .ranking-podium::-webkit-scrollbar { display: none; }
    .podium-card {
        width: 100%;
        max-width: none;
        min-width: 0;
        scroll-snap-align: unset;
        transform: translateY(0);
        padding: 34px 8px 12px;
        border-radius: 16px;
    }
    .podium-1 {
        transform: translateY(-8px);
        padding-top: 40px;
    }
    .podium-1:hover { transform: translateY(-8px); }
    .podium-crown {
        top: -11px;
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
    .podium-crown svg { width: 18px; height: 18px; }
    .podium-medal {
        top: 7px;
        left: 7px;
        width: 30px;
        height: 30px;
    }
    .podium-1 .podium-medal { width: 34px; height: 34px; top: 6px; }
    .podium-avatar { width: 54px; height: 54px; padding: 2px; }
    .podium-1 .podium-avatar { width: 62px; height: 62px; }
    .podium-avatar-photo { border-width: 2px; }
    .podium-avatar-badge {
        right: -3px;
        bottom: 2px;
        width: 17px;
        height: 17px;
    }
    .podium-1 .podium-avatar-badge { width: 19px; height: 19px; }
    .podium-name {
        margin-top: 9px;
        font-size: 0.78rem;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        min-height: 1.8em;
    }
    .podium-1 .podium-name { font-size: 0.84rem; }
    .podium-handle {
        font-size: 0.58rem;
        max-width: 100%;
    }
    .podium-if { display: none; }
    .podium-score {
        /* FIX (Fase 2 - Hotfix UX 2.4E): o badge "X acertos" do pódio mantém
           proporção de chip também em cards estreitos, evitando o bloco gigante em duas linhas. */
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        width: 100%;
        padding: 5px 6px;
        margin: 8px 0 0;
    }
    .podium-score strong { font-size: clamp(0.9rem, 3.5vw, 1.04rem); }
    .podium-1 .podium-score strong { font-size: clamp(0.96rem, 4vw, 1.12rem); }
    .podium-score span {
        font-size: clamp(0.42rem, 1.55vw, 0.5rem);
        line-height: 1;
        letter-spacing: 0.035em;
    }
    .podium-stats { display: none; }
}

@media (max-width: 480px) {
    .perfil-header-flex { flex-direction: column; align-items: center; text-align: center; }
    .user-top { flex-direction: column; align-items: center; gap: 12px; }
    .tag-instituicao-fixa { margin-left: 0; width: 100%; justify-content: center; }
    .usuario { width: 100%; }
    .timeline-header { align-items: flex-start; }
    .feed-shell { margin-left: -4px; margin-right: -4px; padding-left: 4px; padding-right: 4px; top: 66px; }
    .feed-tab { font-size: 0.76rem; gap: 3px; padding-left: 5px; padding-right: 5px; }
    .tab-badge { min-width: 14px; height: 14px; padding: 0 4px; font-size: 0.56rem; }
    /* FIX (Correção UX 2026-07): mantém largura suficiente para "Desempenho" +
       etiqueta "seu raio-x" alinhada mesmo no mobile. */
    .feed-more-dropdown { right: -2px; width: 210px; padding: 6px; }
    .feed-more-item { padding: 8px 9px; font-size: 0.76rem; min-height: 32px; }
    .feed-more-item small { padding: 2px 6px; font-size: 0.55rem; }
    .feed-shell + .post-card,
    .feed-shell + .feed-empty-state { margin-top: 10px; }
    .feed-shell + .review-filter-tabs { margin-top: 7px; }
    .review-filter-tabs + .post-card,
    .review-filter-tabs + .feed-empty-state { margin-top: 9px; }
    .review-filter-tabs { padding-left: 0; padding-right: 0; }
    .review-filter { font-size: 0.7rem; padding-left: 10px; padding-right: 10px; }

    /* ==== RANKING MOBILE (≤480) ==== */
    .ranking-hero { padding: 18px; }
    .ranking-title { font-size: 1.4rem; }
    .ranking-lead { font-size: 0.82rem; }

    .ranking-you { padding: 16px; margin: 14px 0 18px; }
    .ranking-you-main {
        grid-template-columns: minmax(82px, 96px) minmax(0, 1fr);
        gap: 9px;
    }
    .ranking-you-position {
        min-height: 84px;
        padding: 9px 7px;
    }
    .ranking-you-label { font-size: clamp(0.44rem, 2.35vw, 0.52rem); }
    .ranking-you-number { font-size: clamp(1.55rem, 8vw, 1.95rem); }
    .ranking-you-of { font-size: clamp(0.55rem, 2.5vw, 0.66rem); }
    .ranking-you-score strong { font-size: clamp(1.55rem, 8vw, 1.8rem); }
    .ranking-you-score span { font-size: clamp(0.58rem, 2.8vw, 0.7rem); }
    .you-chip {
        padding: 6px 2px;
        font-size: clamp(0.48rem, 2.55vw, 0.6rem);
        letter-spacing: -0.04em;
    }
    .ranking-you-goal { font-size: 0.8rem; padding: 10px 12px; }

    .ranking-podium {
        gap: 6px;
        margin: 0;
        padding: 7px 0 0;
    }
    .podium-card {
        padding: 31px 6px 10px;
        border-radius: 15px;
    }
    .podium-1 {
        padding-top: 36px;
        transform: translateY(-7px);
    }
    .podium-1:hover { transform: translateY(-7px); }
    .podium-crown {
        top: -10px;
        width: 29px;
        height: 29px;
    }
    .podium-crown svg { width: 16px; height: 16px; }
    .podium-medal {
        top: 7px;
        left: 6px;
        width: 26px;
        height: 26px;
    }
    .podium-1 .podium-medal {
        width: 30px;
        height: 30px;
        top: 5px;
    }
    .podium-avatar { width: 46px; height: 46px; }
    .podium-1 .podium-avatar { width: 54px; height: 54px; }
    .podium-avatar-badge {
        width: 15px;
        height: 15px;
        right: -3px;
        bottom: 2px;
    }
    .podium-1 .podium-avatar-badge { width: 17px; height: 17px; }
    .podium-name {
        font-size: 0.7rem;
        min-height: 1.7em;
    }
    .podium-1 .podium-name { font-size: 0.76rem; }
    .podium-handle { display: none; }
    .podium-score {
        padding: 5px 4px;
        min-width: 0;
    }
    .podium-score strong { font-size: clamp(0.82rem, 4.2vw, 0.96rem); }
    .podium-1 .podium-score strong { font-size: clamp(0.9rem, 4.8vw, 1.04rem); }

    /* Lista do #4 em diante — story-style */
    .ranking-row {
        grid-template-columns: 46px 54px minmax(0, 1fr);
        grid-template-areas:
            "pos medal person"
            "score score score"
            "stats stats stats";
        gap: 8px 12px;
        padding: 14px;
        border-radius: 18px;
    }
    .ranking-position { min-width: 44px; padding: 6px 8px; }
    .ranking-position strong { font-size: 0.85rem; }
    .ranking-avatar { width: 52px; height: 52px; }
    .ranking-avatar-badge { width: 16px; height: 16px; right: -3px; bottom: 2px; }
    .ranking-person h2 { font-size: 0.95rem; white-space: normal; }
    .ranking-person p { font-size: 0.72rem; }
    .ranking-me-tag { font-size: 0.52rem; padding: 2px 6px; }
    .ranking-score {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-align: center;
        margin-top: 4px;
        padding: 10px 12px;
        background: var(--aki-line-soft);
        border-radius: 12px;
    }
    .ranking-score strong { font-size: 1.4rem; }
    .ranking-score span { margin-top: 0; font-size: 0.66rem; }
    .ranking-mini-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }
    .ranking-mini-stats span {
        padding: 6px 8px;
        font-size: 0.65rem;
    }
}

/* ========================================================================== 
   Ranking • Temporada mensal (2026-07-15)
   Barra discreta abaixo do cabeçalho do pódio, coerente com user.php.
   ========================================================================== */
.ranking-season {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--aki-purple-border);
    border-radius: var(--aki-radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}
.ranking-season-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.ranking-season-top strong {
    color: var(--aki-ink-2);
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}
.ranking-season-top span {
    color: var(--aki-purple-dark);
    background: var(--aki-purple-soft);
    border: 1px solid var(--aki-purple-border);
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.68rem;
    font-weight: 900;
    white-space: nowrap;
}
.ranking-season-track {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9edf5;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
.ranking-season-track span {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 68%, #a78bfa 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.ranking-season p {
    margin: 8px 0 0;
    color: var(--aki-mute);
    font-size: 0.72rem;
    line-height: 1.4;
}
@media (max-width: 480px) {
    .ranking-season { padding: 11px 12px; margin-bottom: 12px; }
    .ranking-season-top strong { font-size: 0.76rem; }
    .ranking-season-top span { font-size: 0.62rem; padding: 4px 8px; }
    .ranking-season p { font-size: 0.66rem; }
}

/* ========================================================================== 
   Feed • limite diário controlado pelo admin (2026-07-15)
   ========================================================================== */
.feed-limit-card {
    display: grid;
    gap: 9px;
    margin: 10px 0 12px;
    padding: 12px 14px;
    border: 1px solid #ddd6fe;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfaff 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}
.feed-limit-main {
    min-width: 0;
}
.feed-limit-main span {
    display: block;
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.feed-limit-main strong {
    display: block;
    color: #1e293b;
    font-size: 0.92rem;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: -0.015em;
}
.feed-limit-main p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.35;
    font-weight: 650;
}
.feed-limit-meter {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: #e9edf5;
    box-shadow: inset 0 1px 2px rgba(15,23,42,.08);
}
.feed-limit-meter i {
    display: block;
    height: 100%;
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 70%, #a78bfa 100%);
    transition: width .65s cubic-bezier(.22,.72,.18,1);
}
.mensagem-limite-diario {
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    background: #f5f3ff;
    color: #4c1d95;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.4;
}

/* Ranking: evita que a barra da temporada encoste no card/coroa do primeiro lugar. */
.ranking-season { margin-bottom: 28px; }
.ranking-podium { padding-top: 8px; }
@media (max-width: 760px) {
    .ranking-season { margin-bottom: 24px; }
    .ranking-podium { padding-top: 12px; }
}


/* FIX (Bloco 4 - Caderno/Salvas): ação Salvar em formato social, pequena no post. */
.post-card-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px solid #eef2f7;
}
.btn-salvar-questao {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
    opacity: .82;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease, opacity .16s ease, box-shadow .16s ease;
}
.btn-salvar-questao img {
    width: 23px;
    height: 23px;
    object-fit: contain;
    display: block;
    filter: saturate(.9) drop-shadow(0 2px 4px rgba(76, 29, 149, 0.08));
}
.btn-salvar-questao:hover,
.btn-salvar-questao:focus-visible {
    background: #eef2ff;
    border-color: #c7d2fe;
    opacity: 1;
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(76, 29, 149, 0.10);
}
.btn-salvar-questao.is-saved {
    background: #ede9fe;
    border-color: #a78bfa;
    opacity: 1;
}
.btn-salvar-questao.is-loading {
    opacity: .48;
    pointer-events: none;
}
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* FIX (Bloco 4 - ações sociais): aproxima a faixa de ações da base do post,
   deixando espaço para próximos ícones como gostei/comentar sem parecer flutuante. */
.post-question-content .card { padding-bottom: 12px; }
.post-question-content .acoes-card { gap: 9px; margin-top: 14px; }
.post-question-content .card.finalizada .acoes-card { margin-top: 12px; }
.post-question-content .card.finalizada .btn-coment { margin-bottom: 0; }
@media (max-width: 480px) {
    .post-question-content .card { padding-bottom: 10px; }
    .post-question-content .acoes-card { margin-top: 12px; gap: 8px; }
    .post-card-tools { padding-top: 7px; }
}

/* FIX (Bloco 4 - ações sociais): remove o vazio inferior do post.
   A faixa de ações fica compacta, como rede social: linha fina, ícones pequenos
   e pouca distância até a borda inferior. */
.timeline-section .post-card {
    padding-bottom: 7px !important;
}
/* FIX (Bloco 10 - Polimento visual 2026-07-16): respiro entre o botão
   "Responder" e a linha divisória que separa o botão do ícone Salvar. */
.post-question-content .acoes-card {
    gap: 10px !important;
    margin-top: 9px !important;
}
.post-card-tools {
    min-height: 30px;
    margin-top: 0 !important;
    padding-top: 10px !important;
    padding-bottom: 0 !important;
}
.btn-salvar-questao {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
}
.btn-salvar-questao img {
    width: 23px !important;
    height: 23px !important;
}
@media (max-width: 480px) {
    .timeline-section .post-card {
        padding-bottom: 6px !important;
    }
    .post-question-content .acoes-card {
        margin-top: 8px !important;
        gap: 8px !important;
    }
    .post-card-tools {
        min-height: 28px;
        padding-top: 8px !important;
    }
}

/* FIX (Bloco 10 - Polimento visual 2026-07-16): micro-feedback ao salvar.
   Quando o botão recebe .is-saved (via JS após confirmação do servidor),
   dá uma leve batida no ícone. Sem cor nova, sem som, sem vibração. */
@keyframes akiSalvarPop {
    0%   { transform: scale(1);    }
    45%  { transform: scale(1.22); }
    100% { transform: scale(1);    }
}
.btn-salvar-questao.is-saved img {
    animation: akiSalvarPop .22s ease-out;
}
@media (prefers-reduced-motion: reduce) {
    .btn-salvar-questao.is-saved img { animation: none; }
}

/* =========================================================================
   FIX (Bloco 4 - Caderno 2026-07-17): estado vazio ilustrado das abas
   do Caderno (Linha do Tempo / Errei / Acertei / Salvas).
   Substitui visualmente a antiga .feed-empty-state por um card com ícone,
   título curto, microcopy contextual e CTAs. Só aparece dentro do Caderno.
   ========================================================================= */
.caderno-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    width: 100%;
    margin: 14px 0 0;
    padding: 22px 20px 20px;
    background: #ffffff;
    border: 1px solid #e5e7f2;
    border-radius: 18px;
    box-shadow: 0 6px 22px -18px rgba(75, 60, 184, 0.35);
    color: #334155;
}

.caderno-empty-illustration {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: #4B3CB8;
    margin-bottom: 2px;
}

.caderno-empty-illustration svg {
    width: 34px;
    height: 34px;
    display: block;
}

.caderno-empty-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: #1f2340;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.caderno-empty-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #55607a;
    max-width: 40ch;
}

.caderno-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 6px;
}

.caderno-empty-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 999px;
    background: #4B3CB8;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    transition: transform .12s ease, background-color .12s ease, box-shadow .12s ease;
    box-shadow: 0 6px 14px -10px rgba(75, 60, 184, 0.75);
}

.caderno-empty-cta:hover,
.caderno-empty-cta:focus-visible {
    background: #3d31a0;
    transform: translateY(-1px);
    outline: none;
}

.caderno-empty-cta:focus-visible {
    box-shadow: 0 0 0 3px rgba(75, 60, 184, 0.28);
}

.caderno-empty-cta--ghost {
    background: transparent;
    color: #4B3CB8;
    border: 1px solid #d5d0ee;
    box-shadow: none;
}

.caderno-empty-cta--ghost:hover,
.caderno-empty-cta--ghost:focus-visible {
    background: #f5f3ff;
    color: #3d31a0;
}

/* Variações de tom por aba, mantendo paleta lilás/cinza/branco (D1). */
.caderno-empty[data-caderno-tipo="errei"] .caderno-empty-illustration {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    color: #b45151;
}

.caderno-empty[data-caderno-tipo="acertei"] .caderno-empty-illustration {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #2f8f6a;
}

.caderno-empty[data-caderno-tipo="salvas"] .caderno-empty-illustration {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #b0872a;
}

.review-filter-tabs + .caderno-empty {
    margin-top: 10px;
}

@media (max-width: 480px) {
    .caderno-empty {
        padding: 18px 16px 16px;
        border-radius: 16px;
    }
    .caderno-empty-illustration {
        width: 60px;
        height: 60px;
    }
    .caderno-empty-illustration svg {
        width: 30px;
        height: 30px;
    }
    .caderno-empty-title { font-size: 0.96rem; }
    .caderno-empty-text  { font-size: 0.85rem; }
    .caderno-empty-cta   { min-height: 42px; padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .caderno-empty-cta { transition: none; }
    .caderno-empty-cta:hover,
    .caderno-empty-cta:focus-visible { transform: none; }
}

/* =========================================================================
   FIX (Bloco 4 - Caderno 2026-07-17): destaque da sub-aba ativa e
   contadores em pill do lado do label (Linha do Tempo / Errei / Acertei /
   Salvas). Não substitui as regras existentes de .review-filter — só
   reforça o destaque e adiciona o pill de contagem.
   ========================================================================= */
.review-filter-tabs {
    /* leve respiro pro pill não colar na borda inferior da faixa */
    padding-bottom: 2px;
}

.review-filter {
    /* espaço maior entre o label e o pill de contador */
    gap: 6px;
    transition: color .12s ease, background-color .12s ease;
}

.review-filter-label {
    display: inline-block;
    white-space: nowrap;
}

.review-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ede9fe;
    color: #4B3CB8;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
    transition: background-color .12s ease, color .12s ease;
}

.review-filter-count.is-empty {
    background: #f1f5f9;
    color: #94a3b8;
}

/* Reforço do destaque da aba ativa: label mais escuro, pill preenchido em
   lilás e sublinhado mais grosso e visível. Mantém a estética de "abas de
   texto" (sem virar botão retangular). */
.review-filter.active {
    color: #1f2340;
}

.review-filter.active .review-filter-count {
    background: #4B3CB8;
    color: #ffffff;
}

.review-filter.active::after {
    /* aumenta a barrinha inferior pra dar leitura clara de "estou aqui" */
    height: 3px;
    left: 10px;
    right: 10px;
    background: linear-gradient(90deg, #4B3CB8 0%, #7c3aed 100%);
}

.review-filter:hover .review-filter-count,
.review-filter:focus-visible .review-filter-count {
    background: #dcd6fb;
    color: #3d31a0;
}

.review-filter.active:hover .review-filter-count,
.review-filter.active:focus-visible .review-filter-count {
    background: #3d31a0;
    color: #ffffff;
}

.review-filter:focus-visible {
    outline: none;
}

.review-filter:focus-visible .review-filter-label {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

@media (max-width: 480px) {
    .review-filter { padding: 10px 10px 9px; }
    .review-filter-count { font-size: 0.62rem; min-width: 18px; height: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .review-filter,
    .review-filter-count { transition: none; }
}

/* =========================================================================
   FIX (Bloco 4 - Caderno 2026-07-17): polimento específico do estado vazio
   da aba Salvas. Usa o próprio PNG do botão Salvar dentro do círculo, para
   o aluno reconhecer visualmente qual ícone tocar na questão.
   ========================================================================= */
.caderno-empty[data-caderno-tipo="salvas"] .caderno-empty-illustration img {
    width: 34px;
    height: 34px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 1px 1px rgba(75, 60, 184, 0.20));
}

@media (max-width: 480px) {
    .caderno-empty[data-caderno-tipo="salvas"] .caderno-empty-illustration img {
        width: 30px;
        height: 30px;
    }
}

/* Pulse muito discreto SÓ no ícone da aba Salvas para chamar atenção do
   gesto "toque aqui". Bem sutil, sem alta frequência: 2.4s por ciclo,
   3 ciclos e para. Respeita prefers-reduced-motion. */
@keyframes akiSalvarPulse {
    0%   { transform: scale(1);    opacity: 1;   }
    50%  { transform: scale(1.06); opacity: .92; }
    100% { transform: scale(1);    opacity: 1;   }
}

.caderno-empty[data-caderno-tipo="salvas"] .caderno-empty-illustration {
    animation: akiSalvarPulse 2.4s ease-in-out 0s 3;
    transform-origin: center;
}

@media (prefers-reduced-motion: reduce) {
    .caderno-empty[data-caderno-tipo="salvas"] .caderno-empty-illustration {
        animation: none;
    }
}

/* =========================================================================
   FIX (Bloco 5 - Bug avatar-pizza 2026-07-17): fim do efeito "gráfico de
   pizza" no avatar. Antes, .avatar-cluster .avatar-wrapper e .post-meta
   .avatar-wrapper usavam conic-gradient(cor até X%, track depois) como
   fundo, e para alunos com pouco progresso (ex.: 6%) o resultado era uma
   fatia colorida sobre cinza. Agora o anel do avatar é SEMPRE completo
   (track sólido em toda a volta) e, no perfil grande, um SVG por cima
   desenha a barra circular da patente. Nos posts do feed, ficamos só com
   o anel completo (sem barra), para não poluir a leitura.
   Regras usam a nova classe .avatar-anel (adicionada pelo avatar_badge.php)
   e sobrescrevem as regras antigas por especificidade.
   ========================================================================= */

/* Anel completo em qualquer avatar. Substitui o conic-gradient. */
.avatar-anel {
    background: var(--patente-track, #e2e8f0) !important;
    /* Reforça a cor da patente numa borda interna suave, sem fatia. */
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

/* Perfil grande: barra desenhada pelo SVG progress-ring reativado.
   O padding cria o "trilho" onde o SVG se assenta. */
.avatar-anel--perfil {
    padding: 3px;
    border-radius: 50%;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.10);
}

/* Reativa o SVG progress-ring no perfil (o CSS antigo escondia com
   display:none dentro de .avatar-cluster). */
.avatar-cluster .avatar-anel--perfil .progress-ring {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* começa do topo */
    pointer-events: none;
}

.avatar-cluster .avatar-anel--perfil .progress-ring__circle {
    fill: transparent;
    stroke: transparent; /* track já é o fundo sólido do wrapper */
    stroke-width: 0;
}

.avatar-cluster .avatar-anel--perfil .progress-ring__bar {
    fill: transparent;
    stroke: var(--patente-color, #7c3aed);
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset .5s ease;
}

/* Post no feed: só o anel completo, sem barra. Miniatura 45px. */
.avatar-anel--post {
    padding: 2px;
    border-radius: 50%;
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.avatar-anel--post .progress-ring {
    display: none !important;
}

/* Garante que a imagem de perfil e o troféu continuem alinhados
   dentro do wrapper que agora tem padding, sem depender do conic. */
.avatar-anel--perfil .avatar-perfil {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: #f1f5f9;
    border: 3px solid #fff;
    box-sizing: border-box;
}

.avatar-anel--post .post-avatar {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    background: #f1f5f9;
    border: 2px solid #fff;
    box-sizing: border-box;
}


/* FIX (Bloco 10 - Cadastro 2026-07-18B): selo de tipo de conta adulta. */
.tag-perfil-tipo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.7rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.tag-perfil-tipo--professor {
    border-color: #ddd6fe;
    background: #f5f3ff;
    color: #6d28d9;
}

.tag-perfil-tipo--responsavel {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}
