/* The combination bar: one line for the rule and combination, the tiles below it. */
.combo-bar {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.combo-line {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.combo-code {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 5px 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: 700 1.2rem/1 var(--mono);
}
.combo-code button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.combo-rule {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border-radius: 4px;
}
.combo-rule:hover {
  background: var(--panel-2);
}
.combo-class {
  border-bottom: 3px solid var(--c);
  padding: 0 0.5px;
}
.combo-empty {
  color: var(--muted);
}
.combo-caret {
  font-size: 0.6em;
  color: var(--muted);
  margin-left: 2px;
}
.combo-dash {
  color: var(--muted);
  padding: 0 1px;
}
.combo-digit {
  border-bottom: 3px solid var(--t) !important;
  border-radius: 2px 2px 0 0 !important;
  padding: 0 0.5px !important;
}
.combo-digit:disabled {
  cursor: default !important;
}
.combo-digit.is-fixed {
  color: var(--muted);
  font-weight: 500;
}
.combo-digit.is-odd,
.combo-digit.is-cross {
  color: var(--warn);
}
.combo-digit.is-hl,
.combo-digit:not(:disabled):hover {
  background: var(--panel-2) !important;
}
.combo-count {
  font: 500 0.9rem var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 6ch;
  text-align: center;
}
.combo-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.combo-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
}
.combo-icon svg {
  width: 18px;
  height: 18px;
}
.combo-icon:disabled,
.combo-random:disabled {
  opacity: 0.4;
  cursor: default;
}
.combo-random {
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.combo-icon[data-tip]:hover::after,
.combo-icon[data-tip]:focus-visible::after,
.combo-icon.show-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--panel);
  font: 500 0.75rem system-ui, sans-serif;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.combo-status {
  min-height: 1.3em;
  margin: 0;
  padding: 0 2px;
  font-size: 0.82rem;
  color: var(--muted);
}
.combo-status.is-warn,
.combo-menu-n.is-warn,
.combo-tile-of.is-warn {
  color: var(--warn);
}

/* rule menu */
.combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 6px;
  z-index: 30;
  display: grid;
  gap: 2px;
  min-width: 240px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.combo-menu-head {
  padding: 4px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.combo-menu button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 6px 8px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.combo-menu button:hover,
.combo-menu button[aria-checked='true'] {
  background: var(--panel-2);
}
.combo-menu-rule {
  display: inline-flex;
  font: 700 1rem var(--mono);
}
.combo-menu-n {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* paste box */
.combo-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 15, 13, 0.45);
}
.combo-modal {
  display: grid;
  gap: 12px;
  width: min(520px, 100%);
  padding: 18px;
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
}
.combo-modal h3 {
  margin: 0;
  font-size: 1.05rem;
}
.combo-modal textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 84px;
  padding: 8px 10px;
  font: 0.9rem var(--mono);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  resize: vertical;
}
.combo-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* tiles */
.combo-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 6px;
}
.combo-tile {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 4px 5px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.combo-tile.is-hl {
  border-color: var(--text);
}
.combo-tile.is-odd {
  border-color: var(--warn);
}
.combo-tile-open {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.combo-tile-open:hover {
  background: var(--panel-2);
}
.combo-tile-open svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.combo-tile-body {
  stroke: #1d2430;
  stroke-opacity: 0.35;
  stroke-linejoin: round;
}
.combo-tile-casing {
  fill: none;
  stroke: #1d2430;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.combo-tile-chord {
  fill: none;
  stroke: #1d2430;
  stroke-linecap: round;
}
.combo-tile-badge {
  fill: var(--panel);
  stroke: var(--c);
}
.combo-tile-badge.is-on {
  fill: var(--c);
  stroke: #1d2430;
}
.combo-tile-num {
  font-family: var(--mono);
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  fill: var(--muted);
  pointer-events: none;
}
.combo-tile-num.is-on {
  fill: #1d2430;
}
.combo-tile-dot {
  fill: var(--c);
  stroke: #1d2430;
}
.combo-tile-dot.is-off {
  fill: var(--panel);
  stroke: var(--c);
}
.combo-tile-dot.is-odd {
  stroke: var(--danger);
}
.combo-tile-name {
  font-size: 0.8rem;
  font-weight: 700;
}
.combo-tile-slider {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2px;
  width: 100%;
}
.combo-tile-slider button {
  padding: 0 4px;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.combo-tile-slider button:disabled {
  opacity: 0.35;
  cursor: default;
}
.combo-tile-slider input {
  width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
}
.combo-tile-of {
  font: 500 0.72rem var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
/* One row that scrolls sideways, for a bar under a field or in a page's header. */
.combo-tiles.is-row {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: minmax(84px, 1fr);
  overflow-x: auto;
}
@media (max-width: 560px) {
  .combo-code {
    flex-basis: 100%;
    font-size: 1.05rem;
  }
  .combo-count {
    margin-right: auto;
  }
  .combo-tiles:not(.is-row) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* The edge rule's basis groups: flipping one keeps a rule tail-free. */
.rule-groups summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}
.rule-groups-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.8rem;
}
.rule-groups-chips button {
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 600 12px var(--mono);
  cursor: pointer;
}
.rule-groups-chips button.on {
  border-color: var(--text);
  background: var(--text);
  color: var(--panel);
}
/* Widget-layer styling (DESIGN.md §6). Deliberately token-driven so the page
   stages can restyle without touching component internals. */

:root {
  /* Palette, type and control styling shared with the sister site,
     aperiodic-circuits (bohemian-miser/aperiodic-circuits, src/styles.css):
     warm paper in light mode, slate in dark, teal accent. */
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-2: #efece5;
  --text: #1d2430;
  --muted: #7a8494;
  --line: #e2ddd2;
  --accent: #2f7d6d;
  --accent-ink: #ffffff;
  --warn: #b7791f;
  --ok: #2f7d4f;
  --danger: #d1343a;
  --canvas-bg: #fbfaf7;
  --radius: 8px;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --panel: #1a2029;
    --panel-2: #222a35;
    --text: #e6e9ee;
    --muted: #8892a3;
    --line: #2c3440;
    --accent: #58b39e;
    --accent-ink: #0d1512;
    --warn: #ffcc55;
    --ok: #6cd08f;
    --danger: #ff6b6b;
    --canvas-bg: #0f1318;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

a {
  color: var(--accent);
}

/* Base controls. Wrapped in :where() so they carry no specificity: any
   component's own class rule still wins over these defaults. */
:where(select, input, textarea, button) {
  font: inherit;
  color: var(--text);
}
:where(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  white-space: nowrap;
}
:where(button:hover:not(:disabled)) {
  border-color: var(--muted);
}
:where(button:disabled) {
  opacity: 0.5;
  cursor: default;
}
:where(button.primary) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
:where(input[type='range'], input[type='checkbox'], input[type='radio']) {
  accent-color: var(--accent);
}
:where(code, kbd, samp) {
  font-family: var(--mono);
}

/* --- PanZoom ------------------------------------------------------------ */

.panzoom {
  width: 100%;
  height: 100%;
  cursor: grab;
  background: var(--canvas-bg);
}
.panzoom.is-panning {
  cursor: grabbing;
}
.panzoom-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
}
.panzoom-controls button {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.panzoom-controls button:hover {
  border-color: var(--muted);
}

/* --- TileView ----------------------------------------------------------- */

.tile-view {
  display: block;
  overflow: visible;
  touch-action: none;
}
.tile-view.is-dimmed {
  opacity: 0.35;
}

.tile-view .edge-visual {
  opacity: 0;
  transition: opacity 120ms ease, stroke-width 120ms ease;
}
.tile-view .meta-edge.is-hovered .edge-visual,
.tile-view .meta-edge.is-highlighted .edge-visual {
  opacity: 1;
}
/* Plain :focus, not just :focus-visible: Chromium paints its default
   `outline: auto` focus ring on SVG elements scaled by the viewBox transform,
   so a pointer-down on a seam grew a giant two-tone disc over the tile.
   Keyboard users keep the dashed seam cue below. */
.tile-view .meta-edge:focus {
  outline: none;
}
.tile-view .meta-edge:focus-visible .edge-visual {
  opacity: 1;
  stroke-dasharray: 0.2 0.12;
}
.tile-view .edge-dot {
  transition: r 120ms ease;
}
.tile-view .meta-edge.is-hovered .edge-dot {
  /* px here means SVG user units (pre-transform), and CSS requires the unit —
     a bare number is an invalid length and the grow-on-hover never fired. */
  r: 0.21px;
}
.tile-view .landing-spot {
  animation: spectre-pulse 1.1s ease-in-out infinite;
}
.tile-view .landing-spot.is-snapped {
  animation: none;
  stroke-width: 0.08;
}
.tile-view .tile-shape.is-odd {
  animation: spectre-odd 1.6s ease-in-out infinite;
}

@keyframes spectre-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}
@keyframes spectre-odd {
  0%,
  100% {
    stroke: rgba(0, 0, 0, 0.55);
  }
  50% {
    stroke: #ff3b30;
  }
}

/* --- TilePalette -------------------------------------------------------- */

.tile-palette {
  display: grid;
  gap: 10px;
}
.tile-palette-cell {
  margin: 0;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tile-palette-label {
  font-size: 12px;
  color: var(--muted);
}

/* --- Tiling renderers --------------------------------------------------- */

.tiling-view,
.tiling-canvas {
  display: block;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
/* The bitmap lives OUT of flow: an in-flow (inline) canvas adds a baseline
   gap that re-triggers the host's ResizeObserver — a slow, unbounded
   grow-remeasure-redraw loop at the heavy levels. */
.tiling-canvas canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.tiling-view .tile-instance.is-odd {
  filter: drop-shadow(0 0 0.12px #ff3b30);
}

/* --- Seam view ---------------------------------------------------------- */

.seam-view {
  display: block;
  background: var(--panel);
  border-radius: var(--radius);
}
.seam-view.is-empty {
  padding: 12px;
  color: var(--muted);
}

/* --- Controls ----------------------------------------------------------- */

/* A fieldset is a sidebar section: no box, a hairline between sections and
   a small caps heading, as in aperiodic-circuits' sidebar. The legend floats
   so it sits inside the section like an ordinary heading. */
fieldset {
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  margin: 0;
}
fieldset:last-of-type {
  border-bottom: none;
}
legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
legend + * {
  clear: both;
}
fieldset fieldset {
  border: none;
  padding: 4px 0 0;
}
fieldset fieldset legend {
  margin: 4px 0 6px;
  font-size: 11px;
}
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
}
/* A checkbox row reads as one phrase — box then label — so it stays left.
   Only label/control rows want the two ends pushed apart. */
.control-row:has(> input[type='checkbox']:first-child) {
  justify-content: flex-start;
}
.control-row > span {
  font-size: 13px;
}
/* Keep a label and its ⓘ on one line rather than letting the icon wrap. */
.control-row > span:has(.info-tip) {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
select,
input[type='number'],
input[type='text'],
input[type='search'],
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  max-width: 100%;
}

.edge-legend-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.edge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
  cursor: pointer;
}
.edge-chip:hover {
  border-color: var(--muted);
}
.edge-chip.is-on {
  border-color: var(--text);
  background: var(--text);
  color: var(--panel);
}
.edge-chip.is-highlighted {
  outline: 2px solid var(--accent);
}
.edge-chip-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.5);
}

.warning-badge {
  color: var(--warn);
  font-size: 12px;
  margin: 6px 0 0;
}
.ok-badge {
  color: var(--ok);
  font-size: 12px;
  margin: 6px 0 0;
}

.matching-slider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.matching-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.matching-controls input[type='range'] {
  flex: 1;
  min-width: 40px;
}
.matching-controls button {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.matching-badge,
.matching-filter,
.matching-odd-note {
  font-size: 11px;
  color: var(--muted);
}
.matching-odd-note {
  text-align: center;
  margin: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.color-wells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 4px;
}
.color-well {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}

.stats-figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  margin: 0 0 8px;
}
.stats-figures div {
  background: var(--panel-2);
  border-radius: 6px;
  padding: 5px 7px;
}
.stats-figures dt {
  font-size: 11px;
  color: var(--muted);
}
.stats-figures dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.stats-summary h4 {
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.length-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.length-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}
.length-chip.is-active {
  outline: 2px solid var(--accent);
}
.length-chip-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.share-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.share-panel button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.share-url,
.share-combo {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--danger);
}

/* Seam-contract slider: track spans the whole seam, notches mark the vertices
   between physical edges. Inactive classes grey out; class 0 is pinned. */
.contract-slider {
  --csl-thumb-r: 8px;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1 1 140px;
  min-width: 120px;
}
.contract-slider input[type='range'] {
  width: 100%;
  position: relative;
  z-index: 1;
  background: transparent;
}
.contract-slider-track {
  position: absolute;
  left: var(--csl-thumb-r);
  right: var(--csl-thumb-r);
  top: 50%;
  height: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}
.contract-notch {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-1px);
  border-radius: 1px;
  background: currentColor;
  opacity: 0.55;
}
.contract-slider.is-inactive {
  opacity: 0.35;
  filter: grayscale(1);
}
.contract-slider.is-pinned input {
  cursor: not-allowed;
}
.contract-slider.is-pinned .contract-notch {
  opacity: 0.35;
}

/* --- InfoTip ------------------------------------------------------------ */
/* The ⓘ that holds what used to be a paragraph of sidebar prose. */

.info-tip {
  display: inline-block;
  flex: 0 0 auto;
  margin-left: 4px;
  vertical-align: middle;
}
/* The popover spans the ROW, not the icon: the sidebar is narrow enough that
   anything anchored to a 16px button ends up hanging off one edge of it. */
.control-row:has(.info-tip) {
  position: relative;
}
.info-tip > summary {
  list-style: none;
  cursor: help;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  user-select: none;
}
.info-tip > summary::-webkit-details-marker {
  display: none;
}
.info-tip > summary:hover,
.info-tip[open] > summary {
  color: var(--text);
  border-color: var(--accent);
}
.info-tip > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* Floated over the panel so opening one does not shove the controls down. */
.info-tip-body {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.info-tip-body p {
  margin: 0 0 6px;
}
.info-tip-body p:last-child {
  margin-bottom: 0;
}

/* Dual of the strand graph (Explorer analysis panel). */
.dual-stats {
  margin-top: 10px;
}
.dual-stats h4 {
  margin: 0 0 4px;
}
.dual-stats-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 6px 0;
}
.dual-stats-grid dt {
  color: var(--muted);
}
.dual-stats-grid dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.dual-depths {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dual-depth-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
.dual-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* A selected chip with its strand-count stepper attached on the right. */
.edge-chip-group {
  display: inline-flex;
  align-items: stretch;
}
.edge-chip-group > .edge-chip {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
.edge-chip-count {
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.edge-chip-steps {
  display: inline-flex;
  flex-direction: column;
  border: 1px solid var(--accent);
  border-left: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 0 999px 999px 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
}
.edge-chip-steps button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 8px;
  line-height: 1;
  padding: 0 7px 0 5px;
  cursor: pointer;
}
.edge-chip-steps button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}
.edge-chip-steps button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* The magnified tile you draw a pairing on (ported from aperiodic-circuits). */
.tile-editor-pop {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 24px));
  padding: 6px 10px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  z-index: 50;
}
/* Little arrows hugging the sheet's sides step to the neighbouring tiles. */
.tile-editor-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  padding: 18px 4px;
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.tile-editor-nav:hover {
  color: var(--text);
}
.tile-editor-nav.prev {
  left: 0;
}
.tile-editor-nav.next {
  right: 0;
}
.tile-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tile-editor-step {
  display: flex;
  align-items: center;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.tile-editor-step button {
  padding: 0 8px;
}
.tile-editor-close {
  margin-left: auto;
  padding: 0 9px;
  font-size: 18px;
  line-height: 26px;
}
.tile-editor-stage {
  display: block;
  user-select: none;
  -webkit-user-select: none;
  width: 280px;
  height: 260px;
  margin: 0 auto;
  touch-action: none;
}
.tile-editor-body {
  fill: var(--panel-2);
}
.tile-editor-edge:not(.is-on) {
  opacity: 0.45;
}
.tile-editor-edge text {
  font-weight: 700;
  pointer-events: none;
}
.tile-editor-chord {
  stroke: var(--text);
}
.tile-editor-dot {
  fill: var(--text);
}
.tile-editor-dot.is-odd {
  fill: var(--warn);
}
/* A seam whose class is off: pressing its point turns the class on. */
.tile-editor-dot.is-off {
  fill: var(--panel);
}
.tile-editor-hit {
  cursor: crosshair;
}
.tile-editor-hint {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Opens a tile's pairing in the editor. */
.matching-open {
  font-size: 12px;
  padding: 1px 8px;
}
.tile-editor-classes {
  border: none;
  padding: 0;
  margin: 2px 0 0;
}
.tile-editor-classes .edge-legend-chips {
  justify-content: center;
}
.tile-editor-gallery {
  text-align: center;
  font-size: 12px;
}
.tile-editor-gallery ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}
.tile-editor-gallery li button {
  width: 100%;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}
.tile-editor-gallery li button[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--text);
}
.tile-editor-gallery svg {
  display: block;
  width: 100%;
  height: 40px;
}
.tile-editor-gallery svg polygon {
  stroke: var(--muted);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}

/* TileGlyph (components/TileGlyph.tsx), used on several pages. */
.tile-glyph-body {
  fill: var(--panel);
  stroke: var(--muted);
}
.tile-glyph-chord {
  stroke: var(--text);
}
.tile-glyph-dot {
  fill: var(--text);
}
.tile-glyph-dot.is-odd {
  fill: var(--danger);
}

/* StrandRuleControls: the rule's combination string and the whole-rule stepper. */
.combo-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 12px;
}
.combo-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.combo-field input {
  font-family: var(--mono);
  font-size: 12px;
  width: 16em;
}
.combo-readout button {
  padding: 1px 9px;
}
.combo-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  font-size: 13px;
}
.combo-stepper button {
  padding: 1px 9px;
}
.combo-stepper-count {
  font-variant-numeric: tabular-nums;
  min-width: 11em;
  text-align: center;
}

