/* D·P·H — estilos do site (usa os tokens de marca/tokens.css) */

* { box-sizing: border-box; }
html { color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

/* foco visível em todo lugar */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--p);
  outline-offset: 2px;
}

/* -------------------- topo -------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.topbar .home-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.topbar .home-link img { height: 22px; width: auto; }

.topbar .modulo-info {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 700;
  /* --text-dim/--dim-text ficam abaixo de 4.5:1 sobre cards no tema escuro
     (ver marca/MARCA.md); --text-muted tem folga de contraste em qualquer fundo. */
  color: var(--text-muted);
}

.acoes-topo { display: inline-flex; gap: 0.5rem; }

a.theme-toggle { text-decoration: none; display: inline-flex; align-items: center; }

.theme-toggle {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
}

/* -------------------- botões -------------------- */

button, .btn {
  font-family: var(--font);
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
}

.btn-primary {
  background: var(--p);
  color: var(--on-tile, #24333B);
  border-color: var(--p);
  font-weight: 700;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary { background: transparent; }

.acoes {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* -------------------- cartões -------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-2 { background: var(--card-2); }

/* -------------------- tiles das letras -------------------- */

.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 25%;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--on-tile, #24333B);
  flex-shrink: 0;
}
.tile-d { background: var(--d); }
.tile-p { background: var(--p); }
.tile-h { background: var(--h); }

/* -------------------- trechos coloridos por letra -------------------- */

.trecho-d { color: var(--d-text, var(--d)); font-weight: 700; }
.trecho-p { color: var(--p-text, var(--p)); font-weight: 700; }
.trecho-h { color: var(--h-text, var(--h)); font-weight: 700; }

/* -------------------- pílulas de estado -------------------- */

.pill {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1.25px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.pill-recebido { border-color: var(--text-dim); color: var(--text-muted); }
.pill-assumido { border-color: var(--d); color: var(--d-text, var(--d)); }
.pill-em-curso { border-color: var(--p); color: var(--p-text, var(--p)); }
.pill-resolvido { border-color: var(--h); color: var(--h-text, var(--h)); }
.pill-fechado { border-color: var(--orange); color: var(--orange); }
.pill-em-risco-recombinado { border-color: var(--red); color: var(--red-text); }
.pill-aguardando-outra-area { border-color: var(--d); color: var(--d-text, var(--d)); }

/* -------------------- proibido -------------------- */

.proibido {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.bloqueio {
  border: 1.25px solid var(--red);
  background: var(--card-2);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 0.75rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

/* -------------------- opções (quiz / classificar / casos) -------------------- */

.opcoes { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0; }

/* opções curtas (M1): em linha, para não empilhar a página inteira */
.opcoes-curtas { flex-direction: row; flex-wrap: wrap; }
.opcoes-curtas .opcao { width: auto; flex: 1 1 150px; text-align: center; }

.opcao {
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 1.25px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.opcao[aria-pressed="true"] { border-color: var(--p); }
.opcao.certa { border-color: var(--d); background: var(--card-2); }
.opcao.errada { border-color: var(--red); background: var(--card-2); }

.feedback { margin-top: 0.5rem; font-size: 0.9rem; }
.feedback.certa { color: var(--d-text, var(--d)); }
.feedback.errada { color: var(--red-text); }

/* -------------------- linha do tempo (home) -------------------- */

.timeline { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; }

.timeline-momento {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-top: 1rem;
}

.modulo-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}
.modulo-item:hover { border-color: var(--line); }
.modulo-item[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.modulo-item .status-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}
.modulo-item .status-dot.concluido { background: var(--d); border-color: var(--d); }
.modulo-item .status-dot.em-andamento { background: var(--p); border-color: var(--p); }

.modulo-item .txt { flex: 1; }
.modulo-item .duracao { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

/* -------------------- rodapé de navegação -------------------- */

.nav-rodape {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* -------------------- diverso -------------------- */

.trecho-classificavel {
  font-size: 1.1rem;
  padding: 1rem;
}

textarea, input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
}

.aviso-sem-storage {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.4rem;
}

.progresso-barra {
  height: 6px;
  border-radius: 999px;
  background: var(--card-2);
  overflow: hidden;
  margin: 0.75rem 0 1.5rem;
}
.progresso-barra > span {
  display: block;
  height: 100%;
  background: var(--p);
}

@media (max-width: 480px) {
  .topbar { padding: 0.75rem; }
  .container { padding: 1rem 1rem 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .topbar, .nav-rodape, .acoes, .theme-toggle, #instrucao, #exemplos, #contador {
    display: none !important;
  }
  body { background: #fff; color: #000; }
}

/* Home → seção "Preparação" */
.grade-preparacao {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.grade-preparacao .card { margin: 0; }
.grade-preparacao h3 { margin-top: 0; font-size: 1rem; }
.prompt-texto {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.85rem;
}
.grade-preparacao .card-largo { grid-column: 1 / -1; }
.grade-preparacao summary { cursor: pointer; font-weight: 600; margin: 0.5rem 0; }
.grade-preparacao audio { width: 100%; }
