:root {
  color-scheme: light;
  --surface-0: #f4f3ef;
  --surface-1: #fcfcfb;
  --border: #e2e0d9;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --accent: #2a78d6;
  --stage-1: #86b6ef;
  --stage-2: #3987e5;
  --stage-3: #1c5cab;
  --stage-4: #0d366b;
  --known: #2a78d6;
  --new: #eb6834;
  --track: #e9e7e1;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--surface-0);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
/* The hidden attribute always wins: classes like .chip set display, which would otherwise override it. */
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; gap: 16px; flex-wrap: nowrap;
  padding: 14px 24px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text-primary); text-decoration: none; letter-spacing: -0.01em; }
.brand em { font-style: normal; color: var(--accent); }
.search { position: relative; margin-left: auto; width: min(320px, 100%); }
.search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-0); font: inherit;
}
.search-results {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; z-index: 30;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08); max-height: 360px; overflow: auto;
}
.search-results button {
  display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px;
}
.search-results button:hover, .search-results button:focus { background: var(--surface-0); outline: none; }
.search-results small { color: var(--text-muted); }

/* ---------- index page ---------- */
.hero { max-width: 880px; margin: 0 auto; padding: 56px 24px 24px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero p { color: var(--text-secondary); font-size: 18px; max-width: 640px; }
.topics { max-width: 880px; margin: 0 auto; padding: 0 24px 64px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.topic-card {
  display: block; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.topic-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.topic-card h2 { margin: 0 0 4px; font-size: 22px; }
.topic-card .meta { color: var(--text-muted); font-size: 14px; }
.topic-card .sample { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.topic-card.placeholder { border-style: dashed; color: var(--text-muted); }
.chip {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-0); border: 1px solid var(--border); color: var(--text-secondary); white-space: nowrap;
}

/* ---------- topic page ---------- */
.topic-head { max-width: 1280px; margin: 0 auto; padding: 24px 24px 0; }
.topic-head h1 { margin: 0; font-size: 34px; letter-spacing: -0.02em; }
.topic-head .tagline { color: var(--text-secondary); margin: 4px 0 0; }
.tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--text-primary); font-weight: 600; }
.layout { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.panel {
  /* --header-h is the sticky header's real height (set by common.js): it wraps to two rows on narrower screens. */
  position: sticky; top: calc(var(--header-h, 70px) + 12px); background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; max-height: calc(100dvh - var(--header-h, 70px) - 24px); overflow: auto;
}
.panel .empty { color: var(--text-muted); }
.panel h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.panel .aka { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.panel .tags { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.panel .pic { margin: 8px 0; }
.panel .pic figcaption { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.panel .pic figcaption a { color: var(--text-muted); }
.panel img, .panel .pic video { width: 100%; max-height: 280px; object-fit: contain; border-radius: 8px; background: var(--surface-0); }
.panel .def { font-size: 16px; }
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 20px 0 8px; }
.panel .related { display: flex; flex-wrap: wrap; gap: 6px; }
.panel .source { font-size: 13px; color: var(--text-muted); margin-top: 16px; }
.panel .close { display: none; }
.panel-head { position: sticky; top: -20px; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin: -20px -20px 0; padding: 18px 20px 10px; background: var(--surface-1); border-bottom: 1px solid transparent; }
.panel-head h2 { min-width: 0; overflow-wrap: anywhere; }
.panel h3 small { font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.related .more-related { font-weight: 600; color: var(--accent); border-style: dashed; }
.wordlink {
  border: 0; background: none; padding: 0; color: var(--text-primary); font: inherit;
  border-bottom: 1px dashed var(--accent); cursor: pointer;
}
.wordlink:hover { color: var(--accent); }
.related .chip { cursor: pointer; }
.related .chip:hover { border-color: var(--accent); color: var(--text-primary); }

.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.stage-pill i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* know toggle */
.know { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.know button { border: 0; background: var(--surface-1); padding: 4px 10px; font-size: 13px; color: var(--text-secondary); }
.know button + button { border-left: 1px solid var(--border); }
.know button[aria-pressed="true"].k { background: var(--known); color: #fff; }
.know button[aria-pressed="true"].n { background: var(--new); color: #fff; }

/* top 50 */
.top50 { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.top50 li {
  display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 12px; align-items: start;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
}
.top50 li.selected, .path-row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.top50 .rank { font-variant-numeric: tabular-nums; color: var(--text-muted); font-weight: 600; padding-top: 1px; }
.top50 .term { font-weight: 650; font-size: 17px; }
.top50 .term button { all: unset; cursor: pointer; }
.top50 .term button:hover { color: var(--accent); }
.top50 .d { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }
.intro { color: var(--text-secondary); margin: 0 0 16px; max-width: 720px; }

/* learning path */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .sub { color: var(--text-secondary); font-size: 14px; margin: 0 0 14px; }
.quiz { display: grid; gap: 12px; }
.quiz .q-term { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.quiz .q-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quiz .q-def { color: var(--text-secondary); min-height: 1.5em; }
.quiz .q-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--border); background: var(--surface-1); border-radius: 8px; padding: 8px 14px; }
.btn.primary { background: var(--known); border-color: var(--known); color: #fff; }
.btn.warn { background: var(--new); border-color: var(--new); color: #fff; }
.btn kbd { font-size: 11px; opacity: .75; margin-left: 6px; font-family: inherit; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; }
.area { display: grid; gap: 4px; background: none; border: 0; padding: 4px 0; text-align: left; color: inherit; }
.area .row { display: flex; justify-content: space-between; font-size: 14px; }
.area .row b { font-weight: 600; }
.area .row span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bar { display: flex; gap: 2px; height: 10px; background: none; }
.bar i { display: block; height: 100%; border-radius: 3px; }
.bar .k { background: var(--known); }
.bar .n { background: var(--new); }
.bar .u { background: var(--track); }
.area.active .row b { color: var(--accent); }
.gap-note { margin-top: 14px; font-size: 14px; color: var(--text-secondary); }
.stage { margin-bottom: 28px; }
.stage-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.stage-head h2 { margin: 0; font-size: 22px; }
.stage-head .sub { color: var(--text-secondary); font-size: 14px; }
.stage .bar { margin: 8px 0 12px; max-width: 480px; }
.path-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.path-row {
  display: grid; grid-template-columns: 40px minmax(0,1fr) auto auto; gap: 10px; align-items: center;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
}
.path-row .num { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.path-row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-row .t button { all: unset; cursor: pointer; }
.path-row .t button:hover { color: var(--accent); }
.path-row.is-k .t { color: var(--text-muted); font-weight: 500; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 14px; }
.filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--text-secondary); }
.filters select, .filters input[type=text] { font: inherit; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-1); }

/* graph */
.graph-wrap { position: relative; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
#graph { height: calc(100vh - 290px); min-height: 460px; }
.graph-wrap .legend { position: absolute; left: 12px; bottom: 4px; background: rgba(252,252,251,.9); padding: 6px 10px; border-radius: 8px; }
.graph-wrap .legend i { border-radius: 50%; }
.graph-tip { max-width: 280px; font: 13px/1.4 ui-sans-serif, system-ui, sans-serif; color: var(--text-primary); }
.graph-tip b { font-size: 15px; display: block; }
.float-tooltip-kap { background: var(--surface-1) !important; color: var(--text-primary) !important; border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,.12); border-radius: 8px !important; padding: 8px 10px !important; }

/* a-z */
.az-letters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.az-letters a { text-decoration: none; padding: 2px 7px; border-radius: 6px; background: var(--surface-1); border: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
.az h3 { margin: 18px 0 6px; font-size: 18px; scroll-margin-top: 80px; }
.az dl { margin: 0; }
.az dt { font-weight: 600; margin-top: 10px; }
.az dt button { all: unset; cursor: pointer; }
.az dt button:hover { color: var(--accent); }
.az dd { margin: 2px 0 0; color: var(--text-secondary); font-size: 14px; }

.footer { max-width: 1280px; margin: 0 auto; padding: 0 24px 32px; color: var(--text-muted); font-size: 13px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 60vh; border-radius: 16px 16px 0 0; z-index: 40; box-shadow: 0 -8px 30px rgba(0,0,0,.15); display: none; }
  .panel.open { display: block; }
  .panel .close { display: block; flex-shrink: 0; border: 0; background: none; font-size: 22px; color: var(--text-muted); padding: 2px; margin: -2px -6px 0 0; }
  .panel-head { border-bottom-color: var(--border); }
  .path-row { grid-template-columns: 34px minmax(0,1fr) auto; }
  .path-row .chip { display: none; }
  .top50 li { grid-template-columns: 28px minmax(0,1fr); }
  .top50 li .know { grid-column: 2; justify-self: start; }
  #graph { height: 60vh; }
}

/* ---------- shared search results (links grouped by kind) ---------- */
.search-results a { display: block; padding: 7px 12px; color: var(--text-primary); text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--surface-0); outline: none; }
.sr-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: 8px 12px 2px; }
.sr-empty { padding: 8px 12px; color: var(--text-muted); }
.crumbs { font-size: 14px; color: var(--text-muted); }
.crumbs a { color: var(--text-secondary); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------- landing ---------- */
.hero-search { margin: 24px 0 0; width: min(640px, 100%); }
.hero-search input { font-size: 18px; padding: 14px 16px; border-radius: 12px; background: var(--surface-1); }
.explore { max-width: 1100px; margin: 0 auto; padding: 8px 24px 48px; }
.explore-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 22px; margin: 28px 0 8px; letter-spacing: -0.01em; }
.domain { margin-top: 20px; }
.domain-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.domain-head h3 { margin: 0; font-size: 18px; }
.sub { color: var(--text-secondary); font-size: 14px; }
.topic-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
article.topic-card { padding: 0; overflow: hidden; }
article.topic-card:hover { transform: none; }
.topic-link { display: block; padding: 18px 20px 8px; color: inherit; text-decoration: none; }
.topic-link:hover h4 { color: var(--accent); }
.topic-card h4 { margin: 0; font-size: 22px; }
.topic-card .tagline { color: var(--text-secondary); margin: 6px 0 0; font-size: 14px; }
.topic-card .mine { color: var(--known); font-weight: 600; }
.areas-drill { border-top: 1px solid var(--border); margin: 10px 0 0; }
.areas-drill summary { cursor: pointer; padding: 10px 20px; font-size: 14px; color: var(--text-secondary); }
.areas-drill ul { list-style: none; margin: 0; padding: 0 20px 12px; display: grid; gap: 6px; }
.areas-drill li a { text-decoration: none; color: var(--text-primary); }
.areas-drill li a:hover b { color: var(--accent); }
.areas-drill li small { color: var(--text-muted); }
.areas-drill .sample { display: block; font-size: 13px; color: var(--text-muted); }
.sample-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 20px 16px; }
.bridge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.bridge { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.bridge > b { font-size: 18px; }
.bridge a { color: var(--text-secondary); text-decoration: none; font-size: 14px; }
.bridge a:hover { color: var(--text-primary); }

/* ---------- topic overview ---------- */
.ov-head { margin-bottom: 4px; }
.ov-progress { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; }
.ov-progress .row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.ov-progress .row span { color: var(--text-muted); }
.ov-progress .legend { margin: 0; align-items: center; }
.area-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.area-card {
  text-align: left; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; display: grid; gap: 6px; color: inherit;
}
.area-card:hover { border-color: var(--accent); }
.area-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.area-card .row { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.area-card .row span { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.area-card .sample { font-size: 13px; color: var(--text-secondary); min-height: 2.6em; }
.path-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; scroll-margin-top: 80px; }
.path-head + .sub { margin: 0 0 12px; }
.stage-head h3 { margin: 0; font-size: 20px; }

/* ---------- quiz ---------- */
.quiz-setup { display: grid; gap: 10px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick-label { font-size: 13px; color: var(--text-muted); width: 56px; }
.pick { border: 1px solid var(--border); background: var(--surface-1); border-radius: 999px; padding: 3px 10px; font-size: 13px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center; }
.pick.on { background: var(--text-primary); border-color: var(--text-primary); color: #fff; }
.pick .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.redo { font-size: 14px; color: var(--text-secondary); display: inline-flex; gap: 6px; align-items: center; }

/* ---------- cross-topic ---------- */
.elsewhere { display: grid; gap: 8px; }
.elsewhere a { display: block; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; text-decoration: none; color: var(--text-primary); font-size: 14px; }
.elsewhere a:hover { border-color: var(--accent); }
.elsewhere a span { display: block; color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
#graph.graph-all { height: calc(100vh - 250px); min-height: 520px; }
.graph-tip small { color: var(--text-muted); display: block; }
.btn.more { margin-top: 8px; font-size: 14px; }
.panel .provenance { font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.panel .provenance a { color: var(--text-secondary); }

/* Subtopics: a big topic split into smaller learning paths. */
a.area-card { display: block; color: inherit; text-decoration: none; }
.subtopic-cards { margin-bottom: 18px; }
.topic-card .subtopics { font-size: 13px; margin: 0; padding: 0 20px 8px; line-height: 1.6; }
.topic-card .subtopics small { color: var(--text-muted); }
.parent-note { margin: 4px 0 10px; }

/* ---------- scaling update: random, search filters, compact home index, clickable word cards ---------- */

.search-results { max-height: min(70vh, 560px); overflow-y: auto; }
.search-results a { display: block; padding: 8px 12px; color: var(--text-primary); text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--surface-0); outline: none; }
/* Search scope: "in Chess ×" inside the box. Topics in the results open their page (name) or become the scope ("Search in"). */
.search.scoped { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-0); padding-left: 6px; }
.search.scoped input { border: 0; background: transparent; padding-left: 4px; min-width: 0; flex: 1; }
.search.scoped input:focus { outline: none; }
.search.scoped:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.scope-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 55%; flex-shrink: 0; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.scope-chip[hidden] { display: none; }
.scope-label { overflow: hidden; text-overflow: ellipsis; }
.scope-chip button { border: 0; background: none; padding: 2px; display: inline-flex; color: var(--text-muted); border-radius: 50%; }
.scope-chip button:hover { color: var(--text-primary); background: var(--surface-0); }
.sr-topic { display: flex; align-items: center; }
.sr-topic a { flex: 1; min-width: 0; }
.search-results .sr-scope { display: inline-block; width: auto; flex-shrink: 0; margin-right: 8px; border: 1px solid var(--border); background: var(--surface-1); border-radius: 6px; padding: 3px 8px; font-size: 13px; color: var(--text-secondary); }
.search-results .sr-scope:hover { background: var(--surface-1); border-color: var(--accent); color: var(--accent); }
.sr-empty .sr-scope { margin-left: 6px; }
.sr-word .sr-def { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.word-card { cursor: pointer; }
.top50 li.word-card:hover, .path-row.word-card:hover { border-color: var(--accent); }
.az dt.word-card:hover button, .az dd.word-card:hover { color: var(--accent); }

.explore-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.explore-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.domain.compact { padding: 14px 0 6px; border-top: 1px solid var(--border); }
.domain.compact .domain-head { margin-bottom: 6px; }
.topic-list { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 6px 22px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.topic-list li { line-height: 1.35; }
.topic-list a { text-decoration: none; }
.topic-list a:hover b { text-decoration: underline; }
.topic-list small { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.topic-list .subs { font-size: 13px; margin-top: 1px; }
.topic-list .subs a { color: var(--text-secondary); }
.domain-more { margin: 6px 0 4px; }
.domain-more > summary { cursor: pointer; font-size: 14px; color: var(--text-muted); padding: 4px 0; }
.domain-more[open] > summary { margin-bottom: 10px; }
.bridge-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px 22px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.bridge-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.bridge-list a.chip { text-decoration: none; }
.bridge-list a.chip:hover { border-color: var(--accent); color: var(--text-primary); }
@media (max-width: 700px) {
  .explore-actions { margin-left: 0; }
}
.shared-list details { border-top: 1px solid var(--border); padding: 6px 0; }
.shared-list summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.shared-list summary small { color: var(--text-muted); margin-left: auto; }
.shared-list .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.shared-list ul { margin: 6px 0 4px; padding-left: 18px; font-size: 14px; }
.shared-list li { margin: 3px 0; }
.shared-list li small { color: var(--text-muted); }

/* Grid children default to min-width:auto, so a long unbreakable row (graph filters) could widen the page. */
.layout > main { min-width: 0; }
.filters label { white-space: normal; }
.credits { max-width: 860px; margin: 0 auto; padding: 24px 24px 60px; }
.credits h2 { margin-top: 28px; }
.credits h3 { margin: 22px 0 6px; font-size: 16px; }
.credit-topics { padding-left: 18px; font-size: 14px; line-height: 1.6; }
.credit-topics small { color: var(--text-muted); }

/* ---------- toolbar: always one row ----------
   wordmark (shortens with …) · short nav · Random · search (takes the remaining width).
   On phones the nav hides, Random becomes compact and search is an icon that expands over the header. */
.site-header .brand { min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav { display: flex; gap: 14px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
.site-nav a { color: var(--text-secondary); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.site-header .search { margin-left: auto; width: auto; flex: 0 1 340px; min-width: 150px; }
.search-toggle { display: none; }
.topic-crumbs { margin-bottom: 6px; }
/* Narrow screens: the page links move into a Menu button (common.js mountMenu), so every page stays reachable. */
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .site-header { position: sticky; }
  .site-nav { display: none; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); font-size: 18px; color: var(--text-secondary); }
  .site-header.menu-open .site-nav { display: flex; flex-direction: column; gap: 0; position: absolute; top: calc(100% - 4px); right: 14px;
    min-width: 180px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 35; font-size: 15px; }
  .site-header.menu-open .site-nav a { display: block; padding: 9px 12px; border-radius: 6px; }
  .site-header.menu-open .site-nav a:hover { background: var(--surface-0); }
}
@media (max-width: 640px) {
  .site-header { gap: 10px; padding: 10px 14px; }
  .site-header .search { flex: 0 0 auto; min-width: 0; }
  .site-header .search input { display: none; }
  .search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1); font-size: 16px; cursor: pointer; }
  .site-header.searching .brand, .site-header.searching .menu-toggle { display: none; }
  .site-header.searching .search { flex: 1 1 auto; }
  .site-header.searching .search input { display: block; }
  .site-header.searching .search-toggle { display: none; }
  .site-header:not(.searching) .search.scoped { border: 0; background: none; padding: 0; outline: none; }
  .site-header:not(.searching) .scope-chip { display: none; }
}

/* ---------- learning aids ---------- */
.aids .aid { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 4px; }
.aid-board { width: 100%; max-width: 320px; display: block; border-radius: 6px; }
.aid-move { font-size: 14px; margin: 8px 0 4px; min-height: 2.6em; }
.aid-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.aid-controls button { border: 1px solid var(--border); background: var(--surface-1); border-radius: 6px; padding: 4px 9px; font: inherit; font-size: 14px; cursor: pointer; }
.aid-controls button:hover { border-color: var(--accent); }
.aid-pos { font-size: 13px; color: var(--text-muted); margin-left: 4px; }
.aid-svg svg, .aid-frame svg { width: 100%; height: auto; display: block; }
.aid-caption, .aid-credit { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; }
.aid-text { font-size: 14px; margin: 8px 0 4px; min-height: 2.8em; }
.aid-video { display: inline-block; margin-top: 8px; font-size: 14px; }
.aid-html { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.aid-viz { width: 100%; display: block; }
.aid-code { font-size: 12.5px; background: #1f2328; color: #e6e6e6; padding: 10px; border-radius: 8px; overflow-x: auto; margin-top: 8px; }
.aid-code span { display: block; padding: 0 4px; border-radius: 3px; }
.aid-code span.on { background: #3d4b5c; color: #fff; }
.word-card .has-aid { font-size: 12px; color: var(--accent); margin-left: 6px; }
.aid-img { width: 100%; height: auto; display: block; border-radius: 8px; background: #fff; }
.aid-anim canvas { width: 100%; height: auto; display: block; border-radius: 8px; }
.aid-controls input[type=range] { flex: 1; min-width: 80px; }
.aid-staff { width: 100%; height: auto; display: block; background: #fff; border-radius: 8px; }
.aid-vars { border-collapse: collapse; font: 13px ui-monospace, monospace; margin: 6px 0; }
.aid-vars th, .aid-vars td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; }
.aid-vars tr.on td { background: #fdf0d2; }
.aid-out { font-size: 12.5px; background: #f6f5f1; padding: 8px; border-radius: 6px; margin: 6px 0; white-space: pre-wrap; }

/* inline SVG icons (common.js FWF.icon) */
.icon { width: 1em; height: 1em; vertical-align: -0.14em; flex: none; }
.aid-controls button { display: inline-flex; align-items: center; gap: 5px; }
.search-toggle .icon { width: 18px; height: 18px; }
.panel .close .icon { width: 20px; height: 20px; }
.provenance .icon, .aid-video .icon { width: 0.85em; height: 0.85em; }
.aid-caption, .aid-text, .aid-move { overflow-wrap: anywhere; }
.aid-vars td { white-space: pre-wrap; }  /* values like "   14.00" keep their spaces */
