/* v4.19.1 the 链路 layout controls (src/UI/chain-layout.js). While a 链路 world is open in the display mode the section carries data-chain-layout and is a
   grid of 12 columns (human 2026-11-16: "中转城数 and 单向日程 should both in the second line, each width half full line, no more 每路商队, 禁止铸币, 转职跨城
   each 1/3, and the last 1/3 is 预演初态."; "let 预演 to be 1/6, and make 撤销 1/6 left to it"; "预演, not 预演初态."): #scenario-version and #scenario-choice's 链路 row give their items to it (display: contents), so
     row 1  the four tabs
     row 2  [禁止铸币] [转职 | 跨城] [撤销] [预演]         a third, a third (4 columns each), a sixth, a sixth (2 each)
     row 3  [中转城数 ▢] [单向日程 ▢] [行商密度 ▢%]          a third each (#chain-layout-inputs; human 2026-11-16: "中转城数 and 单向日程 should be
            input instead of buttons to select, each 1/3 width. also, add 行商密度"): the count row's -1 0 1 2 5 and the days' 1 2 5 10 20 buttons are
            not shown in this layout (they stay in the DOM, the notes read them, and other tabs and the developer mode keep them)
     row 4  the strip, its index, its slider (a long chain only) and the status
     then the note. Other tabs and the developer mode keep the rows of styles.css. wiki/07-工程索引/chain-layout.md */
.overview-scenarios[data-chain-layout] { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 6px; }
.overview-scenarios[data-chain-layout] > * { grid-column: 1 / -1; }
.overview-scenarios[data-chain-layout] > :is(#scenario-version, #scenario-choice):not([hidden]),
.overview-scenarios[data-chain-layout] .scenario-choice-family[data-family="chain"]:not([hidden]) { display: contents; }
.overview-scenarios[data-chain-layout] > .display-scenario-tabs { grid-row: 1; }
.overview-scenarios[data-chain-layout] #scenario-version > [data-version-toggle="mint"] { grid-row: 2; grid-column: 1 / span 4; }
.overview-scenarios[data-chain-layout] #scenario-version > .scenario-version-pair { grid-row: 2; grid-column: 5 / span 4; }
.overview-scenarios[data-chain-layout] #scenario-version > #chain-layout-undo { grid-row: 2; grid-column: 9 / span 2; }
.overview-scenarios[data-chain-layout] #scenario-version > #chain-layout-rehearse { grid-row: 2; grid-column: 11 / span 2; }
.overview-scenarios[data-chain-layout] .scenario-choice-family[data-family="chain"] > *,
.overview-scenarios[data-chain-layout] #scenario-version > :is(.scenario-version-label, #scenario-route-days) { display: none; }
.overview-scenarios[data-chain-layout] > #chain-layout-inputs { grid-row: 3; }
.overview-scenarios[data-chain-layout] > #chain-layout-panel { grid-row: 4; }
.overview-scenarios[data-chain-layout] > #display-scenario-note { grid-row: 5; }
.overview-scenarios[data-chain-layout] > #scenario-intro { grid-row: 6; }
.overview-scenarios[data-chain-layout] > #scenario-change { grid-row: 7; }
/* row 3's thirds: a label, then the input filling the rest (行商密度 a % after it) */
.chain-layout-inputs[hidden] { display: none; }
.chain-layout-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 6px; }
.chain-layout-field { display: flex; align-items: center; gap: 4px; min-width: 0; }
.chain-layout-field-label { white-space: nowrap; flex: none; }
.chain-layout-field-unit { flex: none; color: #4f5753; }
.overview-scenarios .chain-layout-input { flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box; padding: 2px 4px; font: inherit; text-align: center;
  border: 1px solid #b8c4be; border-radius: 4px; background: #fff; color: #244943; font-variant-numeric: tabular-nums; }
.overview-scenarios .chain-layout-input:focus { outline: 2px solid #3f9b62; outline-offset: -1px; }
.overview-scenarios .chain-layout-input[aria-disabled="true"] { background: #f4f4f1; color: #9aa39f; cursor: default; }
.chain-layout-field[aria-disabled="true"] .chain-layout-field-label { color: #9aa39f; }
#scenario-version > :is(#chain-layout-undo, #chain-layout-rehearse)[hidden] { display: none; }
#scenario-version > :is(#chain-layout-undo, #chain-layout-rehearse) { padding: 0 2px; }

/* the strip (human 2026-11-16: "number should in the centre of squres"; revised: "font size 80 square instead of 90. Each line 20 instead of 33, add a
   slider to drag the showing part, no need to break line."): the line's width shows 20 columns (--strip-columns, chain-layout.js CHAIN_STRIP_COLUMNS), a
   cell a column, never wrapped. The track holds max(cells, 20) columns (--strip-cells) and slides --strip-offset columns west inside a clipping window; the
   range slider under it sets the offset and is hidden while everything fits (a shorter chain leaves the rest of the line empty). A cell is two squares
   stacked, each glyph centred in its square at 80% of the square's side (the font size; the frame is the size container). Shared borders: each cell draws
   its top, right and bottom lines, the first its left one. The day-position index under it on the same columns, sliding with it. */
.chain-layout-panel[hidden] { display: none; }
.chain-layout-panel { display: grid; gap: 4px; }
.chain-strip-frame { --strip-columns: 20; --strip-cells: 20; --strip-offset: 0; --pitch: calc(100cqw / var(--strip-columns));
  container-type: inline-size; display: grid; gap: 2px; width: 100%; }
.chain-strip-frame[hidden] { display: none; }
.chain-strip-window { overflow: hidden; width: 100%; }
.chain-strip-track { display: grid; gap: 1px; width: calc(var(--pitch) * var(--strip-cells)); transform: translateX(calc(var(--pitch) * var(--strip-offset) * -1)); transition: transform 0.08s linear; }
.chain-strip, .chain-strip-index { display: grid; grid-template-columns: repeat(var(--strip-cells), minmax(0, 1fr)); }
.chain-strip-slider { width: 100%; margin: 0; accent-color: #3f9b62; cursor: ew-resize; }
.chain-strip-slider[hidden] { display: none; }
.chain-strip { user-select: none; }
.chain-strip-cell {
  --square: var(--pitch);
  display: grid;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 1 / 2;
  /* (a whole number of pixels per square, so every square starts on a pixel row and the glyphs' baselines, which text drawing puts on whole pixels,
     land where the centring puts them; at most half a pixel off square; aspect-ratio above where round() is not known) */
  height: calc(2 * round(var(--pitch), 1px));
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #8fa39b;
  border-left: 0;
}
.chain-strip-cell:first-child { border-left: 1px solid #8fa39b; }
.chain-strip-city { background: #e6ece8; color: #244943; cursor: default; }
.chain-strip-city[data-relay] { background: #eeeeee; color: #4f5753; cursor: context-menu; }
.overview-scenarios .chain-strip-square {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
/* (the glyph centred both ways in its square: absolutely placed at the square's centre, a line box exactly its font size; once chain-layout.js
   centreGlyphs has measured it (data-centred), laid out at the square's top, a whole pixel, and moved down by --glyph-y, a transform drawn at fractions
   of a pixel, so its ink, not its line box, is centred in the reader's own font; human 2026-11-16: "the number in the square is a little bit too
   close to the upper edge of the square.") */
.overview-scenarios .chain-strip-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: calc(var(--square) * 0.8);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.overview-scenarios .chain-strip-glyph[data-centred] { top: 0; transform: translate(-50%, var(--glyph-y, 0px)); }
.overview-scenarios .chain-strip-upper { border-bottom: 1px solid #d4dcd7; }
.overview-scenarios .chain-strip-city .chain-strip-upper { border-bottom-color: transparent; }
.overview-scenarios .chain-strip-half { background: #fff; color: #6c7672; cursor: pointer; }
.overview-scenarios .chain-strip-half:hover:not([aria-disabled="true"]) { background: #e7f3ea; }
.overview-scenarios .chain-strip-half[aria-pressed="true"] { background: #3f9b62; color: #fff; }
.overview-scenarios .chain-strip-half[aria-disabled="true"] { background: #f4f4f1; color: #9aa39f; cursor: default; }
.overview-scenarios .chain-strip-half[aria-disabled="true"][aria-pressed="true"] { background: #9cc7ab; color: #fff; }
.overview-scenarios .chain-strip-at { color: #8b9691; font-size: calc(var(--pitch) * 0.6); line-height: 1.2; text-align: center; overflow: visible; white-space: nowrap; }
.overview-scenarios .chain-strip-at-city { color: #244943; font-weight: 600; }
.chain-layout-status { margin: 0; color: #3f4c48; font-size: 0.86em; }
.chain-layout-status[hidden] { display: none; }
