@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/newsreader-latin-standard-normal.woff2) format("woff2-variations");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-display: swap;
  font-weight: 200 800;
  src: url(fonts/newsreader-latin-standard-italic.woff2) format("woff2-variations");
}

:root {
  --paper: #f6f3ec;
  --card: #fbfaf6;
  --ink: #1f1d1a;
  --muted: #6d675d;
  --faint: #857f73;
  --rule: #dcd6c9;
  --track: #d3ccbe;
  --accent: #2f4a5c;
  --good: #4f7a5e;
  --mixed: #9a7630;
  --bad: #a54a3b;
  --serif: "Newsreader", "Iowan Old Style", Charter, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151514;
    --card: #1c1c1a;
    --ink: #ebe6dc;
    --muted: #a19a8d;
    --faint: #6f6a61;
    --rule: #34322e;
    --track: #2c2a27;
    --accent: #9fb8c8;
    --good: #7fae8d;
    --mixed: #d4b067;
    --bad: #d07a68;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  padding: 0 16px env(safe-area-inset-bottom);
}

button, input { font: inherit; color: inherit; }

h1, h2, h3, p { margin: 0; }

.valence-good { --v-color: var(--good); }
.valence-mixed { --v-color: var(--mixed); }
.valence-bad { --v-color: var(--bad); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--v-color, var(--faint));
  flex: none;
}

.label, .eyebrow, .section-head h2, .timeframe {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.text-btn {
  font-family: var(--sans);
  font-size: 13px;
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The chart, the header line and the tools use the width of the window, up
   to 2400 px. The long texts below the chart keep a reading column. */
.page {
  max-width: 2400px;
  margin: 0 auto;
}

/* ---------- masthead ---------- */

.masthead { padding: 14px 0 8px; }

.masthead h1 {
  font-size: 24px;
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.subtitle {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.3;
  font-style: italic;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- outlook ---------- */

.outlook {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.outlook-bar {
  display: flex;
  flex: 1 0 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  gap: 2px;
}

.outlook-bar .seg {
  flex-basis: 0;
  background: var(--v-color);
  transition: flex-grow 0.25s ease;
}

.outlook-legend {
  display: flex;
  gap: 16px;
  margin: 0;
  font-family: var(--sans);
  font-size: 13px;
}

.outlook-legend div { display: flex; align-items: baseline; gap: 6px; }
.outlook-legend dt { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.outlook-legend dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.outlook .text-btn { margin-left: auto; padding: 0; }
.export { position: relative; font-family: var(--sans); font-size: 13px; }
.export summary { list-style: none; cursor: pointer; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.export summary::-webkit-details-marker { display: none; }
.export-menu {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 6px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); white-space: nowrap;
}
.outlook .export-menu .text-btn { margin-left: 0; padding: 4px 0; }
.tree.exporting * { transition: none !important; }
.key { flex: 1 0 100%; font-family: var(--sans); font-size: 12px; line-height: 1.35; color: var(--muted); }
.key-ring {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 3px 0 1px;
  border-radius: 50%;
  border: 1.3px dashed var(--ink);
  background: radial-gradient(circle, var(--ink) 0 2.5px, transparent 3px);
  vertical-align: -1px;
}

/* ---------- the tree ---------- */

.diagram { padding-top: 10px; }

.tree {
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tree-svg { position: absolute; left: 0; top: 0; overflow: visible; }

.band { stroke: var(--paper); stroke-width: 0.6; transition: opacity 0.2s ease; }
.band.good { fill: var(--good); }
.band.mixed { fill: var(--mixed); }
.band.bad { fill: var(--bad); }
.ribbons { pointer-events: none; }
.rib { transition: opacity 0.2s ease; }
.rib.dim { opacity: 0.38; }

.hit { fill: none; stroke: transparent; cursor: pointer; pointer-events: stroke; }

.mark { cursor: pointer; transition: opacity 0.2s ease; }
.mark .dot-c { fill: var(--paper); stroke: var(--ink); stroke-width: 1.3; }
.mark .no { font-family: var(--sans); font-size: 10.5px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.mark .ring { fill: none; stroke: none; }
.mark.pivotal .dot-c { fill: var(--ink); }
.mark.pivotal .no { fill: var(--paper); }
.mark.pivotal .ring { stroke: var(--ink); stroke-width: 1.3; stroke-dasharray: 2.2 2.2; fill: color-mix(in srgb, var(--paper) 55%, transparent); }
.mark.dim { opacity: 0.75; }

.cond {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 650;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  paint-order: stroke;
  dominant-baseline: central;
  pointer-events: bounding-box;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.2s ease;
}
.cond.dim { opacity: 0.55; }

.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > * { position: absolute; left: 0; top: 0; pointer-events: auto; }

.end-label {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 5px;
  padding: 3px 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.end-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--v-color);
  transform: translateY(-1px);
}
.end-name { font-size: 13px; line-height: 1.15; font-weight: 520; }
.end-p { font-family: var(--sans); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.end-label.dim { opacity: 0.5; }
.end-top { display: none; grid-column: 2 / 4; font-family: var(--sans); font-size: 9.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.end-label.top .end-top { display: block; }
.end-label.lit .end-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.fork-tag, .root-title { display: none; }

.pivot-note {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
}
.pivot-note li + li { margin-top: 4px; }
.pivot-note a { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.pivot-note a:hover span:last-child { text-decoration: underline; }
.pivot-note .fork-no { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.split-key { list-style: none; margin: 8px 0 0; padding: 0; }
.split-key a { display: flex; align-items: flex-start; gap: 10px; padding: 5px 0; color: var(--ink); text-decoration: none; }
.split-key .fork-no { margin-top: 1px; }
.split-key .pivotal .fork-no { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.split-key .key-text { display: flex; flex-direction: column; min-width: 0; }
.split-key .key-q { font-size: 16px; line-height: 1.3; }
.split-key .key-piv { font-family: var(--sans); font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.split-key a:hover .key-q { text-decoration: underline; text-underline-offset: 3px; }
.tree.wide ~ .split-key { display: none; }
.tree:not(.wide) ~ .pivot-note { display: none; }

.hint { margin-top: 8px; font-family: var(--sans); font-size: 12.5px; color: var(--muted); }

.fork-no {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.3px solid var(--ink);
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Wide: titles and questions on the tree. */
.tree.wide .fork-tag, .tree.wide .root-title { display: block; }
.tree.wide .end-name { font-size: 15.5px; }
.tree.wide .end-p { font-size: 13px; }
.tree.wide .cond { font-size: 11px; }
.tree.wide .end-label { gap: 8px; grid-template-columns: 8px minmax(0, max-content) auto; justify-content: start; }

.fork-tag {
  box-sizing: border-box;
  width: max-content;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 5px;
  padding: 2px 6px 3px;
  background: var(--paper);
  text-align: right;
  font-style: italic;
  font-size: 13px;
  line-height: 1.2;
  color: var(--ink);
  hyphens: manual;
  overflow-wrap: normal;
  word-break: normal;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.fork-tag.pivotal { border-color: var(--ink); }
.fork-tag.dim { opacity: 0.6; }

.root-title {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.2;
  font-weight: 560;
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 0 0 3px var(--paper);
}

/* ---------- below the tree ---------- */

.below { display: grid; gap: 8px; margin-top: 28px; max-width: 1240px; }

.section-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 20px 0 10px;
  border-bottom: 1px solid var(--ink);
}

.fork-list { list-style: none; margin: 0; padding: 0; }
.fork-item { border-bottom: 1px solid var(--rule); }
.fork-item > details > summary {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
}
.fork-item > details > summary::-webkit-details-marker { display: none; }
.fork-item .fork-no { margin-top: 2px; }
.fork-item.pivotal .fork-no { background: var(--ink); color: var(--paper); }
.fork-sum { display: grid; gap: 1px; }
.fork-after { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.fork-q { font-style: italic; color: var(--accent); font-size: 17px; line-height: 1.3; }
.pivot-line { font-family: var(--sans); font-size: 12.5px; font-weight: 650; }
.pivot-line:empty { display: none; }
.fork-item > details[open] > summary .fork-q { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.fork-item .fork-controls { padding: 0 0 14px 34px; }

.branch { padding: 12px 0; }
.branch + .branch { border-top: 1px dotted var(--rule); }
.branch .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.branch .title { font-size: 18px; font-weight: 560; line-height: 1.2; margin: 0; }
.branch.current .title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.nums { display: flex; align-items: baseline; gap: 8px; flex: none; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.pct { font-size: 16px; font-weight: 650; }
.base { font-size: 12px; color: var(--muted); }
.changed .pct { color: var(--accent); }
.summary { margin-top: 4px; font-size: 16px; opacity: 0.88; text-wrap: pretty; }
.fork-foot { padding-top: 4px; }

.more { margin-top: 8px; font-size: 15.5px; }
.more summary { font-family: var(--sans); font-size: 13px; color: var(--accent); cursor: pointer; }
.more > * + * { margin-top: 8px; }
.more .label { margin-top: 14px; }
.signposts { margin: 6px 0 0; padding-left: 18px; }
.signposts li + li { margin-top: 4px; }
.p-note { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.why { margin: 6px 0 8px; }
.why .p-note { margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--ink); opacity: 0.85; text-wrap: pretty; }
.fork-note { font-size: 15px; line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.fork-note[hidden] { display: none; }
.fork-sum .fork-note { display: block; margin: 2px 0 3px; font-size: 14.5px; opacity: 0.85; }
.panel-head .fork-note { margin-top: 4px; }

.abs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
}
.abs-label { flex: 1; }
.abs-val { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- panel ---------- */

.panel {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-top: 1px solid var(--rule);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 30px rgb(0 0 0 / 0.14);
  padding-bottom: env(safe-area-inset-bottom);
}
.panel[hidden] { display: none; }

.panel-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--rule);
}
.panel-head .fork-no { margin-top: 3px; }
.panel-titles { flex: 1; min-width: 0; }
.panel-after { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.panel-head h2 { font-size: 18px; line-height: 1.25; font-weight: 500; font-style: italic; color: var(--accent); }
.panel-head h2:focus { outline: none; }
.panel-head .pivot-line { margin-top: 2px; }

.close {
  flex: none;
  width: 36px;
  height: 36px;
  margin: -4px -8px 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  position: relative;
}
.close::before, .close::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 17px;
  width: 14px;
  height: 1.5px;
  background: var(--ink);
  transform: rotate(45deg);
}
.close::after { transform: rotate(-45deg); }
.close:hover { background: var(--track); }

.panel-body { overflow-y: auto; padding: 0 18px 18px; overscroll-behavior: contain; }

/* ---------- ranked ---------- */

.ranked ol { list-style: none; margin: 0; padding: 0; }

.rank a {
  display: block;
  padding: 10px 0 12px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.rank-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rank-title { font-size: 17px; font-weight: 520; }
.rank-val { font-family: var(--sans); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-path { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); margin-top: 1px; }

.bar {
  display: block;
  height: 5px;
  margin-top: 7px;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}

.bar .fill {
  display: block;
  height: 100%;
  background: var(--v-color);
  transition: width 0.25s ease;
}

.rank a:hover .rank-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- about ---------- */

.about { max-width: 720px; padding-bottom: 56px; }
.about p { margin-top: 12px; text-wrap: pretty; }
.about p + p { font-family: var(--sans); font-size: 13.5px; color: var(--muted); }

.noscript { text-align: center; padding: 40px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- wide ---------- */

@media (min-width: 760px) {
  body { padding: 0 32px; }
  .masthead { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; padding-top: 22px; }
  .masthead h1 { font-size: 34px; }
  .subtitle { font-size: 17px; margin-top: 0; }
  .outlook { gap: 4px 20px; }
  .outlook-bar { flex: 1 1 auto; max-width: 560px; }
  .below { grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; align-items: start; }

  .panel {
    left: auto;
    top: 0;
    width: 400px;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: -8px 0 30px rgb(0 0 0 / 0.1);
  }
  body.panel-open .page { margin-right: 400px; padding-right: 24px; }
}

@media (max-width: 759px) {
  body.panel-open { padding-bottom: 55vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* ---------- editing ---------- */

.edit {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.range {
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  --v: 0%;
  --b: 0%;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ink) var(--v), var(--track) var(--v));
}

.changed .range::-webkit-slider-runnable-track {
  background:
    linear-gradient(to right, transparent calc(var(--b) - 1px), var(--muted) calc(var(--b) - 1px), var(--muted) calc(var(--b) + 1px), transparent calc(var(--b) + 1px)) 0 -3px / 100% 10px no-repeat,
    linear-gradient(to right, var(--accent) var(--v), var(--track) var(--v));
}

.range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
.range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.changed .range::-moz-range-progress { background: var(--accent); }

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--ink);
}

.range:disabled { cursor: default; opacity: 0.45; }

.number-wrap {
  display: flex;
  align-items: baseline;
  flex: none;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 16px;
}

.number {
  width: 3.4em;
  border: 0;
  background: transparent;
  padding: 3px 2px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.number::-webkit-inner-spin-button, .number::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.number-wrap:focus-within { border-bottom-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.number:disabled { opacity: 0.5; }
.unit { color: var(--muted); padding-right: 2px; }

.lock {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  position: relative;
  color: var(--faint);
}

/* A small padlock, drawn in CSS. */
.lock::before, .lock::after { content: ""; position: absolute; left: 50%; }
.lock::before {
  width: 8px;
  height: 7px;
  top: 8px;
  transform: translateX(-50%) translateX(3px);
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  transition: transform 0.15s ease;
}
.lock::after {
  width: 12px;
  height: 9px;
  top: 15px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: currentColor;
}
.lock[aria-pressed="true"] { color: var(--ink); background: var(--track); }
.lock[aria-pressed="true"]::before { transform: translateX(-50%); }



.answer {
  display: inline-block;
  margin-right: 7px;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: 2px;
  color: var(--paper);
  background: var(--ink);
}
.answer-no { background: var(--muted); }
.fork-yn { display: block; font-family: var(--sans); font-size: 12.5px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.nb { white-space: nowrap; }

/* Long texts that a visitor writes: cut on the tree, in full in the panel. */
.end-name, .tag-q, .tree.wide .root-title { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.end-name { -webkit-line-clamp: 3; }
.tag-q { -webkit-line-clamp: 4; }
.root-title { -webkit-line-clamp: 3; }

/* The visitor's own version. */
.mine {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  margin: 10px 0 0; padding: 8px 12px;
  border: 1.5px solid var(--mixed); border-radius: 6px;
  background: color-mix(in srgb, var(--mixed) 10%, var(--paper));
  font-family: var(--sans); font-size: 13.5px;
}
.mine[hidden] { display: none; }
.mine-text { margin: 0; flex: 1 1 320px; }
.mine .text-btn { padding: 0; }
.mine-changes { flex: 1 0 100%; font-size: 13px; }
.mine-changes summary { cursor: pointer; color: var(--accent); }
.mine-changes ol { margin: 6px 0 2px; padding-left: 22px; }
.mine-changes li + li { margin-top: 3px; }

/* The notice after a change of the default map, and the storage message. */
.kept, .warn {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  margin: 10px 0 0; padding: 6px 12px;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--card);
  font-family: var(--sans); font-size: 13.5px;
}
.kept[hidden], .warn[hidden], .earlier[hidden], .warn .text-btn[hidden] { display: none; }
.kept-text { margin: 0; flex: 1 1 auto; }
.kept .text-btn, .warn .text-btn, .earlier .text-btn { padding: 0; }
.kept .kept-hide { color: var(--muted); }
.warn { display: block; border-color: var(--bad); color: var(--bad); font-weight: 600; }
.earlier { margin-top: 8px; }
.earlier summary { cursor: pointer; color: var(--accent); }
.earlier ol { margin: 6px 0 2px; padding-left: 22px; }
.earlier li .text-btn { margin-right: 12px; }

/* The editor. */
.outlook .edit-toggle { margin-left: 0; padding: 0; font-weight: 600; }
body.editing .outlook .edit-toggle { color: var(--ink); }
.edit-tools {
  margin: 10px 0 0; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--card);
  font-family: var(--sans); font-size: 13.5px;
}
.edit-tools[hidden], .send-box[hidden], .edit-msg[hidden] { display: none; }
.edit-help { margin: 0 0 8px; color: var(--muted); }
.edit-row { display: flex; flex-wrap: wrap; gap: 8px; }
.s-btn {
  font: inherit; font-family: var(--sans); font-size: 13px;
  padding: 6px 10px; border-radius: 5px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  background: var(--paper); color: var(--ink); text-align: left;
}
.s-btn:hover { border-color: var(--ink); }
.s-btn:disabled { opacity: 0.45; cursor: default; }
.s-btn.danger { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.page-texts { margin-top: 8px; }
.page-texts summary, .struct.remove summary, .node-edit > summary { cursor: pointer; color: var(--accent); }
.edit-msg { margin: 8px 0 0; color: var(--bad); font-weight: 600; }
.send-box { margin-top: 10px; padding-top: 10px; border-top: 1px dotted var(--rule); }
.send-btn {
  font: inherit; font-weight: 650; padding: 8px 14px; border-radius: 6px; cursor: pointer;
  border: 0; background: var(--accent); color: var(--paper);
}
.send-btn:disabled { opacity: 0.6; }
.send-status { margin: 8px 0 0; font-weight: 600; }

.edit-block { margin: 10px 0 4px; padding: 10px 12px; border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 6px; font-family: var(--sans); font-size: 13.5px; }
.edit-head { margin: 0 0 6px; font-weight: 650; }
.f { display: block; margin: 8px 0 0; }
.f-label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.f-count { font-variant-numeric: tabular-nums; }
.f-count.over { color: var(--mixed); font-weight: 700; }
.f-in {
  box-sizing: border-box; width: 100%; font: inherit; font-size: 15px; line-height: 1.35;
  padding: 6px 8px; border-radius: 5px; border: 1px solid var(--track);
  background: var(--paper); color: var(--ink); resize: vertical;
}
.f-in:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.f-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.struct { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; }
.struct-label { flex: 1 0 100%; color: var(--muted); font-size: 12.5px; }
.struct.remove { display: block; }
.struct.remove .s-btn { display: block; width: 100%; margin-top: 6px; }
.valence-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.valence-pick .f-label { flex: 1 0 100%; }
.v-opt { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.v-opt .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--v-color); }
.v-opt.valence-good { --v-color: var(--good); }
.v-opt.valence-mixed { --v-color: var(--mixed); }
.v-opt.valence-bad { --v-color: var(--bad); }

/* Phone: the mark is one line and the tools one compact row,
   so that the top of the tree stays in the first screen. */
.narrow-only { display: none; }
@media (max-width: 759px) {
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .mine { gap: 4px 12px; margin-top: 8px; padding: 5px 10px; font-size: 13px; }
  .mine-text { flex: 0 1 auto; }
  .mine-changes { flex: 0 1 auto; order: 2; }
  .mine-changes[open] { flex-basis: 100%; }
  .mine #reset-all { order: 3; margin-left: auto; }
  .kept { gap: 4px 12px; margin-top: 8px; padding: 5px 10px; font-size: 13px; flex-wrap: nowrap; white-space: nowrap; }
  .kept .kept-hide { margin-left: auto; }
  .earlier { flex-basis: 100%; margin-top: 0; }
  .edit-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; }
  .edit-help { flex-basis: 100%; margin: 0; font-size: 12.5px; }
  .edit-row { gap: 6px; }
  .s-btn { padding: 5px 9px; }
  .page-texts { margin-top: 0; }
  .page-texts[open], .edit-msg, .send-status { flex-basis: 100%; }
  .edit-msg { margin: 0; }
  .send-box { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin-top: 0; padding-top: 8px; }
  .send-box .f { flex: 1 1 140px; margin: 0; }
  .send-box .f-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .send-box textarea { height: 36px; min-height: 36px; resize: vertical; padding-top: 7px; padding-bottom: 7px; }
  .send-box .send-btn { padding: 6px 12px; }
  .send-status { margin: 0; }
}

/* The add control on each branch in edit mode. */
.add-split {
  margin: 10px 0 4px; padding: 9px 11px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 6px;
  font-family: var(--sans); font-size: 13px;
}
.side-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); }
.side-q { flex-basis: 100%; }
.side-opt { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); cursor: pointer; }
.add-btn {
  display: block; margin-top: 8px; font: inherit; font-weight: 650; padding: 7px 12px;
  border: 0; border-radius: 6px; background: var(--accent); color: var(--paper); cursor: pointer;
}
@media (max-width: 759px) {
  body.editing .panel.branch-pick .panel-head .fork-note,
  body.editing .panel.branch-pick #panel-pivot { display: none; }
}
