:root {
  --bg: #fafafb;
  --surface: #ffffff;
  --ink: #0e0f13;
  --muted: #5f6470;
  --faint: #989ea9;
  --line: #ececf0;
  --line-strong: #e0e1e7;
  /* primary: green (growth); brown marks origin / PIE */
  --accent: #15803d;
  --accent-ink: #166534;
  --accent-weak: #e2f3e7;
  --root: #7c4a1e;
  --root-weak: #f5ecdf;
  /* age ramp, oldest → newest: brown roots to green shoots */
  --native: #7c4a1e;  --native-bg: #f5ecdf;
  --norse:  #96611b;  --norse-bg:  #f7edda;
  --latin:  #7d6512;  --latin-bg:  #f3eed6;
  --french: #4d7c0f;  --french-bg: #edf3da;
  --greek:  #15803d;  --greek-bg:  #e2f3e7;
  --other:  #64748b;  --other-bg:  #edf0f4;
  --oldfrench: #4d7c0f; --oldfrench-bg: #edf3da;
  --shadow-sm: 0 1px 2px rgba(14,15,19,.04);
  --shadow-md: 0 2px 8px rgba(14,15,19,.04), 0 12px 32px rgba(14,15,19,.06);
  --shadow-lg: 0 4px 12px rgba(14,15,19,.05), 0 24px 64px rgba(14,15,19,.12);
  --r: 16px;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Instrument Sans", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* soft accent glow behind the hero */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(560px 320px at 50% -60px, rgba(21,128,61,.06), transparent 70%),
    radial-gradient(900px 480px at 85% -120px, rgba(77,124,15,.045), transparent 70%);
}

.mono, .serif {
  font-family: var(--display);
  font-style: normal;
  font-weight: 500;
  letter-spacing: .01em;
}

.app {
  max-width: 860px; margin: 0 auto; padding: 0 24px;
  min-height: 100dvh; display: flex; flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: -.01em; color: var(--ink); text-decoration: none;
}
.logo { width: 22px; height: 22px; flex: none; }

/* burger (mobile only) */
.nav-toggle { display: none; }
.burger {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
}
.burger span {
  width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle:checked ~ .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle:checked ~ .burger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.topbar-tag {
  font-size: .8rem; color: var(--faint); letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}
.nav { display: flex; gap: 4px; }
.nav a {
  font-size: .88rem; font-weight: 500; color: var(--muted); text-decoration: none;
  padding: 7px 13px; border-radius: 999px;
  transition: color .12s, background .12s;
}
.nav a:hover { color: var(--ink); background: var(--line); }
.nav a.active { color: var(--accent-ink); background: var(--accent-weak); }

/* ---------- Hero ---------- */
.headline {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.12;
  letter-spacing: -.025em;
  margin: 0 0 10px;
}
.headline em {
  font-style: normal;
  background: linear-gradient(100deg, var(--root), var(--accent));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.sub { color: var(--muted); font-size: 1.06rem; line-height: 1.55; margin: 0 0 34px; }
.sub .mono { color: var(--root); font-size: .98em; }

/* ---------- Inner pages ---------- */
.page-head { padding: 56px 0 8px; text-align: center; }
.picker {
  margin: 28px 0 0; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-md); padding: 18px 22px;
  display: flex; flex-direction: column; gap: 14px; text-align: left;
}
.picker-row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.picker-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); text-align: right; padding-top: 8px;
}
.picker-row > .chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.picker .pk {
  font: inherit; font-size: .9rem; font-weight: 500;
  padding: 6px 13px; border-radius: 10px; border: none;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background .12s, color .12s;
}
.picker .pk:hover { background: var(--line); color: var(--ink); }
.picker .pk.current { background: var(--accent); color: #fff; font-weight: 600; }
@media (max-width: 560px) {
  .picker-row { grid-template-columns: 1fr; gap: 4px; }
  .picker-label { text-align: left; padding-top: 0; }
}

/* ---------- Family tree ---------- */
.tree-meta { color: var(--faint); font-size: .88rem; margin: 8px 0 0; }
.tree { margin-top: 24px; overflow-x: auto; }
.tree ul { list-style: none; margin: 0; padding-left: 26px; }
/* top-level branches are full-width sections */
.tree > ul { padding-left: 0; }
.tree > ul > li { padding-left: 0; }
.tree > ul > li::before, .tree > ul > li::after { display: none; }
.tree > ul > li + li { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.tree > ul > li > .t-run > .t-node:first-child .t-form { font-size: 1.12rem; font-weight: 600; }
/* chains flow horizontally and wrap across the panel width */
.t-run { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 4px; }
.t-arrow { color: var(--faint); font-size: .88rem; }
.t-arrow.a1 { color: var(--norse); }
.t-arrow.a2 { color: var(--latin); }
.t-arrow.a3 { color: var(--french); }
.t-arrow.a4 { color: var(--accent); }
.tree li { position: relative; padding: 3px 0 3px 22px; }
/* rounded elbow into the node */
.tree li::before {
  content: ""; position: absolute; left: 0; top: -4px; width: 15px; height: 19px;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  border-bottom-left-radius: 10px;
}
/* continuation rail down to the next sibling */
.tree li:not(:last-child)::after {
  content: ""; position: absolute; left: 0; top: -4px; bottom: 0;
  border-left: 1px solid var(--line-strong);
}
/* connectors age from brown roots to green shoots (after base rules: must win the cascade) */
.tree li.a0::before, .tree li.a0::after { border-color: var(--root); }
.tree li.a1::before, .tree li.a1::after { border-color: var(--norse); }
.tree li.a2::before, .tree li.a2::after { border-color: var(--latin); }
.tree li.a3::before, .tree li.a3::after { border-color: var(--french); }
.tree li.a4::before, .tree li.a4::after { border-color: var(--accent); }
.t-node {
  display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap;
  padding: 2px 8px 2px 0; border-radius: 8px;
}
.t-lang { font-size: .74rem; font-weight: 500; color: var(--faint); letter-spacing: .01em; }
.t-form { font-family: var(--display); font-weight: 500; font-size: 1.04rem; color: var(--ink); letter-spacing: -.005em; }
.t-roman { color: var(--faint); font-size: .84rem; }
.t-node.t-en {
  background: var(--accent-weak); padding: 2px 12px 3px;
}
.t-node.t-en .t-form { color: var(--accent-ink); font-weight: 600; }
.t-node.t-en .t-lang { color: var(--accent); font-weight: 600; }
.t-bor {
  font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--latin); border: 1px solid var(--latin-bg); background: var(--latin-bg);
  padding: 1px 7px; border-radius: 999px; align-self: center;
}

/* ---------- Discovery / doc pages ---------- */
.doc { margin-top: 34px; display: flex; flex-direction: column; gap: 18px; }
.doc .panel { animation: none; overflow-x: auto; }
.doc h2 {
  font-family: var(--display); font-weight: 600; letter-spacing: -.015em;
  font-size: 1.45rem; margin: 4px 0 12px;
}
.doc p { color: var(--muted); line-height: 1.65; margin: 10px 0; }
.doc p b, .doc p i { color: var(--ink); }
.doc a { color: var(--accent-ink); text-decoration: none; }
.doc a:hover { text-decoration: underline; text-underline-offset: 3px; }
.doc .mono { color: var(--root); }
.doc blockquote {
  margin: 16px 0; padding: 14px 20px;
  border-left: 3px solid var(--root); background: var(--root-weak);
  border-radius: 0 12px 12px 0;
  color: var(--ink); font-size: 1.02rem; line-height: 1.6;
}
.cmp { border-collapse: collapse; width: 100%; margin: 14px 0 6px; font-size: .95rem; }
.cmp th, .cmp td { padding: 8px 12px; text-align: left; }
.cmp thead th {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); border-bottom: 1px solid var(--line-strong);
}
.cmp tbody th { font-family: var(--display); font-weight: 500; color: var(--root); white-space: nowrap; }
.cmp tbody tr { border-bottom: 1px solid var(--line); }
.cmp tbody tr:last-child { border-bottom: none; }
.cmp td:last-child { color: var(--accent-ink); font-weight: 600; }

/* ---------- Combobox ---------- */
/* full container width, matching the panels below */
.combo { position: relative; margin: 0 auto; text-align: left; }
.search-field {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 6px 10px 6px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-weak), var(--shadow-md);
}
.search-field .icon { width: 20px; height: 20px; color: var(--faint); flex: none; }
#search {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  font: inherit; font-size: 1.1rem; padding: 14px 0; color: var(--ink);
}
#search::placeholder { color: var(--faint); }
.key {
  flex: none;
  font-family: var(--sans); font-size: .8rem; color: var(--faint);
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 7px; padding: 2px 8px; background: var(--bg);
}
.search-field:focus-within .key,
#search:not(:placeholder-shown) ~ .key { display: none; }
.clear {
  border: none; background: var(--line); color: var(--muted);
  width: 30px; height: 30px; border-radius: 9px; font-size: 1.05rem;
  cursor: pointer; line-height: 1; flex: none;
  transition: background .12s;
}
.clear:hover { background: var(--line-strong); color: var(--ink); }

.suggestions {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0; z-index: 20;
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow-lg);
  max-height: 348px; overflow: auto;
}
.suggestions li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 13px; border-radius: 10px; cursor: pointer;
}
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--accent-weak); }
.sg-word { font-weight: 500; font-size: .98rem; }
.sg-word.mono { color: var(--root); }
.sg-meta { color: var(--faint); font-size: .85rem; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-tag {
  flex: none;
  font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  padding: 3px 8px; border-radius: 999px; background: var(--line); color: var(--muted);
}
.sg-tag.root { background: var(--root-weak); color: var(--root); }

/* ---------- Examples ---------- */
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; }
.examples::before {
  content: "Try"; align-self: center;
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); margin-right: 4px;
}
.examples .ex {
  font: inherit; font-size: .9rem; font-weight: 500;
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted);
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: color .12s, border-color .12s, transform .12s, box-shadow .12s;
}
.examples .ex:hover {
  color: var(--ink); border-color: var(--faint);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.examples .ex .mono { color: var(--root); }

/* ---------- Mythology callout on word pages ---------- */
.myth-note {
  margin-top: 18px; padding: 13px 16px 14px;
  background: var(--root-weak); border-left: 3px solid var(--root);
  border-radius: 0 12px 12px 0;
}
.myth-label {
  font-size: .66rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--root);
}
.myth-body { margin: 5px 0 0; color: var(--muted); line-height: 1.55; font-size: .93rem; }
.myth-god { color: var(--root); font-weight: 600; text-decoration: none; font-family: var(--display); }
.myth-god:hover { text-decoration: underline; text-underline-offset: 3px; }
.myth-conn { color: var(--ink); }

/* ---------- Gods / pantheon ---------- */
.gods-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; margin-top: 34px;
}
.god-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-sm); padding: 20px 20px 18px;
}
.god-name {
  font-family: var(--display); font-weight: 600; letter-spacing: -.015em;
  font-size: 1.25rem; margin: 0 0 4px;
}
.god-blurb { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 0 0 12px; }
.god-chip {
  text-decoration: none; display: inline-block;
  background: var(--accent-weak); color: var(--accent-ink);
}
.god-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.god-chip.nolink { cursor: default; }
.god-chip.nolink:hover { transform: none; box-shadow: none; }

/* ---------- Intro / empty state ---------- */
.intro-title {
  font-family: var(--display); font-weight: 600; letter-spacing: -.015em;
  font-size: 1.45rem; line-height: 1.25; margin: 0 0 10px;
}
.intro .lede { color: var(--muted); line-height: 1.65; margin: 10px 0 18px; font-size: .98rem; }
.intro-eras .stage-gloss { max-width: 620px; }
.intro-eras .lang { font-size: .72rem; }
.intro-chain { margin-top: 4px; }
.intro-chain .t-form { font-size: 1.15rem; }
/* .intro scope so the later .more-btn padding shorthand can't re-indent it */
.intro .intro-go { padding: 14px 0 0; margin: 0; font-size: .92rem; }

/* ---------- Word of the day ---------- */
#wotd { display: flex; justify-content: center; margin-top: 30px; }
#wotd[hidden] { display: none; }
.wotd-card {
  font: inherit; text-align: left; cursor: pointer;
  width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 16px 20px 17px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.wotd-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--line-strong); }
.wotd-head { display: flex; align-items: baseline; gap: 10px; }
.wotd-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase;
  color: var(--accent-ink);
}
.wotd-ipa { color: var(--faint); font-size: .85rem; }
.wotd-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.wotd-word { font-family: var(--display); font-weight: 600; font-size: 1.5rem; letter-spacing: -.015em; color: var(--ink); }
.wotd-from { color: var(--muted); font-size: .92rem; }
.wotd-from .mono { color: var(--root); }

/* ---------- Stage / detail ---------- */
.stage { margin-top: 40px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-md); padding: 34px 34px 30px;
  animation: rise .3s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 8px;
}
.eyebrow-gloss {
  display: block; margin-top: 3px;
  text-transform: none; letter-spacing: normal;
  font-weight: 500; font-size: .88rem; color: var(--muted);
}
.headword {
  font-family: var(--display); font-weight: 600; letter-spacing: -.02em;
  font-size: 2.5rem; line-height: 1.08; margin: 0;
  transition: color .25s;
}
.headword.mono { color: var(--root); }
.root-line { margin: 12px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.root-line a { color: var(--root); text-decoration: none; font-family: var(--display); font-weight: 500; cursor: pointer; }
.root-line a:hover { text-decoration: underline; text-underline-offset: 3px; }
.gloss { color: var(--muted); font-size: 1.15rem; line-height: 1.5; margin: 8px 0 0; }

.ipa { color: var(--faint); font-size: 1rem; margin: 6px 0 0; letter-spacing: .01em; }
.faint-line { color: var(--faint); font-style: italic; }

/* ---------- Senses / definitions ---------- */
.senses { margin: 0; padding: 0 0 0 2px; list-style: none; counter-reset: sense; }
.sense { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; counter-increment: sense; }
.sense::before {
  content: counter(sense); flex: none;
  font-size: .72rem; font-weight: 600; color: var(--faint);
  font-variant-numeric: tabular-nums; min-width: 16px; text-align: right;
}
.sense-pos {
  flex: none; font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent-ink); background: var(--accent-weak);
  padding: 1px 7px; border-radius: 999px;
}
.sense-gloss { color: var(--muted); line-height: 1.55; font-size: .96rem; }
.sense.extra { display: none; }
.senses.expanded .sense.extra { display: flex; }
.more-btn {
  font: inherit; font-size: .85rem; font-weight: 500; color: var(--accent-ink);
  background: none; border: none; cursor: pointer; padding: 6px 0 0 28px;
}
.more-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.more-note { color: var(--faint); font-size: .85rem; margin: 10px 0 0; }

/* ---------- Loading skeleton ---------- */
.panel.skel { min-height: 180px; }
.skel-bar {
  height: 16px; border-radius: 8px; margin: 14px 0;
  background: linear-gradient(90deg, var(--line) 25%, var(--line-strong) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}
.skel-bar.big { height: 34px; }
.skel-bar.w40 { width: 40%; } .skel-bar.w55 { width: 55%; } .skel-bar.w70 { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.via-badge {
  display: inline-block; margin-top: 16px;
  font-size: .76rem; font-weight: 600; letter-spacing: .03em;
  padding: 5px 12px; border-radius: 999px;
}

/* ---------- Timeline ---------- */
.timeline-h, .section-h {
  font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); margin: 34px 0 16px;
  display: flex; align-items: center; gap: 12px;
}
.timeline-h::after, .section-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* vertical timeline: dots on a left rail, one readable row per era */
.timeline { display: flex; flex-direction: column; padding: 6px 0 0 2px; }
.stagebox { position: relative; padding: 0 0 22px 32px; }
.stagebox:last-child { padding-bottom: 4px; }
.stagebox::before {
  /* node dot; sits above the rail so it stays a full circle */
  content: ""; position: absolute; left: 4px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dot, var(--line-strong));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot, var(--line-strong)) 16%, white);
  z-index: 1;
}
.stagebox::after {
  /* rail segment down to the next era, tinted with this era's color */
  content: ""; position: absolute; left: 7px; top: 14px; bottom: -6px;
  border-left: 2px solid color-mix(in srgb, var(--dot, var(--line-strong)) 40%, white);
  z-index: 0;
}
.stagebox:last-child::after { display: none; }
.stagebox.lit::before { animation: nodepulse .45s ease; }
@keyframes nodepulse {
  50% { transform: scale(1.8); }
}
.stage-meta { display: flex; align-items: baseline; gap: 10px; }
.stagebox .lang { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.stagebox .when { font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.stagebox.last .when { color: var(--accent-ink); }
.stage-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.stagebox .word { font-family: var(--display); font-weight: 500; font-size: 1.35rem; letter-spacing: -.01em; color: var(--stage-ink, var(--ink)); }
.stagebox .stage-gloss { font-size: .85rem; color: var(--muted); line-height: 1.4; }

/* ---------- Family / descendants ---------- */
.group { margin-bottom: 16px; }
.group-label { font-size: .8rem; font-weight: 600; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .9rem; font-weight: 500;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip.current { outline: 2px solid currentColor; outline-offset: 1px; font-weight: 600; }
.via-native { background: var(--native-bg); color: var(--native); }
.via-Norse  { background: var(--norse-bg);  color: var(--norse); }
.via-Latin  { background: var(--latin-bg);  color: var(--latin); }
.via-Greek  { background: var(--greek-bg);  color: var(--greek); }
.via-French { background: var(--french-bg); color: var(--french); }
.via-other  { background: var(--other-bg);  color: var(--other); }
.via-badge.via-native { background: var(--native-bg); color: var(--native); }
.via-badge.via-Norse  { background: var(--norse-bg);  color: var(--norse); }
.via-badge.via-Latin  { background: var(--latin-bg);  color: var(--latin); }
.via-badge.via-Greek  { background: var(--greek-bg);  color: var(--greek); }
.via-badge.via-French { background: var(--french-bg); color: var(--french); }
.via-badge.via-other  { background: var(--other-bg);  color: var(--other); }
.group-label.via-native { color: var(--native); background: none; }
.group-label.via-Norse  { color: var(--norse); background: none; }
.group-label.via-Latin  { color: var(--latin); background: none; }
.group-label.via-Greek  { color: var(--greek); background: none; }
.group-label.via-French { color: var(--french); background: none; }
.group-label.via-other  { color: var(--other); background: none; }

.foot {
  margin-top: auto; padding: 26px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .88rem;
}
.foot-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px 32px; flex-wrap: wrap;
}
.foot-brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--ink);
}
.foot-brand .logo { width: 19px; height: 19px; }
.foot-tag { margin: 6px 0 0; color: var(--faint); font-size: .82rem; }
.foot-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; padding-top: 3px; }
.foot-nav a { color: var(--muted); text-decoration: none; }
.foot-nav a:hover { color: var(--ink); }
.foot-legal { margin: 18px 0 0; color: var(--faint); font-size: .78rem; line-height: 1.6; }
.foot-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.foot-legal a:hover { color: var(--ink); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .app { padding: 0 16px; }
  .topbar { padding-top: 14px; flex-wrap: wrap; justify-content: space-between; }
  .topbar-tag { display: none; }
  .burger { display: flex; }
  .nav { display: none; width: 100%; flex-direction: column; gap: 2px; padding: 8px 0 4px; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav a { padding: 10px 12px; font-size: .95rem; border-radius: 10px; }

  .headline { font-size: clamp(1.5rem, 7.5vw, 2.1rem); }
  .sub { font-size: .95rem; margin-bottom: 22px; }
  .search-field { padding: 3px 8px 3px 14px; gap: 8px; }
  #search { font-size: 1rem; padding: 12px 0; }
  .key { display: none; }
  .examples { gap: 6px; }
  .examples .ex { font-size: .84rem; padding: 6px 12px; }
  .examples .ex:nth-of-type(n+5) { display: none; }  /* max 4 example chips on mobile */
  .examples::before { display: none; }

  .panel { padding: 24px 18px 22px; border-radius: 16px; }
  .headword { font-size: 1.9rem; }
  .stagebox .word { font-size: 1.2rem; }
  /* timeline rows stack on mobile: lang+era, then form, then meaning each on own line */
  .stage-meta { flex-wrap: wrap; gap: 4px 10px; }
  .stage-row { flex-direction: column; align-items: flex-start; gap: 1px; }
  .stagebox .stage-gloss { font-size: .82rem; }
  .wotd-card { padding: 13px 16px 14px; }
  .wotd-word { font-size: 1.25rem; }
  .intro-title { font-size: 1.2rem; }

  .page-head { padding: 34px 0 6px; }
  .picker { padding: 12px 14px; gap: 10px; }
  .tree ul { padding-left: 14px; }
  .tree li { padding: 3px 0 3px 16px; }
  .tree li::before { width: 11px; }
  .t-form { font-size: .95rem; }
  .t-lang { font-size: .66rem; }

  .doc h2 { font-size: 1.2rem; }
  .doc .panel { padding: 22px 18px; }
  .cmp { font-size: .84rem; }
  .cmp th, .cmp td { padding: 6px 8px; }

  .foot { font-size: .84rem; padding-bottom: 24px; }
  .foot-inner { flex-direction: column; gap: 16px; }
}
