/* hibrida — estilos da introdução, da aula e do laboratório (curso de AI Engineer). */

/* ---------- aula ---------- */
/* prefixo .hiba- · demos de js/games/hibrida/aula.js (os balões e o bloco "rodar no LLM" vêm de css/ai.css) */

/* canvases só de leitura: o dedo que começa neles ainda rola a página
   (duas classes: lesson.css carrega depois e põe touch-action: none em .ls-canvas) */
.ls-canvas.hiba-canvas { touch-action: pan-y; }
.ls-canvas.hiba-rank { height: 190px; }
.ls-canvas.hiba-fus { height: 220px; }

.hiba-cap { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.hiba-cap b { font-weight: 500; color: var(--text); }

/* a consulta em destaque, com o documento certo à direita */
.hiba-q { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 10px 12px; border: 2px solid var(--line-2); border-left: 4px solid var(--info); background: var(--bg); font-size: 14.5px; line-height: 1.45; color: var(--text); }
.hiba-q:empty { display: none; }
.hiba-alvo { margin-left: auto; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.hiba-alvo code, .hiba-card-alvo code { font: inherit; color: var(--good); }

/* legendas: as mesmas barrinhas arredondadas dos gráficos limpos */
.hiba-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.hiba-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hiba-legend i, .hiba-fig figcaption i, .hiba-lista-t i { display: inline-block; flex: none; width: 14px; height: 6px; border-radius: 3px; }
.hiba-legend .k-caixa { background: #5b9bff; }
.hiba-legend .k-de { background: #5b5675; }
.hiba-legend .k-fuji { background: #ffd23f; }
.hiba-legend .k-alvo { height: 8px; border: 1.5px solid #64d98b; background: transparent; }
.hiba-legend .k-pond, .hiba-legend .k-pal, .hiba-fig .k-pal, .hiba-lista-t .k-pal { background: #ff8c2e; }
.hiba-legend .k-longo { height: 0; border-top: 2px dashed #ff8c2e; background: transparent; }
.hiba-legend .k-curto { background: #64d98b; }
.hiba-legend .k-vet, .hiba-fig .k-vet, .hiba-lista-t .k-vet { background: #7ad7ff; }
.hiba-legend .k-rrf { height: 0; border-top: 2px dashed #7ad7ff; background: transparent; }
.hiba-legend .k-agora { width: 2px; height: 12px; border-radius: 0; background: #c8f53c; }

/* 1 · palpites: um cartão por consulta */
.hiba-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.hiba-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border: 2px solid var(--line-2); border-left-width: 4px; background: var(--bg); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.hiba-card.ok { border-left-color: var(--good); }
.hiba-card.no { border-left-color: var(--bad); }
.hiba-card.cur { border-top-color: var(--accent); border-right-color: var(--accent); border-bottom-color: var(--accent); box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.45); }
.hiba-card-q { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; font-size: 14px; line-height: 1.4; color: var(--text); }
.hiba-card-q b { font-weight: 500; }
.hiba-tipo { padding: 1px 6px; border: 1px solid var(--line-2); font: 400 11px/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.hiba-card-alvo { margin: 0; font: 400 11.5px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.hiba-card-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.hiba-card-btns .btn[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); opacity: 1; }
.hiba-card-res { padding: 0; border: 0; background: none; font: 500 12px/1.45 var(--mono); text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; color: var(--muted); cursor: pointer; }
.hiba-card-res[hidden] { display: none; }
.hiba-card.ok .hiba-card-res { color: var(--good); }
.hiba-card.no .hiba-card-res { color: var(--bad); }
.hiba-card-res:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 2 · os 5 documentos da demo de k1 e b */
.hiba-details { padding: 8px 10px; border: 2px dashed var(--line-2); background: var(--bg); }
.hiba-details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.hiba-details summary:hover { color: var(--text); }
.hiba-docs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.hiba-docs li span:last-child { display: block; }
.hiba-docs b { font-weight: 500; color: var(--text); }
.hiba-docs .mono { margin-left: 6px; font-size: 11.5px; color: var(--muted); }

/* 3 · a consulta da pessoa e as duas buscas lado a lado */
.hiba-free { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.hiba-free .sg-label { margin: 0; }
.hiba-input { flex: 1 1 200px; min-width: 0; height: 32px; padding: 0 10px; border: 2px solid var(--line-2); background: var(--bg); font: 400 14px/1 var(--sans); color: var(--text); }
.hiba-input::placeholder { color: var(--faint); }
.hiba-input:focus { outline: none; border-color: var(--accent); }
.hiba-duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 720px) { .hiba-duo { grid-template-columns: 1fr; } }
.hiba-fig { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.hiba-fig figcaption { display: flex; align-items: center; gap: 6px; font: 500 12px/1.4 var(--mono); color: var(--text-2); }
.hiba-src { margin: 0; font: 400 12px/1.45 var(--mono); color: var(--muted); }
.hiba-src b { font-weight: 500; color: var(--text-2); }

/* 4 · as duas listas que a RRF funde */
.hiba-lista { min-width: 0; padding: 8px 10px; border: 2px dashed var(--line-2); background: var(--bg); }
.hiba-lista-t { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 500 12px/1.4 var(--mono); color: var(--text-2); }
.hiba-lista ol { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.hiba-lista li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; padding: 3px 6px; border-left: 3px solid transparent; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.hiba-lista li.ok { border-left-color: var(--good); background: var(--good-soft); color: var(--text); }
.hiba-lista li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hiba-lista li .mono { font-size: 11.5px; color: var(--muted); }
.hiba-lista li b.mono { font-weight: 500; color: var(--text-2); }
.hiba-lista li small { font-size: 11px; color: var(--accent); }
.hiba-vazio { margin: 0; font-size: 12.5px; font-style: italic; color: var(--muted); }

/* 5 · a tabela das quatro consultas */
.hiba-scroll { overflow-x: auto; }
.hiba-table { width: 100%; }
.hiba-table th, .hiba-table td { padding: 6px 10px; text-align: left; }
.hiba-table code { font: inherit; color: var(--text-2); }
.hiba-td { min-width: 150px; font-family: var(--sans); line-height: 1.35; color: var(--text); }

/* ---------- jogo ---------- */
/* raiz do jogo: .hibg · prefixo .hib- · "Detetive de Busca" (js/games/hibrida/game.js); a base vem de .sg-* (css/games.css) */

.hibg { --hib-hard: 3px 3px 0 0 rgba(0, 0, 0, 0.5); }

/* campo: a cena do arquivo em pixel art (fase 1); nas outras fases o mesmo canvas vira gráfico limpo.
   Só toques (a régua do alpha também aceita arraste com o mouse): o dedo ainda rola a página */
.hibg .sg-canvas {
  border-radius: 0;
  background: #141320;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: var(--hib-hard);
  touch-action: manipulation;
}
.hibg .sg-canvas.chart-canvas { image-rendering: auto; }
.hibg .sg-canvas.hib-short { height: 270px; }
@media (max-width: 640px) { .hibg .sg-canvas.hib-short { height: 240px; } }

/* leitura sob o campo: chips de legenda */
.hibg .sg-caption { justify-content: flex-start; gap: 6px; font: 400 11px/1.3 var(--pixel-ui); color: var(--muted); }
.hibg .sg-caption:empty { display: none; }
.hibg .sg-caption span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 4px 8px; border: 2px solid var(--line-2); background: var(--bg-2); overflow-wrap: anywhere; }
.hibg .sg-caption b { font-weight: 400; color: var(--accent); }
/* as mesmas cores do canvas (PAL de pixel.js): palavras laranja, significado azul-céu */
.hib-dot { flex: none; display: inline-block; width: 10px; height: 10px; border: 1px solid #000; }
.hib-dot.pal { background: #ff8c2e; }
.hib-dot.vet { background: #7ad7ff; }
.hib-dot.alvo { background: transparent; border: 2px solid #64d98b; }
.hib-dot.tem { width: 6px; height: 6px; background: #ff8c2e; }
.hib-dot.ref { width: 14px; height: 0; border: 0; border-top: 2px dashed #ffd23f; }
.hib-dot.win { background: rgba(100, 217, 139, 0.35); border-color: #64d98b; }
.hib-dot.t-caixa { background: #5b9bff; }
.hib-dot.t-de { background: #5b5675; }
.hib-dot.t-fuji { background: #ffd23f; }

/* painel de controles */
.hib-controls { display: flex; flex-direction: column; gap: 12px; }
.hib-msg:empty { display: none; }
.hib-msg .mono { font-size: 0.95em; }
.hib-ask { margin: 0; padding: 10px 12px; border: 2px solid var(--line-2); border-left: 4px solid var(--accent); background: var(--bg); font-size: 14px; line-height: 1.5; color: var(--text-2); box-shadow: var(--hib-hard); }
.hib-ask b { color: var(--text); font-weight: 500; }
.hibg .sg-formula { border-radius: 0; border-color: var(--line-2); background: var(--bg); box-shadow: var(--hib-hard); }
.hibg .sg-formula .muted { font-size: 11.5px; }
.hibg .sg-slider { grid-template-columns: 58px minmax(0, 1fr) 56px; }
.hibg .sg-slider > .mono { font-family: var(--pixel); font-size: 16px; color: var(--accent); }
.hibg .sg-slider output { font-family: var(--pixel-ui); font-size: 11px; }
.hibg .sg-slider:has(input:disabled) { opacity: 0.5; }
.hibg .sg-stats div { min-width: 0; border-radius: 0; border-width: 2px; border-color: var(--line-2); background: var(--bg-2); box-shadow: var(--hib-hard); }
.hibg .sg-stats dd { font-size: 15px; overflow-wrap: anywhere; }
.hibg .sg-stats dd small { display: block; margin-top: 4px; font: 400 10.5px/1.2 var(--mono); letter-spacing: 0; color: var(--muted); }
.hibg .sg-goal, .hibg .sg-msg { border-radius: 0; }
.hibg .btn kbd { margin-left: 6px; }
.hib-keys { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.hib-fund { min-width: 0; font-size: 12px; text-align: right; color: var(--text-2); overflow-wrap: anywhere; }
.hib-key { flex: none; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border: 2px solid var(--line-2); background: var(--bg); font-size: 11px; color: var(--muted); }

/* palpites (fase 1 e a previsão da fase 2) */
.hib-opts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hib-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px; border: 2px solid var(--line-2); background: var(--surface);
  text-align: left; color: var(--text-2); box-shadow: 2px 2px 0 0 #000; cursor: pointer;
}
.hib-otxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hib-otxt b { font-size: 14px; font-weight: 500; color: var(--text); }
.hib-otxt small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.hib-opt:hover:not(:disabled) { border-color: var(--line-3); color: var(--text); }
.hib-opt:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.hib-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hib-opt:disabled { cursor: default; }
.hib-opt[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.hib-opt.ok { border-color: var(--good); background: var(--good-soft); }
.hib-opt.ok small { color: var(--good); }
.hib-opt.no { border-color: var(--bad); background: var(--bad-soft); }
.hib-opt.no small { color: var(--bad); }

/* abaixo do campo */
.hib-board { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hib-board[hidden] { display: none; }
.hib-board .sg-label { line-height: 1.4; }
.hib-q { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 10px 12px; border: 2px solid var(--line-2); border-left: 4px solid var(--info); background: var(--bg); font-size: 14.5px; line-height: 1.45; color: var(--text); box-shadow: var(--hib-hard); }
.hib-q > span { min-width: 0; overflow-wrap: anywhere; }
.hib-alvo { margin-left: auto; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.hib-alvo code { font: inherit; color: var(--good); }
.hib-tipo { padding: 1px 6px; border: 1px solid var(--line-2); font: 400 11px/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.hib-toks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.hib-tok { padding: 2px 7px; border: 2px solid var(--line-2); background: var(--bg); font: 400 12px/1.4 var(--mono); color: var(--muted); }
.hib-tok.hit { border-color: #ff8c2e; color: var(--text); }
.hib-toks small { font-size: 11.5px; color: var(--muted); }
.hib-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.hib-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hib-details { padding: 8px 10px; border: 2px dashed var(--line-2); background: var(--bg); }
.hib-details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.hib-details summary:hover { color: var(--text); }
.hib-docs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.hib-docs li span:last-child { display: block; }
.hib-docs b { font-weight: 500; color: var(--text); }
.hib-docs .mono { margin-left: 6px; font-size: 11.5px; color: var(--muted); }

/* as listas da Lupa e do Faro */
.hib-duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hib-lista { min-width: 0; padding: 8px 10px; border: 2px dashed var(--line-2); background: var(--bg); }
.hib-lista-t { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 500 12px/1.4 var(--mono); color: var(--text-2); }
.hib-lista ol { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; }
.hib-lista li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; gap: 8px; align-items: baseline; padding: 3px 6px; border-left: 3px solid transparent; font-size: 12.5px; line-height: 1.4; color: var(--text-2); }
.hib-lista li.ok { border-left-color: var(--good); background: var(--good-soft); color: var(--text); }
.hib-lista li.on { border-left-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.hib-lista li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hib-lista li .mono { font-size: 11.5px; color: var(--muted); }
.hib-lista li small.mono { color: var(--faint); }
.hib-lista li b.mono { font-weight: 500; color: var(--text-2); }
.hib-vazio { margin: 0; font-size: 12.5px; font-style: italic; color: var(--muted); }

/* fase 3: os documentos das duas listas */
.hib-cands { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 6px; }
.hib-cand {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 8px;
  width: 100%; height: 100%; padding: 8px 10px; border: 2px solid var(--line-2); background: var(--surface);
  text-align: left; color: var(--text-2); box-shadow: 2px 2px 0 0 #000; cursor: pointer;
}
.hib-cand b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; color: var(--text); }
.hib-cand small { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.hib-cand small.hib-frac { color: var(--accent); }
.hib-pos { justify-self: end; font-size: 12px; color: var(--accent); }
.hib-cand:hover:not(:disabled) { border-color: var(--line-3); color: var(--text); }
.hib-cand:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.hib-cand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hib-cand:disabled { cursor: default; }
.hib-cand.on { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: none; }
.hib-cand.no { border-color: var(--bad); background: var(--bad-soft); }

/* fase 4: as três consultas */
.hib-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hib-rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: 6px 10px; border: 2px solid var(--line-2); border-left-width: 4px; background: var(--bg); font-size: 13.5px; line-height: 1.4; color: var(--text); }
.hib-rows li > span { min-width: 0; overflow-wrap: anywhere; }
.hib-rows li.ok { border-left-color: var(--good); }
.hib-rows li.no { border-left-color: var(--bad); }
.hib-rows code { font: 400 12px/1.4 var(--mono); color: var(--muted); }
.hib-rows b { font-size: 12px; font-weight: 500; white-space: nowrap; }
.hib-rows li.ok b { color: var(--good); }
.hib-rows li.no b { color: var(--bad); }

/* celular e tablet: objetivo primeiro, depois o campo, o quadro e os controles */
@media (max-width: 920px) {
  .hibg .sg-body { display: flex; flex-direction: column; gap: 12px; }
  .hibg .sg-main, .hibg .sg-ctrl { display: contents; }
  .hibg .sg-head { order: 1; }
  .hibg .sg-goal { order: 2; }
  .hibg .sg-canvas { order: 3; }
  .hibg .sg-caption { order: 4; }
  .hibg .hib-board { order: 5; }
  .hibg .hib-controls { order: 6; }
  .hibg .hib-msg { order: 7; }
  .hibg .sg-actions { order: 8; }
}
@media (max-width: 520px) {
  .hib-duo { grid-template-columns: minmax(0, 1fr); }
  .hib-alvo { margin-left: 0; }
  .hib-cands { grid-template-columns: minmax(0, 1fr); }
  .hibg .sg-stats { gap: 6px; }
  .hibg .sg-stats div { padding: 8px; }
  .hibg .sg-stats dd { font-size: 13px; }
  .hib-rows li { grid-template-columns: minmax(0, 1fr) auto; }
  .hib-rows code { grid-column: 1; grid-row: 2; }
  .hib-rows b { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}
/* no celular não há teclado: some a linha de atalhos, as teclas dos botões e os números das opções */
@media (hover: none) and (pointer: coarse) {
  .hib-keys, .hibg kbd, .hibg .hib-key { display: none; }
  .hib-opt { grid-template-columns: minmax(0, 1fr); }
  .hib-cand { grid-template-columns: minmax(0, 1fr) auto; }
}
