/*
  Bible Connections styles.
  Layout and controls follow Apple's Human Interface Guidelines: the system font and type scale,
  grouped lists, segmented controls, switches, translucent bars, 44pt touch targets and an 8pt grid.
  Colors are tuned to meet WCAG 2.1 AA contrast in both themes.
*/
:root {
  /* dark appearance (default) */
  --map-water: #10202e;
  --map-land: #2a2a2e;
  --bg: #000000;
  --bar: rgba(22, 22, 24, 0.78);
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --fill: rgba(118, 118, 128, 0.24);
  --separator: rgba(84, 84, 88, 0.6);
  --border: rgba(84, 84, 88, 0.6);
  --border-strong: #8e8e93;
  --text: #ffffff;
  --muted: rgba(235, 235, 245, 0.68);
  --link: #5eb0ff;
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 132, 255, 0.2);
  --focus: #5eb0ff;
  --highlight: #ffd60a;
  --danger: #ff6961;
  --overlay: rgba(28, 28, 30, 0.86);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --heat: 41, 151, 255;

  --radius-s: 8px;
  --radius: 12px;
  --radius-l: 16px;
  --sidebar: 384px;
  --header-h: 56px;

  /* HIG type scale */
  --t-large: 34px;
  --t-title1: 28px;
  --t-title2: 22px;
  --t-title3: 20px;
  --t-headline: 17px;
  --t-body: 17px;
  --t-callout: 16px;
  --t-subhead: 15px;
  --t-footnote: 13px;
  --t-caption: 12px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --map-water: #d9e8f5;
  --map-land: #f4f1ea;
  --bg: #ffffff;
  --bar: rgba(249, 249, 251, 0.8);
  --surface: #f2f2f7;
  --surface-2: #ffffff;
  --surface-3: #e5e5ea;
  --fill: rgba(118, 118, 128, 0.12);
  --separator: rgba(60, 60, 67, 0.29);
  --border: rgba(60, 60, 67, 0.29);
  --border-strong: #8a8a8e;
  --text: #000000;
  --muted: rgba(60, 60, 67, 0.85);
  --link: #0058b0;
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --focus: #0058b0;
  --highlight: #b25000;
  --danger: #c4170c;
  --overlay: rgba(255, 255, 255, 0.92);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --heat: 0, 102, 204;
  color-scheme: light;
}
:root[data-contrast="more"] { --muted: var(--text); --border: var(--border-strong); --separator: var(--border-strong); }
:root[data-theme="dark"][data-contrast="more"] { --surface: #000; --surface-2: #1c1c1e; --border-strong: #aeaeb2; }
:root[data-theme="light"][data-contrast="more"] { --surface: #fff; --border-strong: #3a3a3c; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-callout)/1.47 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; font-family: var(--font-display); text-wrap: balance; }
p, li, dd, dt, label, legend, blockquote { text-wrap: pretty; }
button, input, select { font: inherit; letter-spacing: inherit; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: var(--radius-s); font-weight: 600;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.icon { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Navigation bar (translucent material) ---------- */
.site-header {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 16px; min-height: var(--header-h);
  padding-top: max(6px, env(safe-area-inset-top));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.brand h1 { margin: 0; font-size: var(--t-headline); font-weight: 600; letter-spacing: -0.02em; }
.home-link { color: inherit; text-decoration: none; }
.home-link:hover .brand-name { text-decoration: underline; }
/* the icon sits beside both lines: the name and the count underneath */
.brand { position: relative; min-width: 0; padding-left: 48px; }
.brand-mark { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 9px; display: block; }
:root[data-theme="light"] .brand-mark { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
.tagline { margin: 0; color: var(--muted); font-size: var(--t-footnote); }
.brand h1, .tagline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .brand { padding-left: 42px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 8px; }
}
.header-right { display: flex; align-items: center; gap: 4px; }
.header-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-btn .icon { display: none; }
.nav-btn.icon-nav .icon { display: block; }
.nav-btn.icon-nav .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-btn {
  min-height: 44px; padding: 6px 12px; border-radius: var(--radius-s); border: 0;
  background: transparent; color: var(--link); font-size: var(--t-callout); font-weight: 500; cursor: pointer;
}
.site-header .nav-btn.btn { background: transparent; }
.nav-btn:hover, .site-header .nav-btn.btn:hover { background: var(--fill); }
.site-header .nav-btn.btn[aria-pressed="true"] { background: var(--accent-soft); font-weight: 600; }
.icon-nav { min-width: 44px; display: inline-grid; place-items: center; padding: 6px; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100vh - var(--header-real, var(--header-h)));
  height: calc(100dvh - var(--header-real, var(--header-h)));
}
.viz-wrap { position: relative; min-width: 0; min-height: 0; background: var(--bg); grid-row: 2; }
.viz { position: absolute; inset: 0; touch-action: none; cursor: crosshair; outline-offset: -3px; }
.viz.dragging { cursor: grabbing; }
.viz canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sidebar {
  grid-row: 2;
  border-left: 0.5px solid var(--separator);
  background: var(--surface);
  overflow-y: auto;
  display: flex; flex-direction: column;
}

/* ---------- "You're viewing" bar ---------- */
.context-bar {
  grid-column: 1 / -1; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.context-bar[hidden] { display: none; }
.ctx-label { font-weight: 600; font-size: var(--t-subhead); color: var(--muted); }
.ctx-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; flex: 1; min-width: 0; }
.ctx-chip {
  display: inline-flex; align-items: center; gap: 0; background: var(--accent-soft);
  border-radius: 999px; padding: 0 0 0 12px; font-size: var(--t-subhead); font-weight: 500; max-width: 100%;
}
.ctx-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-x {
  width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: transparent; color: var(--text);
  cursor: pointer; font-size: var(--t-footnote);
}
.ctx-x:hover { background: var(--fill); }
.ctx-reset { margin-left: auto; }

/* ---------- Map overlays ---------- */
.viz-tools {
  position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 0;
  background: var(--overlay); border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); overflow: hidden;
  border: 0.5px solid var(--separator);
}
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn + .icon-btn { border-top: 0.5px solid var(--separator); }
.icon-btn:hover { background: var(--fill); }
.legend {
  position: absolute; left: 12px; top: 12px; max-width: calc(100% - 80px);
  background: var(--overlay); border: 0.5px solid var(--separator); border-radius: var(--radius-s);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 6px 10px; font-size: var(--t-caption); color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; pointer-events: none;
}
.legend .grad { width: 120px; height: 6px; border-radius: 3px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; color: var(--text);
  background: var(--overlay); border: 0.5px solid var(--separator); border-radius: var(--radius-s); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 4px 10px; font-size: var(--t-footnote); white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tips {
  position: absolute; left: 12px; bottom: 96px; z-index: 6; max-width: 300px;
  background: var(--overlay); border-radius: var(--radius-l); padding: 16px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 0.5px solid var(--separator);
}
.tips h2 { font-size: var(--t-headline); margin: 0 0 8px; }
.tips ul { margin: 0 0 12px; padding-left: 18px; font-size: var(--t-subhead); }

/* ---------- Controls ---------- */
.controls { padding: 16px 16px 8px; border-bottom: 0.5px solid var(--separator); }
.field { margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field > label, .field legend, .label-like {
  display: block; font-size: var(--t-footnote); color: var(--muted); margin: 0 0 6px; font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.field.check label {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; text-transform: none; letter-spacing: -0.01em;
  color: var(--text); font-size: var(--t-callout); min-height: 44px; cursor: pointer;
  background: var(--surface-2); border-radius: var(--radius); padding: 8px 12px; margin: 0;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type=search], input[type=text], select {
  width: 100%; min-height: 44px; padding: 8px 12px; color: var(--text); font-size: var(--t-body);
  background: var(--surface-2); border: 0.5px solid var(--separator); border-radius: var(--radius-s);
}
input[type=search]::placeholder { color: var(--muted); opacity: 0.85; }
.search-row { display: flex; gap: 8px; }
.field-error { color: var(--danger); font-size: var(--t-subhead); margin: 8px 0 0; }
.field-error:empty { display: none; }
.hint { color: var(--muted); font-size: var(--t-footnote); margin: 6px 0 0; }
input[type=range] { width: 100%; min-height: 32px; accent-color: var(--accent); }

/* Switch (HIG toggle) for checkboxes */
input.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; cursor: pointer; margin: 0;
  width: 51px; height: 31px; border-radius: 999px; background: var(--fill); transition: background .2s;
  border: 1px solid var(--separator);
}
input.switch::after {
  content: ""; position: absolute; top: 1px; left: 1px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s;
}
input.switch:checked { background: #30d158; border-color: #30d158; }
:root[data-theme="light"] input.switch:checked { background: #248a3d; border-color: #248a3d; }
input.switch:checked::after { transform: translateX(20px); }

/* Segmented control (HIG) */
.segmented {
  display: flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: 9px;
}
.segmented label {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 40px; margin: 0; border-radius: 7px; color: var(--text); font-size: var(--t-subhead); font-weight: 500;
  cursor: pointer; text-transform: none; letter-spacing: -0.01em; text-align: center; padding: 4px 8px;
}
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--surface-3); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
:root[data-theme="light"] .segmented label:has(input:checked) { background: #fff; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }

.filters { margin-bottom: 4px; }
.filters summary {
  cursor: pointer; font-weight: 600; font-size: var(--t-headline); padding: 8px 0; min-height: 44px;
  display: flex; align-items: center; list-style: none;
}
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "›"; margin-left: auto; font-size: 22px; color: var(--muted); transition: transform .2s; }
.filters[open] summary::after { transform: rotate(90deg); }
.filters[open] summary { margin-bottom: 8px; }
.filters-count { margin-left: 8px; font-size: var(--t-caption); font-weight: 600; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: 1px 8px; }
.filters-count:empty { display: none; }
.count { color: var(--muted); font-size: var(--t-footnote); margin: 8px 0; }

/* Buttons: filled, gray (ghost) and plain */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius); font-size: var(--t-headline); font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { filter: brightness(0.92); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--fill); color: var(--link); }
.btn.ghost:hover { filter: none; background: var(--surface-3); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: var(--t-subhead); border-radius: 10px; }
.btn.big { min-height: 50px; padding: 14px 24px; font-size: var(--t-body); border-radius: 14px; }
.btn.full { width: 100%; }

/* ---------- Detail panel ---------- */
.panel { padding: 16px 16px 40px; flex: 1; }
.panel:focus { outline: none; }
.panel h2 { margin: 0 0 12px; font-size: var(--t-title2); font-weight: 700; letter-spacing: -0.02em; }
.panel h3 {
  font-size: var(--t-footnote); margin: 24px 0 8px; color: var(--muted); font-weight: 400;
  text-transform: uppercase; letter-spacing: 0.02em; font-family: var(--font);
}
.panel p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.verse-card {
  background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 8px;
  border-left: 4px solid var(--c, var(--accent));
}
.verse-card .ref { font-weight: 600; font-size: var(--t-headline); margin: 0 0 8px; }
.link-arrow { text-align: center; color: var(--muted); margin: 0 0 8px; font-size: var(--t-footnote); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions.tight { margin: 0; }
.nav-row .btn { flex: 1; }
.note { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.note-head { font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 6px !important; }
.tag {
  font-size: var(--t-caption); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 2px 8px;
}
.question { background: var(--surface-2); border-left: 4px solid var(--highlight); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }

/* Inset grouped lists */
.conn-list, .verse-list, .journey-list, .rank-list, .mini-list, .series-list, .chain { list-style: none; margin: 0; padding: 0; }
.conn-list { background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.conn-list li + li .conn-item { border-top: 0.5px solid var(--separator); }
.conn-item {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 10px 14px; cursor: pointer; background: transparent; color: var(--text);
  border: 0; border-radius: 0; font-size: var(--t-callout);
}
.conn-item:hover { background: var(--fill); }
.conn-item[aria-current="true"] { background: var(--accent-soft); }
.conn-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.conn-item .label { flex: 1; min-width: 0; }
.conn-item .votes { color: var(--muted); font-size: var(--t-footnote); white-space: nowrap; }
.note-dot { font-size: var(--t-caption); font-weight: 600; color: var(--link); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
.verse-list { columns: 2 150px; column-gap: 16px; }
.verse-list li { break-inside: avoid; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 44px; }
.link-btn {
  background: none; border: 0; padding: 6px 0; color: var(--link); cursor: pointer; font-size: var(--t-callout);
  text-align: left; min-height: 44px;
}
.link-btn:hover { text-decoration: underline; }
.mini-link { font-size: var(--t-footnote); color: var(--link); padding: 10px 6px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chip {
  min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 0;
  background: var(--fill); color: var(--text); font-size: var(--t-subhead); font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--surface-3); }
.mini-list { background: var(--surface-2); border-radius: var(--radius); padding: 0 6px 0 14px; margin-bottom: 8px; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mini-list li + li { border-top: 0.5px solid var(--separator); }

/* Journeys */
.journey-card { background: var(--surface-2); border-radius: var(--radius); padding: 14px; margin: 0 0 12px; }
.journey-card h3 { margin: 0 0 4px !important; color: var(--text) !important; text-transform: none !important; letter-spacing: -0.01em !important; font-size: var(--t-headline) !important; font-weight: 600 !important; font-family: var(--font-display) !important; }
.journey-card p { color: var(--muted); font-size: var(--t-subhead); }
.step-count { color: var(--muted); font-size: var(--t-footnote); margin-bottom: 8px !important; }
.progress { height: 4px; background: var(--fill); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.step-title { color: var(--text) !important; text-transform: none !important; letter-spacing: -0.02em !important; font-size: var(--t-title3) !important; font-weight: 700 !important; margin: 0 0 8px !important; font-family: var(--font-display) !important; }
.step-note { font-size: var(--t-body); line-height: 1.5; }

/* Insights */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 8px; }
.stat-grid div { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.stat-grid dt { font-size: var(--t-caption); color: var(--muted); }
.stat-grid dd { margin: 4px 0 0; font-weight: 700; font-size: var(--t-headline); font-variant-numeric: tabular-nums; }
.stat-grid dd span { font-weight: 400; color: var(--muted); font-size: var(--t-footnote); }
.rank-list { background: var(--surface-2); border-radius: var(--radius); padding: 0 14px; }
.rank-list li { display: grid; grid-template-columns: minmax(0, 1fr) 30% auto; align-items: center; gap: 10px; }
.rank-list li + li { border-top: 0.5px solid var(--separator); }
.rank-list .bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--link) var(--w), var(--fill) var(--w)); }
.rank-list .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--t-footnote); min-width: 3ch; text-align: right; }
.heat-wrap { overflow-x: auto; margin: 0 -4px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: var(--t-caption); }
.heat th { font-weight: 500; color: var(--muted); padding: 2px; }
.heat th[scope=row] { text-align: right; white-space: nowrap; padding-right: 6px; }
.heat abbr { text-decoration: none; }
.heat td { padding: 0; }
.heat-cell {
  width: 36px; height: 30px; border-radius: 6px; border: 0; cursor: pointer; padding: 0;
  background: rgba(var(--heat), calc(0.08 + var(--t) * 0.9)); color: var(--text); font-size: 10px;
  display: grid; place-items: center;
}
.heat-cell span { background: var(--surface); border-radius: 4px; padding: 0 3px; line-height: 1.5; }
.heat-cell:hover { outline: 2px solid var(--link); }

/* Chain finder */
.path-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; margin-bottom: 8px; }
.path-form .field { margin: 0; }
.path-form .btn { grid-column: 1 / -1; }
.chain li { display: flex; gap: 10px; padding: 8px 0 8px 18px; border-left: 2px solid var(--highlight); margin-left: 13px; position: relative; }
.chain-num {
  position: absolute; left: -14px; top: 8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--highlight); color: #000; font-weight: 700; display: grid; place-items: center; font-size: var(--t-caption);
}
:root[data-theme="light"] .chain-num { color: #fff; }
.chain .ref { font-weight: 600; margin: 2px 0 0 !important; }
.chain .votes { font-weight: 400; color: var(--muted); font-size: var(--t-footnote); }
.chain-note { font-size: var(--t-subhead); color: var(--muted); margin: 4px 0 0 !important; }

/* Series */
.series-list li { background: var(--surface-2); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.series-title { font-weight: 600; margin-bottom: 8px !important; }

/* Study hub */
.study-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.study-card {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 12px 40px 12px 14px;
  background: var(--surface-2); color: var(--text); border: 0; border-radius: var(--radius); cursor: pointer; position: relative;
}
.study-card::after { content: "›"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--muted); }
.study-card:hover { background: var(--surface-3); }
.study-card strong { font-size: var(--t-headline); font-weight: 600; }
.study-card span { font-size: var(--t-subhead); color: var(--muted); }
.cotd { background: var(--surface-2); border-radius: var(--radius); padding: 14px; text-align: left; }
.cotd-refs { font-weight: 600; font-size: var(--t-headline); margin: 0 0 6px !important; }
.landing-cotd { max-width: 560px; margin: 0 auto 8px; }
.landing-cotd .cotd { background: var(--surface); }
.plan-item { border-top: 0.5px solid var(--separator); padding-top: 12px; margin-top: 12px; }
.plan-item:first-of-type { border-top: 0; margin-top: 0; }
.answer-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.answer {
  width: 100%; min-height: 50px; text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 2px solid transparent;
  background: var(--surface-2); color: var(--text); font-size: var(--t-body); font-weight: 500; cursor: pointer;
}
.answer:hover:not(:disabled) { background: var(--surface-3); }
.answer:disabled { cursor: default; }
.answer.correct { border-color: #30d158; }
.answer.wrong { border-color: var(--danger); }
.answer.correct::after { content: " ✓"; color: #30d158; }
:root[data-theme="light"] .answer.correct { border-color: #248a3d; }
:root[data-theme="light"] .answer.correct::after { color: #248a3d; }
.answer.wrong::after { content: " ✕"; color: var(--danger); }
.result { font-weight: 600; font-size: var(--t-headline); }

/* QR, embed and poster dialogs */
.dialog-inner.center { text-align: center; }
.qr-image { background: #fff; border-radius: var(--radius); padding: 12px; width: min(280px, 80vw); margin: 8px auto; }
.qr-image svg { display: block; width: 100%; height: auto; }
.qr-url { word-break: break-all; }
textarea {
  width: 100%; font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text);
  background: var(--surface-2); border: 0.5px solid var(--separator); border-radius: var(--radius-s); padding: 10px;
}

/* Embedded on another website */
.embed-bar[hidden] { display: none; }
body.embed .site-header, body.embed .sidebar, body.embed .context-bar, body.embed .tips, body.embed .landing { display: none !important; }
body.embed .layout { display: block; height: calc(100vh - 56px); height: calc(100dvh - 56px); }
body.embed .viz-wrap { height: 100%; }
body.embed { padding-bottom: 0 !important; }
.embed-bar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 56px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px; background: var(--surface); border-top: 0.5px solid var(--separator);
}
.embed-title { font-weight: 600; font-size: var(--t-subhead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Word study, collections, summaries */
.lemma { font-size: 40px; line-height: 1.2; margin: 0 0 4px !important; font-family: "SBL Hebrew", "Ezra SIL", "Times New Roman", serif; }
.summary { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; font-size: var(--t-subhead); }
.col-bar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; background: var(--accent-soft); border-bottom: 0.5px solid var(--separator); font-weight: 600;
}
.col-bar[hidden] { display: none; }

/* Second translation */
.compare-row { margin-top: 8px !important; }
.translations .field-row { grid-template-columns: 1fr; gap: 8px; }
.translations .field-row .field { margin-bottom: 0; }
.translations .field > label { text-transform: none; letter-spacing: -0.01em; font-size: var(--t-footnote); }

/* Kids mode: bigger type and targets, fewer advanced controls */
.kids-only { display: none; }
:root[data-kids="on"] .kids-only { display: block; }
:root[data-kids="on"] .adult-only { display: none; }
:root[data-kids="on"] body { font-size: 18px; }
:root[data-kids="on"] .panel p, :root[data-kids="on"] .step-note { font-size: 19px; }
:root[data-kids="on"] .btn.small, :root[data-kids="on"] .chip { min-height: 48px; font-size: 17px; padding: 10px 16px; }
:root[data-kids="on"] .conn-item { min-height: 56px; font-size: 18px; }
:root[data-kids="on"] .filters, :root[data-kids="on"] .count { display: none; }
:root[data-kids="on"] .step-title { font-size: 26px !important; }

/* ---------- Welcome page ---------- */
.landing { position: relative; z-index: 2; background: var(--bg); }
.landing[hidden] { display: none; }
/* The welcome page scrolls like a normal page. The map stays laid out (so it can draw the picture
   at the top) but is hidden behind it, so there is no nested scrolling area for Safari to trip over. */
body.landing-open .layout {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--header-real, var(--header-h));
  height: auto; visibility: hidden; pointer-events: none;
}
/* Welcome page: the map is the picture. */
.landing-hero {
  max-width: 1240px; margin: 0 auto; padding-block: clamp(28px, 6vh, 72px) 8px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.hero-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 64px); align-items: end; }
.landing h2 { font-family: var(--font-display); font-size: clamp(36px, 5vw, 68px); font-weight: 700; line-height: 1.05; letter-spacing: -0.03em; margin: 0; text-wrap: balance; }
.hero-side { min-width: 0; }
.lede { font-size: clamp(var(--t-body), 1.5vw, 20px); line-height: 1.5; color: var(--muted); max-width: 32em; margin: 0 0 20px; }
.landing-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }
.hero-figure { margin: clamp(24px, 5vh, 56px) 0 0; }
.hero { display: block; width: 100%; aspect-ratio: 2.3 / 1; max-height: 62vh; }
.axis { --ot: 0.77; display: grid; grid-template-columns: calc(var(--ot) * 100%) 1fr; margin-top: 2px; font-size: var(--t-footnote); color: var(--muted); }
.axis span { position: relative; border-top: 1px solid var(--border-strong); height: 46px; }
.axis span::before, .axis .axis-nt::after { content: ''; position: absolute; top: -5px; left: 0; height: 9px; border-left: 1px solid var(--border-strong); }
.axis .axis-nt::after { left: auto; right: 0; }
.axis i { position: absolute; top: 7px; left: 0; font-style: normal; white-space: nowrap; }
.axis .end { left: auto; right: 0; }
.axis b { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); font-weight: 600; color: var(--text); white-space: nowrap; }
.stat-band { margin-top: 32px; background: var(--surface); border-block: 0.5px solid var(--separator); }
.stat-row {
  list-style: none; margin: 0 auto; max-width: 960px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); text-align: center;
  padding-block: 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.stat-row li { padding: 22px 12px; border-left: 0.5px solid var(--separator); }
.stat-row li:first-child { border-left: 0; }
.stat-row strong { display: block; font-family: var(--font-display); font-size: clamp(26px, 3vw, 40px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1.1; color: var(--text); }
.stat-row span { color: var(--muted); font-size: var(--t-subhead); }
.landing-search-wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.landing-search { max-width: 560px; margin: 40px auto 0; text-align: center; }
.landing-search label { display: block; font-size: var(--t-subhead); color: var(--muted); margin-bottom: 8px; }
.landing-search .search-row { text-align: left; }

.landing-inner {
  max-width: 1240px; margin: 0 auto; padding-block: 8px 56px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.landing h3 { font-family: var(--font-display); font-size: clamp(20px, 2vw, 24px); font-weight: 700; letter-spacing: -0.02em; color: var(--text); margin: 56px 0 16px; }
.landing-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.landing-split > * { min-width: 0; }
.landing-cotd { max-width: none; margin: 0; }
.landing-cotd .cotd { background: var(--surface); padding: 20px; border-radius: var(--radius); }
.landing .chip-list { justify-content: flex-start; }
.landing-series { background: var(--surface); border-radius: var(--radius); padding: 20px; margin: 40px 0 0; max-width: 640px; }
.landing-series .series-name { font-size: var(--t-title3); margin: 0 0 8px; }
.landing-recent { margin: 24px 0 0; }
.ways { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; border-top: 0.5px solid var(--separator); }
.ways li { border-bottom: 0.5px solid var(--separator); }
.way {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; text-align: left;
  font: inherit; color: var(--text); background: none; border: 0; padding: 18px 0; cursor: pointer;
}
.way::after { content: '›'; grid-column: 2; grid-row: 1 / span 2; font-size: 28px; line-height: 1; color: var(--muted); }
.way strong { font-size: var(--t-headline); font-weight: 600; }
.way span { grid-column: 1; color: var(--muted); font-size: var(--t-subhead); line-height: 1.45; margin-top: 2px; }
.way:hover strong { color: var(--link); }
.way:hover::after { color: var(--link); }
.way:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }
.how { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.how strong { display: block; margin-bottom: 4px; font-size: var(--t-headline); font-weight: 600; }
.how span { color: var(--muted); font-size: var(--t-subhead); }
.landing-foot { margin-top: 56px; padding-top: 20px; border-top: 0.5px solid var(--separator); }
.fine { color: var(--muted); font-size: var(--t-footnote); margin: 0; }
.fine + .fine { margin-top: 8px; }
@media (max-width: 900px) {
  .hero-head { grid-template-columns: 1fr; gap: 16px; }
  .landing-split { grid-template-columns: 1fr; gap: 0; }
  .ways { grid-template-columns: 1fr; }
  .hero { aspect-ratio: 2 / 1; }
}
@media (max-width: 520px) {
  .landing-hero, .landing-inner { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .axis-nt i:not(.end) { display: none; }
  .axis-nt b { left: auto; right: 0; transform: none; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row li:nth-child(3) { border-left: 0; }
  .stat-row li:nth-child(n+3) { border-top: 0.5px solid var(--separator); }
}

/* ---------- Presenter mode ---------- */
.presenter[hidden] { display: none; }
body.presenting .site-header, body.presenting .sidebar, body.presenting .context-bar,
body.presenting .legend, body.presenting .viz-tools, body.presenting .tips { display: none !important; }
body.presenting .layout { display: block; height: 100vh; height: 100dvh; }
body.presenting .viz-wrap { position: fixed; inset: 0 0 auto 0; height: 52vh; height: 52dvh; }
.presenter {
  position: fixed; left: 0; right: 0; bottom: 0; top: 52vh; top: 52dvh; z-index: 40;
  display: flex; flex-direction: column; gap: 12px; padding: 20px clamp(16px, 4vw, 56px) 24px;
  background: var(--bg); border-top: 0.5px solid var(--separator); overflow-y: auto;
}
.pres-card { flex: 1; max-width: 1100px; }
.pres-meta { color: var(--muted); font-size: clamp(var(--t-subhead), 1.6vw, 20px); margin: 0 0 4px; }
.pres-title { font-size: clamp(var(--t-title1), 3.6vw, 48px); margin: 0 0 8px; letter-spacing: -0.025em; }
.pres-refs { font-size: clamp(var(--t-title3), 2.2vw, 28px); font-weight: 600; color: var(--highlight); margin: 0 0 10px; }
.pres-note { font-size: clamp(var(--t-body), 2vw, 26px); line-height: 1.45; margin: 0 0 10px; }
.pres-question { font-size: clamp(var(--t-callout), 1.8vw, 22px); font-style: italic; color: var(--muted); margin: 0; }
.pres-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.pres-controls .btn { min-width: 128px; }

/* ---------- Toast and dialogs ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--overlay); color: var(--text); padding: 10px 18px; border-radius: 999px; font-weight: 600;
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog {
  max-width: min(560px, calc(100vw - 32px)); width: 100%; padding: 0;
  background: var(--surface); color: var(--text); border: 0; border-radius: 14px; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-inner { padding: 24px; max-height: 85vh; overflow-y: auto; }
.dialog-inner h2 { margin-top: 0; font-size: var(--t-title2); letter-spacing: -0.02em; }
.dialog-inner h3 { font-size: var(--t-headline); margin: 20px 0 8px; }
.dialog-inner ul { padding-left: 20px; margin: 0 0 12px; }
.dialog-inner li { margin-bottom: 6px; }
.credit-line { font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { :root { --sidebar: 344px; } }
@media (max-width: 860px) {
  .layout { display: block; height: auto; }
  .viz-wrap { height: clamp(320px, 62vw + 130px, 60svh); border-bottom: 0.5px solid var(--separator); }
  .sidebar { border-left: 0; overflow: visible; }
  .legend { font-size: 11px; }
  .legend .grad { width: 80px; }
  /* a blurred header would become the containing block for the fixed tab bar, so use a solid one here */
  .site-header { position: sticky; top: 0; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  /* iPhone and iPad portrait: main sections move to a bottom tab bar */
  :root { --tabbar-h: calc(50px + env(safe-area-inset-bottom)); }
  body { padding-bottom: var(--tabbar-h); }
  .header-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; gap: 0; flex-wrap: nowrap; justify-content: space-around;
    padding: 0 4px env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 0.5px solid var(--separator);
    -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  }
  .site-header .nav-btn.btn {
    flex: 1; min-width: 0; min-height: 50px; padding: 5px 0 3px; border-radius: 0; flex-direction: column; gap: 2px;
    color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 0.01em;
  }
  .site-header .nav-btn .icon { display: block; width: 24px; height: 24px; }
  .site-header .nav-btn.icon-nav .nav-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .site-header .nav-btn.btn[aria-pressed="true"] { color: var(--link); background: transparent; font-weight: 600; }
  .site-header .nav-btn.btn:hover { background: transparent; color: var(--text); }
  .site-header .about-btn { color: var(--link); }
  .toast { bottom: calc(var(--tabbar-h) + 16px); }
  .tips { left: 8px; right: 8px; bottom: 92px; max-width: none; padding: 12px 14px; }
  .tips ul { font-size: var(--t-footnote); }
}
@media (max-width: 640px) {
  .ctx-list { order: 3; flex-basis: 100%; }
  .ctx-label { flex: 1; }
  .ctx-reset { margin-left: 0; }
  .how { grid-template-columns: 1fr; gap: 16px; }
  .landing-actions .btn { flex: 1 1 100%; }
  .path-form { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .stat-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .site-header, .context-bar, .viz-tools, .legend, .tooltip, .tips, .toast { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}
@media (forced-colors: active) {
  .conn-item[aria-current="true"], .segmented label:has(input:checked), .nav-btn[aria-pressed="true"] { outline: 2px solid Highlight; }
  .heat-cell { forced-color-adjust: none; }
  input.switch { appearance: auto; -webkit-appearance: auto; width: 20px; height: 20px; }
  input.switch::after { display: none; }
}

/* Searchable translation picker */
.vpick { position: relative; }
.vpick-input {
  width: 100%; min-height: 44px; padding: 8px 36px 8px 12px; color: var(--text); font-size: var(--t-body);
  background: var(--surface-2); border: 0.5px solid var(--separator); border-radius: var(--radius-s);
  text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.vpick-input::placeholder { color: var(--muted); }
.vpick-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); max-height: min(320px, 50vh); overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface-2); color: var(--text);
  border: 0.5px solid var(--border-strong); border-radius: var(--radius-s); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.vpick-list [role=option] { padding: 10px; min-height: 44px; border-radius: 6px; cursor: pointer; font-size: var(--t-subhead); display: flex; align-items: center; }
.vpick-list [role=option][aria-selected=true] { font-weight: 600; }
.vpick-list [role=option].active, .vpick-list [role=option]:hover { background: var(--accent); color: #fff; }
.vpick-group { padding: 10px 10px 4px; font-size: var(--t-footnote); font-weight: 600; color: var(--muted); }
.vpick-empty { padding: 10px; color: var(--muted); }

/* Passage explorer */
.study-sec { margin-top: 20px; padding-top: 4px; border-top: 0.5px solid var(--separator); }
.study-sec h4 { font-size: var(--t-subhead); margin: 14px 0 6px; color: var(--muted); }
.book-intro { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; }
.reflect { padding-left: 1.4em; }
.reflect li { margin: 6px 0; }
ol.orig { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.orig-word {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; min-height: 44px; padding: 6px 8px;
  background: var(--surface-2); color: var(--text); border: 0.5px solid var(--separator); border-radius: var(--radius-s); font: inherit; text-align: center;
}
button.orig-word { cursor: pointer; }
button.orig-word:hover { border-color: var(--accent); }
.o-word { font-size: 1.35rem; line-height: 1.3; }
.orig.rtl .o-word { font-family: 'SBL Hebrew', 'Ezra SIL', 'Noto Serif Hebrew', 'Times New Roman', serif; font-size: 1.5rem; }
.o-tr { font-size: var(--t-footnote); color: var(--muted); font-style: italic; }
.o-gl { font-size: var(--t-footnote); max-width: 9em; }

/* Word study */
.word-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.word-facts div { background: var(--surface-2); border-radius: var(--radius-s); padding: 8px 10px; }
.word-facts dt { font-size: var(--t-footnote); color: var(--muted); }
.word-facts dd { margin: 2px 0 0; font-weight: 600; }
.sense-list { list-style: none; padding: 0; margin: 0; }
.book-bars { list-style: none; padding: 0; margin: 8px 0; }
.book-bars li { display: grid; grid-template-columns: 9em 1fr 3em; align-items: center; gap: 8px; min-height: 32px; }
.book-bars .bar { height: 10px; border-radius: 5px; background: var(--accent); width: var(--w); }
.book-bars .count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
table.forms { width: 100%; border-collapse: collapse; font-size: var(--t-subhead); }
table.forms th, table.forms td { text-align: left; padding: 6px 4px; border-bottom: 0.5px solid var(--separator); vertical-align: top; }
table.forms td[lang="he"], table.forms td[lang="arc"] { font-size: 1.2rem; }
table.forms td:last-child, table.forms th:last-child { text-align: right; }
details.lexicon { margin-top: 16px; background: var(--surface-2); border-radius: var(--radius); padding: 8px 12px; }
details.lexicon summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
details.lexicon div { font-size: var(--t-subhead); line-height: 1.55; margin-top: 8px; overflow-wrap: anywhere; }

/* Listen (audio Bible) button: a square headphones icon */
.btn.listen { min-width: 44px; min-height: 40px; padding: 8px 10px; justify-content: center; }
.btn.listen .icon { width: 20px; height: 20px; }

/* My notes */
#verseNote, .notes-list textarea {
  width: 100%; min-height: 96px; padding: 10px 12px; font: inherit; font-size: var(--t-body); line-height: 1.5; color: var(--text);
  background: var(--surface-2); border: 0.5px solid var(--separator); border-radius: var(--radius-s); resize: vertical;
}
#verseNote:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; }
.notes-list { list-style: none; padding: 0; margin: 0; }
.notes-list li { padding: 12px 0; border-bottom: 0.5px solid var(--separator); }
.notes-list p { margin: 4px 0 8px; white-space: pre-wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }

/* Places map */
.places-map { display: block; width: 100%; border-radius: var(--radius); margin: 12px 0; cursor: pointer; }
.places-map.mini { cursor: default; }

/* Easier-to-read font: Atkinson Hyperlegible (SIL Open Font License), loaded only when turned on */
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Atkinson Hyperlegible'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root[data-readable="on"] {
  --font: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
:root[data-readable="on"] body { letter-spacing: 0.01em; word-spacing: 0.04em; }

/* Text size */
:root[data-textsize="large"] {
  --t-large: 38px; --t-title1: 32px; --t-title2: 25px; --t-title3: 23px; --t-headline: 19px; --t-body: 19px;
  --t-callout: 18px; --t-subhead: 17px; --t-footnote: 15px; --t-caption: 14px;
}
:root[data-textsize="xlarge"] {
  --t-large: 42px; --t-title1: 36px; --t-title2: 28px; --t-title3: 26px; --t-headline: 22px; --t-body: 22px;
  --t-callout: 21px; --t-subhead: 20px; --t-footnote: 17px; --t-caption: 16px;
}

/* Choosing between arcs that lie close together */
.arc-picker {
  position: absolute; z-index: 30; width: min(320px, calc(100% - 16px)); padding: 12px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 0.5px solid var(--border-strong); box-shadow: var(--shadow);
}
.arc-picker p { margin: 0 0 8px; font-size: var(--t-subhead); font-weight: 600; }
.arc-picker ul { list-style: none; margin: 0 0 6px; padding: 0; }
.arc-picker li button {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px; text-align: left;
  background: none; border: 0; border-radius: var(--radius-s); color: var(--text); font: inherit; font-size: var(--t-subhead); cursor: pointer;
}
.arc-picker li button:hover, .arc-picker li button:focus-visible { background: var(--surface-2); outline: 2px solid var(--link); outline-offset: -2px; }
.arc-picker .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.arc-picker .votes { margin-left: auto; color: var(--muted); font-size: var(--t-footnote); font-variant-numeric: tabular-nums; }
.arc-picker .link-btn { min-height: 44px; }

/* Words in common */
.common-words { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.common-words li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.common-words strong { min-width: 6em; text-transform: capitalize; }

/* Arc colour styles in Settings */
.arc-styles { display: grid; gap: 6px; }
.arc-style { display: grid; grid-template-columns: auto 72px 1fr; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; border-radius: var(--radius-s); cursor: pointer; }
.arc-style:has(input:checked) { background: var(--surface-2); }
.arc-style input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.arc-swatch { height: 12px; border-radius: 6px; }

#aboutTitle:focus { outline: none; }
#aboutTitle:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 4px; }

/* ---------- Animations (desktop only, set by data-motion) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ease-in-panel { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
:root[data-motion="on"] .landing.play .hero-head h2 { animation: rise 0.7s cubic-bezier(.2, .7, .2, 1) both; }
:root[data-motion="on"] .landing.play .hero-side { animation: rise 0.7s 0.12s cubic-bezier(.2, .7, .2, 1) both; }
:root[data-motion="on"] .landing.play .landing-search { animation: rise 0.6s 0.4s cubic-bezier(.2, .7, .2, 1) both; }
:root[data-motion="on"] .landing .reveal { transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2, .7, .2, 1); }
:root[data-motion="on"] .landing .reveal:not(.in) { opacity: 0; transform: translateY(24px); }
:root[data-motion="on"] .panel-enter { animation: ease-in-panel 0.28s ease-out; }
:root[data-motion="on"] .way strong, :root[data-motion="on"] .way::after { transition: color 0.15s, transform 0.2s; }
:root[data-motion="on"] .way:hover::after { transform: translateX(4px); }
:root[data-motion="on"] .chip, :root[data-motion="on"] .btn { transition: background-color 0.15s, transform 0.15s, box-shadow 0.15s; }
:root[data-motion="on"] .btn:active, :root[data-motion="on"] .chip:active { transform: scale(0.97); }
:root[data-motion="on"] .arc-picker:not([hidden]) { animation: ease-in-panel 0.18s ease-out; }
@media (prefers-reduced-motion: reduce) {
  :root[data-motion="on"] *, :root[data-motion="on"] *::before, :root[data-motion="on"] *::after { animation: none !important; transition: none !important; }
}

/* Search suggestions */
.suggest-list { top: calc(100% + 4px); }
.suggest-list [role=option] { justify-content: space-between; gap: 12px; }
.suggest-list [role=option].active .muted, .suggest-list [role=option]:hover .muted { color: #fff; }
/* How are you feeling? */
.feelings .chip-list { margin-bottom: 12px; }
.surprise-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 0; }
/* Keyboard shortcuts */
table.keys { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
table.keys th, table.keys td { text-align: left; padding: 8px 6px; border-bottom: 0.5px solid var(--separator); vertical-align: middle; font-weight: 400; }
table.keys th { white-space: nowrap; width: 1%; padding-right: 16px; }
kbd { display: inline-block; min-width: 1.8em; padding: 2px 6px; border-radius: 6px; border: 0.5px solid var(--border-strong); background: var(--surface-2); font: 600 var(--t-footnote) var(--font); text-align: center; }
#keysTitle:focus { outline: none; }

/* Grammar under original words */
.orig-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.o-gr { display: none; font-size: var(--t-caption); color: var(--muted); max-width: 10em; line-height: 1.3; }
.show-grammar .o-gr { display: block; }

/* Timeline */
.tl-era-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
ol.timeline { list-style: none; margin: 0 0 8px; padding: 0 0 0 18px; border-left: 2px solid var(--separator); }
ol.timeline li { position: relative; padding: 8px 0 14px; }
ol.timeline li::before { content: ''; position: absolute; left: -25px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--link); box-shadow: 0 0 0 3px var(--bg); }
.tl-when { margin: 0; font-size: var(--t-footnote); color: var(--muted); }
.tl-title { margin: 2px 0 6px; font-weight: 600; font-size: var(--t-headline); }

/* Footer links on the welcome page */
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 12px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: var(--t-subhead); }
