/* expert-system lesson-specific styles. Extracted during theme polish Phase 4. */
.ll-viewport {
      --ll-accent: #3357e5;
      --ll-tab-active: #3357e5;
      --ll-tab-active-bg: rgba(51, 87, 229, 0.10);
    }

    /* ── Mode tabs ─────────────────────────────────────────────── */
    .eg-mode-tabs {
      display: flex;
      gap: 0.4rem;
      padding: 0 var(--page-padding, 1.2rem);
      margin-bottom: -0.25rem;
    }
    .eg-mode-tab {
      background: #f0f2f5;
      border: 1px solid #d4d8e0;
      border-bottom: none;
      border-radius: 8px 8px 0 0;
      padding: 0.5rem 1.2rem;
      font-family: inherit;
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--muted, #666);
      cursor: pointer;
      transition: background 0.14s, color 0.14s;
    }
    .eg-mode-tab.is-active {
      background: #fff;
      color: var(--ink);
      border-color: #d0d3da;
      position: relative;
      z-index: 1;
    }
    .eg-mode-tab:hover:not(.is-active) { background: #e8ebf2; }

    /* ── Clinic card wrapper ───────────────────────────────────── */
    .eg-clinic-card { padding: 0; overflow: hidden; }

    /* ── HUD bar ───────────────────────────────────────────────── */
    .eg-hud {
      display: flex;
      gap: 0;
      background: #1c2a31;
      color: #fff;
    }
    .eg-hud-item {
      flex: 1;
      padding: 0.55rem 1rem;
      font-size: 0.82rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      text-align: center;
      border-right: 1px solid rgba(255,255,255,0.1);
    }
    .eg-hud-item:last-child { border-right: none; }
    .eg-hud-score { color: #ffd166; }
    .eg-hud-insp  { color: #7ec8e3; }

    /* ── Layout ────────────────────────────────────────────────── */
    .eg-layout {
      display: grid;
      grid-template-columns: minmax(0,1fr) minmax(0,1fr);
      gap: 0;
    }
    @media (max-width: 680px) {
      .eg-layout { grid-template-columns: 1fr; }
    }
    .eg-left  { padding: 1.2rem; border-right: 1px solid #e8eaed; }
    .eg-right { padding: 1.2rem; }

    /* ── Patient card ──────────────────────────────────────────── */
    .eg-patient-card {
      background: #f7f8fa;
      border: 1px solid #e2e5ea;
      border-radius: 10px;
      padding: 1rem;
      margin-bottom: 1.1rem;
    }
    .eg-patient-name {
      font-size: 1.15rem;
      font-weight: 700;
      margin: 0 0 0.45rem;
      color: var(--ink);
    }
    .eg-patient-flavour {
      font-size: 0.875rem;
      line-height: 1.55;
      color: var(--muted, #555);
      margin: 0;
    }

    /* ── Inspect block ─────────────────────────────────────────── */
    .eg-inspect-label {
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--muted, #666);
      margin: 0 0 0.55rem;
    }
    .eg-inspect-note { font-weight: 400; font-style: italic; }

    .eg-area-btns {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.5rem;
      margin-bottom: 1.1rem;
    }
    .eg-area-btn {
      background: #fff;
      border: 2px solid #d0d4dc;
      border-radius: 8px;
      padding: 0.5rem 0.6rem;
      font-family: inherit;
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--ink);
      cursor: pointer;
      text-align: left;
      transition: border-color 0.14s, background 0.14s;
    }
    .eg-area-btn:hover:not(:disabled):not(.is-used) {
      border-color: var(--accent, #3357e5);
      background: #edf2ff;
    }
    .eg-area-btn.is-used {
      opacity: 0.45;
      cursor: default;
      text-decoration: line-through;
    }
    .eg-area-btn:disabled:not(.is-used) { opacity: 0.4; cursor: not-allowed; }

    .eg-probe-lab {
      display: grid;
      gap: 0.8rem;
      margin-bottom: 1.1rem;
    }
    .eg-robot-blueprint {
      position: relative;
      border-radius: 14px;
      border: 1px solid #d7dbe3;
      background:
        radial-gradient(circle at top, rgba(51,87,229,0.08), transparent 50%),
        repeating-linear-gradient(0deg, rgba(51,87,229,0.05) 0 1px, transparent 1px 24px),
        repeating-linear-gradient(90deg, rgba(51,87,229,0.04) 0 1px, transparent 1px 24px),
        #f8fbff;
      min-height: 320px;
      overflow: hidden;
    }
    .eg-robot-svg {
      width: 100%;
      height: 320px;
      display: block;
    }
    .eg-probe-node {
      fill: rgba(51,87,229,0.12);
      stroke: #3357e5;
      stroke-width: 2;
      cursor: pointer;
      transition: fill 0.14s ease, transform 0.14s ease;
      transform-origin: center;
    }
    .eg-probe-node:hover,
    .eg-probe-node:focus-visible {
      fill: rgba(51,87,229,0.24);
      outline: none;
      transform: scale(1.03);
    }
    .eg-probe-node.is-used {
      fill: rgba(125,211,252,0.18);
      stroke: #0891b2;
    }
    .eg-probe-label {
      font: 600 12px/1 "IBM Plex Mono", monospace;
      fill: #12345a;
      letter-spacing: 0.04em;
      pointer-events: none;
    }
    .eg-probe-readout {
      border-radius: 10px;
      border: 1px solid #d7dbe3;
      background: #101820;
      color: #d9f99d;
      padding: 0.8rem 0.9rem;
      min-height: 82px;
      font-family: "IBM Plex Mono", monospace;
      font-size: 0.8rem;
      line-height: 1.55;
      box-shadow: inset 0 0 0 1px rgba(57,255,20,0.06);
    }
    .eg-probe-readout strong {
      display: block;
      color: #f8fafc;
      margin-bottom: 0.25rem;
    }
    .eg-probe-hint {
      font-size: 0.74rem;
      color: #86efac;
    }

    /* ── Clues list ────────────────────────────────────────────── */
    .eg-clues-label {
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--muted, #666);
      margin: 0 0 0.45rem;
    }
    .eg-clues-list {
      list-style: none;
      padding: 0;
      margin: 0;
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
    }
    .eg-clue {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      background: #eef5ec;
      border: 1px solid #c3e0be;
      border-radius: 6px;
      padding: 0.35rem 0.65rem;
      font-size: 0.855rem;
    }
    .eg-clue-empty {
      background: #f7f7f7;
      border-color: #e0e0e0;
      color: var(--muted, #888);
      font-style: italic;
    }
    .eg-clue-icon { flex-shrink: 0; }
    .eg-no-clues  { color: var(--muted, #aaa); font-size: 0.855rem; font-style: italic; list-style: none; }

    /* ── AI analysis bars ──────────────────────────────────────── */
    .eg-analysis-label, .eg-diag-label {
      font-size: 0.8rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--muted, #666);
      margin: 0 0 0.5rem;
    }
    .eg-analysis-bars { margin-bottom: 0.3rem; }
    .eg-analysis-empty { font-size: 0.855rem; color: var(--muted, #999); font-style: italic; margin: 0 0 0.5rem; }
    .eg-analysis-note { font-size: 0.77rem; color: var(--muted, #aaa); margin: 0 0 1.2rem; font-style: italic; }

    .eg-analysis-shell {
      display: grid;
      gap: 0.9rem;
    }
    .eg-gauge-wrap {
      display: grid;
      grid-template-columns: auto 1fr;
      align-items: center;
      gap: 0.9rem;
      padding: 0.85rem;
      border-radius: 12px;
      background: #f7f9fd;
      border: 1px solid #e3e8ef;
    }
    .eg-gauge-label strong {
      display: block;
      font-size: 0.92rem;
      color: #111827;
      margin-bottom: 0.18rem;
    }
    .eg-gauge-label span {
      font-size: 0.79rem;
      color: #64748b;
    }
    .eg-gauge-svg {
      width: 114px;
      height: 64px;
    }
    .eg-gauge-track {
      fill: none;
      stroke: #dbe3ee;
      stroke-width: 10;
      stroke-linecap: round;
    }
    .eg-gauge-fill {
      fill: none;
      stroke: #3357e5;
      stroke-width: 10;
      stroke-linecap: round;
      transition: stroke-dashoffset 0.35s ease;
    }
    .eg-gauge-value {
      font: 700 15px/1 "IBM Plex Mono", monospace;
      fill: #111827;
    }

    .eg-flow-shell {
      display: grid;
      gap: 0.7rem;
      padding: 0.85rem;
      border-radius: 12px;
      background: #fbfcfe;
      border: 1px solid #e6ebf2;
    }
    .eg-flow-viz {
      min-height: 210px;
      border-radius: 10px;
      background:
        radial-gradient(circle at center, rgba(51,87,229,0.05), transparent 58%),
        #0f172a;
      overflow: hidden;
    }
    .eg-flow-svg {
      width: 100%;
      height: 210px;
      display: block;
    }
    .eg-flow-link {
      stroke: rgba(148,163,184,0.4);
      stroke-width: 2;
    }
    .eg-flow-link.is-active {
      stroke: rgba(56,189,248,0.85);
    }
    .eg-flow-node {
      fill: rgba(30,41,59,0.92);
      stroke: rgba(148,163,184,0.35);
      stroke-width: 1.5;
      transition: fill 0.18s ease, stroke 0.18s ease;
    }
    .eg-flow-node.rule.is-active {
      fill: rgba(51,87,229,0.4);
      stroke: #60a5fa;
    }
    .eg-flow-node.fact.is-active {
      fill: rgba(16,185,129,0.28);
      stroke: #34d399;
    }
    .eg-flow-text {
      font: 600 11px/1.2 "IBM Plex Mono", monospace;
      fill: #e2e8f0;
      pointer-events: none;
    }
    .eg-flow-spark {
      fill: #f8fafc;
      filter: drop-shadow(0 0 6px rgba(96,165,250,0.75));
      transition: transform 0.22s ease;
    }

    .eg-conflict-banner {
      display: none;
      border-radius: 10px;
      padding: 0.8rem 0.95rem;
      border: 1px solid #f59e0b;
      background: #fff7ed;
      color: #92400e;
      font-size: 0.84rem;
      line-height: 1.5;
    }
    .eg-conflict-banner.is-visible {
      display: block;
    }

    .expert-console {
      border-radius: 12px;
      border: 1px solid #d8dee9;
      background: #0b1220;
      color: #cbd5e1;
      padding: 0.85rem 0.9rem;
      font: 500 0.78rem/1.6 "IBM Plex Mono", monospace;
      min-height: 140px;
      max-height: 220px;
      overflow: auto;
    }
    .expert-console-line {
      white-space: pre-wrap;
    }
    .expert-console-line.is-highlight {
      color: #93c5fd;
    }

    .expert-builder {
      display: grid;
      gap: 0.75rem;
      margin-top: 0.9rem;
      padding-top: 0.9rem;
      border-top: 1px dashed #d7dce6;
    }
    .expert-builder-row {
      display: grid;
      grid-template-columns: 1fr auto 1fr auto auto;
      gap: 0.5rem;
      align-items: center;
    }
    .expert-builder-chip {
      font: 700 0.72rem/1 "IBM Plex Mono", monospace;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #64748b;
    }
    .expert-builder select,
    .expert-builder input {
      width: 100%;
    }
    .expert-builder-preview {
      border-radius: 10px;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      padding: 0.75rem 0.85rem;
      font: 500 0.76rem/1.5 "IBM Plex Mono", monospace;
      color: #334155;
      white-space: pre-wrap;
    }
    @media (max-width: 720px) {
      .expert-builder-row {
        grid-template-columns: 1fr;
      }
    }

    .eg-bar-row {
      display: grid;
      grid-template-columns: 9rem 1fr 2.8rem;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.4rem;
    }
    .eg-bar-label { font-size: 0.8rem; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .eg-bar-track { background: #e8eaed; border-radius: 999px; height: 10px; overflow: hidden; }
    .eg-bar-fill  { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
    .eg-bar-pct   { font-size: 0.78rem; font-weight: 600; color: var(--muted, #666); text-align: right; }

    /* ── Diagnosis buttons ─────────────────────────────────────── */
    .eg-diag-btns {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      margin-bottom: 1rem;
    }
    .eg-diag-btn {
      background: #f0f2f5;
      border: 2px solid #d4d8e0;
      border-radius: 8px;
      padding: 0.5rem 0.9rem;
      font-family: inherit;
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--ink);
      cursor: pointer;
      text-align: left;
      transition: border-color 0.14s, background 0.14s;
    }
    .eg-diag-btn:hover:not(:disabled) { border-color: var(--accent, #3357e5); background: #edf2ff; }
    .eg-diag-btn:disabled { opacity: 0.45; cursor: default; }
    .eg-diag-btn.is-correct { background: #d1fae5; border-color: #34d399; color: #065f46; }
    .eg-diag-btn.is-wrong   { background: #fee2e2; border-color: #f87171; color: #991b1b; }
    .eg-diag-btn.is-answer  { background: #d1fae5; border-color: #34d399; }

    /* ── Result banner ─────────────────────────────────────────── */
    .eg-result-banner {
      border-radius: 10px;
      padding: 1rem 1.1rem;
      margin-bottom: 0.9rem;
    }
    .eg-result-banner.is-correct { background: #d1fae5; border: 1px solid #6ee7b7; }
    .eg-result-banner.is-wrong   { background: #fee2e2; border: 1px solid #fca5a5; }

    .eg-result-top {
      display: flex;
      gap: 0.7rem;
      align-items: flex-start;
      margin-bottom: 0.5rem;
    }
    .eg-result-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
    .eg-result-top strong { display: block; font-size: 1rem; margin-bottom: 0.25rem; }
    .eg-result-top p { margin: 0; font-size: 0.875rem; line-height: 1.5; }
    .eg-result-note { font-size: 0.835rem; font-style: italic; color: #374151; margin: 0 0 0.3rem; line-height: 1.5; }
    .eg-engine-agreed { font-size: 0.835rem; color: #065f46; background: rgba(52,211,153,0.18); border-radius: 5px; padding: 0.25rem 0.6rem; margin: 0; display: inline-block; }

    /* ── Next button ───────────────────────────────────────────── */
    .eg-next-btn {
      background: var(--ink, #1c2a31);
      color: #fff;
      border: none;
      border-radius: 8px;
      padding: 0.6rem 1.4rem;
      font-family: inherit;
      font-size: 0.925rem;
      font-weight: 700;
      cursor: pointer;
      width: 100%;
      transition: opacity 0.14s;
    }
    .eg-next-btn:hover { opacity: 0.82; }

    /* ── Final screen ──────────────────────────────────────────── */
    .eg-final-card { padding: 1.5rem; text-align: center; }
    .eg-final-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.3rem; }
    .eg-final-pts   { font-size: 2.4rem; font-weight: 900; color: var(--accent, #3357e5); margin-bottom: 1.2rem; }

    .eg-final-breakdown {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
      max-width: 420px;
      margin: 0 auto 1.2rem;
      text-align: left;
    }
    .eg-final-row {
      display: grid;
      grid-template-columns: 1fr auto auto;
      gap: 0.6rem;
      align-items: center;
      background: #f7f8fa;
      border-radius: 7px;
      padding: 0.45rem 0.75rem;
      font-size: 0.875rem;
    }
    .eg-final-note { font-size: 0.875rem; color: var(--muted, #666); max-width: 480px; margin: 0 auto 1.2rem; line-height: 1.6; }

    .eg-play-again-btn {
      background: none;
      border: 2px solid #d4d8e0;
      border-radius: 8px;
      padding: 0.55rem 1.4rem;
      font-family: inherit;
      font-size: 0.9rem;
      font-weight: 600;
      cursor: pointer;
      color: var(--muted, #555);
      transition: background 0.14s, border-color 0.14s;
    }
    .eg-play-again-btn:hover { background: #f0f2f5; border-color: #aaa; }
