/* QBank (v2 da Prova de Equivalencia): configurar, responder e rever, com os tokens do ds/pe.css.
   Tres ecras (.screen): configuracao, pergunta e resultados. A pergunta esconde o
   menu lateral e a barra de baixo da app (body.qb-in-question + pna-sem-tabbar).
   Leitor partilhado: o WOD e os simulados da v2 usam as mesmas classes qb-* (cabecalho,
   cartao da pergunta, opcoes, barra de baixo, folha de respostas, paineis Lab e Nota).
   Cores das areas: .pe-area + --area-cor (areas.cor da BD), tokens --pe-area-* do pe.css. */

:root { --qbank-text-size: 16px; --qb-bar-h: 64px; }
body.pe { background: var(--pe-glow), var(--pe-bg); background-repeat: no-repeat; background-attachment: fixed; color: var(--pe-ink-2); }
.pe [hidden] { display: none !important; }
.qb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.screen .pe-i, .qb-dialog .pe-i, #voxi-pane .pe-i { pointer-events: none; }
button { -webkit-tap-highlight-color: transparent; }

/* ---------- Ecras ---------- */
.screen { display: none; min-height: 100vh; font-size: var(--qbank-text-size); }
.screen.active { display: block; }

/* Em modo pergunta o menu lateral e o topo movel saem (UX limpo) */
body.qb-in-question .pna-sidebar,
body.qb-in-question .pna-sidebar-overlay,
body.qb-in-question .pna-mobile-header { display: none !important; }
body.qb-in-question .pna-main-wrapper,
body.qb-in-question .main-wrapper { margin-left: 0 !important; }

/* ---------- A carregar ---------- */
#loading-screen.active { display: grid; place-items: center; min-height: 70vh; }
.qb-loading { display: grid; justify-items: center; gap: 16px; padding: 40px 20px; text-align: center; color: var(--pe-ink-3); font-size: 14px; }
.qb-loading .pe-btn { margin-top: 4px; }
.qb-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--pe-blue-soft); border-top-color: var(--pe-blue-strong); animation: qb-spin .9s linear infinite; }
.qb-spinner--sm { width: 16px; height: 16px; border-width: 2px; flex: none; }
@keyframes qb-spin { to { transform: rotate(360deg); } }

.loading-overlay { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 20px; background: rgba(var(--pe-bg-rgb), .82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.loading-overlay.active { opacity: 1; visibility: visible; }
.qb-prep { width: min(560px, 100%); display: grid; gap: 18px; }
.qb-prep__skel { display: grid; gap: 8px; }
.qb-prep__skel .pe-skel { margin: .2em 0; }
.qb-prep__opt { height: 44px; border-radius: 14px; border: 1px solid var(--pe-line); background: var(--pe-surface); }
.qb-prep__t { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--pe-ink-2); }

/* ---------- Pagina (configuracao e resultados) ---------- */
.qb-main { min-width: 0; max-width: 1360px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 44px) 56px; }
.qb-head { margin-bottom: 22px; }
.qb-head .pe-eyebrow { margin-bottom: 6px; }
.qb-headtools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Tamanho do texto */
.qb-textsize { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--pe-r-pill); border: 1px solid var(--pe-line); background: var(--pe-glass-2); font-size: 12.5px; color: var(--pe-ink-3); flex: none; }
.qb-textsize__l { padding: 0 6px 0 10px; }
.qb-textsize button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--pe-ink); font-size: 13px; font-weight: 500; cursor: pointer; }
.qb-textsize button:hover:not(:disabled) { background: var(--pe-blue-soft); }
.qb-textsize button:disabled { opacity: .35; cursor: default; }
.qb-textsize output { min-width: 40px; text-align: center; color: var(--pe-ink-2); font-variant-numeric: tabular-nums; font-size: 12px; }
.qb-textsize .pe-i { width: 15px; height: 15px; }

/* ---------- Configuracao ---------- */
.qb-config { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.qb-steps { display: grid; gap: 16px; counter-reset: qb-passo; }
.qb-step { padding: 22px 24px 24px; counter-increment: qb-passo; }
.qb-step .pe-card__num { font-size: 56px; }
.qb-step .pe-card__num::before { content: counter(qb-passo, decimal-leading-zero); }
.qb-step__head { margin-bottom: 16px; padding-right: 72px; }
.qb-step__head .pe-card__title { font-size: 16px; }
.qb-step__head p { margin-top: 2px; }

.qb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-chips .pe-chip { min-height: 42px; font-size: 13.5px; font-family: inherit; cursor: pointer; }
.qb-chips .pe-chip:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 2px; }
.qb-n { font-size: 12px; color: var(--pe-ink-3); font-variant-numeric: tabular-nums; }
.pe-chip.is-on .qb-n { color: rgba(255,255,255,.78); }
/* Areas escolhidas ficam com fundo claro: o numero volta a' cor normal (antes branco sobre claro) */
.pe-chip.pe-area.is-on .qb-n { color: var(--pe-ink-2); }

/* Temas agrupados por area (varias areas escolhidas) */
.qb-grupos { display: grid; gap: 8px; grid-column: 1 / -1; }
.qb-grp { border: 1px solid var(--pe-line); border-left: 4px solid var(--pe-area); border-radius: 14px; background: var(--pe-surface); }
.qb-grp > summary { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; cursor: pointer; list-style: none; border-radius: 10px; }
.qb-grp > summary::-webkit-details-marker { display: none; }
.qb-grp > summary:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 2px; }
.qb-grp__t { font-size: 14px; font-weight: 500; color: var(--pe-ink); }
.qb-grp > summary .pe-i { margin-left: auto; color: var(--pe-ink-3); transition: transform .2s; }
.qb-grp[open] > summary .pe-i { transform: rotate(180deg); }
.qb-grp > .qb-picks { padding: 2px 10px 10px; }
/* Opcao B: cabecalho do grupo tingido com a cor da area (texto secundario em --pe-ink-2). */
.qb-grp.pe-area { overflow: hidden; border-color: var(--pe-area-line); border-left-color: var(--pe-area); }
.qb-grp.pe-area > summary { border-radius: 0; background: var(--pe-area-tint); }
.qb-grp.pe-area > summary:focus-visible { outline-offset: -3px; }
.qb-grp.pe-area > summary .qb-n, .qb-grp.pe-area > summary .pe-i { color: var(--pe-ink-2); }
.qb-grp.pe-area[open] > summary { border-bottom: 1px solid var(--pe-area-line); }
.qb-grp.pe-area > .qb-picks { padding-top: 10px; }

.qb-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qb-pick { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--pe-line); background: var(--pe-surface); color: var(--pe-ink-2); font-family: inherit; font-size: .875em; font-weight: 400; line-height: 1.35; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.qb-pick:hover { border-color: var(--pe-blue-strong); }
.qb-pick__box { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--pe-line-2); color: transparent; flex: none; }
.qb-pick__box .pe-i { width: 14px; height: 14px; stroke-width: 2.4; }
.qb-pick__t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qb-pick.is-on { border-color: var(--pe-blue-strong); background: var(--pe-blue-soft); color: var(--pe-ink); }
.qb-pick.is-on .qb-pick__box { background: var(--pe-blue-strong); border-color: var(--pe-blue-strong); color: #fff; }
.qb-more { margin-top: 12px; }
/* Aulas dentro do tema escolhido: linha inteira logo a seguir ao tema; os temas seguintes preenchem
   o lugar vazio ao lado (dense), por isso o painel aparece por baixo da linha do tema */
.qb-picks { grid-auto-flow: row dense; }
.qb-aulas-tema { grid-column: 1 / -1; padding: 12px 12px 10px; border-radius: 14px; background: var(--pe-blue-soft); border: 1px solid var(--pe-line); }
.qb-aulas-tema__h { margin: 0 2px 8px; font-size: 12.5px; font-weight: 600; color: var(--pe-ink); }
.qb-aulas-tema__h span { font-weight: 400; color: var(--pe-ink-3); }
.qb-aulas-tema .qb-more { margin-top: 6px; }
.qb-picks--aulas { gap: 6px; }
.qb-picks--aulas .qb-pick { min-height: 40px; padding: 8px 12px; font-size: .8125em; background: var(--pe-surface); }
/* Cores da area (capitulo) nos temas e aulas escolhidos; seta do tema escolhido; limpar */
.pe-area .qb-pick:hover { border-color: var(--pe-area); }
.pe-area .qb-pick.is-on { border-color: var(--pe-area); background: var(--pe-area-tint); }
.pe-area .qb-pick.is-on .qb-pick__box { background: var(--pe-area-ink); border-color: var(--pe-area-ink); }
.pe-area .qb-aulas-tema { background: var(--pe-area-tint); border-color: var(--pe-area-line); }
.pe-area .qb-aulas-tema .qb-pick.is-on { background: var(--pe-surface); }
.qb-pick__abre { display: inline-grid; place-items: center; flex: none; color: var(--pe-area-ink, var(--pe-blue-strong)); transition: transform .2s var(--pe-ease); }
.qb-pick__abre.is-open { transform: rotate(180deg); }
.qb-step__titulo { display: flex; align-items: center; gap: 10px; }
.qb-limpar { width: 32px; height: 32px; }
.qb-limpar[hidden] { display: none; }
.qb-empty { font-size: 13.5px; color: var(--pe-ink-3); }

.qb-session { position: sticky; top: 24px; display: grid; gap: 20px; padding: 26px; }
.qb-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 13.5px; color: var(--pe-ink-2); margin-top: 8px; overflow-wrap: anywhere; }
.qb-path .pe-i { color: var(--pe-ink-3); }
.qb-avail { display: flex; align-items: baseline; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--pe-line); }
.qb-avail .pe-num { font-size: 60px; }
.qb-avail p { font-size: 14px; color: var(--pe-ink-2); line-height: 1.35; }
.qb-qty { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qb-qty .pe-input { width: 84px; min-height: 42px; padding: 8px 10px; text-align: center; font-variant-numeric: tabular-nums; }
.qb-seg { display: flex; width: 100%; }
.qb-seg button { flex: 1; min-height: 36px; }
.pe-seg button { font-family: inherit; }
.pe-seg button:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 1px; }
.qb-opt { font-weight: 400; color: var(--pe-ink-3); }
.qb-start .pe-i { width: 18px; height: 18px; }
.qb-cta { display: none; }

@media (max-width: 1100px) {
  .qb-config { grid-template-columns: minmax(0, 1fr); }
  .qb-session { position: static; }
}
/* Barra de Iniciar por cima do menu de baixo: so' onde ha' menu de baixo (ate 768 px) */
@media (max-width: 768px) {
  #config-screen .qb-main { padding-bottom: 150px; }
  .qb-session .qb-start, .qb-session .qb-foot { display: none; }
  .qb-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 80; padding: 8px 8px 8px 20px; border-radius: var(--pe-r-pill); background: var(--pe-navy); color: #fff; box-shadow: var(--pe-shadow-lift); }
  .qb-cta p { min-width: 0; font-size: 13px; line-height: 1.3; color: rgba(255,255,255,.8); }
  .qb-cta b { display: block; color: #fff; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .qb-cta .pe-btn { flex: none; }
  .qb-cta .pe-btn[disabled] { background: rgba(255,255,255,.18); color: rgba(255,255,255,.7) !important; }
}
@media (max-width: 768px) {
  .qb-main { padding: 18px 16px 40px; }
  #config-screen .qb-main { padding-bottom: 160px; }
}
@media (max-width: 599px) {
  .qb-picks { grid-template-columns: minmax(0, 1fr); }
  .qb-step { padding: 18px 16px 20px; }
  .qb-step .pe-card__num { font-size: 44px; top: 8px; right: 12px; }
  .qb-step__head { padding-right: 56px; }
  .qb-session { padding: 20px 16px; }
  .qb-head { align-items: flex-start; }
  .qb-head .qb-textsize__l { display: none; }
  .qb-avail .pe-num { font-size: 48px; }
}

/* ---------- Pergunta ---------- */
#question-screen.active { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
.qb-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px; border-bottom: 1px solid var(--pe-line); background: rgba(var(--pe-bg-rgb), .86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); flex: none; font-size: 16px; }
.qb-top__l, .qb-top__r { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qb-top__l { flex: 1; }
.qb-count { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: var(--pe-r-pill); border: 1px solid var(--pe-line); background: var(--pe-surface); color: var(--pe-ink); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qb-count:hover { border-color: var(--pe-line-2); }
.qb-count .pe-i { color: var(--pe-blue-strong); }
.qb-count small { font-size: 13px; font-weight: 400; color: var(--pe-ink-3); }
.qb-prog { display: grid; gap: 5px; width: 220px; }
.qb-prog .pe-small { font-size: 12px; font-variant-numeric: tabular-nums; }
.qb-prog .pe-bar > i { transition: width .4s var(--pe-ease); }
.qb-streak { display: none; }
.qb-streak.is-on { display: inline-flex; }
.qb-timers { display: flex; align-items: center; gap: 8px; }
.qb-timers.timer-hidden .pe-timer { visibility: hidden; }
.qb-top .pe-timer { padding: 7px 12px; font-size: 13.5px; }
.qb-timer-l { font-size: 11px; font-weight: 400; color: var(--pe-ink-3); }
.qb-top .pe-iconbtn { width: 38px; height: 38px; }
.pe-iconbtn .pe-i { width: 18px; height: 18px; }
.pe-iconbtn[aria-pressed="true"] { background: var(--pe-navy); border-color: var(--pe-navy); color: #fff; }
@media (min-width: 900px) { .qb-mobile-only { display: none !important; } }

#session-save-status { flex: none; padding: 8px 28px; font-size: 13px; background: var(--pe-flag-bg); color: var(--pe-flag); }
#session-save-status:empty { display: none; }

.qb-stage { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 28px 40px; container: qs / inline-size; }
.qb-card.pe-q { padding: 24px 32px 28px; max-width: 880px; margin: 0 auto; }
.qb-qhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; min-height: 36px; }
.qb-qhead__tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.qb-tbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 12px; border-radius: var(--pe-r-pill); border: 1px solid var(--pe-line-2); background: var(--pe-surface); color: var(--pe-ink-2); font-family: inherit; font-size: 13px; font-weight: 400; cursor: pointer; }
.qb-tbtn:hover { border-color: var(--pe-ink-3); color: var(--pe-ink); }
.qb-tbtn.is-flag { background: var(--pe-flag-bg); border-color: var(--pe-flag-line); color: var(--pe-flag); }
.qb-tbtn.is-flag .pe-i { fill: currentColor; }

.question-text { position: relative; isolation: isolate; cursor: text; -webkit-user-select: text; user-select: text; font-size: .9375em; line-height: 1.6; color: var(--pe-ink); font-weight: 400; text-align: left; overflow-wrap: anywhere; }
.question-text p { margin: 0 0 12px; }
.question-text p:last-child { margin-bottom: 0; }
.question-text::selection, .question-text *::selection { background: rgba(250, 204, 21, .4); }
.question-text img, .justification-text img, .justification-modal-body img { display: block; max-width: 100%; height: auto; margin: 14px auto; border-radius: 12px; border: 1px solid var(--pe-line); cursor: zoom-in; }
.question-text figure.table, .justification-text figure.table, .justification-modal-body figure.table { margin: 14px 0; overflow-x: auto; }
.question-text table, .justification-text table, .justification-modal-body table { border-collapse: collapse; width: 100%; font-size: .9em; background: var(--pe-surface); }
.question-text table th, .question-text table td,
.justification-text table th, .justification-text table td,
.justification-modal-body table th, .justification-modal-body table td { padding: 8px 12px; border: 1px solid var(--pe-line-2); text-align: left; vertical-align: top; }
.question-text table tr:first-child td:first-child, .question-text table thead td, .question-text table thead th,
.justification-text table tr:first-child td:first-child, .justification-modal-body table tr:first-child td:first-child { background: var(--pe-sunk); font-weight: 500; color: var(--pe-ink); }
.question-text table tr:nth-child(even) td, .justification-text table tr:nth-child(even) td { background: #fafbfd; }
.hl-layer { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.hl-rect { position: absolute; border-radius: 3px; background: #fde68a; }
.hl-toolbar { display: none !important; }
.qb-hint { margin-top: 10px; font-size: 12.5px; color: var(--pe-ink-3); }

.qb-anshead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.qb-anshead h2 { font-size: 12px; }
.qb-colegas { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--pe-ink-3); }
.qb-colegas:empty { display: none; }

.qb-opts { display: grid; gap: 8px; }
.qb-optrow { position: relative; display: flex; align-items: stretch; gap: 6px; }
.qb-optrow .pe-opt { position: relative; overflow: hidden; flex: 1; min-width: 0; align-items: center; min-height: 54px; padding: 11px 16px; font-family: inherit; font-size: .9375em; }
.qb-optrow .pe-opt:focus-visible { outline: 2px solid var(--pe-blue-strong); outline-offset: 2px; }
.pe-opt__l { background: var(--pe-surface); }
.pe-opt .pe-opt__t { padding-top: 0; min-width: 0; overflow-wrap: anywhere; }
.pe-opt__pct { padding-top: 0; font-size: 13.5px; font-weight: 500; color: var(--pe-ink-2); min-width: 3.2em; text-align: right; }
.qb-optnote { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; white-space: nowrap; flex: none; }
.qb-optnote .pe-i { width: 14px; height: 14px; stroke-width: 2.2; }
.is-ok .qb-optnote, .is-ok .pe-opt__pct { color: var(--pe-ok); }
.is-bad .qb-optnote, .is-bad .pe-opt__pct { color: var(--pe-bad); }
.qb-optbar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p, 0%); background: var(--pe-line-2); border-radius: 0 3px 3px 0; }
.is-ok .qb-optbar { background: var(--pe-ok); }
.is-bad .qb-optbar { background: var(--pe-bad); }
.qb-optrow.is-feedback .pe-opt { cursor: default; }
.qb-optrow.is-feedback .pe-opt:hover { box-shadow: none; border-color: var(--pe-line-2); }
.qb-optrow.is-feedback .pe-opt.is-ok:hover { border-color: var(--pe-ok-line); }
.qb-optrow.is-feedback .pe-opt.is-bad:hover { border-color: var(--pe-bad-line); }
.qb-optrow.is-review .pe-opt { cursor: default; }
.pe-opt.is-crossed { opacity: .5; }
.pe-opt.is-crossed .pe-opt__t { text-decoration: line-through; text-decoration-color: var(--pe-ink-3); }
.qb-cross { flex: none; display: grid; place-items: center; width: 40px; border-radius: 14px; border: 1px solid transparent; background: none; color: var(--pe-ink-3); cursor: pointer; }
.qb-cross:hover { color: var(--pe-bad); background: var(--pe-bad-bg); }
.qb-cross[aria-pressed="true"] { color: var(--pe-ink); background: var(--pe-sunk); }
.qb-cross .pe-i { width: 18px; height: 18px; }
.qb-keys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--pe-ink-3); }
.qb-keys span { display: inline-flex; align-items: center; gap: 4px; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--pe-line-2); border-bottom-width: 2px; background: var(--pe-surface); font-family: var(--pe-font); font-size: 11px; font-weight: 500; color: var(--pe-ink); }

/* Antes de responder, em ecra largo: enunciado a' esquerda, opcoes a' direita.
   Depois de responder (.revelada): tudo numa coluna, como em producao desde 29/09. */
@container qs (min-width: 1100px) {
  .question-main:not(.revelada) .qb-card.pe-q { max-width: 1240px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 36px; }
  .question-main:not(.revelada) .qb-card__a { border-left: 1px solid var(--pe-line); padding-left: 36px; }
  .question-main:not(.revelada) .qb-anshead { margin-top: 0; }
}

.justification { display: none; margin-top: 22px; padding: 18px 22px; border-left: 3px solid var(--pe-line-2); }
.justification.show { display: block; }
.justification.correct { border-left-color: var(--pe-ok-line); }
.justification.incorrect { border-left-color: var(--pe-bad-line); }
.justification.unanswered { border-left-color: var(--pe-flag-line); }
.qb-just__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.qb-just__head h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; font-weight: 500; color: var(--pe-ink); }
.qb-just__tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qb-just__tools .pe-iconbtn { width: 36px; height: 36px; background: var(--pe-surface); }
.qb-just__tools .pe-iconbtn.copied { background: var(--pe-ok-bg); border-color: var(--pe-ok-line); color: var(--pe-ok); }
.qb-just__tools .pe-chip { font-family: inherit; }
.justification-text { font-size: .9375em; line-height: 1.7; color: var(--pe-ink-2); overflow-wrap: anywhere; }
.justification-text p { margin: 0 0 12px; }
.justification-text p:last-child { margin-bottom: 0; }

/* Barra de baixo */
.qb-bottom { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 10px 28px; border-top: 1px solid var(--pe-line); background: rgba(var(--pe-bg-rgb), .92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); font-size: 16px; }
.qb-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.qb-tool { display: grid; justify-items: center; gap: 2px; min-width: 56px; padding: 6px 8px; border: 0; border-radius: 12px; background: none; color: var(--pe-ink-3); font-family: inherit; font-size: 11px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.qb-tool .pe-i { width: 20px; height: 20px; color: var(--pe-ink-2); }
.qb-tool:hover { background: var(--pe-glass-2); color: var(--pe-ink); }
.qb-tool[aria-pressed="true"] { background: var(--pe-blue-soft); color: var(--pe-blue-strong); }
.qb-tool[aria-pressed="true"] .pe-i { color: var(--pe-blue-strong); }
.qb-tool:disabled { opacity: .4; cursor: default; }
.qb-nav { display: flex; align-items: center; gap: 8px; }
.qb-nav .pe-btn--ghost { gap: 8px; font-variant-numeric: tabular-nums; }
.qb-actions { display: flex; justify-content: flex-end; gap: 8px; }
.qb-actions .pe-btn { font-family: var(--pe-font); }

/* Voxi aberta ao lado (computador): a barra encolhe os textos */
@media (min-width: 1101px) and (max-width: 1480px) {
  body.voxi-pane-open .qb-tool { min-width: 44px; font-size: 0; gap: 0; }
  body.voxi-pane-open .qb-prog { width: 150px; }
  body.voxi-pane-open .qb-streak { display: none; }
}
@media (min-width: 1101px) and (max-width: 1300px) {
  body.voxi-pane-open .qb-top .qb-desk-only.pe-timer, body.voxi-pane-open .qb-prog .pe-small { display: none; }
  body.voxi-pane-open .qb-nav .qb-folha-l { display: none; }
  body.voxi-pane-open .qb-bottom { gap: 8px; padding-left: 16px; padding-right: 16px; }
}

/* Folha de respostas (durante a sessao) */
.nav-modal { position: fixed; left: 50%; bottom: 84px; z-index: 1200; width: min(420px, calc(100vw - 24px)); transform: translateX(-50%) translateY(12px); padding: 18px; border-radius: var(--pe-r-lg); background: var(--pe-surface); border: 1px solid var(--pe-line); box-shadow: 0 30px 80px rgba(12,44,61,.22); opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s, visibility .2s; }
.nav-modal.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
@media (min-width: 1101px) { body.voxi-pane-open .nav-modal { left: calc((100vw - var(--voxi-pane-w, 400px)) / 2); } }
.qb-folha-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.qb-folha-head h2 { font-size: 15px; font-weight: 600; color: var(--pe-ink); letter-spacing: -.005em; }
.nav-modal .pe-qnav { grid-template-columns: repeat(5, minmax(0, 1fr)); max-height: 46vh; overflow-y: auto; padding: 4px; }
.pe-qnav button { display: grid; place-items: center; height: 38px; border-radius: 10px; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--pe-ink-2); background: var(--pe-surface); border: 1px solid var(--pe-line); cursor: pointer; font-variant-numeric: tabular-nums; }
.pe-qnav button:hover { border-color: var(--pe-line-2); }
.pe-qnav .is-done { background: var(--pe-blue-soft); border-color: transparent; color: var(--pe-blue-strong); }
.pe-qnav .is-ok { background: var(--pe-ok-bg); border-color: transparent; color: var(--pe-ok); }
.pe-qnav .is-bad { background: var(--pe-bad-bg); border-color: transparent; color: var(--pe-bad); }
.pe-qnav .is-flag { box-shadow: inset 0 0 0 1.5px var(--pe-flag); }
.pe-qnav .is-now { background: var(--pe-navy); border-color: var(--pe-navy); color: #fff; }
.qb-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--pe-ink-3); }
.qb-legend span { display: inline-flex; align-items: center; gap: 6px; }
.qb-sw { width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--pe-line); background: var(--pe-surface); }
.qb-sw.is-ok { background: var(--pe-ok-bg); border-color: var(--pe-ok-line); }
.qb-sw.is-bad { background: var(--pe-bad-bg); border-color: var(--pe-bad-line); }
.qb-sw.is-done { background: var(--pe-blue-soft); border-color: transparent; }
.qb-sw.is-flag { box-shadow: inset 0 0 0 1.5px var(--pe-flag); border-color: transparent; }

/* Menu "Mais" no telemovel */
.qb-sheet { position: fixed; inset: 0; z-index: 1300; display: none; align-items: flex-end; }
.qb-sheet.show { display: flex; }
.qb-sheet__box { width: 100%; max-height: 80vh; overflow-y: auto; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); border-radius: var(--pe-r-lg) var(--pe-r-lg) 0 0; background: var(--pe-surface); box-shadow: 0 -20px 60px rgba(12,44,61,.2); }
.qb-sheet__grip { width: 40px; height: 4px; margin: 2px auto 10px; border-radius: 2px; background: var(--pe-line-2); }
.qb-sheet__item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--pe-ink); font-family: inherit; font-size: 15px; font-weight: 400; text-align: left; cursor: pointer; }
.qb-sheet__item:hover { background: var(--pe-bg); }
.qb-sheet__item .pe-i { color: var(--pe-ink-3); }
.qb-sheet__item:disabled { opacity: .45; }
.qb-sheet__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 15px; color: var(--pe-ink); }

/* ---------- Voxi (painel ao lado; o conteudo vem do voxi-widget.js) ---------- */
body.voxi-pane-open .screen.active { width: calc(100vw - var(--voxi-pane-w, 400px)); transition: width .18s ease; }
body.voxi-pane-resizing .screen.active, body.voxi-pane-resizing #voxi-pane { transition: none !important; user-select: none; }
body.voxi-pane-resizing #voxi-pane .voxi-pane-host { pointer-events: none; }
body.voxi-pane-open.voxi-pane-max .screen.active { width: 0; visibility: hidden; }
#voxi-pane { position: fixed; top: 0; right: 0; bottom: 0; z-index: 950; width: var(--voxi-pane-w, 400px); max-width: 100vw; display: flex; flex-direction: column; background: var(--pe-surface); border-left: 1px solid var(--pe-line); box-shadow: -12px 0 32px rgba(12,44,61,.06); font-family: var(--pe-font); transform: translateX(100%); visibility: hidden; transition: transform .28s var(--pe-ease), width .18s ease, visibility .28s; }
#voxi-pane.active { transform: translateX(0); visibility: visible; }
body.voxi-pane-max #voxi-pane { width: 100vw; }
#voxi-pane .voxi-pane-resizer { position: absolute; top: 0; left: -4px; bottom: 0; z-index: 5; width: 8px; cursor: ew-resize; }
#voxi-pane .voxi-pane-resizer::before { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
#voxi-pane .voxi-pane-resizer:hover::before, body.voxi-pane-resizing #voxi-pane .voxi-pane-resizer::before { background: var(--pe-blue-strong); }
body.voxi-pane-max #voxi-pane .voxi-pane-resizer { display: none; }
#voxi-pane .voxi-pane-header { display: flex; align-items: center; gap: 10px; min-height: 63px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--pe-line); background: var(--pe-surface); }
#voxi-pane .voxi-pane-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--pe-blue); color: #fff; flex: none; }
#voxi-pane .voxi-pane-icon .pe-i { width: 18px; height: 18px; }
#voxi-pane .voxi-pane-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--pe-ink); }
#voxi-pane .voxi-pane-title span { display: block; font-size: 12px; font-weight: 400; color: var(--pe-ink-3); }
#voxi-pane .voxi-pane-title span:empty { display: none; }
#voxi-pane .voxi-pane-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--pe-ink-2); cursor: pointer; }
#voxi-pane .voxi-pane-btn:hover { background: var(--pe-bg); color: var(--pe-ink); }
#voxi-pane .voxi-pane-btn .pe-i { width: 18px; height: 18px; }
#voxi-pane .voxi-pane-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
@media (max-width: 1100px) {
  body.voxi-pane-open .screen.active { width: 100%; }
  #voxi-pane { width: 100vw; }
  #voxi-pane .voxi-pane-resizer, #voxi-pane #voxi-pane-max-btn { display: none; }
}

/* ---------- Resultados ---------- */
.qb-res-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.qb-score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; align-items: center; padding: 28px; }
.qb-score .pe-ring { --size: 156px; }
.qb-score .pe-ring::before { inset: 10px; }
.qb-score .pe-ring > span { font-size: 40px; }
.qb-ring-l { display: block; margin-top: 10px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--pe-ink-3); }
.qb-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 18px; }
.qb-kpis .pe-kpi { align-content: start; }
.qb-kpis .pe-kpi__value { font-size: 34px; }
.qb-kpis .is-ok .pe-kpi__value { color: var(--pe-ok); }
.qb-kpis .is-bad .pe-kpi__value { color: var(--pe-bad); }
.qb-folha { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.qb-folha .pe-card__head { margin: 0; flex-wrap: wrap; }
.qb-folha .pe-qnav { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.qb-folha .pe-note { margin-top: auto; font-size: 13.5px; }
.qb-review { padding: 24px; }
.qb-review__bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.qb-review__bar .pe-search { width: 300px; max-width: 100%; }
.qb-review__bar .pe-input { min-height: 42px; font-size: 14px; }
.qb-review .qb-chips { margin: 14px 0 6px; }
.qb-review .qb-chips .pe-chip { min-height: 38px; }
.qb-rows > li { padding: 0; }
.qb-row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 6px; border: 0; border-radius: 12px; background: none; color: inherit; font-family: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: background .2s; }
.qb-row:hover { background: var(--pe-bg); }
.qb-row__n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--pe-sunk); color: var(--pe-ink-2); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; flex: none; }
.qb-row.is-ok .qb-row__n { background: var(--pe-ok-bg); color: var(--pe-ok); }
.qb-row.is-bad .qb-row__n { background: var(--pe-bad-bg); color: var(--pe-bad); }
.qb-row__t { flex: 1; min-width: 0; color: var(--pe-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-row__flag { color: var(--pe-flag); }
.qb-row > .pe-i:last-child { color: var(--pe-ink-3); }
.qb-review .pe-empty { padding: 28px 12px; }
.qb-foot2 { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--pe-line); }
#results-screen.qb-so-revisao .qb-res-top, #results-screen.qb-so-revisao .qb-headtools .pe-btn--ghost, #results-screen.qb-so-revisao #review-filters, #results-screen.qb-so-revisao .qb-review .pe-search { display: none; }

@media (max-width: 1180px) {
  .qb-res-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 899px) {
  .qb-headtools .qb-res-metricas { display: none; }
}
@media (max-width: 599px) {
  .qb-headtools { width: 100%; }
  .qb-headtools .pe-btn { flex: 1; }
  .qb-score { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 22px; padding: 22px 18px; }
  .qb-score .pe-ring { --size: 136px; }
  .qb-kpis { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
  .qb-kpis .pe-kpi__value { font-size: 30px; }
  .qb-folha, .qb-review { padding: 18px 16px; }
  .qb-folha .pe-qnav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .qb-review__bar .pe-search { width: 100%; }
  .qb-row { gap: 12px; padding: 12px 2px; }
  .qb-row .pe-tag { display: none; }
}

/* ---------- Janelas ---------- */
.qb-dialog { position: fixed; inset: 0; z-index: 1300; display: none; align-items: center; justify-content: center; padding: 16px; }
.qb-dialog.show { display: flex; }
.qb-dialog__box { position: relative; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
.qb-dialog__box h2 { font-size: 22px; font-weight: 400; letter-spacing: -.02em; color: var(--pe-ink); margin-bottom: 8px; }
.qb-dialog__box > p { font-size: 14.5px; color: var(--pe-ink-2); }
.qb-dialog__ico { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; background: var(--pe-blue-soft); color: var(--pe-blue-strong); }
.qb-dialog__ico.is-ok { background: var(--pe-ok-bg); color: var(--pe-ok); }
.qb-dialog__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; }
.qb-dialog__acts { display: grid; gap: 8px; margin-top: 22px; }
.qb-dialog__acts .pe-btn { width: 100%; }
.qb-dialog__acts--row { display: flex; justify-content: flex-end; flex-wrap: wrap; }
.qb-dialog__acts--row .pe-btn { width: auto; }
.qb-stats { display: grid; gap: 6px; margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--pe-bg); font-size: 14px; color: var(--pe-ink-2); }
.qb-stats > div { display: flex; justify-content: space-between; gap: 12px; }
.qb-stats b { font-weight: 500; font-variant-numeric: tabular-nums; }
.qb-stats .is-bad { color: var(--pe-bad); }
.qb-stats .is-ok { color: var(--pe-ok); }
.qb-stats__t { font-weight: 500; color: var(--pe-ink); overflow-wrap: anywhere; }

/* Avaliar a pergunta */
.feedback-rating { display: flex; gap: 8px; margin: 14px 0 16px; }
.feedback-star { flex: 1; display: grid; place-items: center; height: 44px; border-radius: 12px; border: 1px solid var(--pe-line-2); background: var(--pe-surface); color: var(--pe-ink); font-family: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s, border-color .2s; }
.feedback-star:hover { border-color: var(--pe-ink-3); }
.feedback-star.selected { background: var(--pe-flag-bg); border-color: var(--pe-flag-line); color: var(--pe-flag); }
#feedback-question-id { margin: 2px 0 0; font-size: 12px; color: var(--pe-ink-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
#feedback-question-id:empty { display: none; }

/* Justificacao em ecra inteiro */
.justification-modal .qb-dialog__box { width: min(900px, 100%); padding: 0; display: flex; flex-direction: column; overflow: hidden; font-size: var(--qbank-text-size); }
.justification-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 16px 24px; border-bottom: 1px solid var(--pe-line); border-left: 4px solid var(--pe-line-2); }
.justification-modal-header.correct { border-left-color: var(--pe-ok); }
.justification-modal-header.incorrect { border-left-color: var(--pe-bad); }
.justification-modal-header h2 { margin: 0; font-size: 18px; }
.justification-modal-body { flex: 1; overflow-y: auto; padding: 24px; font-size: 1em; line-height: 1.75; color: var(--pe-ink-2); overflow-wrap: anywhere; }
.justification-modal-body p { margin: 0 0 12px; }
@media (max-width: 768px) {
  .justification-modal { padding: 0; }
  .justification-modal .qb-dialog__box { width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .justification-modal-body { padding: 18px 16px; }
}

/* Paineis laterais: Lab e Nota */
.qb-panel { position: fixed; inset: 0; z-index: 1300; visibility: hidden; pointer-events: none; }
.qb-panel.show { visibility: visible; pointer-events: auto; }
.qb-panel__scrim { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; }
.qb-panel.show .qb-panel__scrim { opacity: 1; }
.qb-panel__box { position: absolute; top: 0; right: 0; bottom: 0; width: 520px; max-width: 100vw; display: flex; flex-direction: column; background: var(--pe-surface); box-shadow: -20px 0 60px rgba(12,44,61,.16); transform: translateX(100%); transition: transform .28s var(--pe-ease); }
.qb-panel.show .qb-panel__box { transform: translateX(0); }
.qb-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--pe-line); flex: none; }
.qb-panel__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qb-panel__title h2 { font-size: 16px; font-weight: 600; letter-spacing: -.005em; color: var(--pe-ink); }
.qb-panel__title p { font-size: 12.5px; color: var(--pe-ink-3); }
.qb-panel__acts { display: flex; align-items: center; gap: 6px; flex: none; }
.qb-panel__acts .pe-iconbtn { width: 38px; height: 38px; }
.qb-panel__body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.qb-panel__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--pe-line); flex: none; }
.qb-panel__note { padding: 10px 20px; border-top: 1px solid var(--pe-line); font-size: 12px; color: var(--pe-ink-3); text-align: center; flex: none; }
.notas-question-preview { margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; background: var(--pe-bg); font-size: 13.5px; color: var(--pe-ink-2); overflow-wrap: anywhere; }
.notas-question-preview b { font-weight: 500; }
.notas-hint { margin-top: 8px; font-size: 12.5px; color: var(--pe-ink-3); }
#nota-input { min-height: 180px; }
@media (max-width: 768px) {
  .qb-panel__box { width: 100vw; }
  .qb-panel__title p { display: none; }
}

/* Tabela do Lab (conteudo em lab.html, sem alteracoes de valores) */
.lab-content h1 { font-size: 16px; font-weight: 600; color: var(--pe-ink); margin: 0 0 4px; letter-spacing: -.005em; }
.lab-content .lab-subtitle { font-size: 12px; color: var(--pe-ink-3); margin: 0 0 14px; }
.lab-content h2 { margin: 20px 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--pe-line); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--pe-blue-strong); }
.lab-content h2:first-of-type { margin-top: 6px; }
.lab-content table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.lab-content thead th { position: sticky; top: -18px; padding: 7px 8px; background: var(--pe-surface); border-bottom: 1px solid var(--pe-line-2); font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pe-ink-3); text-align: left; }
.lab-content tbody td { padding: 6px 8px; border-bottom: 1px solid var(--pe-line); vertical-align: top; line-height: 1.4; color: var(--pe-ink-2); }
.lab-content tbody td.lab-param { width: 38%; font-weight: 500; color: var(--pe-ink); }
.lab-content tbody td.lab-conv, .lab-content tbody td.lab-si { width: 31%; font-variant-numeric: tabular-nums; }
.lab-content tbody td.lab-si { color: var(--pe-ink-3); }
.lab-content tbody td.lab-sub { padding-left: 18px; }
.lab-content tbody td.lab-cont { padding-left: 18px; color: var(--pe-ink-3); }

/* Avisos */
.qb-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 1400; transform: translateX(-50%); max-width: calc(100vw - 32px); animation: qb-toast-in .25s var(--pe-ease); transition: opacity .3s, transform .3s; }
.qb-toast .pe-i { width: 18px; height: 18px; flex: none; }
.qb-toast.is-ok .pe-i { color: #8fe0b6; }
.qb-toast.is-bad .pe-i { color: #ffb3aa; }
.qb-toast.is-out { opacity: 0; transform: translateX(-50%) translateY(12px); }
@keyframes qb-toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } }
@media (max-width: 768px) {
  body.qb-ecra-config .qb-toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
}

/* ---------- Telemovel: pergunta ---------- */
@media (max-width: 899px) {
  .qb-desk-only { display: none !important; }
  #question-screen.active { display: block; height: auto; min-height: 100vh; min-height: 100dvh; }
  .qb-top { position: sticky; top: 0; z-index: 40; padding: 10px 12px; gap: 8px; }
  .qb-top__l { gap: 10px; }
  .qb-top__r { gap: 6px; }
  .qb-count { padding: 7px 12px 7px 8px; font-size: 13.5px; }
  .qb-prog { position: absolute; left: 0; right: 0; bottom: -1px; width: auto; gap: 0; }
  .qb-prog .pe-bar { border-radius: 0; background: transparent; height: 3px; }
  .qb-prog .pe-small { display: none; }
  .qb-streak.is-on { display: none; }
  .qb-top .pe-timer { padding: 6px 10px; font-size: 13px; }
  .qb-top .pe-iconbtn { width: 36px; height: 36px; }
  .qb-top .pe-btn--link { min-height: 36px; padding: 0 4px; }
  #session-save-status { padding: 8px 16px; }
  .qb-stage { padding: 14px 10px calc(var(--qb-bar-h) + 40px + env(safe-area-inset-bottom)); overflow: visible; }
  .qb-card.pe-q { padding: 18px 16px 20px; border-radius: var(--pe-r); }
  .qb-qhead { margin-bottom: 12px; }
  .qb-tbtn .qb-tbtn__l { display: none; }
  .qb-tbtn { width: 38px; padding: 0; justify-content: center; }
  .qb-anshead { margin-top: 20px; }
  .qb-optrow .pe-opt { padding: 11px 12px; gap: 12px; }
  .qb-cross { width: 36px; }
  .justification { padding: 16px; }
  .qb-just__head { align-items: flex-start; }
  .qb-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .qb-tools { gap: 2px; flex: none; }
  .qb-tool { min-width: 50px; padding: 5px 4px; }
  .qb-actions { flex: 1; min-width: 0; }
  .qb-actions .pe-btn { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .nav-modal { bottom: calc(var(--qb-bar-h) + 16px + env(safe-area-inset-bottom)); }
  .qb-toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 599px) {
  .qb-optnote { font-size: 0; gap: 0; }
  .qb-optnote .pe-i { width: 16px; height: 16px; }
  .pe-opt__pct { min-width: 2.6em; }
}
@media (max-width: 360px) {
  .qb-tool { min-width: 44px; font-size: 10px; }
  .qb-top .pe-timer .pe-i { display: none; }
}

@media print {
  .qb-top, .qb-bottom, .qb-cta, #voxi-pane { display: none !important; }
}

/* A pergunta ocupa o ecra; a ajuda do teclado fica recolhida na barra inferior. */
.qb-stage { padding: 16px 20px 24px; }
.qb-card.pe-q { width: 100%; max-width: 1180px; padding: 24px 28px; }
@container qs (min-width: 900px) {
  .question-main:not(.revelada) .qb-card.pe-q { max-width: none; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 28px; }
  .question-main:not(.revelada) .qb-card__a { border-left: 1px solid var(--pe-line); padding-left: 28px; }
  .question-main:not(.revelada) .qb-anshead { margin-top: 0; }
}
.qb-shortcuts { flex: none; padding: 4px 28px; border-top: 1px solid var(--pe-line); color: var(--pe-ink-3); font-size: 11px; background: var(--pe-bg); }
.qb-shortcuts summary { cursor: pointer; width: fit-content; margin-left: auto; padding: 4px; }
.qb-shortcuts .qb-keys { margin: 0 0 6px; justify-content: flex-end; font-size: 11px; }
.qb-shortcuts kbd { height: 18px; min-width: 18px; font-size: 10px; }
.qb-shortcuts[hidden], #answers-coorte[hidden] { display: none; }
/* Notas sem modal: pergunta e respostas continuam visiveis e utilizaveis. */
body { --qb-note-width: clamp(340px, 28vw, 460px); }
#notas-modal, #notas-modal.show { pointer-events: none; }
#notas-modal .qb-panel__box { pointer-events: auto; width: var(--qb-note-width); border-left: 1px solid var(--pe-line); box-shadow: none; }
#notas-modal .notas-question-preview { max-height: 120px; overflow-y: auto; }
body.notes-pane-open #question-screen, body.notes-pane-open #results-screen { margin-right: var(--qb-note-width); }
body.notes-pane-open .qb-bottom { gap: 8px; padding-left: 12px; padding-right: 12px; }
body.notes-pane-open .qb-tools { gap: 0; }
body.notes-pane-open .qb-tool { padding-left: 6px; padding-right: 6px; }
@media (max-width: 899px) {
  .qb-stage { padding: 12px; }
  .qb-card.pe-q { padding: 18px; }
  body.notes-pane-open #question-screen, body.notes-pane-open #results-screen { margin-right: 0; }
  body.notes-pane-open #question-screen.active { height: 56dvh; min-height: 0; overflow: hidden; }
  body.notes-pane-open #question-screen .qb-stage { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 12px; }
  body.notes-pane-open #question-screen .qb-bottom { position: relative; bottom: auto; }
  body.notes-pane-open #results-screen { padding-bottom: 46dvh; }
  #notas-modal .qb-panel__box { width: 100%; top: auto; height: 44dvh; border-left: 0; border-top: 1px solid var(--pe-line); }
  #notas-modal .qb-panel__head { padding: 8px 14px; }
  #notas-modal .qb-panel__body { padding: 10px 14px; }
  #notas-modal .notas-question-preview { max-height: 48px; overflow-y: auto; padding: 6px; font-size: 11px; }
  #nota-input { min-height: 90px; }
}

/* Lab tambem sem modal (como as notas): a pergunta e as respostas continuam a' vista. */
body { --qb-lab-width: clamp(380px, 32vw, 520px); }
#lab-modal, #lab-modal.show { pointer-events: none; }
#lab-modal .qb-panel__box { pointer-events: auto; width: var(--qb-lab-width); border-left: 1px solid var(--pe-line); box-shadow: none; }
body.lab-pane-open #question-screen, body.lab-pane-open #results-screen { margin-right: var(--qb-lab-width); }
body.lab-pane-open .qb-bottom { gap: 8px; padding-left: 12px; padding-right: 12px; }
body.lab-pane-open .qb-tools { gap: 0; }
body.lab-pane-open .qb-tool { padding-left: 6px; padding-right: 6px; }
@media (min-width: 900px) {
  body.lab-pane-open .qb-bottom { grid-template-columns: 1fr auto; }
  body.lab-pane-open .qb-bottom .qb-tools { grid-column: 1 / -1; justify-content: center; }
}
@media (max-width: 899px) {
  body.lab-pane-open #question-screen, body.lab-pane-open #results-screen { margin-right: 0; }
  body.lab-pane-open #question-screen.active { display: flex; flex-direction: column; height: 56dvh; min-height: 0; overflow: hidden; }
  body.lab-pane-open #question-screen .qb-stage { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 12px; }
  body.lab-pane-open #question-screen .qb-bottom { position: relative; bottom: auto; }
  body.lab-pane-open #results-screen { padding-bottom: 46dvh; }
  #lab-modal .qb-panel__box { width: 100%; top: auto; height: 44dvh; border-left: 0; border-top: 1px solid var(--pe-line); }
}

/* Revisao: lista persistente e caso completo ao lado. */
#results-screen .qb-main { max-width: 1600px; }
.qb-review-grid { display: grid; grid-template-columns: minmax(230px, 320px) minmax(0, 1fr); gap: 24px; align-items: start; }
.qb-review-grid .qb-rows { position: sticky; top: 16px; max-height: calc(100dvh - 120px); overflow-y: auto; padding: 4px; }
.qb-review-grid .qb-row { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 6px 10px; padding: 12px; border: 1px solid transparent; }
.qb-review-grid .qb-row.is-sel { background: var(--pe-blue-soft); border-color: var(--pe-blue-line); }
.qb-review-grid .qb-row__t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.5; }
.qb-review-grid .qb-row .pe-tag { grid-column: 2; justify-self: start; }
.qb-review-grid .qb-row > .pe-i:last-child { display: none; }
.qb-review-detail { min-width: 0; }
.qb-review-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 12px; }
.qb-review-tools[hidden] { display: none; }
#review-question .qb-card { max-width: none; display: block; border: 1px solid var(--pe-line); padding: 22px; }
#review-question .qb-card__a { border: 0; padding-left: 0; }
#review-question .question-text { line-height: 1.7; }
#review-question .qb-anshead { margin-top: 20px; }
.qb-review-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 999px) {
  .qb-review-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .qb-review-grid .qb-rows { position: static; max-height: 220px; }
  .qb-review-grid .qb-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .qb-review-grid .qb-row .pe-tag { grid-column: 3; grid-row: 1; }
  #review-question .qb-card { padding: 16px; }
}
@media (min-width: 900px) {
  body.notes-pane-open .qb-bottom { grid-template-columns: 1fr auto; }
  body.notes-pane-open .qb-bottom .qb-tools { grid-column: 1 / -1; justify-content: center; }
}
@media (max-width: 899px) {
  .qb-stage { padding-bottom: calc(var(--qb-bar-h) + 40px + env(safe-area-inset-bottom)); }
  body.notes-pane-open #question-screen.active { display: flex; flex-direction: column; }
  body.notes-pane-open #question-screen .qb-stage { padding-bottom: 12px; }
}
