:root {
  --fundo: #f3f4f8;
  --painel: #ffffff;
  --texto: #1d1f2b;
  --suave: #5f6577;
  --linha: #dfe2ea;
  --marca: #2b2d6e;
  --a: #d63c3c;
  --b: #2f6fd6;
  --c: #d9a10f;
  --d: #2e9a55;
  --ok: #2e9a55;
  --mal: #d63c3c;
  --codigo: #1e1e1e;
  --raio: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto);
  font-size: 16px;
}
button { font: inherit; cursor: pointer; }
.contentor { max-width: 1200px; margin: 0 auto; padding: 16px; }
.cartao { background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); padding: 20px; }
.topo { background: var(--marca); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topo h1 { font-size: 1.1rem; margin: 0; font-weight: 600; }
.topo .info { font-size: .95rem; opacity: .9; }
h2 { margin: 0 0 12px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 12px 14px; font-size: 1.1rem; border: 2px solid var(--linha); border-radius: 10px; background: #fff; color: var(--texto);
}
input:focus, select:focus { outline: none; border-color: var(--b); }
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 10px; background: var(--marca); color: #fff; font-weight: 600; font-size: 1.05rem;
}
.botao:disabled { opacity: .4; cursor: not-allowed; }
.botao.grande { padding: 16px 28px; font-size: 1.25rem; }
.botao.verde { background: var(--ok); }
.ligacao { background: none; border: 0; color: var(--suave); text-decoration: underline; padding: 6px; }
.erro { color: var(--mal); font-weight: 600; min-height: 1.4em; margin-top: 10px; }
.suave { color: var(--suave); }
.centro { text-align: center; }
.escondido { display: none !important; }

/* Pergunta */
.cabecalho-pergunta { color: var(--suave); font-weight: 600; margin-bottom: 8px; }
.enunciado { font-size: 1.35rem; font-weight: 700; line-height: 1.35; margin: 0 0 14px; }
pre.codigo {
  background: var(--codigo); color: #e6e6e6; border-radius: 10px; padding: 14px 16px; margin: 0 0 16px;
  font-family: Consolas, "Courier New", monospace; font-size: 1rem; line-height: 1.45; overflow-x: auto; white-space: pre;
}
.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .opcoes { grid-template-columns: 1fr; } }
.opcao {
  display: flex; align-items: center; gap: 12px; text-align: left; min-height: 64px;
  padding: 12px 16px; border: 0; border-radius: 10px; color: #fff; font-size: 1.1rem; font-weight: 600; line-height: 1.3;
  transition: transform .1s, opacity .2s;
}
.opcao .letra {
  flex: none; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.opcao .texto { flex: 1; word-break: break-word; }
.opcao .conta { flex: none; font-size: 1.2rem; font-weight: 800; }
.opcao.A { background: var(--a); } .opcao.B { background: var(--b); }
.opcao.C { background: var(--c); } .opcao.D { background: var(--d); }
.opcao:not(:disabled):hover { transform: translateY(-2px); }
.opcao:disabled { cursor: default; }
.opcao.apagada { opacity: .3; }
.opcao.escolhida { outline: 4px solid var(--texto); outline-offset: 2px; }
.opcao.certa { outline: 5px solid var(--texto); outline-offset: 2px; opacity: 1; }
.opcao.errada { opacity: .9; outline: 5px dashed var(--mal); outline-offset: 2px; }
@media (max-width: 640px) { pre.codigo { font-size: .82rem; padding: 12px; } .enunciado { font-size: 1.15rem; } }
.explicacao { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: #eef7f1; border: 1px solid #c9e7d3; font-size: 1.05rem; }

/* Estado do aluno */
.faixa { padding: 18px; border-radius: var(--raio); color: #fff; text-align: center; font-size: 1.4rem; font-weight: 800; margin-bottom: 14px; }
.faixa.ok { background: var(--ok); } .faixa.mal { background: var(--mal); } .faixa.espera { background: var(--marca); }
.grande-numero { font-size: 3rem; font-weight: 800; }

/* Professor */
.grelha-prof { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grelha-prof { grid-template-columns: 1fr; } }
.codigo-jogo { font-size: 5rem; font-weight: 800; letter-spacing: .12em; color: var(--marca); }
.endereco { font-size: 1.4rem; font-weight: 600; word-break: break-all; }
.fichas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ficha { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #e9ebf3; font-weight: 600; }
.ficha.respondeu { background: #d4efdd; }
.ficha button { border: 0; background: none; color: var(--suave); font-size: 1rem; padding: 0 2px; }
.contador { font-size: 2.6rem; font-weight: 800; }
.barra { height: 12px; border-radius: 6px; background: #e9ebf3; overflow: hidden; margin: 8px 0 4px; }
.barra > div { height: 100%; background: var(--ok); transition: width .3s; }
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--linha); font-variant-numeric: tabular-nums; }
.ranking .pos { width: 28px; text-align: right; font-weight: 800; color: var(--suave); }
.ranking .nome { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .pts { font-weight: 800; }
.ranking li.top1 .pos { color: #c9a20a; } .ranking li.top2 .pos { color: #8f97a6; } .ranking li.top3 .pos { color: #b0703a; }
.acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.podio { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 20px 0; }
.degrau { width: 180px; max-width: 30%; text-align: center; }
.degrau .bloco { border-radius: 10px 10px 0 0; color: #fff; font-weight: 800; font-size: 2rem; display: flex; align-items: center; justify-content: center; }
.degrau .quem { font-weight: 800; font-size: 1.15rem; margin-bottom: 6px; word-break: break-word; }
.degrau.p1 .bloco { height: 170px; background: #c9a20a; }
.degrau.p2 .bloco { height: 120px; background: #8f97a6; }
.degrau.p3 .bloco { height: 90px; background: #b0703a; }

/* Projetor: letra maior no ecrã do professor */
body.projetor .enunciado { font-size: 1.7rem; }
body.projetor pre.codigo { font-size: 1.15rem; }
body.projetor .opcao { font-size: 1.3rem; min-height: 76px; }
