/* Ropework Crossing Trainer - MIT (c) 2026 ipusiron. */
:root {
  color-scheme: light;
  --bg: #edf2f7;
  --panel: #ffffff;
  --ink: #172f42;
  --muted: #465c6d;
  --line: #728797;
  --accent: #145d88;
  --focus: #b04600;
  --warning: #9f2734;
  --soft: #e6eff6;
  --tab-idle: #d3dee9;
  --tab-hover: #c3d2e0;
  --tile-over: #e6eff6;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101a24;
  --panel: #1a2938;
  --ink: #eff7ff;
  --muted: #bdcbd8;
  --line: #8297a8;
  --accent: #9bd5ff;
  --focus: #ffb76b;
  --warning: #ff9eaa;
  --soft: #273e50;
  --tab-idle: #22364a;
  --tab-hover: #2d4660;
  --tile-over: #34526a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 system-ui, Meiryo, sans-serif; }
button, input, select { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  line-height: 1.4;
}
button:hover { border-color: var(--accent); background: var(--soft); }
button[aria-pressed="true"], button[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 -3px var(--accent);
  background: var(--soft);
  font-weight: 700;
}
button[aria-disabled="true"] { opacity: .48; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 3px; overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 18px; line-height: 1.5; }
h3 { font-size: 16px; }
[hidden] { display: none !important; }
.ph { white-space: nowrap; }
.wrap { width: min(1184px, 100%); margin-inline: auto; padding-inline: 16px; }
.site-header { padding-block: 8px 8px; }
h1 { font-size: clamp(25px, 3.2vw, 36px); font-weight: 800; line-height: 1.17; letter-spacing: -.025em; }
.subtitle { margin-top: 6px; color: var(--muted); font-size: 14px; text-wrap: balance; }
/* A reason line does not leave a short phrase alone on its last line. */
#freehand-reason .sentence { text-wrap: pretty; }
.header-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.header-title { min-width: 0; text-align: center; }
.header-buttons { display: flex; justify-content: center; gap: 6px; }
.header-buttons button { border-radius: 999px; font-weight: 700; white-space: nowrap; }
.introduction { margin-bottom: 8px; }
summary { min-height: 44px; cursor: pointer; font-weight: 600; }
.accordion {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow-anchor: none;
}
.accordion-summary {
  display: block;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--bg);
  color: var(--accent);
  list-style: none;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary::marker { content: ''; }
.accordion-summary > .accordion-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  font: inherit;
}
.accordion-label { min-width: 0; }
.disclosure-space { height: 100dvh; pointer-events: none; }
.accordion-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 10px;
  color: var(--accent);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}
.accordion-indicator-label { line-height: 1; }
.accordion-chevron {
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  background: var(--panel);
  transition: transform .18s ease;
}
@media (prefers-reduced-motion: reduce) {
  .accordion-chevron { transition: none; }
}
.accordion[open] > .accordion-summary {
  border-bottom: 1px solid var(--line);
  border-radius: 9px 9px 0 0;
  background: var(--soft);
}
.accordion[open] > .accordion-summary .accordion-chevron {
  transform: rotate(180deg);
  background: var(--accent);
  color: var(--panel);
}
.accordion[open] > .accordion-summary .accordion-label { color: var(--accent); }
.accordion-summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; background: var(--soft); }
@media (hover: hover) {
  .accordion-summary:hover { background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
  .accordion-summary:hover .accordion-chevron { background: var(--soft); }
}
.intro-copy { padding: 4px 12px 12px; }
.intro-copy p { margin-top: 5px; }
.conventions { padding: 4px 8px; border-left: 3px solid var(--accent); font-size: 13px; line-height: 1.45; background: var(--panel); }
/* Folder tabs: the unselected tabs sit back on a deeper fill; the selected tab
   takes the page color, an outline and a thick accent top edge, and covers
   the strip's bottom rule so it joins the content below. */
#tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
}
#tabs button {
  margin-bottom: 0; padding: 9px 3px 8px; font-size: 14px; white-space: nowrap; word-break: keep-all;
  border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0;
  background: var(--tab-idle); color: var(--muted); font-weight: 600; box-shadow: none;
}
#tabs button:hover { background: var(--tab-hover); border-color: var(--line); color: var(--ink); }
#tabs button:focus-visible { outline: 3px solid var(--focus); outline-offset: -4px; background: var(--tab-hover); color: var(--ink); }
#tabs button[aria-selected="true"] {
  margin-bottom: -2px; padding-bottom: 10px; border-color: var(--line); background: var(--bg);
  color: var(--accent); font-weight: 800; box-shadow: inset 0 4px var(--accent);
}
.panels { display: grid; align-items: start; overflow-anchor: none; }
.panels > section { grid-area: 1 / 1; min-width: 0; }
.panels > section[hidden] {
  display: block !important; visibility: hidden; pointer-events: none; contain: size layout paint; overflow: clip;
}
.panels.is-measuring > section[hidden] { contain: none; }
.panel-baseline { grid-area: 1 / 1; display: block; width: 1px; visibility: hidden; pointer-events: none; }
.knot-choice { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0 4px; }
.knot-choice[hidden] { display: none; }
.knot-about { margin-top: 16px; }
/* The handcuff knot's caution stays above its steps while it is chosen. */
.knot-caution {
  border: 2px solid var(--warning); border-radius: 6px; padding: 8px 12px; margin: 10px 0 4px;
  background: var(--panel); font-weight: 700;
}
.knot-caution p { margin: 0; }
.knot-caution p + p { margin-top: 2px; }
.knot-caution .knot-caution-note { margin-top: 6px; color: var(--muted); font-size: 14px; font-weight: 400; }
.compare-empty { border-left: 3px solid var(--warning); padding: 8px 12px; margin: 6px 0 16px; }
.knot-about-line {
  display: block;
  margin-block: .5rem 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  }
.knot-about-body { padding: 4px 8px 12px; }
.knot-about-body section + section { margin-top: 14px; }
.knot-about-body p { margin-top: 4px; }
/* The same marks as "Details" in Freehand: a disc, then a circle one level in. */
.about-list { margin: 4px 0 0; padding-inline-start: 1.25em; line-height: 1.7; }
.about-list ul { margin: 0; padding-inline-start: 1.25em; list-style: circle; }
.knot-about-body .about-note { margin-top: 8px; }
.knot-about-body .about-end { margin-top: 14px; }
.about-reference { display: inline-block; min-height: 44px; padding-block: 10px; }
.small-label { font-size: 14px; color: var(--muted); font-weight: 600; }
/* Step tools: Next is the primary action (filled), Play is outlined, First
   and Previous are icon-only secondary buttons. At >= 600 px the group is
   right-aligned; below, the group spans the row with Next widest. */
.step-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: stretch; }
.step-tools button {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 10px;
  font-size: 14px;
  }
.step-tools #step-next {
  background: var(--accent);
  color: var(--panel);
  font-weight: 700;
  border: 2px solid var(--accent);
  flex: 1 1 auto;
  }
.step-tools #step-play {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--accent);
  font-weight: 600;
  }
.step-tools #step-first, .step-tools #step-previous {
  background: var(--soft);
  padding: 6px 10px;
  flex: 0 0 auto;
  }
@media (min-width: 600px) {
  .step-tools { justify-content: flex-end; flex-wrap: nowrap; }
  .step-tools #step-next { flex: 0 0 auto; }
  }
@media (max-width: 400px) {
  .step-tools { flex-wrap: wrap; }
  }
.action-button { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 600; }
.action-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.start-guide { display: grid; padding-block: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.start-guide > p:first-of-type, .start-guide > .step-reason { grid-area: 1 / 1; }
.start-guide > p:last-of-type { grid-area: 2 / 1; }
@media (max-width: 599px) { .start-guide { padding-block: 2px; } }
@media (max-width: 359px) { .start-guide { grid-template-rows: minmax(3em, auto) auto; } }
.is-quiet { visibility: hidden; }
.step-info { display: grid; padding: 4px 0; }
.step-info > div { grid-area: 1 / 1; }
.step-info-measure { visibility: hidden; pointer-events: none; }
/* Below 900px the figure comes next, so the step number and its lines sit at
   the bottom of the room kept for the tallest step, right above the figure. */
@media (width < 900px) { .step-info > .step-info-content { align-self: end; } }
.step-info h2 { margin-bottom: 5px; }
/* The step number, with a link to the longer text under the tiles. */
.step-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; }
.step-body-link, .step-body-back { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
.step-body-link { margin-left: auto; }
.knot-choice-note { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.crossing-copy, .crossing-copy-measure { font-size: 14px; line-height: 1.5; }
.crossing-copy .is-current { background: var(--soft); box-shadow: inset 3px 0 var(--accent); padding-left: 7px; }
.figure-column { min-width: 0; }
.stage-shell { position: relative; }
.knot-stage { user-select: none; -webkit-user-select: none; }
.knot-stage { height: min(55dvh, 400px); min-height: 260px; border: 1px solid var(--line); border-radius: 12px; }
.rotate-hint { position: absolute; top: 9px; left: 11px; z-index: 2; font-size: 12px; color: var(--muted); pointer-events: none; }
.view-head { display: flex; align-items: center; gap: 12px; margin-top: 10px; margin-bottom: 6px; }
.view-head strong { font-size: 14px; }
.view-badge { margin-left: auto; background: var(--soft); padding: 2px 8px; border-radius: 5px; font-size: 14px; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.preset { display: flex; flex-direction: column; align-items: center; min-height: 76px; padding: 5px 2px; gap: 1px; }
.preset-icon { width: 30px; height: 22px; color: var(--accent); }
.preset-title { font-size: 14px; }
.preset-hint { font-size: 11px; color: var(--muted); }
.turn-title { margin-top: 8px; font-size: 14px; }
.turn-row { display: flex; gap: 6px; margin-top: 4px; align-items: center; }
.turn-buttons { display: flex; gap: 4px; }
.turn-buttons button { display: flex; flex-direction: column; align-items: center; padding: 2px 4px; min-width: 48px; }
.turn-symbol { font-size: 23px; line-height: 1.2; }
.turn-label { font-size: 10px; }
.spread-button { margin-left: auto; padding-inline: 8px; font-size: 14px; }
.turn-buttons button, .spread-button, .highlight-tools button, .panel-actions button { background: var(--soft); }
.control-reason { color: var(--muted); font-size: 13px; line-height: 1.5; }
.turn-reason { min-height: 39px; margin-top: 4px; }
.retry-button { margin: 0 0 8px; background: var(--soft); }
.number-reason { min-height: 39px; margin-top: 3px; }
.input-reasons { min-height: 39px; margin-bottom: 8px; }
.display-box { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.display-title { font-size: 14px; margin-bottom: 4px; }
.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.switch {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border-color: transparent;
  padding-inline: 6px;
  font-size: 14px;
}
.switch:first-child { grid-column: 1 / -1; }
.switch-track { display: block; flex: 0 0 36px; height: 22px; border: 1px solid var(--muted); border-radius: 20px; padding: 3px; }
.switch-track::after { content: ""; display: block; height: 14px; width: 14px; background: var(--muted); border-radius: 100%; }
.switch[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch-track::after { margin-left: 14px; background: var(--panel); }
.view-status { padding: 12px 0 8px; font-size: 14px; color: var(--muted); }
.highlight-tools { display: flex; gap: 8px; min-height: 56px; align-content: start; flex-wrap: wrap; }
.highlight-tools.is-empty { display: none; }
.highlight-tools button { font-size: 14px; }
.sequence { border-top: 1px solid var(--line); padding-top: 14px; }
.sequence-hint, .sequence-reading { color: var(--muted); font-size: 14px; }
.sequence-hint { margin: 5px 0 12px; }
.sequence-groups { min-height: 197px; }
.sequence-empty { min-height: 197px; }
.sequence-label { margin: 7px 0 5px; font-size: 14px; color: var(--muted); }
.sequence-tiles { display: flex; gap: 5px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.sequence-tile { min-width: 44px; min-height: 56px; padding: 5px; display: flex; flex-direction: column; align-items: center; }
.sequence-tile .tile-number { font-size: 16px; font-weight: 750; }
.sequence-tile .tile-word { font-size: 12px; }
.sequence-tile[data-over="true"] { background: var(--tile-over); }
.loop-divider { margin: 6px 0; color: var(--muted); font-size: 14px; }
.sequence-reading { margin-top: 12px; }
.sequence-reading p { margin-block: 5px; }
.step-body { margin-top: 20px; min-height: 145px; }
.step-body p { margin: 7px 0; }
.safety { border-left: 3px solid var(--warning); padding: 8px 12px; margin-top: 22px; font-size: 14px; color: var(--muted); }
.compare-choice { margin: 3px 0 16px; }
.compare-choice .choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.compare-choice button { font-size: 14px; }
.compare-about { margin-top: 12px; }
.compare-related .related-title { font-weight: 700; margin-block: 0 .5rem; }
.compare-order { margin: 8px 0 0; font-size: 15px; font-weight: 700; text-align: center; }
.compare-figures { display: grid; gap: 14px; }
.compare-figure { min-width: 0; }
.figure-title { min-height: 60px; font-size: 16px; padding-block: 6px; }
.compare-local-tabs { display: none; gap: 6px; margin-bottom: 8px; }
.compare-local-tabs button { flex: 1; font-size: 13px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.pick-row .small-label { width: 100%; }
.site-footer { padding-block: 18px 28px; font-size: 14px; border-top: 1px solid var(--line); margin-top: 20px; text-align: center; }
.site-footer a { display: inline-block; min-height: 44px; padding-block: 10px; overflow-wrap: normal; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
dialog { max-width: min(700px, calc(100% - 24px)); max-height: 85dvh; color: var(--ink); background: var(--panel); }
dialog::backdrop { background: #081422b3; }
noscript { display: block; padding: 24px; }
@media (min-width: 600px) {
  .wrap { padding-inline: 24px; }
  .switches { grid-template-columns: 1.3fr 1fr 1fr; }
  .switch:first-child { grid-column: auto; }
  .compare-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .highlight-tools { min-height: 56px; }
}
@media (min-width: 900px) {
  .header-content { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2.5fr) minmax(180px, 1fr); }
  .header-title { grid-column: 2; }
  .header-buttons { grid-column: 3; justify-self: end; }
  .step-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); column-gap: 28px;
    grid-template-rows: min-content min-content min-content 1fr; }
  .step-info { grid-column: 2; grid-row: 1; padding-top: 4px; }
  .figure-column { grid-column: 1; grid-row: 1 / 5; }
  .sequence { grid-column: 2; grid-row: 2; align-self: start; }
  .step-body { grid-column: 2; grid-row: 3; align-self: start; }
  .step-layout > .safety { grid-column: 2; grid-row: 4; align-self: start; }
  .knot-stage { height: min(60dvh, 450px); }
  .number-reason { min-height: 19.5px; }
  /* The figures span the rows of "Pick a crossing" and the view controls, and
     are usually the taller side. The spare height goes to the last row, so
     the number buttons keep their size when the controls' text changes. */
  #panel-compare { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); column-gap: 24px;
    grid-template-rows: auto min-content min-content 1fr; }
  .panels > #panel-compare[hidden] { display: grid !important; }
  .compare-choice { grid-column: 1 / -1; }
  .compare-figures { position: sticky; top: 10px; grid-column: 1; grid-row: 2 / 5; align-self: start; }
  #panel-compare .pick-row { grid-column: 2; grid-row: 2; margin-top: 0; align-self: start; align-content: flex-start; }
  #panel-compare .pick-row button { align-self: flex-start; }
  #panel-compare .view-controls { grid-column: 2; grid-row: 3; align-self: start; }
  /* The compare column is narrower than the steps column, so the three
     figure-display switches reflow onto two rows to stay the same shape,
     typography and track as the steps tab instead of being drawn as full-width
     white bands the way the earlier override made them. */
  #panel-compare .switches { grid-template-columns: 1fr 1fr; }
  #panel-compare .switch:first-child { grid-column: 1 / -1; }
  .compare-figure .figure-title { min-height: 82px; }
  .compare-figure .knot-stage { height: min(60dvh, 510px); }
}
@media (max-width: 359px) {
  .wrap { padding-inline: 12px; }
  h1 { font-size: 24px; }
  #tabs button { font-size: 12px; padding-inline: 2px; }
  #tabs { grid-template-columns: repeat(4, minmax(max-content, 1fr)); gap: 3px; }
  .step-tools { gap: 4px; }
  .preset { min-height: 56px; }
  .preset-hint { display: none; }
  .turn-row { gap: 4px; }
  .turn-buttons { gap: 2px; }
  .turn-buttons button { min-width: 44px; }
  .turn-label { display: none; }
  .spread-button { font-size: 12px; padding-inline: 4px; }
  .compare-local-tabs { display: flex; }
  .compare-figure.is-small-hidden { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .accordion-chevron { transition: none; }
}

:root {
  --figure-bg: #f6f9fc;
  --rope-standing: #287db2;
  --rope-working: #d76a22;
  --rope-outline: #172f42;
  --rope-shine: #ffffff;
  --rope-stripe: #602a09;
  --post-fill: #80909f;
  --post-outline: #253848;
  --figure-ink: #172f42;
  --figure-muted: #526573;
  --figure-warning: #b02b39;
  /* Reference figures: a blue rope with an outline, light stripes on it, and
     orange dots, each at least 3:1 against the rope. Ropes in the step-diagram
     colors (term tiles, card 29) take the dark dot instead. */
  --ref-rope: #1d6a9a;
  --ref-stripe: #f4f8fb;
  --ref-dot: #ffad5e;
  --ref-dot-deep: #0b2a40;
  --ref-halo: #ffffff;
  /* Card 35 draws its three braid strands in the blue and orange ropes and
     this gray, which is far darker than both here and far lighter in the dark
     theme, so the three differ in lightness as well as in hue. */
  --ref-strand-3: #4a4a4a;
  /* Freehand's three-color paint: blue, orange and reddish purple, apart in
     hue and lightness and for each kind of color vision checked in
     test/contrast.test.js, each at least 3:1 against the frame. */
  --paint-1: #3b3b98;
  --paint-2: #c2410c;
  --paint-3: #cc79a7;
}
:root[data-theme="dark"] {
  --figure-bg: #172330;
  --rope-standing: #3796cb;
  --rope-working: #c77826;
  --rope-outline: #eff7ff;
  --rope-shine: #ffffff;
  --rope-stripe: #301c0b;
  --post-fill: #647686;
  --post-outline: #e0e9f2;
  --figure-ink: #eff7ff;
  --figure-muted: #bdcbd8;
  --figure-warning: #ff9eaa;
  --ref-rope: #1d6a9a;
  --ref-stripe: #f4f8fb;
  --ref-dot: #ffb76b;
  --ref-dot-deep: #0b2a40;
  --ref-halo: #ffffff;
  --ref-strand-3: #d4d4d4;
  --paint-1: #56b4e9;
  --paint-2: #f5c342;
  --paint-3: #d1495b;
}
.knot-stage {
  position: relative;
  overflow: hidden;
  background: var(--figure-bg);
  min-width: 0;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}
.knot-stage.is-dragging { cursor: grabbing; }
.knot-canvas, .knot-svg { display: block; width: 100%; height: 100%; }
.knot-canvas { position: absolute; inset: 0; }
.knot-canvas[hidden] { display: none; }
.knot-svg { position: relative; pointer-events: none; }
.knot-svg text { font-family: Meiryo, "Yu Gothic", sans-serif; text-anchor: middle; dominant-baseline: middle; }
.knot-svg .hidden { visibility: hidden; }
.rope-halo, .rope-edge, .rope-color, .rope-shine, .rope-stripe, .post-edge, .post-color {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: round;
}
.rope-halo { stroke: var(--figure-bg); }
.rope-edge { stroke: var(--rope-outline); }
.rope-color.standing { fill: var(--rope-standing); }
.rope-color.working { fill: var(--rope-working); }
.rope-shine { stroke: var(--rope-shine); opacity: .32; }
.rope-stripe { stroke: var(--rope-stripe); stroke-linecap: butt; }
.rope-stripe.rope-dots { stroke-linecap: round; }
.post-edge { stroke: var(--post-outline); }
.post-color { fill: var(--post-fill); }
.rope-muted { opacity: .4; }
.flat-edge, .flat-color { fill: none; stroke-linecap: butt; stroke-linejoin: round; }
.flat-edge { stroke: var(--rope-outline); }
.flat-color.standing { stroke: var(--rope-standing); }
.flat-color.working { stroke: var(--rope-working); }
.flat-post { fill: var(--post-fill); stroke: var(--post-outline); }
.number-line, .label-line { fill: none; stroke: var(--figure-muted); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.number-circle { fill: var(--figure-bg); stroke: var(--figure-ink); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.number-text { fill: var(--figure-ink); font-weight: 700; }
.number-circle.picked { fill: var(--figure-ink); }
.number-text.picked { fill: var(--figure-bg); }
.figure-label {
  fill: var(--figure-ink);
  stroke: var(--figure-bg);
  stroke-width: 3;
  paint-order: stroke fill;
  stroke-linejoin: round;
}
.tip-arrow { fill: var(--rope-working); stroke: var(--rope-outline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.view-arrow { fill: var(--figure-muted); }
.picked-ring { fill: none; stroke: var(--figure-ink); stroke-width: 3; vector-effect: non-scaling-stroke; }
.difference-ring { fill: none; stroke: var(--figure-warning); stroke-width: 2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.difference-label { fill: var(--figure-warning); }
.guide-path { fill: none; stroke: var(--figure-ink); stroke-dasharray: 4 4; stroke-width: 2; vector-effect: non-scaling-stroke; }
.stopped-guides.is-faint { opacity: .3; }

.panel-prose .sentence {
  display: block;
  }
.panel-prose .sentence[hidden] {
  display: none;
  }
.panel-prose {
  line-height: 1.7;
  }
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  }
.panel-heading {
  margin-block: 0 1rem;
  }
/* Freehand: the two groups of buttons, the frame, then the check, the
   crossings and the key to the marks. From 900 px the check sits beside the
   frame, top edges level, and the crossings and key stay under the frame. */
.freehand-question {
  margin-block-end: 12px;
  }
.freehand-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 40px;
  margin-block-end: 16px;
  }
.freehand-bar .panel-actions {
  gap: 8px;
  }
@media (width < 600px) {
  .freehand-bar > * {
  flex-basis: 100%;
  }
}
.freehand-tools {
  justify-content: flex-start;
  }
.freehand-below > * {
  margin-block-start: 8px;
  }
.freehand-below .input-reasons {
  min-height: 0;
  margin-block-end: 0;
  }
.freehand-notice {
  color: var(--warning);
  }
.freehand-below .input-reasons:empty, .freehand-notice:not(:has(.sentence:not([hidden]))) {
  margin-block-start: 0;
  }
.freehand-check, .freehand-crossing-block, .freehand-key {
  margin-block-start: 16px;
  }
.freehand-crossing-block > h3 {
  margin-block-end: 8px;
  }
@media (min-width: 900px) {
  .freehand-layout {
  display: grid;
  grid-template-columns: minmax(0, 800px) minmax(280px, 1fr);
  grid-template-rows: auto auto auto auto auto 1fr;
  grid-template-areas: "bar bar" "frame check" "below check" "list check" "key check" ". check";
  column-gap: 24px;
  align-items: start;
  }
  .freehand-bar { grid-area: bar; }
  .freehand-frame { grid-area: frame; }
  .freehand-below { grid-area: below; }
  .freehand-check { grid-area: check; margin-block-start: 0; }
  .freehand-crossing-block { grid-area: list; }
  .freehand-key { grid-area: key; }
}
.freehand-frame {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--panel);
  overflow: hidden;
  }
#freehand-stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
  }
.freehand-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
  }
.freehand-empty[hidden] {
  display: none;
  }
.freehand-legend {
  margin-block-end: 4px;
  line-height: 1.65;
  }
.freehand-rope {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: butt;
  stroke-linejoin: round;
  }
.freehand-chevron {
  fill: none;
  stroke: var(--panel);
  stroke-linecap: round;
  stroke-linejoin: round;
  }
.freehand-hit {
  fill: transparent;
  stroke: none;
  }
.freehand-preview-crossing {
  fill: none;
  stroke: var(--ink);
  }
.freehand-number circle {
  fill: var(--panel);
  stroke: var(--ink);
  }
.freehand-number text {
  fill: var(--ink);
  font-weight: 700;
  }
.freehand-number.is-picked circle {
  fill: var(--ink);
  }
.freehand-number.is-picked text {
  fill: var(--panel);
  }
.freehand-number-leader {
  stroke: var(--muted);
  fill: none;
  }
.freehand-start {
  fill: var(--panel);
  stroke: var(--ink);
  }
.freehand-end {
  fill: var(--ink);
  }
.freehand-end-ring {
  fill: none;
  stroke: var(--ink);
  }
.freehand-end-label {
  fill: var(--ink);
  stroke: var(--panel);
  stroke-width: 3px;
  paint-order: stroke;
  font-weight: 700;
  }
/* The crossings tile across and wrap; each card is as wide as its words. */
.freehand-crossings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  }
.freehand-crossing-row {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  max-width: 100%;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: .5rem;
  }
.freehand-crossing-row.is-picked {
  border-color: var(--ink);
  background: var(--soft);
  }
.freehand-crossing-description {
  flex: 1 1 auto;
  min-width: 0;
  }
.freehand-swap {
  flex: 0 1 auto;
  }
.freehand-examples {
  justify-content: flex-start;
  align-items: center;
  }
.freehand-examples-label {
  font-weight: 700;
  }
.freehand-example-note[hidden], .freehand-check [hidden] {
  display: none;
  }
/* Painted, the rope becomes a thin edge just outside the three colors. */
.freehand-rope.is-painted {
  stroke: var(--rope-outline);
  }
.freehand-paint {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: round;
  }
.freehand-paint-1 { stroke: var(--paint-1); }
.freehand-paint-2 { stroke: var(--paint-2); }
.freehand-paint-3 { stroke: var(--paint-3); }
.freehand-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-block-end: 0;
  padding: 0;
  list-style: none;
  }
.freehand-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  }
.freehand-swatch-dot {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--rope-outline);
  border-radius: 50%;
  }
.freehand-swatch-1 { background: var(--paint-1); }
.freehand-swatch-2 { background: var(--paint-2); }
.freehand-swatch-3 { background: var(--paint-3); }
.freehand-step-span {
  fill: none;
  stroke: var(--focus);
  stroke-opacity: .35;
  stroke-linecap: round;
  stroke-linejoin: round;
  }
.freehand-step-ring {
  fill: none;
  stroke: var(--focus);
  }
.freehand-faded {
  fill: var(--panel);
  fill-opacity: .7;
  }
.freehand-number.is-faded {
  opacity: .35;
  }
.freehand-trouble {
  fill: none;
  stroke: var(--warning);
  }
.freehand-enclosed {
  fill: none;
  stroke: var(--warning);
  }
/* Each block of the check: heading, 6 px, contents; 16 px between blocks. */
.freehand-check {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  }
.freehand-check > div > h3, .freehand-check > div > h4 {
  margin-block: 0 6px;
  font-size: 16px;
  }
.freehand-verdict {
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--soft);
  font-weight: 700;
  }
.freehand-verdict[data-verdict="knot"] {
  border: 2px solid var(--ink);
  }
.freehand-verdict[data-verdict="unknown"] {
  border: 2px solid var(--warning);
  background: var(--panel);
  }
/* Inside "Details" the words keep clear of the frame's edge. */
.freehand-details-body {
  padding: 10px 16px 12px;
  }
.freehand-details-text > * + * {
  margin-block-start: 8px;
  }
.freehand-details-list {
  margin-block-end: 0;
  padding-inline-start: 1.25em;
  line-height: 1.7;
  }
.freehand-details-list ul {
  margin: 0;
  padding-inline-start: 1.25em;
  list-style: circle;
  }
.freehand-step-tools, .freehand-paint-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-block-start: 8px;
  }
.freehand-paint-tools {
  flex-direction: column;
  align-items: flex-start;
  margin-block-start: 0;
  }
.freehand-caveat {
  color: var(--muted);
  }
.reference-tools {
  justify-content: flex-end;
  gap: 0 12px;
  margin-block: .4rem .25rem;
  }
.reference-tools button {
  min-height: 44px;
  padding: 6px 4px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  }
@media (hover: hover) {
  .reference-tools button:hover { background: var(--soft); border-color: transparent; }
  }
.genre {
  margin-block: .75rem;
  }
.genre-summary, .card-summary {
  scroll-margin-top: 5rem;
  }
.genre-summary h3 {
  display: inline;
  margin: 0;
  font-size: 1.06rem;
  }
.genre-content {
  padding: 0 .75rem .75rem;
  }
.genre-description {
  margin-block: .25rem .75rem;
  color: var(--muted);
  line-height: 1.7;
  }
.study-card {
  margin-block: .75rem;
  }
.card-summary h4 {
  display: inline;
  margin: 0;
  font-size: 1rem;
  }
.card-summary .no {
  display: inline-block;
  min-width: 1.6em;
  margin-inline-end: .3rem;
  color: var(--accent);
  font-weight: 700;
  }
.card-line {
  display: block;
  margin-block: .5rem 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  }
.card-body {
  padding: 0 .75rem .75rem;
  }
/* A card with two or more figures shows them below the text, one per row on
   narrow screens and side by side from 720 px, all the same size. */
.card-body > .reference-figures.is-multi { grid-template-columns: minmax(0, 1fr); }
.reference-figures.is-multi > .reference-figure { max-width: 420px; }
@media (min-width: 720px) {
  .card-body > .reference-figures.is-multi { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .card-body > .reference-figures.is-multi:is([data-count="2"], [data-count="4"]) { max-width: 820px; }
  .reference-figures.is-multi > .reference-figure { max-width: none; margin: 0; }
}
@media (min-width: 1000px) {
  .card-body > .reference-figures.is-multi:not([data-count="2"], [data-count="4"]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* At wider viewports, a single figure floats to the left so the body text
   wraps on its right. Sources stay full width. */
@media (min-width: 720px) {
  .card-body > .reference-figures:not(.is-multi) {
    float: left;
    width: 340px;
    margin-right: 1rem;
    margin-block: 0 .75rem;
    }
  /* The table's frame takes the table's own width rather than the figure column's. */
  .card-body > .reference-figures:not(.is-multi):has(> .reference-tally) { width: auto; max-width: 100%; }
  .card-body::after { content: ''; display: block; clear: both; }
  .card-body > .card-sources { clear: both; }
  }
.card-paragraph {
  margin-block: .75rem;
  }
.card-term {
  margin-block: 1rem;
  }
.card-term dt {
  font-weight: 700;
  }
.card-term dd {
  margin: .35rem 0 0;
  }
.card-step {
  display: grid;
  grid-template-columns: 1.5em 1fr;
  column-gap: .5em;
  margin-block: .5rem;
  }
.card-step dd { margin: 0; }
.card-sources {
  border-top: 1px solid var(--line);
  margin-block: 1rem;
  padding-block-start: .75rem;
  }
.reference-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  margin-block: 1rem;
  align-items: start;
  }
.reference-figure {
  min-width: 0;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--panel);
  }
.reference-figure svg {
  display: block;
  width: 100%;
  height: auto;
  }
.reference-figure figcaption {
  margin-block-start: .5rem;
  font-size: 1rem;
  line-height: 1.8;
  }
.reference-tally { padding: .5rem; max-width: none; }
.tally-scroller { max-width: 100%; overflow-x: auto; }
.tally-scroller:focus-visible { outline-offset: 1px; }
/* The table keeps its natural width so no heading wraps inside a word. */
.tally-table {
  width: max-content;
  border-collapse: collapse;
  text-align: center;
  font-size: .95rem;
  }
.tally-table caption {
  caption-side: top;
  padding-block-end: .4rem;
  text-align: left;
  font-weight: 700;
  }
.tally-table th, .tally-table td {
  padding: .35rem .5rem;
  border: 1px solid var(--line);
  }
.tally-table thead th { background: var(--soft); white-space: nowrap; }
.tally-table tbody th { text-align: left; white-space: nowrap; background: var(--soft); }
.tally-yes { color: var(--accent); font-weight: 700; font-size: 1.05em; }
.tally-no { color: var(--warning); font-weight: 700; font-size: 1.05em; }
.tally-key { margin: .4rem 0 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 420px) {
  .tally-table { font-size: .85rem; }
  .tally-table th, .tally-table td { padding: .25rem .25rem; }
  }
/* On narrow screens the source names stand upright in vertical text, so the
   table fits the card without breaking a name. */
@media (max-width: 480px) {
  .tally-table thead th:not(:first-child) { writing-mode: vertical-rl; vertical-align: bottom; padding: .4rem .15rem; }
  .tally-table { width: auto; }
  .tally-table th, .tally-table td { padding-inline: .2rem; }
  .tally-table td { min-width: 1.5em; }
  .reference-tally { padding-inline: .25rem; }
  /* English knot names may wrap between their words. */
  html[lang="en"] .tally-table tbody th { white-space: normal; }
  }
.ref-combinations { padding: .5rem; max-width: 100%; display: none; overflow-x: auto; min-width: 0; }
.ref-combinations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-block-start: .5rem;
  text-align: center;
  }
.ref-combinations-table td, .ref-combinations-table th { white-space: normal; word-break: keep-all; }
.ref-combinations-table th, .ref-combinations-table td {
  padding: .25rem .2rem;
  border: 1px solid var(--line);
  }
.ref-combinations-table thead th, .ref-combinations-table tbody th { background: var(--soft); }
.ref-combinations-table .ref-combination-a td:last-child { color: var(--accent); font-weight: 700; }
.ref-combinations-table .ref-combination-b td:last-child { color: var(--muted); }
.ref-combinations-key { margin: .5rem 0 0; padding-inline-start: 1.1em; font-size: .8rem; line-height: 1.6; }
@media (max-width: 599px) {
  .ref-combinations { display: block; }
  }
.card-jump { margin-block: .75rem 0; display: flex; justify-content: flex-start; }
.card-jump-button {
  min-height: 44px;
  padding: .5rem 1rem;
  border-radius: .5rem;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--panel);
  font-weight: 700;
  cursor: pointer;
  }
/* Keep the filled look on hover and focus; the plain button:hover rule would
   otherwise paint a pale background under the white label. */
.card-jump-button:hover, .card-jump-button:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--panel);
  filter: brightness(1.1);
  }
.ref-rope, .ref-core {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  }
.ref-rope { stroke: var(--rope-outline); stroke-width: 10; }
.ref-core { stroke: var(--ref-rope); stroke-width: 6; }
.ref-highlight { stroke: var(--rope-working); }
/* Cards 6 and 13: rope A is blue and rope B orange; their letters match. */
.ref-rope-a { stroke: var(--rope-standing); }
.ref-rope-b { stroke: var(--rope-working); }
.ref-label.ref-letter-a { fill: var(--accent); font-weight: 700; }
.ref-label.ref-letter-b { fill: var(--focus); font-weight: 700; }
.ref-rope-stripe { fill: none; stroke: var(--ref-stripe); stroke-width: 2; }
/* Cards 32 and 36: knots as beads and wound blocks in the working end's
   orange, with the rope's outline; card 32's rows as thin dotted lines. */
.ref-bead { fill: var(--rope-working); stroke: var(--rope-outline); stroke-width: 1.5; }
.ref-guide { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
/* Card 35: square ends, so each gap at a crossing keeps its full length. */
.ref-closed .ref-rope, .ref-closed .ref-core { stroke-linecap: butt; }
/* Card 35: each braid strand keeps its color from its top end, round its arc,
   back to the next top end; a small number beside each top end names it. */
.ref-strand-1 { stroke: var(--rope-standing); }
.ref-strand-2 { stroke: var(--rope-working); }
.ref-strand-3 { stroke: var(--ref-strand-3); }
.ref-label.ref-strand-number { font-size: 14px; font-weight: 700; }
#panel-reference .rope-stripe { stroke: var(--ref-stripe); }
.ref-gap { fill: none; stroke: var(--panel); stroke-width: 20; stroke-linecap: butt; }
/* Leader lines use a neutral gray distinct from the rope's ink color so the
   two never blend together. Light theme: medium gray; dark theme: light gray. */
/* Photos share one frame size; the whole photo shows inside it (no cropping). */
.reference-photo { max-width: 420px; }
.reference-photo-image {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 6px; background: var(--figure-bg);
}
.reference-photo-image { object-fit: contain; }
.reference-photo figcaption { margin-block-start: .4rem; }
.reference-photo-label { display: block; font-weight: 700; }
.reference-photo-detail { display: block; line-height: 1.8; }
.reference-photo-credit { margin: .1rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.credit-part { white-space: nowrap; }
.reference-photo-credit a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; white-space: nowrap; }
.reference-checks { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; font-weight: 700; line-height: 1.9; }
.ref-leader { fill: none; stroke: #6b7580; stroke-width: 1.8; }
:root[data-theme="dark"] .ref-leader { stroke: #c7cfd6; }
.ref-label { fill: var(--ink); font-size: 18px; }
.ref-dot { fill: var(--ref-dot); }
.ref-dot-deep { fill: var(--ref-dot-deep); }
.ref-dot-halo { fill: var(--ref-halo); }
.ref-arrowhead { fill: var(--ink); stroke: var(--panel); stroke-width: 2; paint-order: stroke fill; }
.ref-shape { fill: none; stroke: var(--ink); stroke-width: 3; }
.ref-dashed { fill: none; stroke: var(--ref-rope); stroke-width: 6; stroke-dasharray: 6 6; }
.ref-stripe { fill: none; stroke: var(--ink); stroke-width: 2; }
.ref-block, .ref-sail { fill: var(--soft); stroke: var(--ink); stroke-width: 2; }
.ref-paper { fill: none; stroke: var(--ink); stroke-width: 4; }
/* Card 27: metal in a mid gray with an ink edge in both themes, and a red stamp. */
.ref-metal-edge, .ref-metal { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ref-metal-edge { stroke: var(--ink); }
.ref-metal { stroke: var(--post-fill); }
.ref-metal-link, .ref-metal-case { fill: var(--post-fill); stroke: var(--ink); stroke-width: 2; }
.ref-stamp { fill: var(--figure-warning); stroke: var(--ink); stroke-width: 1; }
.ref-callout { fill: none; stroke: var(--focus); stroke-width: 2; stroke-dasharray: 4 4; }
.ref-bowline .ref-rope, .ref-bowline .ref-core { stroke-linecap: butt; }
.ref-letter { font-weight: 700; }
.reference-part-key { margin: .75rem 0 0; }
.reference-part-key > div { display: flex; gap: .5rem; margin-block: .4rem; }
.reference-part-key dt { font-weight: 700; color: var(--accent); }
.reference-part-key dd { margin: 0; line-height: 1.7; }
.card-sources h5 {
  font-size: 1rem;
  margin-block: 0 .5rem;
  }
/* A book without a link is cited on its own line, like the links. */
.card-sources .card-source-citation { display: block; padding-block: .5rem; }
.card-sources a {
  display: block;
  min-height: 44px;
  padding-block: .5rem;
  color: var(--accent);
  }
html:has(#help-dialog[open]) {
  overflow: hidden;
  }
#help-dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .75rem;
  width: min(42rem, calc(100% - 2rem));
  max-height: 85dvh;
  padding: 1.25rem;
  overflow: hidden;
  }
#help-dialog[open] {
  display: flex;
  flex-direction: column;
  }
#help-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 45%, transparent);
  }
#help-dialog h2 {
  margin-block: 0 1rem;
  flex-shrink: 0;
  }
.help-prose {
  margin-block-end: 1rem;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  }
.help-close {
  align-self: flex-start;
  flex-shrink: 0;
  }
@media (width < 900px) {
  .freehand-frame {
  max-width: min(800px, calc(55dvh * 4 / 3));
  }
}@media (width < 360px) {
  .genre-content {
  padding-inline: .5rem;
  }
  .card-summary, .card-body {
  padding-inline: .6rem;
  }
}

/* Keep annotation lines and letters distinct from the rope. */
.figure-note .label-line, .crossing-mark .label-line {
  stroke-dasharray: 2 2;
}
.figure-label {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* Keep each term, its location and its definition together. */
.reference-term-list { display: grid; gap: 1rem; margin-block: 1rem; }
.reference-term-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .75rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
}
.reference-term-figure {
  width: 100%;
  max-width: 260px;
  min-width: 0;
  margin: 0 auto;
  background: var(--figure-bg);
  border-radius: .4rem;
}
.reference-term-figure svg { display: block; width: 100%; height: auto; }
.reference-term-context { opacity: .35; }
.reference-term-highlight { opacity: 1; }
.reference-term-text { min-width: 0; margin: 0; align-self: center; }
.reference-term-text dt { font-weight: 700; }
.reference-term-text dd { margin: .5rem 0 0; }
.reference-term-english { display: block; font-size: 1rem; font-weight: 400; }
.reference-term-english[hidden] { display: none; }
@media (min-width: 600px) {
  .reference-term-row { grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 1.25rem; }
}
/* On wider screens the term cards tile two or three per row so the right-hand
   space stops sitting empty; each tile stacks figure on top with the words
   below, and every tile shares the figure width. */
@media (min-width: 900px) {
  .reference-term-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: stretch; }
  .reference-term-row { grid-template-columns: minmax(0, 1fr); gap: .75rem; align-content: start; }
  .reference-term-figure { max-width: none; }
  .reference-term-text { align-self: start; }
}
/* The frame header keeps help and drag guidance clear of rope labels. */
.stage-shell { border: 1px solid var(--line); border-radius: 12px; }
.stage-shell .knot-stage { border: 0; border-radius: 0 0 12px 12px; }
.stage-guidance { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; padding: 0 10px; }
.diagram-help { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.stage-guidance .rotate-hint { position: static; font-size: 12px; padding-block: 4px; }
.help-toc ul, .help-capabilities, .help-links { list-style: none; padding: 0; margin-block: .5rem 1.25rem; }
.help-toc a, .help-links a { display: block; min-height: 44px; padding-block: .5rem; }
.help-toc a { padding-inline: .5rem; border-radius: .35rem; }
.help-toc a:hover { background: var(--soft); }
.help-section { border-top: 1px solid var(--line); padding-block: 1rem; }
.help-section h3 { margin-block: 0 .75rem; }
.help-section h4 { margin-block: 1rem .5rem; }
.help-section .panel-prose { margin-block: .5rem; }
.help-capabilities li, .help-links li { margin-block: .75rem; }
.help-capabilities li { border-left: 3px solid var(--line); padding-left: .75rem; }
.help-open-tab { margin-block: .35rem; }
.help-top h3 { margin-block: 1rem .25rem; }
.help-unique { padding-inline-start: 1.25em; margin-block: .25rem 1rem; }
.help-unique li { margin-block: .4rem; }
.help-unique .panel-prose { margin-block: 0; }
.help-prose { scrollbar-gutter: stable; padding-inline: 2px 10px; }
.help-section h3:focus, #help-heading:focus { outline-offset: 2px; }
@media (min-width: 600px) {
  .help-toc ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem .75rem; }
}
