/* ---------- Tema ---------- */
:root {
  --bg: #ffffff;
  --bg-suave: #f6f7fb;
  --superficie: #ffffff;
  --texto: #1f2433;
  --texto-suave: #6b7185;
  --borda: #e3e5ee;
  --borda-forte: #d3d6e2;
  --primaria: #16a34a;
  --primaria-escura: #12813b;
  --primaria-clara: #e8f8ee;
  --acento: #6c63ff;
  --acento-claro: #efedff;
  --ok: #15803d;
  --ok-fundo: #e9fbf0;
  --ok-borda: #86e0a8;
  --ok-sheet: #d9f6e4;
  --erro: #dc2626;
  --erro-fundo: #fff1f1;
  --erro-borda: #fca5a5;
  --erro-sheet: #ffe0e2;
  --erro-botao: #ef4444;
  --sombra: 0 1px 2px rgba(31, 36, 51, .05), 0 6px 20px rgba(31, 36, 51, .06);
  --raio: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117;
    --bg-suave: #161922;
    --superficie: #171a23;
    --texto: #eceef5;
    --texto-suave: #9aa0b4;
    --borda: #2a2f3d;
    --borda-forte: #363c4d;
    --primaria: #22c55e;
    --primaria-escura: #16a34a;
    --primaria-clara: #12301f;
    --acento: #8b84ff;
    --acento-claro: #24224a;
    --ok: #4ade80;
    --ok-fundo: #11281b;
    --ok-borda: #1f7a45;
    --ok-sheet: #122a1c;
    --erro: #f87171;
    --erro-fundo: #2c1517;
    --erro-borda: #8f2f33;
    --erro-sheet: #321619;
    --erro-botao: #ef4444;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1117;
  --bg-suave: #161922;
  --superficie: #171a23;
  --texto: #eceef5;
  --texto-suave: #9aa0b4;
  --borda: #2a2f3d;
  --borda-forte: #363c4d;
  --primaria: #22c55e;
  --primaria-escura: #16a34a;
  --primaria-clara: #12301f;
  --acento: #8b84ff;
  --acento-claro: #24224a;
  --ok: #4ade80;
  --ok-fundo: #11281b;
  --ok-borda: #1f7a45;
  --ok-sheet: #122a1c;
  --erro: #f87171;
  --erro-fundo: #2c1517;
  --erro-borda: #8f2f33;
  --erro-sheet: #321619;
  --erro-botao: #ef4444;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 1rem/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--primaria); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acento) 60%, transparent); outline-offset: 2px; }
svg { flex: none; }

/* ---------- Topo ---------- */
.topo { border-bottom: 1px solid var(--borda); background: var(--bg); }
.topo-in { max-width: 1040px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: flex; align-items: center; gap: 2px; background: none; border: 0; padding: 0; font-size: 1.55rem; letter-spacing: -.02em; }
.logo-a { font-weight: 800; color: var(--texto); }
.logo-b { font-weight: 400; color: var(--texto-suave); margin-left: 4px; }
.logo-check { width: 26px; height: 26px; fill: none; stroke: var(--primaria); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.topo-dir { display: flex; align-items: center; gap: 14px; }
.topo-titulo { font-weight: 600; font-size: .9rem; }
.topo-titulo[hidden] { display: none; }

.tema {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  border: 1px solid var(--borda); background: var(--superficie);
}
.tema:hover { border-color: var(--borda-forte); }
.tema svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tema .lua { fill: currentColor; stroke: none; }
.tema .sol { display: none; }
:root[data-theme="dark"] .tema .sol { display: block; }
:root[data-theme="dark"] .tema .lua { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tema .sol { display: block; }
  :root:not([data-theme="light"]) .tema .lua { display: none; }
}

/* ---------- Layout ---------- */
.conteudo { max-width: 700px; margin: 0 auto; padding: 36px 20px 48px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px;
  border: 1.5px solid var(--borda-forte); background: var(--superficie);
  font-weight: 700;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: var(--texto-suave); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn.primario { background: var(--primaria); border-color: var(--primaria); color: #fff; box-shadow: 0 3px 0 var(--primaria-escura); }
.btn.primario:hover:not(:disabled) { background: var(--primaria-escura); border-color: var(--primaria-escura); }
.btn.grande { width: 100%; padding: 16px; font-size: 1.05rem; margin-top: 8px; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-texto { background: none; border: 0; padding: 6px 4px; font-weight: 600; color: var(--texto-suave); }
.btn-texto:hover { color: var(--texto); }
.btn-texto[hidden] { display: none; }

/* ---------- Configuração ---------- */
.config h1 { font-size: 1.9rem; letter-spacing: -.02em; margin: 0 0 6px; }
.sub { color: var(--texto-suave); margin: 0 0 28px; }
.grupo { margin-bottom: 26px; }
.grupo h2 { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); margin: 0 0 10px; }

.segmentado { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg {
  padding: 13px 10px; border-radius: 12px;
  border: 2px solid var(--borda); border-bottom-width: 4px;
  background: var(--superficie); font-weight: 600;
  transition: border-color .15s, background-color .15s, color .15s;
}
.seg:hover { border-color: var(--borda-forte); }
.seg.ativo { border-color: var(--primaria); background: var(--primaria-clara); color: var(--primaria-escura); }
:root[data-theme="dark"] .seg.ativo { color: var(--primaria); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg.ativo { color: var(--primaria); } }

.opcoes { border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; }
.opcao { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; }
.opcao + .opcao { border-top: 1px solid var(--borda); }
.opcao:hover { background: var(--bg-suave); }
.opcao-txt { display: flex; flex-direction: column; }
.opcao-txt small { color: var(--texto-suave); font-size: .85rem; }

.switch {
  appearance: none; flex: none; position: relative; cursor: pointer;
  width: 46px; height: 26px; margin: 0; border-radius: 999px;
  background: var(--borda-forte); transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch:checked { background: var(--primaria); }
.switch:checked::after { transform: translateX(20px); }


.retomar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 28px; border-radius: var(--raio);
  background: var(--acento-claro); color: var(--texto);
}
.retomar-acoes { display: flex; gap: 8px; align-items: center; }
.retomar .btn { padding: 9px 18px; }

/* ---------- Questão ---------- */
.status { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.timer {
  flex: none; padding: 3px 10px; border-radius: 7px;
  background: var(--acento); color: #fff;
  font: 700 .82rem/1.6 ui-monospace, "SF Mono", Consolas, monospace;
}
.timer.acabando { background: var(--erro-botao); }
.trilha { position: relative; flex: 1; height: 26px; border-radius: 999px; background: var(--acento-claro); overflow: hidden; }
.trilha-fill { height: 100%; background: color-mix(in srgb, var(--acento) 35%, var(--acento-claro)); border-radius: 999px; transition: width .4s ease; }
.trilha span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: .78rem; font-weight: 700; }

.detalhes { display: flex; flex-wrap: wrap; gap: 6px; margin: -14px 0 16px; }
.detalhes span { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--bg-suave); color: var(--texto-suave); border: 1px solid var(--borda); }

.pergunta { font-size: 1.45rem; font-weight: 700; line-height: 1.4; letter-spacing: -.01em; margin: 0 0 22px; white-space: pre-line; }
.pergunta.longa { font-size: 1.12rem; font-weight: 500; line-height: 1.7; letter-spacing: 0; }
.pergunta-final { font-size: 1.12rem; font-weight: 600; margin: 0 0 20px; }

.tabela-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--borda); border-radius: 10px; }
table { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--borda); }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { text-align: left; }
th { background: var(--bg-suave); font-weight: 600; }

.alternativas { display: flex; flex-direction: column; gap: 12px; }
.alt {
  display: flex; gap: 14px; align-items: flex-start; text-align: left;
  padding: 14px 16px; border-radius: 12px;
  border: 2px solid var(--borda); border-bottom-width: 4px;
  background: var(--superficie);
  font-size: 1rem; line-height: 1.55;
  transition: border-color .15s, background-color .15s, color .15s, opacity .2s;
}
.alt:hover:not(:disabled) { border-color: var(--borda-forte); background: var(--bg-suave); }
.alt:active:not(:disabled) { border-bottom-width: 2px; margin-top: 2px; }
.alt .letra {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  border: 1.5px solid var(--borda-forte); color: var(--texto-suave);
  font-size: .95rem;
}
.alt .txt { white-space: pre-line; padding-top: 2px; }
.alt.certa { border-color: var(--ok-borda); background: var(--ok-fundo); color: var(--ok); }
.alt.certa .letra { border-color: var(--ok-borda); color: var(--ok); }
.alt.errada { border-color: var(--erro-borda); background: var(--erro-fundo); color: var(--erro); }
.alt.errada .letra { border-color: var(--erro-borda); color: var(--erro); }
.alt.apagada { opacity: .55; }

/* ---------- Painel fixo de resposta ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  border-top: 1px solid transparent;
  animation: sheet-sobe .25s cubic-bezier(.2, .8, .3, 1);
}
.sheet[hidden] { display: none; }
.sheet.ok { background: var(--ok-sheet); color: var(--ok); border-top-color: var(--ok-borda); }
.sheet.nok { background: var(--erro-sheet); color: var(--erro); border-top-color: var(--erro-borda); }
.sheet-in { max-width: 700px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.sheet-icone { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--superficie); align-self: start; }
.sheet-icone svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sheet-texto strong { font-size: 1.15rem; }
.sheet-resposta { white-space: pre-line; }
.sheet-acoes { display: flex; flex-direction: column; gap: 8px; min-width: 170px; }
.btn.continuar { border: 0; color: #fff; padding: 15px 28px; font-size: 1.05rem; }
.sheet.ok .btn.continuar { background: var(--primaria); box-shadow: 0 3px 0 var(--primaria-escura); }
.sheet.nok .btn.continuar { background: var(--erro-botao); box-shadow: 0 3px 0 #b91c1c; }
.btn.ver-video { background: var(--superficie); border-color: transparent; color: var(--texto); }
.btn.ver-video svg { color: #ff0033; }
@keyframes sheet-sobe { from { transform: translateY(100%); } }

/* ---------- Resultado ---------- */
.resumo { display: flex; gap: 28px; align-items: center; margin-bottom: 24px; }
.anel {
  flex: none; width: 150px; height: 150px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--cor) calc(var(--p) * 1%), var(--bg-suave) 0);
}
.anel.ok { --cor: var(--primaria); }
.anel.nok { --cor: var(--erro-botao); }
.anel > span {
  width: 118px; height: 118px; border-radius: 50%; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.anel b { font-size: 2rem; font-weight: 800; line-height: 1; }
.anel small { color: var(--texto-suave); font-size: .78rem; margin-top: 4px; }
.resumo-txt h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 4px; }
.resumo-txt .sub { margin-bottom: 16px; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.n { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--bg-suave); font-size: .78rem; color: var(--texto-suave); }
.n b { font-size: 1.2rem; color: var(--texto); font-variant-numeric: tabular-nums; }
.n.ok b { color: var(--ok); }
.n.nok b { color: var(--erro); }

.acoes-resultado { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 32px; }
.titulo-lista { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); margin: 0 0 8px; }
.lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--borda); border-radius: var(--raio); overflow: hidden; }
.linha { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.linha + .linha { border-top: 1px solid var(--borda); }
.linha-icone { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--bg-suave); color: var(--texto-suave); }
.linha.ok .linha-icone { background: var(--ok-fundo); color: var(--ok); }
.linha.nok .linha-icone { background: var(--erro-fundo); color: var(--erro); }
.linha-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .9rem; }
.linha-txt span { color: var(--texto-suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-mini {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  border: 1.5px solid var(--borda); background: var(--superficie);
  font-size: .82rem; font-weight: 600;
}
.btn-mini:hover { border-color: var(--borda-forte); }
.btn-mini svg { width: 14px; height: 14px; fill: #ff0033; }

/* ---------- Transição de tela ---------- */
.entra { animation: entra .3s ease; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Popup do vídeo ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10, 12, 20, .7);
}
.modal[hidden] { display: none; }
.modal-caixa {
  width: min(900px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--superficie); border-radius: var(--raio); box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}
.modal-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; }
.modal-topo h2 { margin: 0; font-size: 1rem; }
.fechar { background: none; border: 0; font-size: 1.8rem; line-height: 1; padding: 2px 8px; color: var(--texto-suave); }
.fechar:hover { color: var(--texto); }
.modal-corpo { padding: 0 18px 18px; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-clique { position: absolute; inset: 0; cursor: pointer; }

.btn-yt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 9px;
  border: 1.5px solid var(--borda); background: var(--superficie);
  font-size: .85rem; font-weight: 600;
}
.btn-yt:hover { border-color: #ff0033; color: #ff0033; }
.btn-yt svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-acoes { display: flex; align-items: center; gap: 6px; }

/* ---------- Controles do player ---------- */
.player { display: flex; flex-direction: column; }
.controles { margin-top: 10px; }
.controles-linha { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.espaco { flex: 1; }
.tempo { margin-left: 8px; font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--texto-suave); white-space: nowrap; }
.ctl {
  width: 40px; height: 40px; border-radius: 10px; border: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--texto);
  transition: background-color .15s;
}
@media (hover: hover) { .ctl:hover { background: var(--bg-suave); } }
.ctl { -webkit-tap-highlight-color: transparent; }
.ctl svg { width: 22px; height: 22px; fill: currentColor; }
.ctl svg.traco { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ctl svg text { fill: currentColor; stroke: none; font: 700 6.5px Inter, sans-serif; }
.ctl.principal svg { width: 30px; height: 30px; }
.ctl.cc { color: var(--texto-suave); }
.ctl.cc[aria-pressed="true"] { color: var(--primaria); }
.ctl.cc[aria-pressed="true"] svg { stroke-width: 2.4; }
.ctl.vel { width: auto; min-width: 52px; padding: 0 10px; font-weight: 700; font-size: .85rem; border: 1.5px solid var(--borda); }

.seek {
  --pos: 0%; --carregado: 0%;
  appearance: none; width: 100%; height: 18px; margin: 0; background: transparent; cursor: pointer;
}
.seek::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--primaria) var(--pos), var(--borda-forte) var(--pos), var(--borda-forte) var(--carregado), var(--borda) var(--carregado));
}
.seek::-moz-range-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--primaria) var(--pos), var(--borda-forte) var(--pos), var(--borda-forte) var(--carregado), var(--borda) var(--carregado));
}
.seek::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%;
  background: var(--primaria); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  transition: transform .15s;
}
.seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--primaria); border: 2px solid #fff; }
.seek:hover::-webkit-slider-thumb { transform: scale(1.2); }
.atalhos-video { margin: 8px 0 0; font-size: .75rem; color: var(--texto-suave); text-align: center; }

.player:fullscreen { background: #000; padding: 16px; justify-content: center; }
.player:fullscreen .video { flex: 1; aspect-ratio: auto; border-radius: 0; }
.player:fullscreen .controles, .player:fullscreen .atalhos-video { color: #fff; --texto: #fff; --texto-suave: #c9ccd6; --bg-suave: #ffffff1f; --borda: #ffffff33; --borda-forte: #ffffff66; }

.capa { display: grid; place-items: center; }
.capa img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.capa-botao {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 999px; background: #ff0033; color: #fff;
  font-weight: 700; text-decoration: none; transition: transform .15s;
}
.capa:hover .capa-botao { transform: scale(1.05); }
.capa-botao svg { width: 20px; height: 20px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .entra, .sheet { animation: none; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  html { font-size: 16px; }
  .topo-in { padding: 12px 16px; }
  .logo { font-size: 1.3rem; }
  .topo-titulo { display: none; }
  .conteudo { padding: 24px 16px 40px; }
  .config h1 { font-size: 1.6rem; }
  .segmentado { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .pergunta { font-size: 1.25rem; }
  .pergunta.longa { font-size: 1.05rem; }
  .sheet-in { grid-template-columns: auto 1fr; padding: 16px; gap: 12px; }
  .sheet-icone { width: 40px; height: 40px; }
  .sheet-acoes { grid-column: 1 / -1; flex-direction: row-reverse; min-width: 0; }
  .sheet-acoes .btn { flex: 1; padding: 13px 12px; }
  .resumo { flex-direction: column; text-align: center; }
  .btn-yt span, .atalhos-video { display: none; }
  .modal-topo { padding: 10px 12px; }
  .modal-corpo { padding: 0 12px 12px; }
  .controles-linha { gap: 0; }
  .ctl { width: 34px; height: 38px; }
  .ctl.vel { min-width: 42px; padding: 0 6px; }
  .tempo { margin-left: 4px; font-size: .78rem; }
  .numeros { grid-template-columns: repeat(2, 1fr); }
  .acoes-resultado { grid-template-columns: 1fr; }
}
