/*! PeoplePlotr story trees. Copyright © 2026 Webalon Ltd. All rights reserved.
 * Licensed for use on peopleplotr.com only. Copying, modifying, redistributing or hosting this code
 * elsewhere, in whole or in part, is not permitted without written permission from Webalon Ltd. */
/*
 * The family tree itself: colour tokens, the stage with its bar of views, tips and zoom,
 * the person info panel, and how each design dresses them. Shared by the editor
 * (index.html) and the shared or embedded tree (viewer.html).
 */
:root {
  --bg: #eef1e6;
  --bar: #ffffff;
  --page: #ffffff;          /* the story area under the tree: plain and neutral */
  --page-line: #e1e1de;
  --panel: #fffdf8;
  --ink: #2c2a24;
  --muted: #6c6a5c;
  --line: #d9dcc9;
  --accent: #4f7f3c;
  /* PeoplePlotr's own colours, the same whatever the tree's design */
  --brand: #7c4dff;
  --brand-a: #ff6b6b;
  --brand-b: #ffb703;
  --brand-c: #12b5a5;
  --brand-ink: #ffffff;
  --accent-ink: #ffffff;
  --branch: #86603f;
  --rel: #fbe6b2;
  --value: #d8ecd0;
  --place: #dfe4f7;
  --unknown: #c8443c;
  --warn-bg: #fbf0d6;
  --bad-bg: #f9e3df;
  --info-bg: #e6eef8;
  --good: #3f7f3a;
  --shadow: 0 1px 2px rgba(60, 60, 40, 0.08), 0 6px 20px rgba(60, 60, 40, 0.08);
  --name-l: 86%;
  --name-s: 70%;
  /* the tree's and the story's shares of the height below the bar (editor.js keeps them in step when the splitter moves) */
  --tree-grow: 60;
  --story-grow: 40;
  --font-head: Fredoka, "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: Nunito, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --editor-font: 18px/1.7 Nunito, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c2624;
    --bar: #1f2223;
    --page: #1f2223;
    --page-line: #3a3d3e;
    --panel: #24302d;
    --ink: #eef2e8;
    --muted: #a9b8ad;
    --line: #3a4a45;
    --accent: #8cc276;
    --brand: #b39dff;
    --brand-a: #ff8787;
    --brand-b: #ffc94d;
    --brand-c: #3fd6c5;
    --brand-ink: #1d1340;
    --accent-ink: #14201b;
    --branch: #c4a27a;
    --rel: #5b4a1e;
    --value: #2a4a2e;
    --place: #303a66;
    --unknown: #ff8a80;
    --warn-bg: #3d3420;
    --bad-bg: #432526;
    --info-bg: #23314d;
    --good: #8cd08c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --name-l: 32%;
    --name-s: 45%;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1c2624;
  --bar: #1f2223;
  --page: #1f2223;
  --page-line: #3a3d3e;
  --panel: #24302d;
  --ink: #eef2e8;
  --muted: #a9b8ad;
  --line: #3a4a45;
  --accent: #8cc276;
  --brand: #b39dff;
  --brand-a: #ff8787;
  --brand-b: #ffc94d;
  --brand-c: #3fd6c5;
  --brand-ink: #1d1340;
  --accent-ink: #14201b;
  --branch: #c4a27a;
  --rel: #5b4a1e;
  --value: #2a4a2e;
  --place: #303a66;
  --unknown: #ff8a80;
  --warn-bg: #3d3420;
  --bad-bg: #432526;
  --info-bg: #23314d;
  --good: #8cd08c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --name-l: 32%;
  --name-s: 45%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, .notes-scroll, .editor textarea { overscroll-behavior: none; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; text-wrap: balance; }
button { font: inherit; color: inherit; }

.zoom button, .views button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.zoom button:hover, .views button:hover { border-color: var(--accent); }

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

.stage {
  position: relative;
  /* Shares of the free height, not a percentage flex-basis: Safari 14 sized a percentage basis
     here from the content, so the stage grew with its canvas, never shrank, and ignored the splitter. */
  flex: var(--tree-grow) 1 0px;
  min-height: 160px;
  /* keeps the canvas's and bars' z-index inside the stage, so the person panel (z-index 5) is above all of it */
  isolation: isolate;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stage canvas { position: relative; z-index: 1; display: block; width: 100%; flex: 1 1 0px; min-height: 0; touch-action: none; }
.stage canvas:focus { outline: none; }
.stage canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* the strip under the tree: theme picker, tips and zoom, dressed to match the theme */
.tree-bar {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
}
/* on wide screens the info panel hangs over the right; the zoom slides left to stay in view */
@media (min-width: 721px) {
  .stage.panel-open .tree-bar { padding-right: 402px; padding-right: calc(max(12px, env(safe-area-inset-right, 0px)) + 390px); }
}
.views, .zoom {
  flex: none;
  display: flex;
  padding: 2px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
}
.views button + button, .zoom button + button { margin-left: 2px; }
.views button, .zoom button { border-color: transparent; background: transparent; font-weight: 600; font-size: 12px; padding: 2px 9px; line-height: 1.4; }
.zoom button { min-width: 26px; font-size: 15px; line-height: 1; padding: 3px 7px; }
.zoom .fit { font-size: 12px; }
.views button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }
/* views still to come: shown, but quiet */
.views button[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.views button[aria-disabled="true"]:hover { border-color: transparent; }

/* Some people are past the account's limit (they're drawn faded): a note just above the bar */
.limit-note {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin: 0 0 10px;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel, #fff);
  color: var(--ink, #2a2238);
  box-shadow: 0 4px 14px rgba(30, 20, 60, 0.18);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}
.limit-note[hidden] { display: none; }
.limit-note a { color: var(--accent, #7c4dff); font-weight: 700; white-space: nowrap; }

.tree-tip {
  flex: 1 1 0%;
  min-width: 0;
  margin: 0 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tip-narrow { display: none; }

.splitter {
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  touch-action: none;
}
.splitter span { width: 48px; height: 5px; border-radius: 3px; background: var(--line); }
.splitter:hover span { background: var(--accent); }
.splitter:focus span { background: var(--accent); }
.splitter:focus { outline: none; }

/* the bar over the tree: the design's icon, the tree's title and "About this" */
.tree-head {
  position: relative;
  z-index: 4;
  flex: none;
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 4px 12px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
@media (min-width: 721px) {
  .stage.panel-open .tree-head { padding-right: 402px; padding-right: calc(max(12px, env(safe-area-inset-right, 0px)) + 390px); }
}
.tree-mark {
  flex: none; margin-right: 8px; width: 14px; height: 14px;
  background: var(--accent); border-radius: 0 70% 0 70%; -webkit-transform: rotate(-10deg); transform: rotate(-10deg);
}
.tree-title {
  flex: 1 1 0%; min-width: 0; margin: 0;
  font: 600 17px/1.3 var(--font-head);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tree-head-tools { margin-left: 12px; }
/* the card "About this" opens, under the bar on the right */
.tree-about {
  position: absolute; z-index: 5; right: 12px; right: max(12px, env(safe-area-inset-right, 0px));
  width: 360px; max-width: calc(100% - 24px); max-height: 70%; overflow: auto;
  padding: 16px 20px 18px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 10px 34px rgba(20, 20, 10, 0.2);
}
.tree-about-close {
  float: right; margin: -6px -10px 0 8px; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: inherit;
}
.tree-about-close:hover { background: var(--line); }
.tree-about-kicker { margin: 0 0 2px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.tree-about h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.2; }
.tree-about-text p { margin: 0 0 8px; line-height: 1.5; }
.tree-about-text p:last-child { margin-bottom: 0; }

/* narrower screens: shorter tips and tighter buttons in the bar under the tree */
@media (max-width: 860px) {
  .tip-wide { display: none; }
  .tip-narrow { display: inline; }
  .tree-bar { padding-top: 4px; padding-bottom: 4px; }
  .tree-tip { margin: 0 8px; font-size: 11px; }
  .views button { padding-left: 7px; padding-right: 7px; }
}
@media (max-width: 480px) {
  .tree-tip { display: none; }
}

/* ---------- person info panel ----------
 * One layout, three skins that match the tree's themes. Storybook uses the page's own
 * colours (so it follows light and dark); Royal and Most Wanted always look the same.
 */

.app { position: relative; }
.editor-probe {
  position: absolute; visibility: hidden; height: auto; left: 0; top: 0;
  padding: 14px 16px; font: var(--editor-font); white-space: pre-wrap; overflow-wrap: break-word;
}

.person-panel {
  --i-bg: var(--panel);
  --i-ink: var(--ink);
  --i-muted: var(--muted);
  --i-line: var(--line);
  --i-sub: var(--bg);
  --i-head: var(--font-head);
  --i-body: var(--font-body);
  --i-btn: var(--panel);
  --i-radius: 18px;
  position: absolute;
  z-index: 5;
  top: 64px;
  top: var(--info-top, 64px);
  right: 12px;
  right: max(12px, env(safe-area-inset-right, 0px));
  right: var(--info-right, max(12px, env(safe-area-inset-right, 0px)));
  bottom: 12px;
  bottom: var(--info-bottom, 12px);
  width: 370px;
  max-width: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 8px 12px 14px;
  background: var(--i-bg);
  color: var(--i-ink);
  font: 15px/1.45 var(--i-body);
  border: 1px solid var(--i-line);
  border-radius: var(--i-radius);
  box-shadow: 0 10px 40px rgba(20, 20, 10, 0.22);
  animation: info-in 0.22s ease-out;
  /* its own layer: Safari 14 drew the tree's canvas layer over the panel */
  will-change: transform;
}
@keyframes info-in { from { opacity: 0; transform: translateX(16px); } }
@media (prefers-reduced-motion: reduce) { .person-panel { animation: none; } }
.person-panel:focus { outline: none; }
/* the part that scrolls: inset from the frame so text never touches the panel's edge */
.info-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;   /* no rubber-band bounce on Mac trackpads */
  padding: 4px 8px 8px 4px;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--i-line) transparent;
}

/* The close button sits at the top of the content and scrolls away with it. */
.info-close {
  position: absolute; z-index: 2; top: 2px; right: 6px;
  width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 1px solid var(--i-line);
  background: var(--i-btn); color: var(--i-ink); font-size: 20px; line-height: 30px; text-align: center; cursor: pointer;
}
.info-close:hover { border-color: var(--info-accent); }

.info-head { display: flex; align-items: center; padding-right: 36px; }
.info-portrait { flex: none; width: 92px; height: 92px; margin-right: 14px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 4px var(--info-accent), 0 4px 12px rgba(0, 0, 0, 0.15); }
.info-portrait canvas { display: block; width: 100%; height: 100%; }
.info-title { flex: 1 1 auto; min-width: 0; }
.info-title h2 { margin: 0; font: 600 23px/1.15 var(--i-head); word-wrap: break-word; overflow-wrap: break-word; }
.info-kicker { margin: 0 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--i-muted); }
.info-poster { display: none; }
.info-rel { margin: 4px 0 0; font-weight: 700; color: var(--info-accent); }
.info-years { margin: 2px 0 0; font-size: 14px; color: var(--i-muted); }
.info-group { display: flex; align-items: center; margin: 4px 0 0; font-size: 13px; color: var(--i-muted); }
.info-group span { flex: none; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--info-accent); }

.info-summary { margin: 14px 0 0; font-size: 16px; }
.info-about p { margin: 0 0 8px; font-size: 16px; line-height: 1.5; white-space: pre-line; }
.info-about p:last-child { margin-bottom: 0; }
/* the owner's bio carries on from the summary, with no line between (Most Wanted keeps its poster rules) */
.person-panel:not([data-skin="wanted"]) .info-sec.info-about { margin-top: 8px; padding-top: 0; border-top: 0; }
.info-sec { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--i-line); }
.info-sec h3 { margin: 0 0 8px; font: 600 15px/1.2 var(--i-head); letter-spacing: 0.02em; }
.info-hint { margin: 0 0 8px; font-size: 13px; color: var(--i-muted); }
.info-more { margin: 6px 0 0; font-size: 13px; color: var(--i-muted); }

/* rows of chips, buttons and swatches: margins rather than flex "gap" */
.info-row { margin-top: 8px; }
.info-label { display: block; margin-bottom: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--i-muted); }
.chips, .info-buttons, .swatches { display: flex; flex-wrap: wrap; margin: -3px; }
.chips > *, .info-buttons > *, .swatches > * { margin: 3px; }
.info-buttons { margin-top: 5px; }
.chip {
  display: inline-flex; align-items: center; padding: 4px 11px 4px 8px;
  border: 1px solid var(--i-line); border-radius: 999px; background: var(--i-btn); color: var(--i-ink);
  font: inherit; font-size: 14px; cursor: pointer;
}
.chip small { margin-left: 6px; color: var(--i-muted); font-size: 12px; }
.chip:hover { border-color: var(--info-accent); }
.chip-dot { flex: none; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: hsl(var(--h, 200), 55%, 55%); }
.chip-pet { cursor: default; }
.chip-pet:hover { border-color: var(--i-line); }
.chip .ico { flex: none; margin-right: 6px; color: var(--info-accent); }
.chip-trait { cursor: default; }
.chip-trait:hover { border-color: var(--i-line); }
.chip-hobby[aria-pressed="true"] { border-color: var(--info-accent); box-shadow: inset 0 0 0 1px var(--info-accent); }
.info-share { margin: 8px 0 0; font-size: 14px; color: var(--i-muted); }

.facts { margin: 0; padding-left: 18px; }
.facts li + li { margin-top: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline:before { content: ""; position: absolute; left: 44px; top: 6px; bottom: 6px; width: 2px; background: var(--i-line); }
.timeline li { display: flex; align-items: flex-start; padding: 4px 0; position: relative; }
.timeline li:before { content: ""; position: absolute; left: 40px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--info-accent); box-shadow: 0 0 0 2px var(--i-bg); }
.timeline .tl-year { flex: none; width: 40px; margin-right: 16px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.tl-what { flex: 1 1 auto; min-width: 0; }
.tl-what small { display: block; color: var(--i-muted); font-size: 13px; }

.quotes, .asks, .sources, .path { list-style: none; margin: 0; padding: 0; }
.quotes li + li, .asks li + li, .sources li + li, .path li + li { margin-top: 6px; }
.quote, .ask {
  display: block; width: 100%; text-align: left; padding: 8px 11px; border-radius: 10px;
  border: 1px solid var(--i-line); background: var(--i-sub); color: var(--i-ink); font: inherit; font-size: 14px; cursor: pointer;
}
.quote { border-left: 4px solid var(--info-accent); }
.quote:hover, .ask:hover { border-color: var(--info-accent); }
.quote mark { background: rgba(127, 127, 127, 0.25); background: var(--i-mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.ask { font-weight: 700; }
.ask small { display: block; font-weight: 400; color: var(--i-muted); font-size: 13px; }
.sources li { padding: 6px 10px; border-radius: 8px; background: var(--i-sub); font-size: 14px; }

.person-panel .btn {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--i-line); background: var(--i-btn); color: var(--i-ink);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.person-panel .btn:hover { border-color: var(--info-accent); }
.person-panel .btn[aria-pressed="true"] { background: var(--info-accent); border-color: var(--info-accent); color: #fff; }
.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; -webkit-text-decoration-color: var(--info-accent); text-decoration-color: var(--info-accent); cursor: pointer; text-align: left; }

.compare { display: flex; flex-wrap: wrap; align-items: center; font-size: 14px; }
.compare select { margin-left: 6px; font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--i-line); background: var(--i-btn); color: var(--i-ink); max-width: 100%; }
.answer { margin: 10px 0 8px; font-size: 17px; font-weight: 700; }
.path { margin-bottom: 10px; counter-reset: step; font-size: 14px; }
.path li { counter-increment: step; display: flex; align-items: baseline; }
.path li:before { content: counter(step); flex: none; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: var(--i-sub); border: 1px solid var(--i-line); font-size: 11px; line-height: 18px; text-align: center; }
.path .link { margin-right: 4px; }

.colour-pick { margin-top: 12px; }
.seg { display: inline-flex; margin-bottom: 8px; border: 1px solid var(--i-line); border-radius: 999px; overflow: hidden; }
.seg button { padding: 4px 12px; border: 0; background: var(--i-btn); color: var(--i-ink); font: inherit; font-size: 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--i-ink); color: var(--i-bg); }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid var(--i-bg); background: var(--c); box-shadow: 0 0 0 1px var(--i-line); cursor: pointer; }
.swatch[aria-pressed="true"], .swatch:hover { box-shadow: 0 0 0 2px var(--i-ink); }
.swatch-none { background: linear-gradient(135deg, transparent 45%, var(--unknown) 45%, var(--unknown) 55%, transparent 55%), var(--i-btn); }

/* Royal: velvet, gold leaf and an oval cameo */

/* a small gold seal in the plaque's top-right corner */

/* the cross is drawn rather than typed, so it sits dead centre whatever the font */

/* Most Wanted: a paper poster nailed to the boards */

/* a torn-off ticket with an inked cross, just under the right-hand nail */

/* Phones: a sheet that slides up over the story */
@media (max-width: 720px) {
  .person-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 64vh;
    max-height: 64dvh;
    border-radius: 18px 18px 0 0;
    border-radius: var(--i-radius) var(--i-radius) 0 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 20px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    animation-name: info-up;
  }
  @keyframes info-up { from { opacity: 0; transform: translateY(24px); } }
}

/* the design's icon by the title: a leaf, a crown or a sheriff's star (SVG, which every browser draws) */
.stage[data-skin="royal"] .tree-mark, .stage[data-skin="wanted"] .tree-mark {
  border-radius: 0; -webkit-transform: none; transform: none; background-color: transparent; background-repeat: no-repeat; background-size: 100% 100%;
}

/* narrow phones: squeeze the tree bar's buttons so both groups fit, whatever the theme */
@media (max-width: 480px) {
  .tree-bar { padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .stage[data-skin] .tree-bar .views button, .stage[data-skin] .tree-bar .zoom .fit { font-size: 11px; padding-left: 5px; padding-right: 5px; }
  .stage[data-skin] .tree-bar .zoom button { min-width: 22px; padding-left: 4px; padding-right: 4px; }
  .tree-head { min-height: 34px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .stage[data-skin] .tree-title { font-size: 14px; }
  .stage[data-skin] .tree-head .zoom .fit { font-size: 11px; padding-left: 6px; padding-right: 6px; }
}

/* the card over a hobby or pet badge on the tree */
.badge-tip {
  position: absolute; z-index: 6; max-width: 260px; padding: 8px 12px 9px; pointer-events: none;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22); font-size: 13px; line-height: 1.4;
}
.badge-tip p { margin: 0; }
.badge-tip-what { display: flex; align-items: center; font-size: 14px; }
.badge-tip-what .ico { flex: none; width: 16px; height: 16px; margin-right: 6px; color: var(--accent); }
.badge-tip-what small { margin-left: 4px; font-weight: 400; color: var(--muted); }
.badge-tip-who { color: var(--muted); font-size: 12px; }
.badge-tip-said { margin-top: 5px !important; }
.person-panel .badge-tip { color: var(--i-ink); background: var(--i-bg); border-color: var(--i-line); font-family: var(--i-body); max-width: 280px; }
.chip-tip .badge-tip-said { margin: 0 0 4px !important; }

/* Vintage: a little print in its photo corners */

/* ---------- timeline view ----------
 * A strip of events above the tree bar, and a card telling the picked event over the right
 * of the tree (under the people on phones). Each design dresses both.
 */

.tl-nav {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.tl-btn {
  position: relative; flex: none; width: 30px; height: 30px; margin: 0 2px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
}
.tl-btn:hover { border-color: var(--accent); }
.tl-btn:before, .tl-btn:after { content: ""; position: absolute; top: 50%; left: 50%; }
/* play / pause drawn with borders, so they take the text colour of any design */
.tl-play:before { margin: -6px 0 0 -3px; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid currentColor; }
.tl-playing .tl-play:before { margin: -5px 0 0 -5px; width: 3px; height: 10px; border: 0; background: currentColor; }
.tl-playing .tl-play:after { margin: -5px 0 0 2px; width: 3px; height: 10px; background: currentColor; }
.tl-empty .tl-btn { visibility: hidden; }

.tl-scroll { position: relative; flex: 1 1 0%; min-width: 0; height: 56px; margin: 0 6px; overflow: hidden; touch-action: pan-y; cursor: -webkit-grab; cursor: grab; }
/* faded ends where the strip carries on out of sight */
.tl-scroll:before, .tl-scroll:after {
  content: ""; position: absolute; z-index: 1; top: 0; bottom: 0; width: 34px; pointer-events: none; opacity: 0;
  -webkit-transition: opacity 0.2s; transition: opacity 0.2s;
}
.tl-scroll:before { left: 0; background: linear-gradient(to right, var(--tl-fade, var(--panel)), rgba(255, 255, 255, 0)); }
.tl-scroll:after { right: 0; background: linear-gradient(to left, var(--tl-fade, var(--panel)), rgba(255, 255, 255, 0)); }
.tl-more-left:before, .tl-more-right:after { opacity: 1; }
.tl-track { position: absolute; top: 0; left: 0; height: 100%; }
.tl-glide { -webkit-transition: -webkit-transform 0.45s ease; transition: transform 0.45s ease; }
@media (prefers-reduced-motion: reduce) { .tl-glide { -webkit-transition: none; transition: none; } }
.tl-axis { position: absolute; left: 0; top: 20px; height: 2px; background: var(--line); }
.tl-event {
  position: absolute; top: 5px; width: 32px; height: 32px; margin-left: -16px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); background: var(--panel); border: 2px solid var(--line); border-radius: 50%; cursor: pointer;
  -webkit-transition: -webkit-transform 0.2s, background 0.2s; transition: transform 0.2s, background 0.2s;
}
.tl-event .ico { width: 17px; height: 17px; }
.tl-event:hover { border-color: var(--accent); color: var(--ink); }
.tl-event[aria-current="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); -webkit-transform: scale(1.18); transform: scale(1.18); }
.tl-track .tl-year { position: absolute; top: 40px; -webkit-transform: translateX(-50%); transform: translateX(-50%); font-size: 11px; font-weight: 600; line-height: 1.2; white-space: nowrap; color: var(--muted); }
.tl-about { font-style: italic; }
/* a long gap with nothing in it, shortened */
.tl-break { position: absolute; top: 13px; width: 9px; height: 16px; margin-left: -5px; background: var(--tl-fade, var(--panel)); border-left: 2px solid var(--muted); border-right: 2px solid var(--muted); -webkit-transform: skewX(-20deg); transform: skewX(-20deg); }
.tl-undated { position: absolute; top: 4px; height: 34px; border-left: 1px dashed var(--muted); }
.tl-undated span { position: absolute; top: 34px; left: 5px; font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tl-none { margin: 0; padding: 0 8px; line-height: 56px; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* the card: over the tree, which stays faded behind it */
.tl-layer {
  position: absolute; z-index: 3; top: 0; left: 0; right: 0;
  display: flex; pointer-events: none;
  padding: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.tl-side { align-items: center; justify-content: flex-end; }
.tl-side .tl-card { width: 44%; max-width: 440px; margin-right: 3%; }
.tl-below { align-items: flex-end; justify-content: center; }
.tl-below .tl-card { width: 100%; max-width: 480px; }
.tl-card {
  pointer-events: auto; max-height: 100%; overflow: auto; padding: 18px 22px 20px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 34px rgba(20, 20, 10, 0.18);
  animation: tl-in 0.35s ease-out;
}
@keyframes tl-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .tl-card { animation: none; } }
.tl-kicker { display: flex; align-items: center; margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.tl-kicker .ico { margin-right: 6px; width: 18px; height: 18px; }
.tl-count { margin-left: auto; font-weight: 600; letter-spacing: 0.02em; text-transform: none; color: var(--muted); }
.tl-title { margin: 0; font-size: 26px; line-height: 1.15; }
.tl-when { margin: 4px 0 0; font-weight: 700; color: var(--muted); }
.tl-text { margin: 10px 0 0; line-height: 1.5; }
/* phones: a compact card, so the people above it keep their room */
.tl-layer.tl-below { padding-top: 8px; padding-bottom: 8px; }
.stage[data-skin] .tl-below .tl-card { padding: 10px 14px 12px; font-size: 14px; }
.stage[data-skin] .tl-below .tl-kicker { margin-bottom: 2px; font-size: 11px; }
.stage[data-skin] .tl-below .tl-title { font-size: 19px; }
.stage[data-skin] .tl-below .tl-title:after { display: none; }
.stage[data-skin] .tl-below .tl-when { margin-top: 2px; font-size: 13px; }
.stage[data-skin] .tl-below .tl-text { margin-top: 4px; font-size: 14px; line-height: 1.4; }

/* Royal: a proclamation on velvet with a gold edge */

/* Most Wanted: a cutting from the frontier newspaper, pinned over the wood */

/* ---------- quiz view ----------
 * The same card and strip as the timeline (and the same dress for each design), with answers
 * to pick and a row of dots for the score.
 */

.qz-nav { justify-content: space-between; min-height: 48px; }
.qz-dots { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; }
.qz-dot { width: 12px; height: 12px; margin: 3px; border-radius: 50%; border: 2px solid var(--line); background: transparent; }
.qz-now { border-color: var(--accent); -webkit-transform: scale(1.25); transform: scale(1.25); }
.qz-right { background: #3f9a4a; border-color: #3f9a4a; }
.qz-wrong { background: #c8443c; border-color: #c8443c; }
.qz-score { flex: 1 1 auto; margin: 0 12px; text-align: center; font-size: 13px; font-weight: 700; white-space: nowrap; }
.qz-new, .qz-next {
  flex: none; padding: 5px 14px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 999px;
}
.qz-new:hover { border-color: var(--accent); }

.qz-options { display: flex; flex-wrap: wrap; margin: 12px -4px 0; }
.qz-option {
  display: flex; align-items: center; width: calc(50% - 8px); margin: 4px; padding: 9px 12px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.25; text-align: left; cursor: pointer;
  color: inherit; background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
}
.qz-option:hover:not(:disabled) { border-color: var(--accent); }
.qz-option:disabled { cursor: default; opacity: 0.55; }
.qz-key {
  flex: none; display: inline-block; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%;
  font-size: 11px; line-height: 20px; text-align: center; color: var(--muted); border: 1px solid var(--line);
}
.qz-option.qz-correct { opacity: 1; color: #fff; background: #3f9a4a; border-color: #3f9a4a; }
.qz-option.qz-chosen { opacity: 1; color: #fff; background: #c8443c; border-color: #c8443c; }
.qz-correct .qz-key, .qz-chosen .qz-key { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.qz-result { margin-top: 12px; }
.qz-verdict { margin: 0; font-size: 18px; font-weight: 800; }
.qz-yes .qz-verdict { color: #3f9a4a; }
.qz-no .qz-verdict { color: #c8443c; }
.qz-result .tl-text { margin-top: 4px; }
.qz-card .qz-next { margin-top: 12px; padding: 8px 18px; font-size: 14px; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.qz-stars { margin: 8px 0 0; font-size: 28px; letter-spacing: 4px; color: var(--line); }
.qz-star-on { color: #e8b730; }
.tl-below .qz-option { padding: 7px 10px; font-size: 14px; }
.qz-card { padding-top: 14px; padding-bottom: 16px; }
.qz-card .tl-title { font-size: 23px; }
.qz-card .qz-result .tl-text { margin-top: 2px; }

/* Royal */

/* Most Wanted */

/* cards on the page: a cream print tucked into four photo corners */

/* the timeline strip: dates in pencil, the picked one a little print */

/* the quiz, on the same cream print */

/* the person panel: an album page, their picture a print stuck in at a slant */

/* cards on the page: a comic panel with a caption box for its kicker */

/* the timeline strip: an inked rule, each event a roundel, the picked one yellow */

/* the quiz: answers in inked boxes, and a verdict that shouts */

/* the card over a hobby or pet badge: a speech balloon's worth of panel */

/* the person panel: their hero file, the portrait an inked panel at a jaunty angle */

/* cards on the wall: a pane of amber glass, leaded, in a stone frame */

/* the timeline strip: a lead line with glass roundels on it */

/* the quiz: answers are panes of coloured glass */

/* the card over a hobby or pet badge: a small amber pane */

/* the person panel: a stone niche, their portrait a leaded roundel */

/* cards over the stars: a display panel with a corner cut off and a glowing edge */

/* the timeline strip: a beam with glowing waypoints */

/* the quiz: answers on the ship's console */

/* the card over a hobby or pet badge: a small readout */

/* the person panel: their crew file */

/* cards on the paper: a sheet with a fine rule, and a seal-red line at the top */

/* the timeline strip: a hairline with small ink circles, the picked one a red sun */

/* the quiz: answers on plain paper with a fine rule */

/* the card over a hobby or pet badge */

/* the person panel: a sheet of paper, fine rules, a red seal for the accent */

/* cards on the paper: cream, rounded, with a blush of petal colour at the top */

/* the timeline strip: a green stem with round flower heads */

/* the quiz: answers like seed packets, green for right and petal pink for wrong */

/* the card over a hobby or pet badge */

/* the person panel: a garden card */

