:root {
  --H: #e4572e;   /* hélice  — vermelho */
  --E: #f3b700;   /* folha   — amarelo/ouro */
  --C: #b8c1cc;   /* coil    — cinza */
  --pad: #eef1f4; /* padding da janela */
  --ink: #1c2733;
  --muted: #6b7886;
  --line: #dde3ea;
  --accent: #1565c0;
  --bg: #f7f9fb;
  --cell: 22px;   /* largura de um resíduo */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}

.top { padding: 16px 24px 0; }
.top h1 { font-size: 20px; margin: 0 0 12px; font-weight: 650; }
.muted { color: var(--muted); font-weight: 400; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); }
.tab {
  border: none; background: none; cursor: pointer;
  padding: 10px 16px; font-size: 15px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.legend { padding: 12px 24px 0; display: flex; gap: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw.H { background: var(--H); }
.sw.E { background: var(--E); }
.sw.C { background: var(--C); }

main { padding: 8px 24px 24px; }
.panel { display: none; }
.panel.active { display: block; }

.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  margin: 14px 0;
}
.controls label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.controls label.grow { flex: 1; min-width: 280px; }
.prot-select { font-size: 14px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.toggles { display: flex; gap: 16px; }

.hint { color: var(--muted); font-size: 13.5px; max-width: 760px; line-height: 1.5; }

.stats { display: flex; gap: 14px; font-size: 13px; }
.stats .b { font-weight: 600; color: var(--ink); }

/* --- Trilhas de resíduos --- */
.track-wrap { overflow-x: auto; padding: 8px 0 4px; }
.track-row { display: flex; align-items: stretch; margin: 2px 0; }
.track-label {
  position: sticky; left: 0; min-width: 96px; max-width: 96px;
  display: flex; align-items: center; font-size: 13px; font-weight: 600;
  background: var(--bg); padding-right: 8px; z-index: 2;
}
.track { display: flex; }
.res {
  width: var(--cell); min-width: var(--cell);
  display: flex; flex-direction: column; align-items: center;
  font-size: 11px; line-height: 1.2;
}
.res .aa { color: var(--muted); height: 14px; font-family: ui-monospace, monospace; }
.res .ss {
  width: 100%; height: 20px; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
}
.res .ss.H { background: var(--H); }
.res .ss.E { background: var(--E); color: #5a4500; }
.res .ss.C { background: var(--C); color: #3a4654; }
.res.err .ss { box-shadow: inset 0 0 0 2px #b00020; position: relative; }
.res.err .ss::after { content: "✗"; position: absolute; font-size: 9px; color: #b00020; top: -1px; right: 1px; }
.res:hover .aa { color: var(--ink); font-weight: 700; }

/* janela destacada na aba 2 */
.windowed .res.dim { opacity: .35; }
.windowed .res.win .ss { outline: 2px solid var(--accent); outline-offset: -2px; }
.windowed .res.center .aa { color: var(--accent); font-weight: 800; }
.windowed .res.center .ss { box-shadow: 0 0 0 3px rgba(21,101,192,.35); }

/* --- Heatmap PSSM --- */
.pssm-block { margin-top: 16px; }
.pssm-caption { font-size: 14px; margin-bottom: 8px; }
.heat-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); width: max-content; }
.heat-corner, .heat-col-h, .heat-row-h { background: var(--bg); font-size: 10.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; font-family: ui-monospace, monospace; }
.heat-col-h { height: 18px; cursor: help; }
.heat-row-h { padding: 0 6px; justify-content: flex-end; white-space: nowrap; }
.heat-cell { width: 20px; height: 18px; }
.heat-legend { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend-item { display: inline-flex; flex-direction: column; gap: 3px; width: 220px; }
.legend-bar { height: 12px; border: 1px solid var(--line); border-radius: 2px; }
.legend-scale { display: flex; justify-content: space-between; font-size: 11px; font-family: ui-monospace, monospace; }
.legend-label { max-width: 620px; line-height: 1.5; }
.legend-label b { color: var(--ink); font-weight: 600; }
.legend-pad { display: inline-flex; align-items: center; gap: 6px; }
.legend-pad-sw { width: 20px; height: 12px; background: var(--pad); border: 1px solid var(--line); border-radius: 2px; }
.heat-row-center .heat-row-h { color: var(--accent); font-weight: 700; }

/* --- Q3 e confusão (aba 3) --- */
.q3-row { display: flex; gap: 24px; margin: 14px 0; font-size: 14px; }
.q3-pill { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.q3-pill b { font-size: 18px; color: var(--accent); }

.confusion-block { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
.confusion-block h3 { font-size: 16px; margin: 0 0 4px; }
.cm-grid { display: grid; grid-template-columns: auto repeat(3, 64px); gap: 2px; width: max-content; margin: 8px 0; }
.cm-h { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.cm-cell { height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 13px; font-variant-numeric: tabular-nums; }
.cm-cell.diag { font-weight: 700; }

.foot { padding: 12px 24px 24px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }
