:root {
  --blue: #204683; --blue-d: #16325f; --sel: #204683; --sel-soft: #e6ecf6;
  /* cor do nível: azul da marca na tela inicial; muda com <html data-level="A1"> etc. */
  --accent: #204683; --accent-d: #16325f; --accent-soft: #e6ecf6;
  --ink: #0b1e44; --orange: #c2460c; --cream: #fdf2da;
  --gray: #737c85; --line: #d9dee6; --bg: #f4f6f9; --stage: #e6e9ef; --ok: #1f7a3d; --warn: #9a6200;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
[data-level="A1"] { --accent: #c2460c; --accent-d: #8c3209; --accent-soft: #f8e9e2; }
[data-level="A2"] { --accent: #8a5d00; --accent-d: #634300; --accent-soft: #f1ece0; }
[data-level="B1"] { --accent: #2d7a2f; --accent-d: #205822; --accent-soft: #e6efe6; }
[data-level="B2"] { --accent: #0b7a85; --accent-d: #085860; --accent-soft: #e2eff0; }
[data-level="C1"] { --accent: #b8265f; --accent-d: #841b44; --accent-soft: #f6e5ec; }
[data-level="C2"] { --accent: #6a2bc4; --accent-d: #4c1f8d; --accent-soft: #ede6f8; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); overscroll-behavior: none; }
/* Tamanho de fonte do sistema (celular): tudo que não é PDF usa rem/em e acompanha o ajuste do aparelho.
   Android/Chrome: a meta text-scale (index.html) liga o escalonamento e 1rem passa a seguir o sistema.
   iOS/Safari: só o Dynamic Type (font: -apple-system-body) acompanha; o resto do mundo ignora este bloco.
   Campos/notas/rótulos sobre o PDF ficam em px de propósito (acompanham o zoom da página, não o sistema). */
@supports (font: -apple-system-body) {
  html { -webkit-text-size-adjust: 100%; font: -apple-system-body; font-family: system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; }
}
#app { min-height: 100%; height: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1.5px solid var(--accent); background: #fff; color: var(--accent); font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.55); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; text-decoration: none; flex: none; }
.icon-btn:hover:not(:disabled) { background: rgba(127,127,127,.16); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn[aria-pressed="true"].on { color: var(--sel); background: var(--sel-soft); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 20px;
  border: 1.5px solid var(--line); background: #fff; font-size: .9rem; }
.chip-btn[aria-pressed="true"] { background: var(--sel-soft); border-color: var(--sel); color: var(--sel); font-weight: 600; }
.pill { background: var(--orange); color: #fff; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.home-head .pill, .topbar .pill { background: #fff; color: var(--accent-d); }
.pill.small { padding: 2px 8px; font-size: .72rem; }

/* ---------- tela inicial ---------- */
.home-head { background: var(--accent); color: #fff; padding: calc(var(--sat) + 18px) max(18px, var(--sal)) 22px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; line-height: 1.1; }
.slogan { margin: 2px 0 0; color: #ffb454; font-weight: 600; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.home { max-width: 860px; margin: 0 auto; padding: 18px max(16px, var(--sal)) calc(var(--sab) + 32px); }
.continue { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--cream); border: 1.5px solid #f0d9a8; color: var(--ink); text-decoration: none; margin-bottom: 18px; }
.continue-k { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--orange); font-weight: 700; }
.continue-t { font-size: 1.1rem; font-weight: 700; }
.continue-s { color: var(--gray); font-size: .9rem; }
.level-tabs, .tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tab { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tab small { font-weight: 500; color: var(--gray); font-size: .7rem; }
.tab[aria-selected="true"] { background: var(--sel); color: #fff; border-color: var(--sel); }
.tab[aria-selected="true"] small { color: #cfd9ee; }
.home-content { margin-top: 16px; }
.module h2 { font-size: 1.05rem; color: var(--accent); margin: 8px 0; }
.empty { color: var(--gray); padding: 24px 4px; }
.lesson-card { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; margin-bottom: 12px; }
.lesson-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.lesson-code { background: var(--orange); color: #fff; font-weight: 800; border-radius: 10px; padding: 8px 10px; font-size: .95rem; }
.lesson-top h3 { margin: 0; font-size: 1.2rem; }
.meta { margin: 2px 0 0; color: var(--gray); font-size: .9rem; }
.badge { margin-left: auto; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eceff3; color: var(--gray); }
.badge.complete { background: #dff3e6; color: var(--ok); }
.badge.partial { background: #fff0cf; color: var(--warn); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dl-msg { margin: 0; min-height: 1.2em; font-size: .9rem; color: var(--gray); }
.err { color: #a11; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.install-help { margin-top: 24px; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.install-help summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.offline-note { margin: 12px 0 0; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 16px; color: var(--gray); font-size: .9rem; line-height: 1.45; }
.install-help + .offline-note { margin-top: 12px; }
.shelf + .offline-note { margin-top: 24px; }
.center-msg { display: grid; gap: 14px; place-content: center; justify-items: center; text-align: center; min-height: 70vh; padding: 24px; }

/* ---------- leitura ---------- */
.reader-screen { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--stage); }
.topbar { background: var(--accent); color: #fff; display: flex; align-items: center; gap: 6px; padding: var(--sat) max(6px, var(--sar)) 0 max(6px, var(--sal)); min-height: calc(52px + var(--sat)); flex: none; }
.top-logo { flex: none; }
.top-title { min-width: 0; flex: 1; line-height: 1.2; }
.top-kicker { font-size: .7rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-main { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 2px; padding: 2px max(6px, var(--sar)) 2px max(6px, var(--sal)); flex: none; overflow-x: auto; }
.toolbar .sep { width: 1px; height: 26px; background: var(--line); margin: 0 6px; flex: none; }
.page-box { display: flex; align-items: center; gap: 4px; flex: none; }
.page-input { width: 3.6em; height: 38px; text-align: center; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font-weight: 700; }
.page-total { color: var(--gray); }
.page-label { color: var(--orange); font-size: .78rem; font-weight: 700; margin-left: 4px; }
.page-label:empty { display: none; }
.zoom-label { min-width: 3.2em; text-align: center; font-size: .85rem; color: var(--gray); }
.stage-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.stage { flex: 1; min-width: 0; overflow: auto; display: grid; padding: 12px; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; outline: none; background: var(--stage); }
.spread { margin: auto; display: flex; transform-origin: 0 0; will-change: transform; box-shadow: 0 2px 14px rgba(11,30,68,.25); background: #fff; }
.pdf-page { position: relative; background: #fff; flex: none; }
.canvas-holder, .canvas-holder canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.textLayer { position: absolute; inset: 0; overflow: clip; line-height: 1; text-align: initial; transform-origin: 0 0; -webkit-user-select: text; user-select: text; z-index: 1; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(32,70,131,.3); }
.hotspot-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* marcadores de áudio: invisíveis por padrão, a aparência impressa do PDF não muda */
.hotspot { position: absolute; padding: 0; margin: 0; border: 0; background: transparent; border-radius: 999px; pointer-events: auto; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hotspot::after { content: ''; position: absolute; left: 50%; top: 50%; width: calc(100% + 4px); height: max(100%, 34px); transform: translate(-50%, -50%); }
.hotspot:hover { background: rgba(32,70,131,.14); }
.hotspot:focus-visible { outline: 3px solid var(--sel); outline-offset: 1px; }
/* ▶ tocando: a pílula impressa se preenche de azul (#204683) e o texto "▶ 8.12" vira branco.
   O preenchimento usa o contorno externo da pílula impressa (hsp.pill), então não passa do botão original. */
.hotspot .hs-label { display: none; }
.hotspot.active { background: var(--sel); box-shadow: none; outline: none; color: #fff; }
.hotspot.active:hover { background: var(--sel); }
.hotspot.active .hs-label { display: flex; position: absolute; inset: 0; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden;
  font: 600 calc(var(--scale-factor, 1) * var(--fs, 8) * 1px)/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; pointer-events: none; }
.hotspot.active[data-state="loading"] { animation: pulse 1s infinite; }
.hotspot.active[data-state="paused"] { opacity: .78; }
.hotspot.active[data-state="error"] { background: #b3261e; }
.hotspot.debug { background: rgba(0,160,255,.25); outline: 1px solid #0080d0; }
.hotspot.debug::before { content: attr(data-label); position: absolute; top: -14px; left: 0; font-size: 10px; color: #0060a0; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .hotspot.active[data-state="loading"] { animation: none; } }

/* painel lateral */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: #fff; border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(11,30,68,.18); z-index: 10; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 16px; }
.drawer .tabs { padding: 0 12px 8px; }
.drawer-body { overflow: auto; padding: 0 12px 16px; flex: 1; }
.hint { color: var(--gray); font-size: .85rem; margin: 4px 4px 10px; }
.nav-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.nav-list button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.nav-list button:hover { background: var(--cream); }
.nav-list small { color: var(--orange); font-weight: 700; white-space: nowrap; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.search-row input { flex: 1; min-width: 0; height: 44px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; }

/* ---------- reprodutor ---------- */
.player { flex: none; background: #fff; border-top: 2px solid var(--accent); padding: 6px max(10px, var(--sar)) calc(6px + var(--sab)) max(10px, var(--sal)); box-shadow: 0 -4px 16px rgba(11,30,68,.1); }
.p-main { display: flex; align-items: center; gap: 10px; }
.p-play { width: 48px; height: 48px; flex: none; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.p-play:disabled { background: #c9ced6; cursor: default; }
.p-info { flex: 1; min-width: 0; line-height: 1.2; }
.p-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: .8rem; color: var(--gray); }
.player[data-state="error"] .p-sub { color: #b00; font-weight: 600; white-space: normal; }
.p-time { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--gray); white-space: nowrap; }
.p-expand svg { transition: transform .15s; }
.player[data-expanded="true"] .p-expand svg { transform: rotate(180deg); }
.p-seek { width: 100%; height: 28px; margin: 2px 0 0; accent-color: var(--orange); }
.p-more { display: none; padding-top: 4px; }
.player[data-expanded="true"] .p-more { display: grid; gap: 10px; max-height: 38vh; overflow: auto; }
.p-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.speed-label { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.p-speed { height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 8px; background: #fff; }
.p-list-title { font-size: .75rem; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.p-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.p-item { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; }
.p-item[aria-current="true"] { border-color: var(--sel); background: var(--sel-soft); font-weight: 700; }
.p-item-dur { color: var(--gray); font-size: .8rem; font-variant-numeric: tabular-nums; }
.p-empty { color: var(--gray); font-size: .9rem; }

@media (min-width: 760px) { .player { padding-top: 8px; } }
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .p-time { font-size: .78rem; }
}
@media (max-height: 460px) and (orientation: landscape) {
  .topbar { min-height: calc(40px + var(--sat)); }
  .top-kicker { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .player[data-expanded="true"] .p-more { max-height: 30vh; }
}

#toast { position: fixed; left: 50%; bottom: calc(90px + var(--sab)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* player expandido mais compacto no celular */
@media (max-width: 640px) {
  .p-more { padding-top: 2px; }
  .player[data-expanded="true"] .p-more { max-height: 30vh; gap: 6px; }
  .p-controls { gap: 6px; }
  .p-controls .chip-btn { min-height: 38px; padding: 0 10px; font-size: .85rem; }
  .speed-label { font-size: .85rem; }
  .p-speed { height: 38px; }
  .p-item { min-height: 40px; padding: 0 10px; }
  .p-list { gap: 6px; }
}

/* celular deitado: player em uma linha só, para sobrar espaço para o livro */
@media (max-height: 460px) and (orientation: landscape) {
  .player { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; padding-top: 2px; padding-bottom: calc(2px + var(--sab)); }
  .p-main { flex: 0 0 auto; width: min(52%, 520px); }
  .p-seek { flex: 1; min-width: 120px; margin: 0; }
  .p-more { flex: 0 0 100%; }
  .p-play { width: 40px; height: 40px; }
  .toolbar .icon-btn { width: 40px; height: 40px; }
  .page-input { height: 34px; }
}

/* ---------- capas dos níveis ---------- */
.level-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.level-card { appearance: none; font: inherit; cursor: pointer; width: 100%; position: relative; display: grid; gap: 4px; padding: 6px 6px 8px; border: 2px solid transparent; border-radius: 12px; background: #fff; text-align: left; box-shadow: 0 1px 4px rgba(11,30,68,.12); text-decoration: none; color: inherit; }
.level-card img { width: 100%; aspect-ratio: 210 / 297; object-fit: cover; border-radius: 7px; display: block; background: #e9ecf1; }
.level-card:hover, .level-card:focus-visible { border-color: var(--accent); }
.lc-name { font-weight: 700; font-size: .85rem; line-height: 1.15; }
.lc-sub { font-size: .75rem; color: var(--gray); }
.level-card.soon img { filter: grayscale(.85); opacity: .55; }
.level-card.soon .lc-sub { color: var(--orange); font-weight: 700; }
@media (max-width: 640px) {
  .level-cards { display: flex; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; }
  .level-card { flex: 0 0 104px; scroll-snap-align: start; }
}

/* ---------- campos de resposta ---------- */
.field-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.hotspot-layer { z-index: 3; }
.field { position: absolute; pointer-events: auto; }
.field input { position: absolute; left: 0; top: 0; width: calc(100% / var(--k)); height: calc(100% / var(--k)); transform: scale(var(--k)); transform-origin: 0 0;
  font: 16px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 600; color: #1a47b8; background: rgba(32,70,131,.06); border: 0; border-radius: 3px; padding: 0 3px; margin: 0; outline: none; text-align: left; }
.field-box input { text-align: center; padding: 0; }
.field textarea { position: absolute; left: 0; top: 0; width: calc(100% / var(--k)); height: calc(100% / var(--k)); transform: scale(var(--k)); transform-origin: 0 0; box-sizing: border-box;
  font: 600 16px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1a47b8; background: transparent; border: 0; border-radius: 3px; padding: 0 3px; margin: 0; outline: none; resize: none; overflow: auto; text-align: left; }
.field textarea:focus { background: rgba(255,244,214,.55); box-shadow: 0 0 0 2px var(--orange); }
.field-free input { background: transparent; }
.field input:focus { background: rgba(255,244,214,.95); box-shadow: 0 0 0 2px var(--orange); }
.field input::selection { background: rgba(194,70,12,.25); }
.field .choice { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); border: 0; border-radius: 999px; background: transparent; padding: 0; -webkit-tap-highlight-color: transparent; }
.field .choice::after { content: ''; position: absolute; left: 0; right: 0; top: -3px; bottom: -3px; }   /* sem invadir as linhas vizinhas */
.field .choice:hover { background: rgba(32,70,131,.10); }
.field .choice.on { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 0 0 0 2.5px var(--accent); }
/* caixinha: ao marcar, preenche o quadradinho impresso com a cor do nível; o ✓ é branco e menor que a caixa */
.field .check { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; padding: 0; border-radius: 2px; }
.field .check svg { width: 72%; height: 72%; opacity: 0; }
.field .check.on { background: var(--accent); }
.field .check.on svg { opacity: 1; }
.field .check::after { content: ''; position: absolute; left: -9px; right: -9px; top: -5px; bottom: -5px; }
.field .check:hover:not(.on) { background: rgba(32,70,131,.12); }
.answers-off .field-layer { display: none; }
.field :is(button):focus-visible { outline: 3px solid var(--orange); outline-offset: 1px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; }
.switch input { width: 22px; height: 22px; accent-color: var(--sel); }
.stack { display: grid; gap: 8px; margin-top: 8px; }
.p-close { margin-left: -4px; }

/* ---- links do sumário, lupa de foco, comentários ---- */
.topic-layer, .link-layer, .note-layer { position: absolute; inset: 0; pointer-events: none; }
.topic-layer, .link-layer { z-index: 2; }
.note-layer { z-index: 4; }
.page-link { position: absolute; pointer-events: auto; border: 0; background: transparent; border-radius: 8px; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
.page-link:hover, .page-link:focus-visible { background: rgba(32,70,131,.09); box-shadow: inset 0 0 0 2px rgba(32,70,131,.45); outline: none; }
.focus-mode .topic { position: absolute; pointer-events: auto; cursor: zoom-in; border-radius: 10px; -webkit-tap-highlight-color: transparent; }
.focus-mode .topic:hover { background: rgba(32,70,131,.07); box-shadow: inset 0 0 0 2px rgba(32,70,131,.5); }
.focus-mode .topic.current { cursor: zoom-out; box-shadow: inset 0 0 0 2px var(--sel); background: transparent; }
.focus-mode .topic::before { content: attr(data-title); position: absolute; left: 8px; top: 6px; padding: 2px 8px; border-radius: 999px; background: var(--sel); color: #fff; font: 600 .75rem/1.4 system-ui, sans-serif; opacity: 0; transition: opacity .12s; pointer-events: none; }
.focus-mode .topic:hover::before { opacity: .95; }
@media (hover: none) { .focus-mode .topic { box-shadow: inset 0 0 0 1.5px rgba(32,70,131,.28); } }

.note-armed .note-layer { pointer-events: auto; cursor: crosshair; background: rgba(255,226,102,.10); }
.note-armed .pdf-page { outline: 2px dashed var(--sel); outline-offset: -2px; }
.notes-off .note-layer { display: none; }
.note { position: absolute; width: 220px; height: 150px; transform: scale(var(--ns, .6)); transform-origin: 0 0; pointer-events: auto; display: flex; flex-direction: column;
  background: #fff1a8; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.28), 0 0 0 1px rgba(160,120,0,.25); touch-action: auto; }
.note-bar { flex: none; height: 26px; display: flex; align-items: center; justify-content: space-between; padding: 0 4px 0 8px; background: #ffe066; border-radius: 4px 4px 0 0; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.note-bar:active { cursor: grabbing; }
.note-grip { width: 34px; height: 8px; background: radial-gradient(circle, rgba(0,0,0,.35) 1.4px, transparent 1.6px) 0 0 / 8px 8px repeat-x; }
.note-del { width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: #6b5200; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.note-del:hover { background: rgba(0,0,0,.12); }
.note textarea { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; resize: none; border: 0; background: transparent; padding: 6px 8px; font: 16px/1.3 system-ui, sans-serif; color: #2a2200; border-radius: 0 0 4px 4px; outline: none; }
.note textarea:focus { background: rgba(255,255,255,.35); box-shadow: inset 0 0 0 2px var(--orange); }
.focus-mode .topic.current::before { display: none; }

/* sumário em dois níveis (livro de módulo): aula > seção */
.nav-list .toc-l1 { margin-top: 8px; font-weight: 700; }
.nav-list .toc-l2 button { padding-left: 28px; font-size: .92em; }

/* ---------- navegação: capas > módulos > aulas ---------- */
.section-h { font-size: 1.05rem; color: var(--accent); margin: 18px 2px 10px; }
.kicker { margin: 0 0 2px; font-size: .78rem; font-weight: 600; color: #fff; }
.home-head .brand .icon-btn { color: #fff; margin-left: -8px; }
.module-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.module-card { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; }
.module-card:hover, .module-card:focus-visible { border-color: var(--accent); }
.mc-num { flex: none; min-width: 42px; height: 42px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.1rem; }
.mc-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mc-title { font-weight: 700; font-size: 1.05rem; }
.mc-sub { color: var(--gray); font-size: .85rem; }
.mc-go { flex: none; color: var(--accent); display: inline-flex; }
.module-panel { border-color: var(--accent); background: var(--accent-soft); }
.module-panel .badge { background: #fff; }
.module-panel .badge.complete { background: #dff3e6; }
.module-panel .badge.partial { background: #fff0cf; }

/* alternativas "a) b) c)" da prova e círculos da folha de respostas: marcado = círculo na cor do nível + letra branca */
.choice-dot .choice { inset: 0; width: 100%; height: 100%; border-radius: 4px; }
.choice-dot .choice:hover { background: rgba(32,70,131,.08); }
.choice-dot .choice.on, .choice-dot .choice.on:hover { background: transparent; box-shadow: none; }
.choice-dot .dot, .choice-dot .paren { position: absolute; display: none; pointer-events: none; }
.choice-dot .paren { background: #fff; }
.choice-dot .dot { align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; overflow: hidden;
  font: 700 calc(var(--scale-factor, 1) * var(--fs, 8) * 1px)/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.choice-dot .choice.on ~ .paren { display: block; }
.choice-dot .choice.on ~ .dot { display: flex; }

/* ---------- progresso, painel de downloads, próxima aula, transições ---------- */
.prog { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.prog-bar { flex: 1; height: 6px; border-radius: 99px; background: #e3e7ee; overflow: hidden; }
.prog-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.prog-pct { font-size: .78rem; font-weight: 700; color: var(--accent); min-width: 2.6em; text-align: right; }
.level-card .prog { margin-top: 2px; }
.mod-progress { margin: 0 0 14px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); }
.mod-progress .meta { margin: 0; }
.head-actions .icon-btn { color: #fff; }

.sheet-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(11,30,68,.45); display: flex; align-items: center; justify-content: center; padding: 12px; animation: fadeIn .18s ease both; }
.sheet { background: #fff; color: var(--ink); width: min(580px, 100%); max-height: min(86vh, 720px); border-radius: 18px; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(11,30,68,.35); animation: rise .22s ease both; overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 18px; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; color: var(--accent); }
.sheet > .hint { margin: 2px 18px 8px; }
.sheet-tools { padding: 0 18px 8px; }
.dl-list { overflow: auto; padding: 0 12px; display: grid; gap: 6px; align-content: start; flex: 1; min-height: 0; }
.dl-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.dl-row:has(input:checked) { border-color: var(--sel); background: var(--sel-soft); }
.dl-row input { width: 22px; height: 22px; accent-color: var(--sel); flex: none; }
.dl-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.dl-text strong { font-size: .98rem; }
.dl-row .badge { margin-left: 0; white-space: nowrap; }
.sheet-foot { padding: 12px 18px calc(14px + var(--sab)); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.sheet-foot .dl-msg { min-height: 1.2em; }

.next-lesson { position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100% - 24px); box-shadow: 0 6px 20px rgba(11,30,68,.35); animation: rise .25s ease both; text-align: left; line-height: 1.2; padding-block: 8px; }
.next-lesson span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.next-lesson { animation-name: riseX; }
@keyframes riseX { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translateX(-50%); } }
#app { transition: opacity .14s ease; }
#app.leaving { opacity: 0; }
#app > * { animation: fadeIn .26s ease both; }
@media (prefers-reduced-motion: reduce) { #app { transition: none; } #app > *, .sheet, .sheet-overlay, .next-lesson { animation: none; } }

/* ---------- home: capa que se abre com resumo ---------- */
.shelf { display: grid; gap: 14px; }
.feature { display: grid; grid-template-columns: calc((100% - 50px) / 3 + 10px) minmax(0, 1fr); gap: 20px; align-items: start; }
.level-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 6px 18px rgba(11,30,68,.18); }
.level-panel { display: grid; gap: 8px; align-content: start; padding: 6px 2px; animation: fadeIn .3s ease both; }
.level-panel h2 { margin: 0; font-size: 1.35rem; color: var(--accent); }
.lp-meta { margin: 0; font-weight: 700; color: var(--gray); font-size: .9rem; }
.lp-text { margin: 0; line-height: 1.5; text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.level-panel .btn { justify-self: start; margin-top: 6px; }
@media (max-width: 640px) {
  .feature { grid-template-columns: minmax(0, 44%) minmax(0, 1fr); gap: 12px; }
  .level-panel h2 { font-size: 1.1rem; }
  .lp-text { font-size: .9rem; line-height: 1.4; }
}
.home-head, .home-head .pill { transition: background-color .3s ease; }
html.tint, html.tint body { background: var(--accent-soft); }
html, body { transition: background-color .3s ease; }
@media (prefers-reduced-motion: reduce) { .level-panel { animation: none; } .home-head, html, body { transition: none; } }
html[data-level] .slogan { color: #fff; }
.lesson-card .actions { align-items: center; }

/* "Marcar como concluída": só o quadrado, no canto inferior direito do cartão da aula */
.done-toggle { margin-left: auto; position: relative; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.done-toggle::after { content: ''; position: absolute; inset: -6px; }
.done-toggle .ck { width: 26px; height: 26px; border: 2px solid var(--accent); border-radius: 7px; background: #fff; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.done-toggle .ck svg { width: 18px; height: 18px; opacity: 0; }
.done-toggle[aria-pressed="true"] .ck { background: var(--accent); }
.done-toggle[aria-pressed="true"] .ck svg { opacity: 1; }
.done-toggle:hover .ck { background: var(--accent-soft); }
.done-toggle[aria-pressed="true"]:hover .ck { background: var(--accent); }
/* celular: o resumo do livro cabe na altura da capa */
@media (max-width: 640px) {
  .level-panel { gap: 5px; padding-top: 2px; }
  .level-panel h2 { font-size: 1rem; }
  .lp-text { font-size: .74rem; line-height: 1.32; }
  .level-panel .btn { min-height: 38px; margin-top: 4px; font-size: .9rem; }
}

/* ---------- Teste de nivelamento (telas de entrada e de envio) ---------- */
.pt-screen { min-height: 100%; padding: calc(16px + var(--sat)) 16px calc(24px + var(--sab)); display: flex; justify-content: center; align-items: flex-start; background: var(--bg); overflow-y: auto; height: 100%; }
.pt-card { width: 100%; max-width: 640px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px 26px; display: grid; gap: 14px; }
.pt-logo { height: 44px; width: auto; justify-self: start; }
.pt-card h1 { margin: 0; font-size: 1.6rem; line-height: 1.2; color: var(--blue); }
.pt-card h3 { margin: 0 0 4px; font-size: .95rem; color: var(--blue); }
.pt-card .lead { margin: 0; font-size: 1.05rem; line-height: 1.5; }
.pt-list { margin: 0; padding-left: 1.1rem; display: grid; gap: 8px; line-height: 1.45; }
.pt-form { display: grid; gap: 12px; margin-top: 4px; }
.pt-row { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
.pt-row input[type=text], .pt-row input[type=email], .pt-row input[type=tel], .pt-note { width: 100%; min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; font-size: 1rem; }
.pt-note { min-height: 84px; resize: vertical; font-family: inherit; }
.pt-row input:focus, .pt-note:focus { outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent); border-color: var(--blue); }
.pt-check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: .92rem; line-height: 1.4; }
.pt-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); }
.pt-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.pt-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: #8a1c13; font-weight: 600; font-size: .92rem; }
.pt-ok { margin: 0; padding: 10px 12px; border-radius: 10px; background: #e7f4ea; color: var(--ok); font-weight: 600; }
.pt-progress, .pt-hint { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--sel-soft); font-size: .92rem; }
.pt-hint { background: #fff6e0; color: #6b4600; }
.btn.big { min-height: 52px; font-size: 1.05rem; justify-content: center; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.pt-send-btn { background: #fff; color: var(--accent); border-color: #fff; font-weight: 700; text-decoration: none; }
.pt-summary { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pt-summary li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.pt-summary li:first-child { border-top: 0; }
.pt-text { border-left: 4px solid var(--blue); padding: 2px 0 2px 12px; }
.pt-text p { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.pt-text .muted { color: var(--gray); }
.pt-edit { margin: 0; font-size: .92rem; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pt-result { display: grid; gap: 10px; }
.pt-pre { margin: 0; padding: 12px; border-radius: 10px; background: #f1f3f7; font-size: .8rem; white-space: pre-wrap; word-break: break-word; max-height: 40vh; overflow: auto; }
.pt-done { width: 72px; height: 72px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }

/* ---------- conta do aluno ---------- */
.muted { color: var(--gray); margin: 0; }
.muted.small { font-size: .85rem; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink, inherit); }
.acct-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10, 20, 40, .55); }
.acct-card { width: min(440px, 100%); max-height: 92vh; overflow: auto; display: grid; gap: 12px; padding: 20px; border-radius: 16px; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.acct-card h2 { margin: 0; color: var(--blue); font-size: 1.3rem; }
.acct-card h3 { margin: 4px 0 0; font-size: .95rem; color: var(--blue); }
.acct-card input[type=password] { width: 100%; min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; }
.pt-row input[type=password] { width: 100%; min-height: 46px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.pt-row input[type=password]:focus, .acct-card input:focus { outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent); border-color: var(--blue); }
