/* ============================================================
   RAR PHYSIOLOGY · Helium dilution styles
   Self-contained, bespoke to the Lung Volumes & Capacities module.
   Reuses the spirogram lung-blue; helium is teal. No new visual
   language, sentence case. Scoped under .hd.
   ============================================================ */

.hd { display: block; margin-top: 12px; }

.hd-figwrap {
    border: 1px solid var(--line, rgba(15, 23, 42, 0.08));
    border-radius: var(--radius-sm, 14px);
    background: var(--surface-strong, rgba(255, 255, 255, 0.92));
    padding: 8px 10px;
}
/* compact + centered so the figure doesn't dominate the page */
.hd-svg { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; }

/* chambers */
.hd-chamber { stroke-width: 2; }
.hd-chamber--spiro { fill: rgba(148, 163, 184, 0.1); stroke: #9aa3b2; }
/* the lungs — spirogram lung idiom (blue lobes), scaled with Vl in JS */
.hd-lobe { fill: rgba(10, 132, 255, 0.09); stroke: var(--accent, #0a84ff); stroke-width: 2; }
.hd-csub--lung { fill: #0a6fd0; font-weight: 700; }
.hd-tube { fill: rgba(148, 163, 184, 0.18); }
.hd-valve { fill: #c0c7d2; stroke: #9aa3b2; stroke-width: 1.5; transition: fill 0.25s ease; }
.hd-valve.is-open { fill: #12b3a6; stroke: #0e9488; }

.hd-clabel { fill: var(--text, #111318); font-size: 12px; font-weight: 800; }
.hd-clabel--lung { fill: #0a6fd0; }
.hd-csub { fill: var(--text, #111318); font-size: 10.5px; font-weight: 700; }

.hd-dot { fill: #12b3a6; fill-opacity: 0.92; }

/* controls */
.hd-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-top: 12px;
}
.hd-btn {
    appearance: none;
    border: 1px solid var(--line, rgba(15, 23, 42, 0.14));
    background: var(--surface-strong, #fff);
    color: var(--text, #111318);
    font-size: 12.5px;
    font-weight: 650;
    padding: 7px 14px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}
.hd-btn:hover { border-color: var(--accent, #0a84ff); color: var(--accent-strong, #0066cc); }
.hd-btn--primary { background: #12b3a6; border-color: #12b3a6; color: #fff; }
.hd-btn--primary:hover { background: #0e9488; border-color: #0e9488; color: #fff; }
.hd-btn:disabled { opacity: 0.55; cursor: default; }
.hd-btn--primary:disabled { background: #12b3a6; border-color: #12b3a6; color: #fff; }

.hd-slider-group {
    display: grid;
    grid-template-columns: minmax(180px, 320px);
    gap: 2px;
    margin-left: auto;
}
.hd-slider-label { font-size: 11.5px; font-weight: 700; color: var(--text, #111318); }
.hd-slider { width: 100%; accent-color: #12b3a6; cursor: pointer; }
.hd-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text, #111318);
}
.hd-tick-frc { color: #0e9488; }

/* why chips */
.hd-why { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.hd-chip {
    appearance: none;
    border: 1px dashed var(--line, rgba(15, 23, 42, 0.22));
    background: var(--surface-soft, rgba(255, 255, 255, 0.58));
    color: var(--text, #111318);
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    cursor: help;
    transition: border-color 0.14s ease, color 0.14s ease;
}
.hd-chip:hover { border-color: #12b3a6; color: #0e9488; }

/* equation — uses the module's shared readout/callout treatment (the
   same teal box as the unlock panel below) so the widget reads as one. */
.hd-eq {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid rgba(18, 179, 166, 0.32);
    border-radius: var(--radius-sm, 14px);
    background: rgba(18, 179, 166, 0.07);
}
/* principle — the conservation-of-mass law, centered + elevated */
.hd-eq-principle {
    text-align: center;
    padding-bottom: 11px;
    border-bottom: 1px dashed var(--line, rgba(15, 23, 42, 0.14));
}
.hd-eq-law {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--text, #111318);
}
.hd-eq-law sub { font-size: 0.58em; font-weight: 700; }
.hd-eq-lawsub { margin-top: 4px; font-size: 11.5px; color: var(--text, #111318); }
.hd-eq-why {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 1px solid var(--accent, #0a84ff);
    background: transparent;
    color: var(--accent-strong, #0066cc);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: help;
    padding: 0;
}
/* live substitution, centered under the law */
.hd-eq-sub {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 6px 12px;
    margin-top: 11px;
    font-size: 16px;
    color: var(--text, #111318);
}
.hd-eq-sub b { font-weight: 800; }
.hd-eq-equals { font-weight: 800; color: var(--text, #111318); }
.hd-eq-pending { margin-top: 11px; text-align: center; }
.hd-eq-hint { font-size: 13px; font-weight: 600; color: var(--text, #111318); }
/* horizontal step-by-step solve — boxes flow across, wrap to next line */
.hd-eq-steps {
    margin-top: 11px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
}
.hd-eq-stepbox {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 12px;
    border: 1px solid rgba(18, 179, 166, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
}
.hd-eq-stepbox--final { border-color: rgba(18, 179, 166, 0.6); background: rgba(18, 179, 166, 0.1); }
/* the "Step N" label is larger + bolder than the calculation text */
.hd-eq-stepno {
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #0e9488;
}
.hd-eq-stepbody {
    font-size: 12.5px;
    color: var(--text, #111318);
    font-variant-numeric: tabular-nums;
}
.hd-eq-stepbody sub { font-size: 0.7em; }
.hd-eq-stepbody b { color: #0e9488; font-weight: 800; font-size: 1.05em; }

/* unlock panel */
.hd-unlock {
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(18, 179, 166, 0.32);
    border-radius: var(--radius-sm, 14px);
    background: rgba(18, 179, 166, 0.07);
}
.hd-unlock-intro { margin: 0 0 9px; font-size: 12.5px; line-height: 1.5; color: var(--text, #111318); }
.hd-unlock-rows { display: flex; flex-direction: column; gap: 7px; }
.hd-unlock-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text, #111318); }
.hd-unlock-row b { font-weight: 800; }
.hd-unlock-note { color: var(--text, #111318); font-weight: 600; font-size: 12px; }
.hd-lock { width: 16px; height: 16px; flex-shrink: 0; color: #0e9488; }

/* tooltip — body-anchored, never clipped */
.hd-tip {
    position: fixed;
    left: 0; top: 0;
    z-index: 9999;
    max-width: min(300px, 86vw);
    padding: 10px 13px;
    border-radius: 10px;
    background: #111318;
    color: #f4f6fb;
    font-size: 12.5px;
    line-height: 1.5;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.hd-tip.is-on { opacity: 1; }
.hd-tip strong { display: block; color: #fff; font-weight: 800; }
.hd-tip__tag {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7fe0d4;
}
.hd-tip__def { display: block; margin-top: 5px; color: #d4dcea; }

@media (max-width: 560px) {
    .hd-slider-group { margin-left: 0; width: 100%; }
}
