/* Cabeçalho, sessão e login do Academia Enem */
.ae-header { position: sticky; top: 0; z-index: 1000; min-height: 72px; margin: -24px calc(50% - 50vw) 34px; padding: 12px max(22px, calc((100vw - 1136px) / 2)); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgba(53,74,87,.07); backdrop-filter: blur(14px); }
.ae-header .brand { color: var(--ink); text-decoration: none; white-space: nowrap; }
.ae-header .brand-mark { width: 44px; height: 44px; }
.ae-header .topnav { gap: 5px; }
.ae-header .topnav a { padding: 10px 12px; border-radius: 10px; white-space: nowrap; }
.ae-header .topnav a:hover, .ae-header .topnav a:focus-visible { color: var(--blue-dark); background: #fff0eb; }
.ae-account { display: flex; align-items: center; justify-content: flex-end; min-width: 175px; }
.ae-account-guest, .ae-account-profile { display: flex; align-items: center; gap: 10px; }
.ae-account-guest > span { max-width: 165px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.ae-login-button, .ae-logout-button { border: 0; border-radius: 10px; padding: 10px 15px; color: #fff; background: var(--blue); font: 700 13px "DM Sans", sans-serif; cursor: pointer; white-space: nowrap; }
.ae-login-button:hover { background: var(--blue-dark); }
.ae-account-profile[hidden] { display: none; }
.ae-avatar { width: 38px; height: 38px; border: 2px solid #fbd0c3; border-radius: 50%; object-fit: cover; }
.ae-greeting { display: block; min-width: 60px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.ae-greeting strong { display: block; max-width: 130px; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ae-greeting small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.ae-logout-button { padding: 8px 11px; color: var(--ink); background: #eef1f3; }
.ae-logout-button:hover { background: #e1e7ea; }
.ae-auth-modal { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px; }
.ae-auth-modal.is-open { display: flex; }
.ae-auth-overlay { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(18,31,39,.72); backdrop-filter: blur(5px); cursor: default; }
.ae-auth-dialog { position: relative; display: flex; flex-direction: column; width: min(900px, 100%); height: min(760px, 88vh); overflow: hidden; border-radius: 20px; background: white; box-shadow: 0 28px 90px rgba(0,0,0,.32); }
.ae-auth-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 22px; }
.ae-auth-heading h2 { margin: 0 0 4px; color: var(--ink); font: 800 19px "Manrope", sans-serif; }
.ae-auth-heading p, .ae-auth-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ae-auth-close { width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 50%; color: var(--ink); background: #f1f3f5; font-size: 25px; cursor: pointer; }
.ae-auth-iframe { width: 100%; flex: 1; min-height: 0; border: 0; background: #fff; }
.ae-auth-note { padding: 10px 22px 14px; text-align: center; }
body.ae-auth-open { overflow: hidden; }
@media (max-width: 850px) {
  .ae-header { flex-wrap: wrap; gap: 8px 12px; margin: -18px -16px 28px; padding: 10px 16px; }
  .ae-header .brand-mark { width: 38px; height: 38px; }
  .ae-header .topnav { order: 3; width: 100%; overflow-x: auto; }
  .ae-header .topnav a { padding: 8px 10px; font-size: 12px; }
  .ae-account { margin-left: auto; min-width: 0; }
  .ae-account-guest > span { display: none; }
  .ae-greeting strong { max-width: 92px; }
  .ae-auth-modal { padding: 0; align-items: flex-end; }
  .ae-auth-dialog { width: 100%; height: min(88dvh, 760px); border-radius: 18px 18px 0 0; }
}

/* Ajustes para celulares estreitos e telas baixas */
@media (max-width: 480px) {
  .ae-header { column-gap: 6px; }
  .ae-header .brand { gap: 7px; font-size: 13px; }
  .ae-header .brand-mark { width: 34px; height: 34px; }
  .ae-account-profile { gap: 6px; }
  .ae-avatar { width: 32px; height: 32px; }
  .ae-greeting strong { max-width: 64px; font-size: 12px; }
  .ae-greeting small { font-size: 9px; }
  .ae-logout-button { padding: 7px 8px; font-size: 11px; }
  .ae-header .topnav { scrollbar-width: none; }
  .ae-header .topnav::-webkit-scrollbar { display: none; }
  .ae-auth-dialog { height: 90dvh; }
  .ae-auth-heading { padding: 15px 16px; }
  .ae-auth-note { padding: 8px 14px 12px; font-size: 11px; }
  body .modal { padding: 0; align-items: flex-end; }
  .modal .modal-dialog { width: 100%; max-height: 100dvh; overflow-y: auto; border-radius: 16px 16px 0 0; }
}

@media (max-height: 520px) and (max-width: 850px) {
  .ae-auth-modal { align-items: flex-start; overflow-y: auto; }
  .ae-auth-dialog { height: 100dvh; min-height: 320px; border-radius: 0; }
  .ae-auth-heading { padding: 9px 14px; }
  .ae-auth-note { padding: 6px 12px; }
  body .modal { align-items: flex-start; overflow-y: auto; }
  .modal .modal-dialog { max-height: none; border-radius: 0; }
}
.ae-account-guest[hidden] { display: none; }
