/* constellation-mode — the rules that only ever match inside this engine, moved out of
   core/styles.css so other pages don't download them. Loaded by core/app.js after
   core/styles.css (the ENGINES table's css). */

body.constellation-mode #constellationRoot {
  display: block;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(1100px 760px at 50% 44%, var(--bg-haze) 0%, var(--bg-1) 46%, var(--bg-0) 100%);
  color: var(--text);

  /* The four readings. Theme-independent on purpose. */
  --v-connects: #4c9ee8;    --v-connects-rgb: 76, 158, 232;
  --v-strains: #e8b64c;     --v-strains-rgb: 232, 182, 76;
  --v-contradicts: #e05c5c; --v-contradicts-rgb: 224, 92, 92;
  --v-silent: #7c8497;      --v-silent-rgb: 124, 132, 151;
  /* The readings as words: as is on the dark page, deeper on a light one (below). */
  --v-connects-ink: var(--v-connects); --v-strains-ink: var(--v-strains);
  --v-contradicts-ink: var(--v-contradicts); --v-silent-ink: var(--v-silent);

  --hud-h: clamp(112px, 15vh, 148px);
  --node-scale: 1;
}

/* ---- HUD + question banner ------------------------------------------ */
#constellationHud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  text-align: center; padding: 14px 64px 8px;
  background: linear-gradient(var(--bg-0), rgba(0, 0, 0, 0));
  pointer-events: none;
}

#constellationTitle {
  font-family: var(--font-display, inherit);
  font-size: clamp(18px, 2.6vw, 26px); font-weight: 800;
}

#constellationSubtitle {
  color: var(--text-dim); font-size: 13px; letter-spacing: 0.04em; margin-top: 2px;
}

#constellationQuestion {
  /* Clears the subtitle even on a short viewport, where 9vh alone would not. */
  position: fixed; top: clamp(70px, 9vh, 78px); left: 50%; transform: translateX(-50%);
  z-index: 19; width: min(820px, calc(100% - 36px));
  text-align: center; padding: 8px 18px;
  background: rgba(var(--accent-rgb), 0.1);
  border: 1px solid var(--card-border); border-radius: 999px;
}

.cons-question__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent-ink); margin-right: 10px;
}

.cons-question__text { font-weight: 700; }

/* ---- The stage: SVG links underneath, HTML nodes on top -------------- */
#constellationStage {
  position: absolute; inset: var(--hud-h) 0 84px 0;
  overflow: hidden;
}

#constellationEdges {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}

#constellationNodes { position: absolute; inset: 0; }

/* The cluster wrappers exist only to give screen readers a sane grouping and
   to keep tab order in author order; they must not affect layout. */
.cons-group { display: contents; }

/* ---- Links -----------------------------------------------------------
   A link takes the state of its weaker endpoint. Neutral (no subject in the
   core) is the plain web: the reader sees every relationship before any of it
   is coloured by a subject. */
.cons-edge {
  stroke-linecap: round;
  transition: stroke 0.24s ease, stroke-width 0.24s ease, opacity 0.24s ease;
}

.cons-edge.is-neutral     { stroke: var(--text-dim); stroke-width: 1.4; opacity: 0.4; }

.cons-edge.is-connects    { stroke: var(--v-connects); stroke-width: 2.6; opacity: 0.9; }

.cons-edge.is-strains     { stroke: var(--v-strains); stroke-width: 2.1; opacity: 0.75; stroke-dasharray: 7 5; }

.cons-edge.is-contradicts { stroke: var(--v-contradicts); stroke-width: 1.5; opacity: 0.5; stroke-dasharray: 3 6; }

.cons-edge.is-silent      { stroke: var(--v-silent); stroke-width: 1; opacity: 0.16; }

/* ---- Nodes: one passage each ----------------------------------------- */
.cons-node {
  position: absolute;
  transform: translate(-50%, -50%) scale(var(--node-scale));
  transform-origin: center;
  display: grid; gap: 3px; justify-items: center; align-content: center;
  /* Every node is the SAME box. The relaxation pass in the engine measures
     these to push overlapping nodes apart, so the size must not change when a
     subject repaints - otherwise the web would shift under the reader every
     time the centre steps. The height is a floor, not a cap: a reference that
     wraps to two lines grows its box (once, at build) rather than pushing the
     dot and claim out of the bottom of it. */
  width: 152px; min-height: 78px; overflow: hidden;
  text-align: center; font: inherit; color: var(--text);
  padding: 8px 10px; cursor: pointer;
  background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: 12px;
  transition: border-color 0.2s ease, background 0.2s ease,
              opacity 0.24s ease, box-shadow 0.2s ease;
}

.cons-node:hover { border-color: var(--accent); z-index: 5; }

.cons-node:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; z-index: 6; }

.cons-node__ref { font-style: normal; font-weight: 700; font-size: 12.5px; line-height: 1.2; }

.cons-node__vv { white-space: nowrap; }

/* The dot the links meet. A fixed square, so it never moves with the reading. */
.cons-node__glyph { display: block; width: 12px; height: 12px; color: var(--text-dim); }

.cons-node__glyph .cons-mark { display: block; width: 12px; height: 12px; }

/* Every drawn glyph (legend, list, pills, popup links) is a 1em square that
   sits on the text's centre line. */
.cons-mark { display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }

.cons-node__claim {
  font-size: 10.5px; line-height: 1.35; color: var(--text-dim);
  height: 28px;   /* fixed, not min: 1-line and 2-line claims must measure alike */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Neutral: the whole collection, uncoloured, before any subject tints it. */
.cons-node.is-neutral { opacity: 1; }

.cons-node.is-connects {
  border-color: var(--v-connects);
  background: rgba(var(--v-connects-rgb), 0.16);
  box-shadow: 0 0 0 1px rgba(var(--v-connects-rgb), 0.35),
              0 0 22px rgba(var(--v-connects-rgb), 0.22);
}

.cons-node.is-connects .cons-node__glyph { color: var(--v-connects-ink); }

.cons-node.is-strains {
  border-color: var(--v-strains);
  background: rgba(var(--v-strains-rgb), 0.13);
}

.cons-node.is-strains .cons-node__glyph { color: var(--v-strains-ink); }

.cons-node.is-contradicts {
  border-color: var(--v-contradicts);
  background: rgba(var(--v-contradicts-rgb), 0.12);
}

.cons-node.is-contradicts .cons-node__glyph { color: var(--v-contradicts-ink); }

/* Silent is the grey-out: still readable, clearly not part of the figure. */
.cons-node.is-silent {
  opacity: 0.32;
  border-color: var(--card-border);
  background: var(--card-bg);
}

.cons-node.is-silent .cons-node__glyph { color: var(--v-silent-ink); }

.cons-node.is-silent:hover, .cons-node.is-silent:focus-visible { opacity: 0.85; }

/* ---- The core: the changing centre ----------------------------------- */
#constellationCore {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 4; pointer-events: none;
  display: grid; gap: 7px; justify-items: center; align-content: center;
  text-align: center;
  /* Fixed size, like the nodes: the engine's relaxation pass measures this box
     to keep passages from sliding under it, so it must NOT grow or shrink when
     the centre steps from one subject to the next - otherwise every node would
     shift a little each time the subject changed. */
  width: min(320px, 44vw); min-height: 152px; padding: 18px 20px;
  /* Opaque (the card colour laid over the page colour), so the links that
     pass behind the centre do not show through it. */
  background:
    radial-gradient(circle at 50% 40%, rgba(var(--accent-rgb), 0.18), rgba(0, 0, 0, 0) 72%),
    linear-gradient(var(--card-bg), var(--card-bg)), var(--bg-1);
  border: 1px solid var(--accent); border-radius: 20px;
  box-shadow: 0 0 46px rgba(var(--accent-rgb), 0.24);
}

#constellationCore.is-empty {
  border-color: var(--card-border);
  box-shadow: none;
  background: linear-gradient(var(--card-bg), var(--card-bg)), var(--bg-1);
}

#constellationCoreName {
  font-family: var(--font-display, inherit);
  font-size: clamp(17px, 2.2vw, 23px); font-weight: 800; line-height: 1.15;
}

#constellationCore.is-empty #constellationCoreName { color: var(--text-dim); font-weight: 700; }

#constellationCoreMeta { display: grid; gap: 6px; justify-items: center; width: 100%; }

.cons-core__hint { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

.cons-core__score { font-size: 12px; font-weight: 700; color: var(--v-contradicts-ink); }

.cons-core__score.is-clean { color: var(--v-connects-ink); }

.cons-core__bar {
  display: flex; width: 100%; height: 7px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.cons-core__seg { display: block; min-width: 3px; }

.cons-core__seg.is-connects { background: var(--v-connects); }

.cons-core__seg.is-strains { background: var(--v-strains); }

.cons-core__seg.is-contradicts { background: var(--v-contradicts); }

.cons-core__seg.is-silent { background: var(--v-silent); opacity: 0.5; }

.cons-core__counts { font-size: 10.5px; color: var(--text-dim); line-height: 1.4; }

/* ---- Legend ---------------------------------------------------------- */
#constellationLegend {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 18;
  display: flex; gap: 14px; align-items: center;
  padding: 6px 14px; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--card-border);
}

.cons-legend__item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }

.cons-legend__glyph { display: inline-flex; font-size: 11px; }

.cons-legend__item.is-connects .cons-legend__glyph { color: var(--v-connects-ink); }

.cons-legend__item.is-strains .cons-legend__glyph { color: var(--v-strains-ink); }

.cons-legend__item.is-contradicts .cons-legend__glyph { color: var(--v-contradicts-ink); }

.cons-legend__item.is-silent .cons-legend__glyph { color: var(--v-silent-ink); }

/* ---- List view: passages x subjects ----------------------------------
   The screen-reader path, the print path, and the small-phone path in one. */
#constellationList {
  position: absolute; inset: var(--hud-h) 0 84px 0;
  overflow: auto; padding: 16px 20px 30px;
}

.cons-grid { border-collapse: collapse; width: 100%; font-size: 13px; }

.cons-grid th, .cons-grid td { border: 1px solid var(--card-border); padding: 6px 9px; }

.cons-grid__corner { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-dim); }

.cons-grid__subject {
  font-size: 12px; font-weight: 700; cursor: pointer; vertical-align: bottom;
  position: sticky; top: 0; z-index: 2; background: var(--bg-1);
}

/* Opaque (the header row is sticky: cells scroll under it), and only lightly
   tinted, so the accent ink reads at 4.5:1 (on a 0.14 tint it was 4.3:1). */
.cons-grid__subject.is-selected { color: var(--accent-ink);
  background: linear-gradient(rgba(var(--accent-rgb), 0.06), rgba(var(--accent-rgb), 0.06)), var(--bg-1); }

.cons-grid__cluster-name {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent-ink); background: rgba(var(--accent-rgb), 0.08);
}

.cons-grid__ref { text-align: left; font-weight: 600; white-space: nowrap; }

/* td.-qualified so the `.cons-grid td` padding (and the phone override) cannot
   win: the tinted button must fill its cell edge to edge, not float inset. */
.cons-grid td.cons-grid__cell { text-align: center; padding: 0; height: 1px; }

.cons-cell {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; min-height: 32px; padding: 6px 0; font: inherit; font-size: 13px;
  background: none; border: 0; cursor: pointer; color: var(--text-dim);
}

.cons-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.cons-cell.is-connects { color: var(--v-connects-ink); background: rgba(var(--v-connects-rgb), 0.14); }

.cons-cell.is-strains { color: var(--v-strains-ink); background: rgba(var(--v-strains-rgb), 0.13); }

.cons-cell.is-contradicts { color: var(--v-contradicts-ink); background: rgba(var(--v-contradicts-rgb), 0.13); }

.cons-cell.is-silent { color: var(--v-silent-ink); }

.cons-grid__links { margin-top: 22px; }

.cons-grid__links h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-dim); margin: 0 0 8px;
}

.cons-grid__links ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

.cons-grid__links li { font-size: 12.5px; }

.cons-grid__link-note { color: var(--text-dim); font-style: italic; }

/* ---- Controls -------------------------------------------------------- */
#constellationControls {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 22;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--card-border);
}

.cons-ctrl, .cons-nav {
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer;
  padding: 8px 13px; border-radius: 999px;
  background: transparent; border: 1px solid var(--card-border);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.cons-ctrl:hover, .cons-nav:hover { border-color: var(--accent); color: var(--accent-ink); }

.cons-ctrl:focus-visible, .cons-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cons-ctrl:disabled { opacity: 0.4; cursor: default; }

.cons-ctrl:disabled:hover { border-color: var(--card-border); color: var(--text); }

.cons-ctrl.is-on { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.16); color: var(--accent-ink); }

.cons-nav { font-weight: 700; }

/* The icon buttons (Clear the center, ⛶) are square, never narrower than tall. */
#constellationResetBtn, #constellationFsBtn { min-width: 40px; display: inline-grid; place-items: center; }

/* On a phone constellation.js gathers the buttons into one row under the counter
   (the phone block below); elsewhere the row is invisible to layout. */
.cons-dock__row { display: contents; }

/* …so on a desktop the counter still sits between Prev and Next. */
#constellationListBtn, #constellationPrevBtn { order: -1; }

#constellationStatus {
  min-width: 118px; text-align: center; font-size: 11.5px; color: var(--text-dim);
}

/* ---- Credit (⌂ Library is the shared .lib-link) --------------------- */
#constellationBackToGallery { --lib-z: 24; }

#constellationCredit {
  position: fixed; top: 16px; right: 18px; z-index: 24; font-size: 11px; color: var(--text-dim);
}

/* ---- Popup ----------------------------------------------------------- */
#constellationPopup { position: fixed; inset: 0; z-index: 60; }

#constellationPopupBackdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); }

.cons-pop__panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(660px, calc(100% - 32px)); max-height: min(84vh, 780px); overflow: auto;
  padding: 22px 24px 26px;
  background: var(--bg-1); border: 1px solid var(--card-border); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

#constellationPopupClose {
  position: absolute; top: 12px; right: 14px;
  font: inherit; font-size: 14px; color: var(--text-dim); cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent; border: 1px solid var(--card-border);
}

#constellationPopupClose:hover { color: var(--text); border-color: var(--accent); }

#constellationPopupTitle {
  margin: 0 40px 14px 0; font-family: var(--font-display, inherit); font-size: 20px;
}

.cons-pop__passage { margin-bottom: 16px; }

.cons-pop__text {
  margin: 0; padding: 10px 0 6px 14px; border-left: 3px solid var(--accent);
  font-size: 14.5px; line-height: 1.65;
}

.cons-pop__text p { margin: 0 0 8px; }

.cons-pop__cite { display: block; font-size: 11.5px; color: var(--text-dim); margin: 4px 0 0 17px; }

.cons-pop__issue { margin: 12px 0 0; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

.cons-pop__issue-label {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent-ink); margin-bottom: 3px;
}

.cons-pop__all-head {
  margin: 18px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-dim); font-weight: 700;
}

.cons-pop__all { display: grid; gap: 10px; }

.cons-pop__reading {
  padding: 12px 14px; border-radius: 12px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-left-width: 3px;
}

.cons-pop__reading.is-connects { border-left-color: var(--v-connects); }

.cons-pop__reading.is-strains { border-left-color: var(--v-strains); }

.cons-pop__reading.is-contradicts { border-left-color: var(--v-contradicts); }

.cons-pop__reading.is-silent { border-left-color: var(--v-silent); }

.cons-pop__reading-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

.cons-pop__subject { font-weight: 700; font-size: 14px; }

.cons-pill__glyph, .cons-pop__link-glyph { display: inline-flex; }

.cons-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid currentColor;
}

.cons-pill.is-connects { color: var(--v-connects-ink); background: rgba(var(--v-connects-rgb), 0.14); }

.cons-pill.is-strains { color: var(--v-strains-ink); background: rgba(var(--v-strains-rgb), 0.14); }

.cons-pill.is-contradicts { color: var(--v-contradicts-ink); background: rgba(var(--v-contradicts-rgb), 0.14); }

.cons-pill.is-silent { color: var(--v-silent-ink); background: rgba(var(--v-silent-rgb), 0.14); }

.cons-pop__claim { margin: 8px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.5; }

.cons-pop__why { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--text-dim); }

.cons-pop__why p { margin: 0 0 7px; }

.cons-pop__muted { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); font-style: italic; }

/* The assumption is what makes an amber honest rather than a shrug. */
.cons-pop__assumption {
  margin-top: 10px; padding: 9px 11px; border-radius: 9px;
  background: rgba(var(--v-strains-rgb), 0.1);
  border: 1px solid rgba(var(--v-strains-rgb), 0.34);
}

.cons-pop__assumption-label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--v-strains-ink); margin-bottom: 3px; font-weight: 700;
}

.cons-pop__assumption p { margin: 0; font-size: 12.5px; line-height: 1.55; }

.cons-pop__answer { margin-top: 10px; }

.cons-pop__answer-sum { cursor: pointer; list-style: none; }

.cons-pop__answer-sum::-webkit-details-marker { display: none; }

.cons-pop__answer-tag {
  display: inline-block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-dim); padding: 3px 9px; border-radius: 999px;
  border: 1px dashed var(--card-border);
}

.cons-pop__answer-sum:hover .cons-pop__answer-tag { color: var(--accent-ink); border-color: var(--accent); }

.cons-pop__answer-body { margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }

.cons-pop__answer-body p { margin: 0 0 7px; }

/* Walk the chain from inside the popup. */
.cons-pop__links { margin-top: 16px; }

.cons-pop__links-label {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--text-dim); margin-bottom: 7px;
}

.cons-pop__links-body { display: flex; flex-wrap: wrap; gap: 7px; }

.cons-pop__link {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; color: var(--text); cursor: pointer;
  padding: 5px 11px; border-radius: 999px;
  background: var(--card-bg); border: 1px solid var(--card-border);
}

.cons-pop__link cite { font-style: normal; }

.cons-pop__link:hover { border-color: var(--accent); color: var(--accent-ink); }

.cons-pop__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cons-pop__link.is-connects { border-color: rgba(var(--v-connects-rgb), 0.6); }

.cons-pop__link.is-connects .cons-pop__link-glyph { color: var(--v-connects-ink); }

.cons-pop__link.is-strains { border-color: rgba(var(--v-strains-rgb), 0.6); }

.cons-pop__link.is-strains .cons-pop__link-glyph { color: var(--v-strains-ink); }

.cons-pop__link.is-contradicts { border-color: rgba(var(--v-contradicts-rgb), 0.6); }

.cons-pop__link.is-contradicts .cons-pop__link-glyph { color: var(--v-contradicts-ink); }

.cons-pop__link.is-silent { opacity: 0.6; }

.cons-pop__link.is-silent .cons-pop__link-glyph { color: var(--v-silent-ink); }

.cons-pop__note { font-size: 13.5px; line-height: 1.65; color: var(--text-dim); }

.cons-pop__note p { margin: 0 0 9px; }

.cons-pop__subjects { display: grid; gap: 12px; margin-top: 16px; }

.cons-pop__subject-item {
  padding: 12px 14px; border-radius: 12px;
  background: var(--card-bg); border: 1px solid var(--card-border);
}

.cons-pop__subject-item h3 { margin: 0 0 5px; font-size: 14.5px; }

.cons-pop__subject-item p { margin: 0 0 5px; font-size: 13px; line-height: 1.55; color: var(--text-dim); }

.cons-pop__heldby { font-size: 11.5px !important; font-style: italic; opacity: 0.85; }

.cons-pop__subject-detail { font-size: 13px; line-height: 1.6; color: var(--text-dim); }

@media (max-width: 760px) {
  /* The ⌂ Library and light/dark pills share the top-left corner, so the
     title starts below them (MOBILE.md rule 2), and the question banner
     below the title; clearQuestion() in the JS pushes the stage under it. */
  #constellationHud { padding: 58px 16px 8px; text-align: left; }

  #constellationTitle { font-size: 21px; line-height: 1.2; }

  #constellationQuestion { top: 112px; padding: 8px 14px; border-radius: 18px; }

  .cons-question__label { font-size: 12px; }
  
  #constellationCredit { display: none; }
  
  #constellationCore { width: min(260px, 68vw); min-height: 128px; padding: 14px 15px; }
  
  .cons-node { width: 124px; min-height: 46px; padding: 6px 8px; }
  
  .cons-node__ref { font-size: 11.5px; }
  
  .cons-node__claim { display: none; height: 0; }
  
  #constellationLegend { left: 12px; right: 12px; transform: none; bottom: 92px; justify-content: center; gap: 10px; }
  
  #constellationControls { left: 12px; right: 12px; transform: none; gap: 7px; padding: 10px; justify-content: center; }
  
  .cons-ctrl, .cons-nav { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
  
  #constellationStatus { min-width: 0; flex: 1; font-size: 12px; }
  
  #constellationStage, #constellationList { bottom: 96px; }
  
  #constellationList { padding: 14px 12px 30px; }
  
  /* Seven buttons and the counter do not fit one 366px row: the counter takes its
     own line on top (never squeezed to a word per line), and the buttons keep to
     ONE row under it. With several subjects that row is full (Web, Prev, Next,
     Play, Clear, About, ⛶); where it is still too wide (a 360px phone) it scrolls
     sideways rather than wrap a third row up over the legend. The legend and the
     stage sit above the bar as measured (--cons-dock, set by constellation.js),
     so a taller bar can never cover them. */
  #constellationControls { flex-wrap: wrap; row-gap: 6px; border-radius: 22px; padding: 8px 8px; gap: 5px; left: 8px; right: 8px; }

  #constellationStatus { order: -1; flex: 1 0 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .cons-dock__row { display: flex; flex-wrap: nowrap; gap: 3px; justify-content: safe center; flex: 1 0 100%;
    min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }

  .cons-dock__row::-webkit-scrollbar { display: none; }

  /* Cut off (a 360px phone): a fade at the cut edge says the row scrolls. */
  .cons-dock__row.is-cut { -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent); }

  .cons-ctrl, .cons-nav { padding: 6px 7px; flex: none; }

  .cons-ctrl__more { display: none; }

  #constellationLegend { bottom: calc(var(--cons-dock, 98px) + 6px); }

  #constellationStage, #constellationList { bottom: calc(var(--cons-dock, 98px) + 41px); }
  
  .cons-grid { font-size: 12px; }

  .cons-grid__corner, .cons-grid__cluster-name { font-size: 12px; }
  
  .cons-grid th, .cons-grid td { padding: 5px 6px; }
}

/* ---- Constellation in immersive mode (HL.immersive; shared fade rules under
   "IMMERSIVE MODE") -----------------------------------------------------------
   The stage runs edge to edge (engines/constellation.js re-fits the web to it and stops
   keeping clear of the legend and question); the chrome floats over the web on
   soft top / bottom scrims that fade with it. The list keeps its insets. */
body.constellation-mode.hl-immersive #constellationStage { inset: 0; }

/* The banner now sits on the web: an opaque fill under its tint, so links and
   nodes do not show through the words. */
body.constellation-mode.hl-immersive #constellationQuestion {
  pointer-events: none;
  background: linear-gradient(rgba(var(--accent-rgb), 0.1), rgba(var(--accent-rgb), 0.1)), var(--bg-1);
}

body.constellation-mode.hl-immersive #constellationRoot:not(.is-listing)::before,
body.constellation-mode.hl-immersive #constellationRoot:not(.is-listing)::after {
  content: ""; position: fixed; left: 0; right: 0; z-index: 11; pointer-events: none;
  transition: opacity 0.5s ease;
}

body.constellation-mode.hl-immersive #constellationRoot::before { top: 0; height: 130px; background: linear-gradient(var(--bg-0), transparent); }

body.constellation-mode.hl-immersive #constellationRoot::after { bottom: 0; height: 150px; background: linear-gradient(transparent, var(--bg-0) 70%); }

body.constellation-mode.hl-idle #constellationRoot::before,
body.constellation-mode.hl-idle #constellationRoot::after { opacity: 0; transition: opacity 0.8s ease; }

/* A phone held sideways: the HUD and the question share one short band, the
   legend sits in the controls' row instead of on the web. */
@media (max-height: 500px) and (min-width: 761px) {
  #constellationHud { padding: 10px 200px 4px; }

  #constellationTitle { font-size: 19px; }

  #constellationSubtitle, #constellationCredit { display: none; }

  #constellationQuestion { top: 46px; padding: 5px 16px; }

  #constellationLegend { left: 16px; transform: none; bottom: 22px; }

  #constellationControls { left: auto; right: 16px; transform: none; bottom: 12px; padding: 6px 10px; }

  #constellationStage, #constellationList { bottom: 64px; }
}

/* Touch: the bar's buttons and the grid's cells take a full fingertip. */
@media (pointer: coarse) {
  .cons-ctrl, .cons-nav { min-height: 40px; }

  .cons-cell { min-height: 40px; }

  .cons-ctrl.hl-fs-btn { min-width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .cons-node, .cons-edge { transition: none; }
}

body.low-power .cons-node, body.low-power .cons-edge { transition: none; }

/* Light page: the four readings' colors were drawn for a dark sky. As text they were
   2-2.5:1 on the light page ("No contradictions"); these deeper inks read at 4.5:1. */
:root[data-mode="light"] body.constellation-mode #constellationRoot {
  --v-connects-ink: #1f63a8; --v-strains-ink: #7b5c11; --v-contradicts-ink: #ad2a2a; --v-silent-ink: #555c70;
}
