/* ============================================================
   USMLE Wise: Stroke Lab (/stroke-lab)
   Loads after heart-lab.css and reuses its shell, stage, chips, panel,
   quiz and table. This file adds only what the Stroke Lab needs:
   the side switch, the bedside charts and the territory key.
   ============================================================ */

/* ---------- Side switch (top right) ---------- */
.sl-sidebox { display: grid; gap: 6px; justify-items: end; }
.sl-sidenote { margin: 0; min-height: 1.2em; font-size: 12.5px; color: var(--uw-ink-500); text-align: right; }
.hl-mode[role="radio"][aria-checked="true"] { background: var(--uw-blue-500); color: #fff; }
.hl-mode[role="radio"][aria-checked="false"] { background: transparent; }
.hl-mode.is-off { opacity: .45; cursor: default; }

/* ---------- Stage: picker | brain | panel, bedside charts under the first two ---------- */
.sl-stage {
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(310px, 380px);
  grid-template-rows: minmax(560px, auto) auto;
  grid-template-areas:
    "left brain panel"
    "bed bed panel";
}
.sl-stage .hl-left { grid-area: left; max-height: 720px; }
.sl-stage .sl-brain { grid-area: brain; min-height: 560px; }
/* height:0 + min-height:100% lets the panel fill the whole stage and scroll inside, without its long text stretching the stage */
.sl-stage .sl-panel { grid-area: panel; height: 0; min-height: 100%; max-height: none; }
.sl-stage .sl-bed { grid-area: bed; }

.sl-reset { margin-bottom: var(--space-4); }
.sl-pick { display: grid; gap: var(--space-5); }
.sl-pick .hl-mi { padding: 9px 10px; }
.sl-pick .hl-mi__name { font-size: 16.5px; }

/* ---------- 3D overlay extras ---------- */
.sl-brain .hl-heart__legend { gap: 6px 14px; }
.sl-leg--aca i, .sl-leg--mca i, .sl-leg--pca i { width: 14px; height: 10px; border-radius: 3px; }
.sl-leg--aca i { background: #8f9fe6; }
.sl-leg--mca i { background: #f0d08c; }
.sl-leg--pca i { background: #88cdb2; }
.sl-tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  background: var(--uw-ink-900);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
[data-theme="dark"] .sl-tip { background: var(--uw-surface); color: var(--uw-ink-900); border: 1px solid var(--uw-border-strong); }

/* ---------- Panel extras ---------- */
.sl-terr { margin: 0 0 var(--space-5); display: grid; gap: 6px; }
.sl-terr__row { margin: 0; display: flex; align-items: baseline; gap: 10px; font-size: 14.5px; line-height: 1.45; color: var(--uw-ink-700); }
.sl-terr__row i { flex: none; width: 14px; height: 10px; border-radius: 3px; transform: translateY(1px); }
.sl-terr__row b { color: var(--uw-ink-900); font-weight: 600; margin-right: 2px; }
.sl-note { font-size: 12.5px; line-height: 1.5; color: var(--uw-ink-500); margin: calc(var(--space-2) * -1) 0 var(--space-5); }

/* ---------- Bedside charts ---------- */
.sl-bed {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--uw-border);
  min-width: 0;
}
.sl-card { margin: 0; padding: var(--space-4) var(--space-5) var(--space-5); min-width: 0; }
.sl-card + .sl-card { border-left: 1px solid var(--uw-border); }
.sl-card__h { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--uw-ink-500); margin: 0 0 var(--space-2); }
.sl-card__cap { margin: var(--space-2) 0 0; font-size: 13.5px; line-height: 1.45; color: var(--uw-ink-700); min-height: 3em; }
.sl-svg svg { display: block; width: 100%; height: auto; }
.sl-svg--body svg { max-height: 280px; }
.sl-svg--vf svg { max-height: 200px; }

.sl-key { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--uw-ink-600); margin-bottom: var(--space-2); }
.sl-key span { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: -6px; }
.sl-key__m { background: var(--uw-red-500); opacity: .82; }
.sl-key__s { background: repeating-linear-gradient(135deg, var(--uw-blue-500) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--uw-blue-200); }
.sl-key__a { box-shadow: inset 0 0 0 2px var(--uw-warning-500); }

.sl-part { fill: var(--uw-ink-75); stroke: var(--uw-border-strong); stroke-width: 1.2; }
.sl-m { fill: var(--uw-red-500); }
.sl-s { fill: url(#slHatch); stroke: var(--uw-blue-500); stroke-width: 1; }
.sl-a { fill: none; stroke: var(--uw-warning-500); stroke-width: 3; stroke-dasharray: 6 4; }
.sl-lr { font-family: var(--font-mono); font-size: 10px; fill: var(--uw-ink-500); }
.sl-vfc { fill: var(--uw-surface); stroke: var(--uw-ink-400); stroke-width: 1.5; }
.sl-vfx { fill: var(--uw-ink-800); opacity: .82; }
.sl-vfs { fill: var(--uw-surface); stroke: var(--uw-ink-400); stroke-width: 1; }
.sl-vfd { fill: var(--uw-ink-500); }

/* ---------- Quiz ---------- */
.sl-vig {
  font-family: var(--font-display);
  font-size: clamp(19px, 1.8vw, 23px);
  line-height: 1.4;
  color: #fff;
  margin: 0 0 var(--space-4);
  min-height: 5.6em;
}
.sl-next { margin-top: var(--space-4); background: #fff; color: var(--uw-blue-900); box-shadow: none; }
.sl-next:hover { background: var(--uw-blue-100); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sl-stage {
    grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "brain brain"
      "bed bed"
      "left panel";
  }
  .sl-stage .hl-left { max-height: none; }
  .sl-stage .sl-panel { height: auto; min-height: 0; max-height: none; }
  .sl-stage .sl-brain { min-height: 520px; }
}
@media (max-width: 720px) {
  .sl-sidebox { width: 100%; justify-items: stretch; }
  .sl-sidenote { text-align: left; }
  .sl-stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "brain" "bed" "left" "panel"; }
  .sl-stage .sl-brain { min-height: 470px; }
  .sl-bed { grid-template-columns: 1fr; }
  .sl-card + .sl-card { border-left: 0; border-top: 1px solid var(--uw-border); }
  .sl-svg--body svg { max-height: 240px; }
  .sl-vig { min-height: 0; }
}

/* ---------- View chips: show which view is active (heart-lab.css gives the overlay chips a pale fill) ---------- */
.sl-brain .hl-heart__views .hl-chip.is-on,
.sl-brain .hl-heart__views .hl-chip[aria-pressed="true"] { background: var(--uw-blue-500); border-color: var(--uw-blue-500); color: #fff; backdrop-filter: none; }
.sl-brain .hl-heart__hint { bottom: calc(var(--space-4) + 86px); }
@media (max-width: 720px) { .sl-brain .hl-heart__views { gap: 5px; } .sl-brain .hl-heart__views .hl-chip { padding: 6px 9px; font-size: 12px; } }
