/* =============================================================================
   ht-console.css — H-Test console pieces the Cover Test console does not have:
   position pad, OM diagram, live readout, clinical result. The shell, steps,
   coaching, buttons, drawers, about cards and log reuse css/cover-test/* so
   the three tests read as one family. Pupilla tokens; grade colours local.
   Markup: js/h-test/ui/ht-console-template.js
   ============================================================================= */

.htc {
  --ht-under: #b8402d;
  --ht-under-tint: color-mix(in srgb, #b8402d 13%, var(--surface));
  --ht-over: #b7791f;
  --ht-over-tint: color-mix(in srgb, #d99a1e 16%, var(--surface));
}
.htc .ctc-icon { color: var(--accent); }
.htc .ctc-auto-btn svg { width: 14px; height: 14px; }
.htc .ctc-auto-btn { display: inline-flex; align-items: center; gap: 6px; }

/* ── Position pad (as you face the patient) ─────────────────────────────── */
.ht-pad {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  max-width: 420px; padding: 8px;
  border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-sunken);
}
.ht-pad-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 48px; padding: 6px 4px;
  border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}
.ht-pad-cell:hover:not(:disabled) { border-color: var(--accent); }
.ht-pad-cell:disabled { cursor: default; opacity: 0.55; }
.ht-pad-cell[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-strong); }
.ht-pad-dot { width: 9px; height: 9px; border: 2px solid currentColor; border-radius: 50%; }
.ht-pad-cell[aria-pressed="true"] .ht-pad-dot { background: currentColor; }

/* ── OM diagram ─────────────────────────────────────────────────────────── */
.ctc-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ht-om-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ht-om-cell {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 6px; border: 1px solid var(--border-soft); border-radius: 10px; background: var(--surface);
}
.ht-om-cell.is-held { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ht-om-primary { justify-content: center; align-items: center; background: var(--surface-sunken); text-align: center; }
.ht-om-pos { font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-soft); }
.ht-om-dev { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ht-om-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.ht-om-chip {
  display: inline-flex; align-items: baseline; gap: 3px;
  padding: 1px 5px; border: 1px solid var(--border-soft); border-radius: 6px;
  font-family: var(--ct-mono); font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text-soft);
}
.ht-om-chip b { font-family: inherit; font-size: 9px; font-weight: 700; color: var(--text-faint, var(--text-soft)); }
.ht-om-chip.is-full { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-strong); }
.ht-om-chip[class*="is-under"] { border-color: var(--ht-under); background: var(--ht-under-tint); color: var(--ht-under); font-weight: 700; }
.ht-om-chip.is-under-4 { background: var(--ht-under); color: #fff; }
.ht-om-chip.is-under-4 b { color: rgba(255, 255, 255, 0.8); }
.ht-om-chip.is-over { border-color: var(--ht-over); background: var(--ht-over-tint); color: var(--ht-over); font-weight: 700; }
.ht-om-chip.is-nt { border-style: dashed; }
.ht-om-chip.is-better { box-shadow: 0 0 0 1px var(--accent) inset; }
.ht-om-vs { font-size: 9px; opacity: 0.8; }
.ht-om-muscles { display: flex; justify-content: space-between; gap: 2px; font-size: 9.5px; line-height: 1.2; color: var(--text-soft); }
.ht-om-muscles span { min-width: 0; overflow-wrap: anywhere; }
.ht-om-exp { font-size: 9.5px; line-height: 1.25; color: var(--note-strong); }
.ht-om-legend, .ht-torsion-read { margin: 4px 0 0; font-size: 10.5px; line-height: 1.4; color: var(--text-soft); }
.ht-torsion-read:empty { display: none; }

/* ── Live readout ───────────────────────────────────────────────────────── */
.ht-live-grid { display: grid; gap: 3px; margin: 0; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.ht-live-grid > div { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 6px; }
.ht-live-grid dt { font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-soft); }
.ht-live-grid dd { margin: 0; font-size: 12px; }
.ht-empty { margin: 0; padding: 10px; border: 1px dashed var(--border); border-radius: 10px; font-size: 12px; color: var(--text-soft); }

/* ── Result ─────────────────────────────────────────────────────────────── */
.ht-result { display: flex; flex-direction: column; gap: 10px; }
.ht-result section { display: flex; flex-direction: column; gap: 4px; }
.ht-result h4 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-soft); }
.ht-result ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.ht-headline { margin: 0; padding: 10px 12px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--accent-tint); font-size: 14px; font-weight: 600; line-height: 1.4; }
.ht-findings { display: flex; flex-wrap: wrap; gap: 5px; }
.ht-finding { padding: 2px 9px; border: 1px solid; border-radius: 999px; font-family: var(--ct-mono); font-size: 11.5px; font-weight: 700; }
.ht-finding.is-under { border-color: var(--ht-under); background: var(--ht-under-tint); color: var(--ht-under); }
.ht-finding.is-over { border-color: var(--ht-over); background: var(--ht-over-tint); color: var(--ht-over); }
.ht-finding.is-restricted {
  border-color: var(--ht-under); color: var(--ht-under);
  background: repeating-linear-gradient(45deg, var(--ht-under-tint) 0 4px, var(--surface) 4px 8px);
}
.ht-expected { padding: 8px 10px; border: 1px dashed var(--note); border-radius: 10px; }
.ht-expected p, .ht-fdt-exp { margin: 0; font-size: 12px; }
.ht-technique { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.ht-technique li + li { margin-top: 3px; }

/* ── Narrow console (hand-tracking panel open, tablets, phones) ─────────── */
@container ctc (max-width: 640px) {
  .htc .ctc-auto { flex-wrap: wrap; }
  .ht-pad { max-width: none; }
  .ht-om-cell { padding: 4px; }
  .ht-om-muscles { flex-direction: column; }
}
@container ctc (max-width: 420px) {
  .ht-om-chip { font-size: 10px; padding: 1px 3px; }
  .ht-om-muscles, .ht-om-exp { display: none; }
  .ht-pad-cell { min-height: 40px; font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ht-pad-cell { transition: none; }
}
