/* ============================================================================
   Help Panel — design system  (muriel redesign, 2026-06-26)
   ----------------------------------------------------------------------------
   The in-app brand is neon-green PHOSPHOR (brand-tokens.css / docs/STYLE_GUIDE.md
   — "do NOT cross" palettes). The green was never the problem: the accreted
   Tailwind sky/slate (#7dd3fc, #cbd5e1, #94a3b8) was the off-brand intruder.
   This file evicts it, binds every role to the canonical --pd-* tokens, and
   adds a polish pass. Loaded AFTER styles.css / shared-ui.css so its
   #selector.help-active-scoped rules win over the older scattered .help-* rules
   (left in place, now superseded).

   CONTRAST (polish.md rule 17): the panel stays glassy, but every text-bearing
   surface is a near-opaque CARD scrim, so text holds >=8:1 over ANY fractal
   frame rather than depending on what shows through — not a panel-wide plate.
   Audited vs a card over a bright fractal patch: label #aaffaa 14.6, body
   #f0f0f0 15.3, dim #cfe8cf 13.4, muted #c8c8d0 10.5, accent rgb(var(--pd-accent-rgb)) 12.7,
   dark-on-phosphor 13.9. (Emerald --pd-active is FILL-only — 7.8:1 as text.)
   ============================================================================ */

#selector.help-active {
  --h-accent:    var(--pd-accent-fill, var(--pd-phosphor)); /* active FILL — 8:1-safe (lifted at low-luminance hues), pairs with --h-on-ink */
  --h-label:     var(--pd-phosphor-soft);     /* #aaffaa — titles, keycaps, labels */
  --h-connect:   var(--pd-phosphor-dim);      /* #cfe8cf — connective / descriptions */
  --h-ink:       var(--pd-text);              /* #f0f0f0 — body text */
  --h-muted:     var(--pd-text-muted);        /* #c8c8d0 — secondary notes */
  --h-on-ink:    var(--pd-accent-on, #00140a); /* label PAIRED to --h-accent for 8:1 — flips dark/white by fill luminance (not a fixed dark) */
  --h-surface:   rgba(10, 10, 15, 0.92);       /* content card — near-opaque scrim */
  --h-surface-2: rgba(0, 0, 0, 0.5);           /* nested chip / <pre> */
  --h-line:      var(--pd-border);             /* rgba(var(--pd-accent-rgb), 0.40) phosphor ring */
  --h-line-soft: rgba(var(--pd-accent-rgb), 0.16);        /* divider / hairline */
  --h-shadow:    0 1px 2px rgba(0,0,0,0.5), 0 6px 18px rgba(0,0,0,0.35);
  --h-r:    var(--pd-radius);                  /* 14px (18 on mobile) */
  --h-r-in: 10px;                              /* concentric: 14 = 10 + 4px pad (rule 1) */
  -webkit-font-smoothing: antialiased;         /* polish rule 7 */
  -moz-osx-font-smoothing: grayscale;
}

/* Panel stays glassy (the see-through is liked) but more present than the old
   0.15; the cards carry text contrast so 8:1 never rides on the backdrop. */
#selector.help-active {
  background: rgba(11, 11, 16, 0.66);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}

/* ---- Sections & headings -------------------------------------------------- */
#selector.help-active .help-section {
  padding: 16px;
  background: var(--h-surface);
  border-radius: var(--h-r);
  box-shadow: var(--h-shadow);
  margin-bottom: 14px;
}
#selector.help-active .help-section-title {
  margin: 0 0 12px;
  color: var(--h-label);
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  text-wrap: balance;
}
#selector.help-active .help-subtitle {
  margin: 0 0 8px;
  color: var(--h-label);
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
#selector.help-active .help-lede {
  margin: 0 0 12px;
  color: var(--h-connect);
  font-size: 13px; line-height: 1.55;
  text-wrap: pretty;
}
#selector.help-active .help-lede strong,
#selector.help-active .help-lede b,
#selector.help-active .help-lede em { color: var(--h-ink); font-weight: 600; font-style: normal; }

/* ---- Grids & cards -------------------------------------------------------- */
#selector.help-active .help-grid { display: grid; gap: 10px; }
#selector.help-active .help-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

#selector.help-active .help-card {
  background: var(--h-surface-2);
  border: 1px solid var(--h-line-soft);
  border-left: 3px solid var(--h-line);
  border-radius: var(--h-r-in);
  padding: 11px 13px;
}
#selector.help-active .help-card-title { color: var(--h-label); font-weight: 600; font-size: 14px; margin-bottom: 3px; }
#selector.help-active .help-card-desc  { color: var(--h-connect); font-size: 13px; line-height: 1.45; }
#selector.help-active .help-card-desc b,
#selector.help-active .help-card-desc strong { color: var(--h-ink); font-weight: 600; }

/* label | description card */
#selector.help-active .help-card.row2 { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; }
#selector.help-active .help-card.row2.narrow { grid-template-columns: 46px 1fr; }

/* compact indicator chip (icon + label) */
#selector.help-active .help-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  background: var(--h-surface-2);
  border: 1px solid var(--h-line-soft);
  border-radius: var(--h-r-in);
}
#selector.help-active .help-chip .ico { font-size: 18px; min-width: 24px; text-align: center; }
#selector.help-active .help-chip .lbl { color: var(--h-connect); font-size: 13px; }

/* gesture-zones device schematic — reused from the consumer control-surface
   .pd-help-phone (replaces the old monospace ASCII diagram, which couldn't
   align emoji to fixed cells and broke on narrow touch widths). The SVG carries
   its own dark device fill + colors, so it only needs sizing here. */
#selector.help-active .help-phone-fig { margin: 4px 0 0; }
#selector.help-active .help-phone { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
#selector.help-active .help-zones-note {
  margin: 8px 0 0; color: var(--h-connect);
  font-size: 13px; line-height: 1.5; text-align: center; text-wrap: pretty;
}
#selector.help-active .help-zones-note b { color: var(--h-ink); font-weight: 700; }
#selector.help-active .help-list { margin: 8px 0 0 18px; color: var(--h-connect); font-size: 13px; line-height: 1.6; }
#selector.help-active .help-list li { margin-bottom: 4px; }
#selector.help-active .help-list b, #selector.help-active .help-list strong { color: var(--h-ink); }

/* divider between sub-blocks within a section */
#selector.help-active .help-divider { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--h-line-soft); }

/* ---- Action button (gyro / heart sensor / MIDI) --------------------------- */
#selector.help-active .help-action-btn {
  width: 100%; min-height: 44px; padding: 12px 14px;
  background: rgba(var(--pd-accent-rgb), 0.1);
  border: 1px solid var(--h-line);
  border-radius: var(--h-r-in);
  color: var(--h-label);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition-property: scale, background-color, border-color, color;
  transition-duration: 150ms; transition-timing-function: ease-out;
}
@media (hover: hover) and (pointer: fine) {
  #selector.help-active .help-action-btn:hover { background: rgba(var(--pd-accent3-rgb), 0.18); border-color: var(--pd-accent3-border); }
}
#selector.help-active .help-action-btn:active { scale: 0.96; }
#selector.help-active .help-action-btn.on {
  background: var(--h-accent); border-color: var(--pd-phosphor-soft);
  color: var(--h-on-ink); font-weight: 700;
}
#selector.help-active .help-action-btn.denied {
  background: rgba(229, 115, 115, 0.18); border-color: rgba(229, 115, 115, 0.55); color: #ffdada;
}

/* live numeric readout (BPM) */
#selector.help-active .help-readout {
  text-align: center; color: var(--h-label);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-variant-numeric: tabular-nums;
  font-size: 22px; font-weight: 700; padding: 6px 0 2px;
  text-shadow: 0 0 10px rgba(var(--pd-accent-rgb), 0.35);
}
#selector.help-active .help-note { color: var(--h-muted); font-size: 12px; line-height: 1.45; }

/* ---- Retoken the keyboard-command classes (override green-terminal) -------- */
#selector.help-active .help-commands-list { padding: 4px 0; gap: 8px; }
#selector.help-active .help-row {
  grid-template-columns: 60px 1fr; gap: 12px; align-items: center;
  padding: 8px 10px; margin: 0;
  background: var(--h-surface); border-radius: var(--h-r-in);
}
#selector.help-active .help-key {
  min-width: 52px; min-height: 40px; padding: 9px 14px;
  background: rgba(var(--pd-accent-rgb), 0.12); border: 1px solid var(--h-line);
  border-radius: 8px; color: var(--h-label); font-weight: 700; font-size: 18px;
  text-align: center; cursor: pointer; box-shadow: none;
  transition-property: scale, background-color, border-color, color;
  transition-duration: 150ms; transition-timing-function: ease-out;
}
@media (hover: hover) and (pointer: fine) {
  #selector.help-active .help-key:hover,
  #selector.help-active .help-key:focus { background: rgba(var(--pd-accent3-rgb), 0.2); border-color: var(--pd-accent3-border); box-shadow: 0 0 10px var(--pd-accent3-glow); transform: none; }
}
#selector.help-active .help-key:active { scale: 0.96; transform: none; }
/* Selected-key fill: the opaque --h-accent / --h-on-ink pair is the 8:1-verified
   one and must render. This selector (#id + 3 classes) wins on specificity now
   that the legacy translucent `.help-key.active` rules in styles.css/shared-ui.css
   have been deleted — no !important needed. */
#selector.help-active .help-key.active {
  background: var(--h-accent); border-color: var(--pd-phosphor-soft);
  color: var(--h-on-ink); box-shadow: 0 0 12px rgba(var(--pd-accent-rgb), 0.4);
}
#selector.help-active .help-command-name {
  color: var(--h-ink); font-weight: 600; font-size: 16px; padding: 8px 14px;
  background: var(--h-surface-2); border: 1px solid var(--h-line-soft); border-radius: 8px;
}
#selector.help-active .help-command-name.active {
  color: var(--h-label); border-color: var(--h-line);
  background: rgba(var(--pd-accent-rgb), 0.12); box-shadow: none;
}
#selector.help-active .help-desc { color: var(--h-connect); opacity: 1; font-size: 13px; line-height: 1.45; }
#selector.help-active .help-command-meta { gap: 14px; }
#selector.help-active .help-command-intensity { color: var(--h-muted); }

#selector.help-active .help-state-button {
  background: rgba(var(--pd-accent-rgb), 0.1); border: 1px solid var(--h-line); border-radius: 8px;
  color: var(--h-label); font-size: 14px; font-weight: 600; padding: 7px 12px; cursor: pointer;
  min-width: 72px; min-height: 40px; text-align: center;
  transition-property: scale, background-color, border-color, color;
  transition-duration: 150ms; transition-timing-function: ease-out;
}
@media (hover: hover) and (pointer: fine) {
  #selector.help-active .help-state-button:hover { background: rgba(var(--pd-accent3-rgb), 0.18); border-color: var(--pd-accent3-border); transform: none; }
}
#selector.help-active .help-state-button:active { scale: 0.96; transform: none; }
/* Selected state-button fill — same opaque 8:1 pair as .help-key.active above.
   Wins on specificity now that the legacy `.help-state-button.active` rules are
   gone; no !important needed. */
#selector.help-active .help-state-button.active {
  background: var(--h-accent); border-color: var(--pd-phosphor-soft); color: var(--h-on-ink); box-shadow: none;
}

/* state-flow arrows between grouped state buttons */
#selector.help-active .help-flow-arrow { color: var(--h-accent); opacity: 0.5; margin: 0 2px; }

/* active-effects summary pill */
#selector.help-active #active-effects-summary {
  margin-bottom: 14px; padding: 11px 13px;
  background: var(--h-surface); border: 1px solid var(--h-line-soft); border-radius: var(--h-r-in);
  color: var(--h-ink); font-size: 13px;
}
#selector.help-active #active-effects-summary b { color: var(--h-label); }
#selector.help-active .help-effect-on { color: var(--h-label); font-weight: 600; }
