/* ============================================================
   RAR PHYSIOLOGY · Determinants page styles
   Scoped under .rar-topic-content. Compact / vertically dense.
   Reuses the shared spirogram engine, hy-callout, and cav-term.
   ============================================================ */

/* condition selector — compact pill row */
.rar-topic-content .lvc-det-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 4px;
    margin-bottom: 12px;
}
.rar-topic-content .lvc-det-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: 700;
    padding: 7px 15px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.rar-topic-content .lvc-det-btn:hover { border-color: var(--accent, #0a84ff); }
.rar-topic-content .lvc-det-btn.is-on { background: var(--accent, #0a84ff); border-color: var(--accent, #0a84ff); color: #fff; }

.rar-topic-content .lvc-det-engine-mount { display: block; }

/* readout — one compact line + preserved badge (+ diaphragm figure) */
.rar-topic-content .lvc-det-readout {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 12px;
    padding: 11px 14px;
    border: 1px solid var(--line, rgba(15, 23, 42, 0.1));
    border-radius: var(--radius-sm, 14px);
    background: var(--surface-soft, rgba(255, 255, 255, 0.58));
}
.rar-topic-content .lvc-det-readout-body { flex: 1 1 auto; min-width: 0; }
/* the headline preserved-value chip (the trap), pinned at the top */
.rar-topic-content .lvc-det-preserved {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(52, 199, 89, 0.18);
    color: #1f8f43;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
}
.rar-topic-content .lvc-det-title { margin: 0 0 9px; font-size: 14px; font-weight: 800; line-height: 1.45; color: var(--text, #111318); }

/* each affected value on its own line: arrow · name · direction · reason */
.rar-topic-content .lvc-det-changes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.rar-topic-content .lvc-det-change {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 9px;
    align-items: baseline;
    padding: 5px 9px;
    border-radius: 8px;
}
.rar-topic-content .lvc-det-arrow { text-align: center; font-size: 15px; font-weight: 900; line-height: 1; }
.rar-topic-content .lvc-det-change--up .lvc-det-arrow { color: #c4561f; }
.rar-topic-content .lvc-det-change--down .lvc-det-arrow { color: var(--accent-strong, #0066cc); }
.rar-topic-content .lvc-det-change--same .lvc-det-arrow { color: #1f8f43; }
.rar-topic-content .lvc-det-line { font-size: 13px; line-height: 1.5; color: var(--text, #111318); }
.rar-topic-content .lvc-det-var { font-weight: 800; color: var(--text, #111318); }
.rar-topic-content .lvc-det-word { font-weight: 800; color: var(--text, #111318); }
.rar-topic-content .lvc-det-reason { color: var(--text, #111318); }
.rar-topic-content .lvc-det-change.is-preserved {
    background: rgba(52, 199, 89, 0.1);
    box-shadow: inset 0 0 0 1.5px rgba(52, 199, 89, 0.55);
}
.rar-topic-content .lvc-det-change.is-preserved .lvc-det-var,
.rar-topic-content .lvc-det-change.is-preserved .lvc-det-word { color: #1f8f43; }
.rar-topic-content .lvc-det-note { margin: 9px 0 0; font-size: 12.5px; font-style: italic; color: var(--text, #111318); }
.rar-topic-content .lvc-det-xref {
    margin: 7px 0 0; font-size: 12px; font-weight: 700;
    color: var(--accent-strong, #0066cc);
}
.rar-topic-content .lvc-det-diaphragm { flex: 0 0 auto; margin: 0; width: 92px; text-align: center; }
.rar-topic-content .lvc-det-diaphragm img { width: 100%; height: auto; display: block; }
.rar-topic-content .lvc-det-diaphragm figcaption { margin-top: 3px; font-size: 10px; line-height: 1.3; color: var(--text, #111318); }
.rar-topic-content .lvc-det-diaphragm[hidden] { display: none; }

/* discrimination matrix — dense, preserved value boxed.
   overflow:visible (NOT auto) so the cav-term hover tooltips aren't clipped. */
.rar-topic-content .lvc-det-matrix-wrap { margin-top: 8px; overflow: visible; }
.rar-topic-content .lvc-det-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 520px;
}
.rar-topic-content .lvc-det-matrix th,
.rar-topic-content .lvc-det-matrix td {
    padding: 7px 8px;
    text-align: center;
    border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.08));
}
.rar-topic-content .lvc-det-matrix thead th {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text, #111318);
    background: rgba(15, 23, 42, 0.03);
}
.rar-topic-content .lvc-det-matrix tbody th { text-align: left; font-weight: 800; color: var(--text, #111318); white-space: nowrap; }
.rar-topic-content .lvc-up { color: #c4561f; font-weight: 800; }
.rar-topic-content .lvc-dn { color: var(--accent-strong, #0066cc); font-weight: 800; }
.rar-topic-content .lvc-eq { color: var(--text, #111318); font-weight: 700; }
.rar-topic-content .lvc-det-matrix td.is-preserved {
    background: rgba(52, 199, 89, 0.14);
    box-shadow: inset 0 0 0 2px #34c759;
}
.rar-topic-content .lvc-det-matrix td.is-preserved .lvc-eq { color: #1f8f43; font-weight: 900; }

@media (max-width: 560px) {
    .rar-topic-content .lvc-det-readout { flex-direction: column; }
    .rar-topic-content .lvc-det-diaphragm { width: 120px; align-self: center; }
    /* shrink the matrix to fit (no scroll wrapper, so it must not spill) */
    .rar-topic-content .lvc-det-matrix { min-width: 0; font-size: 11px; }
    .rar-topic-content .lvc-det-matrix th,
    .rar-topic-content .lvc-det-matrix td { padding: 5px 3px; }
}

/* ============================================================
   Direction drill (↑/↓/= discrimination game) — row mechanic.
   Reuses the pharm game shell (styles in lvc-calc-game.css); only
   the seven direction rows are new. Compact / tight per prompt.
   ============================================================ */
.rar-topic-content .lvc-dg-rows { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.rar-topic-content .lvc-dg-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 6px 9px;
    border: 1px solid var(--line, rgba(15, 23, 42, 0.1));
    border-radius: 9px;
    background: var(--surface-strong, #fff);
}
.rar-topic-content .lvc-dg-name { font-size: 12.5px; font-weight: 700; color: var(--text, #111318); line-height: 1.25; }
.rar-topic-content .lvc-dg-btns { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.rar-topic-content .lvc-dg-b {
    appearance: none; width: 34px; height: 30px;
    border: 1px solid var(--line, rgba(15, 23, 42, 0.16));
    border-radius: 8px; background: #fff;
    font-size: 15px; font-weight: 800; line-height: 1; color: var(--text, #111318);
    cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.rar-topic-content .lvc-dg-b:hover:not(:disabled) { border-color: var(--accent, #0a84ff); }
.rar-topic-content .lvc-dg-b.is-sel { background: var(--accent, #0a84ff); border-color: var(--accent, #0a84ff); color: #fff; }
.rar-topic-content .lvc-dg-b:disabled { cursor: default; }
/* graded state */
.rar-topic-content .lvc-dg-b.is-correct { background: rgba(52, 199, 89, 0.16); border-color: #34c759; color: #1f8f43; }
.rar-topic-content .lvc-dg-b.is-wrong { background: rgba(255, 69, 58, 0.14); border-color: var(--danger, #ff453a); color: var(--danger, #ff453a); }
.rar-topic-content .lvc-dg-row.is-right { background: rgba(52, 199, 89, 0.06); border-color: rgba(52, 199, 89, 0.4); }
.rar-topic-content .lvc-dg-row.is-wrong { background: rgba(255, 69, 58, 0.05); border-color: rgba(255, 69, 58, 0.35); }

@media (max-width: 460px) {
    .rar-topic-content .lvc-dg-name { font-size: 11.5px; }
    .rar-topic-content .lvc-dg-b { width: 30px; height: 28px; font-size: 14px; }
}

/* ============================================================
   Direction drill — header + card polish.
   Scoped to #lvc-det-game-mount so the shared pharm shell and the
   Foundations calc game are untouched.
   ------------------------------------------------------------ */
/* The teal "Practice & Retrieval" pill reads var(--cav-pharm-practice),
   which the shared engine only defines inside [data-pgc-game]. The pill
   sits above that in .pgc-header, so define the teal here on the mount. */
#lvc-det-game-mount { --cav-pharm-practice: #0a7a73; --cav-pharm-practice-soft: rgba(20, 160, 152, 0.08); }

/* card: drop the tall empty center, warm the bland white with a soft
   teal wash + a hovering glow that matches the Start button */
#lvc-det-game-mount .cav-pharm-game {
    min-height: 0;
    border-color: rgba(20, 160, 152, 0.28);
    background:
        radial-gradient(120% 90% at 50% -10%, rgba(20, 160, 152, 0.07), rgba(255, 255, 255, 0) 60%),
        #ffffff;
    box-shadow: 0 10px 28px rgba(20, 160, 152, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
}
#lvc-det-game-mount .cav-pharm-game__screen--start { padding: 30px 24px; gap: 11px; }
