/* ============================================================
   Tema técnico/futurista — paleta, tipografia e componentes.
   Fase A: motivos geométricos genéricos (retículo, anel, leque).
   ============================================================ */

:root {
  --bg: #0a0e14;
  --surface: #10161f;
  --surface-2: #141c27;
  --border: #1f2a37;
  --text: #d7e1ea;
  --text-dim: #8a99a8;
  --accent: #22d3ee;
  --accent-2: #35e0d0;
  --warn: #f5b942;
  --ok: #4ade80;
  --err: #ef5350;
  --grid-line: rgba(34, 211, 238, 0.025);
  --topbar-bg: rgba(10, 14, 20, 0.92);
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 6px;
  --pad: 16px;
}

/* tema claro — mesmas variáveis, paleta fria técnica */
html[data-theme="light"] {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #e3eaf1;
  --border: #c3cfdb;
  --text: #15202b;
  --text-dim: #5a6b7b;
  --accent: #0e7e96;
  --accent-2: #0c8a7d;
  --warn: #a16207;
  --ok: #15803d;
  --err: #b91c1c;
  --grid-line: rgba(14, 126, 150, 0.05);
  --topbar-bg: rgba(238, 242, 246, 0.92);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100%;
}

/* grade técnica sutil ao fundo */
body {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre { font-family: var(--mono); font-size: 0.9em; }

button {
  font-family: var(--mono);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 14px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
button:hover { border-color: var(--accent); }
button:active { transform: scale(0.98); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- componentes ---------- */

.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  background: var(--surface);
  white-space: nowrap;
}
.chip.accent { color: var(--accent-2); border-color: rgba(53, 224, 208, 0.35); }
.chip.warn { color: var(--warn); border-color: rgba(245, 185, 66, 0.35); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
}

.panel-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 0 0 14px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .glyph { font-size: 2rem; opacity: 0.5; margin-bottom: 8px; }

.btn-primary {
  background: linear-gradient(135deg, rgba(34,211,238,0.16), rgba(53,224,208,0.08));
  border-color: rgba(34, 211, 238, 0.5);
  color: var(--accent);
}
.btn-primary:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* botões da escala de revisão */
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rating-btn { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; text-align: center; }
.rating-btn .rating-name { font-size: 0.95rem; font-weight: 700; }
.rating-btn .rating-hint { font-family: var(--sans); font-size: 0.72rem; color: var(--text-dim); line-height: 1.35; }
.rating-btn.r-errado .rating-name { color: var(--err); }
.rating-btn.r-dificil .rating-name { color: var(--warn); }
.rating-btn.r-normal .rating-name { color: var(--accent); }
.rating-btn.r-facil .rating-name { color: var(--ok); }

/* alternativas de questão */
.alt-btn { display: flex; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; margin-bottom: 8px; font-family: var(--sans); align-items: baseline; }
.alt-btn .alt-letra { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.alt-btn.correct { border-color: var(--ok); background: rgba(74, 222, 128, 0.08); }
.alt-btn.wrong { border-color: var(--err); background: rgba(239, 83, 80, 0.08); }
.alt-btn:disabled { cursor: default; opacity: 0.85; }

/* conteúdo markdown renderizado */
.md-body h3 { color: var(--accent-2); font-size: 1.02rem; margin-top: 1.6em; }
.md-body table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.92rem; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.md-body th { background: var(--surface-2); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.05em; }
.md-body tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
.md-body input[type="checkbox"] { accent-color: var(--accent); }
.md-body img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.md-body blockquote { border-left: 3px solid var(--warn); margin: 1em 0; padding: 4px 14px; color: var(--text-dim); background: rgba(245, 185, 66, 0.05); }
.md-body details { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 1em 0; background: var(--surface-2); }
.md-body details summary { cursor: pointer; font-family: var(--mono); color: var(--accent); }

/* toggles dos sistemas de revisão */
.sys-toggles { margin-bottom: 14px; }
.sys-toggle-row { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .slider {
  width: 34px; height: 18px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; transition: background 0.15s, border-color 0.15s;
}
.switch .slider::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-dim); transition: left 0.15s, background 0.15s;
}
.switch input:checked + .slider { background: rgba(34, 211, 238, 0.2); border-color: var(--accent); }
.switch input:checked + .slider::after { left: 18px; background: var(--accent); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; }
.count-card.sys-off { opacity: 0.35; }
.subtab-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* treino de passo a passo */
.rules-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-top: 12px; background: var(--surface-2); }
.rules-panel ul { list-style: none; margin: 8px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step-seq { margin: 12px 0; padding-left: 24px; display: flex; flex-direction: column; gap: 6px; }
.step-seq li { font-family: var(--mono); font-size: 0.85rem; color: var(--ok); }
.step-pool { display: flex; flex-direction: column; gap: 8px; }
.step-btn { text-align: left; font-family: var(--sans); padding: 11px 14px; }
.flash-wrong { animation: flashWrong 0.45s ease; }
@keyframes flashWrong {
  0% { border-color: var(--err); background: rgba(239, 83, 80, 0.25); }
  100% { border-color: var(--border); background: var(--surface-2); }
}
.outcome { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; margin: 8px 0; }
.outcome-errado { color: var(--err); }
.outcome-dificil { color: var(--warn); }
.outcome-normal { color: var(--accent); }
.outcome-facil { color: var(--ok); }

/* trecho omitido nos flashcards cloze (Omissão de Palavras) */
.md-body .cloze {
  color: var(--accent);
  font-weight: 700;
  border-bottom: 1px dashed var(--accent);
  padding: 0 2px;
}

/* barra de status */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
}

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