:root {
  /* Dark cream palette with a caramel main colour (no pure white). */
  --bg: #e2d3b6;
  --surface: #f1e6d0;
  --surface-2: #e6d7ba;
  --field: #f7eedd;
  --text: #2a2218;
  --muted: #6f6150;
  --border: #d3c09c;
  --primary: #7d5d30;
  --primary-ink: #fbf4e6;
  --primary-soft: #e9d9b8;
  --accent: #c2410c;
  --gold: #b7791f;
  --danger: #b42318;
  --good: #15803d;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 8px 24px rgb(0 0 0 / 0.06);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1712;
    --surface: #241f18;
    --field: #2b251d;
    --surface-2: #2f281f;
    --text: #f2ebdd;
    --muted: #aa9f8b;
    --border: #3d3427;
    --primary: #d8bd8a;
    --primary-ink: #2a2015;
    --primary-soft: #3a301f;
    --accent: #fb923c;
    --gold: #f6c05c;
    --danger: #f87171;
    --good: #4ade80;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }

/* --- top bar ---------------------------------------------------------- */

/* One row: logo | language → Ewe bubble and the Welcome … Write switch, centred
   together | profile. Narrower screens keep the language bubble centred on the top
   row and move the switch to a centred second row. */
.topbar {
  display: grid;
  /* Centred bubbles, but the sides never shrink under their content (the bubbles move over instead). */
  grid-template-columns: minmax(max-content, 1fr) auto auto minmax(max-content, 1fr);
  grid-template-areas: "brand langs modes account";
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  /* Stays at the top of the screen while the page scrolls, and above a page
     sliding past while flipping. */
  position: sticky; top: 0; z-index: 10;
}

.brand-group { grid-area: brand; }
.lang-pair { grid-area: langs; }
.tabs-account { grid-area: account; justify-self: end; }
@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
    grid-template-areas: "brand langs account" "modes modes modes";
    row-gap: 12px;
  }
}

/* Speak / Listen / Write: segmented switch, centered in the header. */
.modes {
  grid-area: modes; justify-self: center;
  display: flex; gap: 4px; width: fit-content; max-width: 100%; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.modes a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 8px 20px 8px 16px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600;
}
.modes svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
/* Around the three ways to contribute: Welcome and How to help before them, Partners and
   Contact us after. */
.modes-sep {
  flex: none; align-self: stretch; width: 2px; margin: 6px 6px; border-radius: 1px;
  background: color-mix(in srgb, var(--primary) 45%, transparent);
}
/* How to help and Contact us: always just their icon (the name is for screen readers, and a tooltip). */
.modes a.mode-icon { flex: none; padding-inline: 12px; }
.modes a.mode-icon span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.modes a:hover { color: var(--text); }
.modes a.active { background: var(--surface); color: var(--text); font-weight: 800; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.modes a.active svg { stroke-width: 2.5; }
@media (max-width: 600px) {
  .modes { width: 100%; }
  .modes a { padding: 8px 8px; gap: 6px; font-size: 0.92rem; }
  .modes a.mode-intro, .modes a.mode-icon { flex: none; padding-inline: 10px; }
}
/* Phones: tighter still, so every tab fits. */
@media (max-width: 600px) {
  .modes { gap: 2px; padding: 3px; }
  .modes-sep { margin-inline: 3px; }
  .modes a { padding-inline: 6px; gap: 4px; font-size: 0.86rem; }
  .modes a.mode-intro, .modes a.mode-icon { padding-inline: 8px; }
  .modes svg { width: 16px; height: 16px; }
}
@media (max-width: 430px) {
  .modes a:not(.mode-intro, .mode-icon) svg { display: none; }
}
@media (max-width: 380px) {
  .modes-sep { margin-inline: 2px; }
  .modes a { padding-inline: 5px; font-size: 0.82rem; }
  .modes a.mode-intro, .modes a.mode-icon { padding-inline: 6px; }
}
@media (max-width: 340px) {
  .modes-sep { margin-inline: 1px; }
  .modes a { padding-inline: 3px; font-size: 0.76rem; }
  .modes a.mode-intro, .modes a.mode-icon { padding-inline: 4px; }
  .modes svg { width: 15px; height: 15px; }
}
/* Welcome and Partners shrink to their icon where the full switch doesn't fit (their
   names stay for screen readers, and as a tooltip). */
@media (min-width: 1101px) and (max-width: 1300px), (min-width: 601px) and (max-width: 800px) {
  .modes a.mode-intro { padding-inline: 12px; }
}
@media (min-width: 1101px) and (max-width: 1300px), (max-width: 800px) {
  .modes a.mode-intro span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none;
}

/* "myCL2.voices" wordmark, all italic: a small raised "my" in brown, a heavy "CL2" with
   the welcome page's slowly drifting gold-orange gradient, then ".voices" in brown. */
.brand-mark {
  display: inline-block; line-height: 1; white-space: nowrap; color: var(--primary);
  padding-right: 3px; /* room for the italic "2" to lean into */
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold), var(--accent), var(--gold)) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: greet-shimmer 8s linear infinite;
}
.brand-my {
  display: inline-block; margin-right: -1px; vertical-align: 0.85em; /* right against "CL2" */
  font-size: 11px; font-style: italic; font-weight: 700; letter-spacing: 0.02em;
  -webkit-text-fill-color: var(--primary);
}
.brand-cl { font-size: 27px; font-style: italic; font-weight: 900; letter-spacing: -0.01em; }
/* ".voices" after "CL2", in the brown italic of "my". */
.brand-voices {
  margin-left: 0; font-size: 13px; font-style: italic; font-weight: 700; letter-spacing: 0.02em;
  -webkit-text-fill-color: var(--primary);
}
@media (prefers-reduced-motion: reduce) { .brand-mark { animation: none; } }
/* "myCL2.voices" in running text (see brandify in app.js), drawn like the logo above
   at the size of the text around it. */
.brand-inline { white-space: nowrap; font-style: italic; }
.brand-inline .bi-my {
  margin-right: -0.05em; vertical-align: 0.55em; font-size: 0.62em; font-weight: 700; color: var(--primary);
}
.brand-inline .bi-cl {
  padding-right: 0.1em; font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold), var(--accent), var(--gold)) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: greet-shimmer 8s linear infinite;
}
.brand-inline .bi-voices { margin-left: 0; font-size: 0.82em; font-weight: 700; color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .brand-inline .bi-cl { animation: none; } }

.brand-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand { white-space: nowrap; }
.brand-from { display: flex; color: var(--muted); }
.brand-from svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Visually hidden, still read by screen readers. */
/* --- profile page (Common Voice-style) ---------------------------------- */

.card.profile-layout { position: relative; display: grid; grid-template-columns: 240px minmax(0, 1fr); padding: 0; overflow: hidden; }
/* × on Profile / Admin cards: back to the previous page. */
.page-close { position: absolute; top: 8px; right: 8px; z-index: 1; }
.profile-nav {
  display: flex; flex-direction: column; gap: 8px; padding: 32px 20px;
  background: linear-gradient(var(--surface-2), var(--surface));
}
.profile-nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.profile-nav a:hover { color: var(--text); }
.profile-nav a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgb(0 0 0 / 0.08); }
.profile-nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.profile-main { padding: 32px 36px 36px; min-width: 0; }
@media (max-width: 760px) {
  .card.profile-layout { grid-template-columns: 1fr; padding: 0; }
  .profile-nav { flex-direction: row; padding: 14px 16px 0; background: none; }
  .profile-nav a { padding: 9px 14px; }
  .profile-main { padding: 20px 16px 24px; }
}

/* Form fields with the label sitting on the top border. */
.ogrid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 24px; }
@media (max-width: 600px) { .ogrid { grid-template-columns: 1fr; } }
.ofield { position: relative; }
.ofield input, .ofield select { height: 52px; padding: 15px 13px 12px; border-radius: 6px; }
.ofield label {
  position: absolute; top: -8px; left: 10px; padding: 0 5px;
  background: var(--surface); color: var(--muted); font-size: 0.78rem; line-height: 1rem;
}
.lede + .pform { margin-top: 24px; }
.pdivider { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.pconsent b { display: block; margin-bottom: 4px; font-size: 1rem; }
.psave { display: flex; justify-content: center; }
.psave .btn { min-width: 220px; }

/* Admin window: like Profile, with a reddish side panel so it's unmistakable. */
.admin-layout .profile-nav { background: linear-gradient(#f6dcd8, #fbefed); }
.admin-layout .profile-nav .count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 0.8rem; text-align: center;
}
@media (prefers-color-scheme: dark) { .admin-layout .profile-nav { background: linear-gradient(#3a1c19, #2a1816); } }
@media (max-width: 760px) { .admin-layout .profile-nav { background: none; } }

/* Old-browser banner (plain colours: it must work where newer CSS doesn't). */
.old-browser {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: #7a2e12; color: #fbf6ec; font-size: 0.95rem; line-height: 1.4;
}
.old-browser span { flex: 1; }
.old-browser button {
  flex: none; width: 32px; height: 32px; border: 1px solid #fbf6ec; border-radius: 50%;
  background: transparent; color: #fbf6ec; font-size: 1.3rem; line-height: 1; cursor: pointer;
}

/* Touch-only devices: keyboard shortcuts don't apply. */
@media (hover: none) and (pointer: coarse) {
  .shortcut-hint, .vote-row kbd, .actions kbd { display: none; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Flag or mic + language name in one pill: the interface language and the language to
   record share it, at the same size. */
.lang-pill {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 12px 7px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em;
}
.lang-btn { cursor: pointer; }
.lang-btn .flag { width: 22px; height: 15px; }
.target-mic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
/* Language → Ewe share one bubble, like the Welcome … Write switch; inside it the two
   pills look like the switch's selected tab. */
.lang-pair {
  display: flex; align-items: center; gap: 6px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.lang-pair .lang-pill { border-color: transparent; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.lang-btn:hover, .target-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.target-btn { cursor: pointer; font-family: inherit; }
/* The language's full name is always shown. When a long one (Kinyarwanda / Kirundi…)
   doesn't fit, fitHeader in app.js steps the header down until it does: fit-1 Welcome
   and Partners show just their icon, fit-2 the switch moves to a second row, fit-3
   the language bubble gets a row of its own, fit-4 the name may wrap. */
.topbar.fit-1 .modes a.mode-intro span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.topbar.fit-2 {
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  grid-template-areas: "brand langs account" "modes modes modes";
}
.topbar.fit-3 {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand account" "langs langs" "modes modes";
}
.topbar.fit-3 .lang-pair { justify-self: center; max-width: 100%; }
.topbar.fit-4 .target-btn { white-space: normal; text-align: center; }
/* Stepped down that far above phone widths, the switch packs its tabs closer too
   (phones already have tighter rules of their own). */
@media (min-width: 601px) {
  .topbar.fit-3 .modes { gap: 2px; padding: 3px; }
  .topbar.fit-3 .modes a, .topbar.fit-3 .modes a.mode-intro, .topbar.fit-3 .modes a.mode-icon { padding-inline: 8px; }
}
.lang-btn .chevron, .target-btn .chevron {
  width: 14px; height: 14px; margin-left: -2px; flex: none;
  fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.15s ease;
}
.lang-btn[aria-expanded="true"] .chevron, .target-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.flag {
  display: flex; width: 24px; height: 16px; flex: none; overflow: hidden;
  border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12);
}
.flag svg { width: 100%; height: 100%; }

/* Light cream, in dark mode too, so the window keeps its light palette
   (same as the profile menu). */
.lang-dialog {
  --surface: #f6eddb; --surface-2: #e9dcc2; --text: #2a2218; --muted: #6f6150;
  --border: #dccaa8; --primary: #7d5d30;
  /* Anchored under the globe button; top/left are set from JS. */
  position: fixed; margin: 0; inset: auto;
  width: min(320px, calc(100vw - 32px)); padding: 14px;
  background: #f6eddb; color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 12px 32px rgb(0 0 0 / 0.16);
}
.lang-dialog::backdrop { background: transparent; }
.lang-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.lang-head h2 { margin: 0; font-size: 1.15rem; }
.lang-dialog ul { list-style: none; margin: 0; padding: 0; max-height: min(320px, 50vh); overflow-y: auto; }
.lang-dialog ul:focus { outline: none; } /* the highlighted row shows where you are */
.lang-dialog li {
  display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.lang-dialog li .native { font-weight: 600; }
.lang-dialog li .alt { color: var(--muted); font-size: 0.85rem; }
.lang-dialog li .tick { margin-left: auto; color: var(--primary); align-self: center; display: flex; }
.lang-dialog li .tick svg { width: 16px; height: 16px; }
.lang-dialog li.active { background: var(--surface-2); }
/* Search box over the list of languages to record. */
.lang-search {
  display: block; width: 100%; margin: 0 0 10px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fffaf0; color: var(--text); font: inherit; font-size: 0.95rem;
}
.lang-search:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.lang-dialog li.empty { cursor: default; color: var(--muted); font-size: 0.9rem; }
.lang-dialog li[aria-selected="true"] .native { color: var(--primary); }

.tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.active { background: var(--primary-soft); color: var(--primary); }
/* The Profile tab can hold a contributor's initial and name; keep long names on one line. */
/* Header profile button + its account menu. */
.profile-wrap { position: relative; }
.profile-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 7px 10px 7px 14px; border-radius: 999px; border: none; background: none;
  color: var(--muted); font-weight: 600;
}
.profile-btn:hover { background: var(--surface-2); color: var(--text); }
.profile-btn.active { background: var(--primary-soft); color: var(--primary); }
.profile-label { display: inline-flex; align-items: center; gap: 7px; }
.profile-btn .tab-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-btn .chevron {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s ease;
}
.profile-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
/* The name (or "Profile") in the myCL2 logo's drifting gold-orange, with the arrow and
   the initial (all phones show) to match. */
.profile-btn .tab-name {
  font-weight: 700;
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold), var(--accent), var(--gold)) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: greet-shimmer 8s linear infinite;
}
.profile-btn .chevron { stroke: var(--accent); }
.profile-btn .avatar { background: linear-gradient(135deg, var(--gold), var(--accent)); color: #fff; }
@media (prefers-reduced-motion: reduce) { .profile-btn .tab-name { animation: none; } }
.profile-menu {
  /* Light cream, with a light palette even in dark mode (like the language list). */
  --surface-2: #e9dcc2; --text: #2a2218; --muted: #6f6150; --border: #dccaa8;
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  min-width: 230px; max-width: calc(100vw - 32px); padding: 6px;
  background: #f6eddb; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 12px 32px rgb(0 0 0 / 0.16);
}
.profile-menu[hidden] { display: none; }
.menu-head { padding: 8px 12px 10px; color: var(--muted); font-size: 0.88rem; }
.profile-menu .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px;
  border: none; background: none; color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; text-align: left; cursor: pointer;
}
.profile-menu .menu-item:hover, .profile-menu .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.profile-menu .menu-item svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* Log in / create account pages: a narrow card like About / Contact. */
.info-page.auth-page { max-width: 460px; }
.auth-page .hint { color: var(--muted); font-size: 0.86rem; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-switch { text-align: center; margin: 14px 0 0; color: var(--muted); font-size: 0.92rem; }
.link-btn { border: none; background: none; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

.avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  font-size: 0.78rem; font-weight: 700; line-height: 1;
}
/* Not named yet: a person icon in the circle (alone on phones, like the initial). */
.avatar.anon { background: var(--primary-soft); color: var(--primary); }
.avatar.anon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 520px) {
  .topbar { padding: 12px 16px; }
  .tabs { flex-wrap: nowrap; gap: 2px; }
  .tabs a { padding: 7px 9px; font-size: 0.92rem; }
  .topbar { column-gap: 8px; }
  .brand-group { gap: 6px; }
  /* A smaller logo on phones, so logo, languages and Profile fit on one row. */
  .brand-cl { font-size: 22px; }
  .brand-voices { font-size: 11px; }
  .brand-my { font-size: 9px; }
  /* Phones: the initial alone stands for the name (it's in the tab's tooltip/label). */
  .profile-btn .avatar + .tab-name { display: none; }
  .profile-btn { padding-left: 8px; }
}
/* Narrow phones: tighten the top row a little more. */
@media (max-width: 430px) {
  .brand-group { gap: 4px; }
  .brand-cl { font-size: 19px; }
  .brand-voices { font-size: 10px; }
  .brand-my { font-size: 8px; }
  .lang-pair .lang-pill { padding: 6px 9px 6px 7px; gap: 4px; }
  .lang-pair { gap: 2px; padding: 3px; }
  .target-mic { width: 16px; height: 16px; }
  .brand-from svg { width: 16px; height: 16px; }
}
/* Small phones: the bubble keeps the two languages (and the mic), without the arrow. */
@media (max-width: 380px) {
  .brand-from { display: none; }
}
@media (max-width: 360px) {
  .topbar { column-gap: 6px; }
  .lang-pair .lang-pill { padding: 5px 6px; gap: 3px; }
  .lang-pair { gap: 3px; }
}
@media (max-width: 340px) {
  .brand-cl { font-size: 17px; }
  .brand-voices { font-size: 9px; }
  .lang-pill { font-size: 0.88rem; }
  .lang-btn .flag { width: 19px; height: 13px; }
}

/* --- stats strip ------------------------------------------------------ */

.stats {
  display: flex; gap: 28px; justify-content: center; flex-wrap: wrap;
  padding: 12px 16px; font-size: 0.9rem; color: var(--muted);
}
.stats[hidden] { display: none; }
.stats b { color: var(--text); font-variant-numeric: tabular-nums; }

/* --- layout ----------------------------------------------------------- */

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 16px 24px; /* clear space below the header */
}
@media (max-width: 520px) { main { padding-top: 20px; } }

/* Computers: Welcome, How to help, Your voice, Speak, Listen, Write and Partners one
   under the other on a single page (see the strip code in app.js), each under a line
   naming it. The last page is at least a screen tall, so it too can be scrolled up to
   just below the header. */
.strip-page { padding: 44px 0; }
.strip-page:last-child { min-height: calc(100vh - var(--header-h, 80px)); padding-bottom: 8px; }
.strip-divider {
  display: flex; align-items: center; gap: 16px; max-width: 940px; margin: 0 auto;
  color: var(--primary); font-size: 0.92rem; font-weight: 700;
}
.strip-divider::before, .strip-divider::after {
  content: ""; flex: 1; height: 2px; border-radius: 1px;
  background: color-mix(in srgb, var(--primary) 30%, transparent);
}
.strip-divider-label {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 14px 5px 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 999px; background: var(--surface);
}
.strip-divider-label svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Speak / Listen / Write flipped by scrolling (see the flip code in app.js). */
/* No pull-to-refresh or bounce: pulling at the page's edge flips to the next mode. */
html { overscroll-behavior-y: none; }
/* The outgoing page, still moving off while the new one comes in. */
.flip-ghost { position: fixed; z-index: 5; margin: 0; pointer-events: none; }
/* The mode being pulled into view, at the edge it will come from. */
.flip-peek {
  position: fixed; left: 50%; bottom: 24px; z-index: 6; pointer-events: none;
  display: flex; align-items: center; gap: 8px; padding: 9px 18px 9px 14px; border-radius: 999px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.14); font-weight: 600; opacity: 0;
  transform: translate(-50%, 0); transition: color 0.15s ease, border-color 0.15s ease;
}
.flip-peek[data-from="top"] { bottom: auto; }
.flip-peek[hidden] { display: none; }
.flip-peek.ready { color: var(--primary); border-color: var(--primary); }
.flip-peek svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Every Speak / Listen / Write card has the same width and (at least) the same height,
   so moving between the pages doesn't make the card jump. The tagline stays at the
   top; the rest is centred in any extra height. */
.page-card, .speak-card, .listen-card {
  max-width: 860px; margin: 0 auto; min-height: 624px;
  display: flex; flex-direction: column;
}
.page-card > *, .speak-card > *, .listen-card > * { flex: none; }
.page-card > :last-child, .speak-card > :last-child, .listen-card > :last-child { margin-bottom: auto; }
/* Speak / Listen / Write, How to help, Partners and About / Contact / Privacy: a brown
   ribbon along the card's top edge, the colour of the mic and play buttons (drawn as a
   background, so it follows the rounded corners). */
.card.page-card, .card.speak-card, .card.listen-card, .card.help-card, .card.partners-card,
.card.info-page:not(.auth-page) {
  background: linear-gradient(var(--primary), var(--primary)) top / 100% 5px no-repeat, var(--surface);
}
@media (max-width: 520px) {
  .page-card, .speak-card, .listen-card { min-height: 558px; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
@media (max-width: 520px) { .card { padding: 20px 16px; } }

.instruction {
  text-align: center; color: var(--muted); font-weight: 600;
  margin: 0 0 18px; font-size: 0.95rem;
}
/* Headline instruction (Speak, Listen): the app's green; bone white on the dark card in dark mode. */
.instruction-title { color: var(--primary); }
@media (prefers-color-scheme: dark) { .instruction-title { color: #f9f6ee; } }
.instruction-hint { display: block; margin-top: 2px; font-weight: 400; font-size: 0.88rem; }

/* --- progress pills --------------------------------------------------- */

.pills { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; }
.pill {
  width: 40px; height: 8px; border-radius: 999px; background: var(--surface-2);
  border: none; padding: 0; cursor: pointer;
}
.pill.done { background: var(--primary); }
.pill.current { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- prompt ----------------------------------------------------------- */

.prompt {
  min-height: 120px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; gap: 10px; padding: 12px 8px;
}
.prompt .main {
  font-size: clamp(1.4rem, 3.4vw, 2rem); font-weight: 600; line-height: 1.3;
  overflow-wrap: anywhere;
}
.prompt .sub { color: var(--muted); font-size: 1.05rem; }
.lang-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}

/* --- recorder --------------------------------------------------------- */

.recorder { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 22px 0 6px; }

.mic {
  position: relative;
  width: 92px; height: 92px; border-radius: 50%;
  border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-ink);
  display: grid; place-items: center;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: transform 0.12s ease, background 0.2s ease;
}
.mic:hover { transform: scale(1.04); }
.mic:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.mic svg { width: 38px; height: 38px; position: relative; z-index: 1; }
/* Waiting for the microphone/audio to start (can take a moment on some devices). */
.mic.starting { animation: mic-starting 0.9s ease-in-out infinite; cursor: progress; }
@keyframes mic-starting { 50% { opacity: 0.6; transform: scale(0.96); } }
@media (prefers-reduced-motion: reduce) { .mic.starting { animation: none; opacity: 0.7; } }
.mic.recording { background: var(--accent); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.mic .ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 3px solid var(--accent); opacity: 0; pointer-events: none;
  transform: scale(var(--level, 1));
  transition: transform 0.08s linear;
}
.mic.recording .ring { opacity: 0.55; }

.rec-status { font-size: 0.9rem; color: var(--muted); min-height: 1.4em; font-variant-numeric: tabular-nums; }
.rec-status.live { color: var(--accent); font-weight: 600; }

/* --- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600;
  text-decoration: none; color: var(--text);
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn.big { padding: 14px 28px; font-size: 1.05rem; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.yes { border-color: var(--good); color: var(--good); }
.btn.no { border-color: var(--danger); color: var(--danger); }
.btn.yes:hover:not(:disabled) { background: color-mix(in srgb, var(--good) 12%, transparent); }
.btn.no:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn svg { width: 18px; height: 18px; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.actions.centered { justify-content: center; }
.actions .group { display: flex; gap: 8px; flex-wrap: wrap; }

kbd {
  font-family: ui-monospace, monospace; font-size: 0.75em;
  padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}

/* --- side clip list --------------------------------------------------- */

/* --- Speak: submit button that fills up as clips are recorded ------------- */

.submit-btn {
  position: relative; overflow: hidden; isolation: isolate;
  min-width: 250px; height: 56px; padding: 0 28px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent); background: var(--primary-soft);
  color: color-mix(in srgb, var(--primary) 70%, #000); /* readable on both the light and filled green */
  font: inherit; font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em;
  cursor: not-allowed; transition: transform 0.15s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.submit-fill {
  position: absolute; inset: 0; z-index: -1; width: var(--progress, 0%);
  background: color-mix(in srgb, var(--primary) 22%, var(--primary-soft));
  transition: width 0.45s ease;
}
@media (prefers-color-scheme: dark) { .submit-btn { color: var(--primary); } }
.submit-label { display: inline-flex; align-items: center; gap: 10px; }
.submit-label svg { width: 20px; height: 20px; }
.submit-btn.ready, .submit-btn.uploading {
  border-color: transparent; color: var(--primary-ink);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 85%, #fff), var(--primary) 55%, color-mix(in srgb, var(--primary) 80%, #000));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--primary) 35%, transparent), inset 0 1px 0 rgb(255 255 255 / 0.18);
}
.submit-btn.ready { cursor: pointer; }
.submit-btn.pop { animation: submit-ready 0.5s ease; }
.submit-btn.ready .submit-fill { display: none; }
.submit-btn.ready:hover { transform: translateY(-2px); box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 42%, transparent); }
.submit-btn.ready:active { transform: translateY(0); }
.submit-btn.uploading { cursor: progress; }
.submit-btn.uploading .submit-fill { background: rgb(255 255 255 / 0.18); }
@keyframes submit-ready { 0% { transform: scale(0.96); } 60% { transform: scale(1.03); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .submit-btn, .submit-fill { transition: none; animation: none !important; } }

/* --- Speak: sliding reel of the batch's sentences ------------------------ */

.reel {
  position: relative; overflow: hidden; margin: -6px -28px 22px; padding: 6px 0 10px;
  /* Fade the neighbours out towards the card edges. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}
.reel-track { display: flex; gap: 12px; width: max-content; transition: transform 0.35s ease; }
@media (prefers-reduced-motion: reduce) { .reel-track { transition: none; } }
/* Cards size to their sentence so it stays on one line (capped for very long ones). */
.slot {
  flex: none; width: max-content; min-width: 170px; max-width: min(560px, 80vw);
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; text-align: left;
  opacity: 0.55; transform: scale(0.94); transition: opacity 0.35s ease, transform 0.35s ease;
}
.slot:hover { opacity: 0.8; }
.slot.current { opacity: 1; transform: none; border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.slot:not(.current) .icon-btn { pointer-events: none; } /* clicks select the card instead */
.slot .text { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.slot .row { display: flex; align-items: center; gap: 6px; }
.slot .num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); flex: none;
}
.slot .num svg { width: 14px; height: 14px; }
.slot.has-clip .num { background: var(--primary); color: var(--primary-ink); }
.slot .num.vote-up { background: var(--good); color: #fbf6ec; }
.slot .num.vote-down { background: var(--danger); color: #fbf6ec; }
/* Listen: the vote already given on a reviewed clip. */
.vote-row .btn.chosen:disabled { opacity: 1; box-shadow: 0 0 0 2px currentColor; }
.slot .meta { margin-left: auto; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .reel { margin: -4px -16px 18px; }
  /* Phones: smaller text and padding so even the longest sentence fits on one line. */
  .slot { min-width: 150px; max-width: calc(100vw - 24px); padding: 10px; }
  .slot .text { font-size: 0.78rem; }
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 15px; height: 15px; }

/* --- forms ------------------------------------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field .hint { font-size: 0.82rem; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--field);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }

.charbar { display: flex; flex-wrap: wrap; gap: 4px; }
.charbar button {
  min-width: 34px; height: 32px; padding: 0 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 1rem;
}
.charbar button:hover { border-color: var(--primary); }


/* --- misc ------------------------------------------------------------- */

.page-title { font-size: 1.5rem; margin: 6px 0 4px; }
.lede { color: var(--muted); margin: 0 0 20px; }

/* Write: the emblem over a centred title and intro. */
.write-head { text-align: center; }
.write-head .lede { max-width: 560px; margin-inline: auto; }
/* The review note, then Submit centred on its own line. */
.write-actions { flex-direction: column; align-items: flex-start; gap: 16px; }
.write-actions .submit-btn { align-self: center; }
.write-logo { display: block; width: 96px; height: 96px; margin: 0 auto 6px; overflow: visible; }
.wl-bg { fill: var(--primary-soft); }
.wl-spark { fill: var(--gold); }
.wl-spark.small { opacity: 0.8; }
.wl-page { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }
.wl-line { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; }
.wl-pencil-body { fill: var(--accent); }
.wl-pencil-end { fill: var(--primary); }
.wl-pencil-wood { fill: #f3d9a4; }
.wl-pencil-lead { fill: var(--text); }
.wl-bubble { fill: var(--primary); }
.wl-dot { fill: var(--primary-ink); }
/* The pencil writes the last line, over and over. */
.wl-writing { stroke-dasharray: 20; animation: wl-write 3s ease-in-out infinite; }
.wl-pencil { animation: wl-pencil 3s ease-in-out infinite; }
@keyframes wl-write { 0% { stroke-dashoffset: 20; } 55%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 20; } }
@keyframes wl-pencil { 0% { transform: translate(-19px, -2px); } 55%, 85% { transform: translate(0, 0); } 100% { transform: translate(-19px, -2px); } }
@media (prefers-reduced-motion: reduce) { .wl-writing, .wl-pencil { animation: none; } }
.center { text-align: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); margin-top: 0; }
.big-check {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
}
.big-check svg { width: 36px; height: 36px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, monospace; font-size: 0.85rem; overflow-wrap: anywhere; }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; }
.table-wrap { overflow-x: auto; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 0.92rem; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fbf6ec; }

/* The tagline at the top of every Speak / Listen / Write card. */
/* The same gap on every page between the line under it and what follows: --tagline-gap
   (smaller on short phones). Cards that space their parts with a gap of their own
   (--card-gap) take it off the tagline's margin. */
:root { --tagline-gap: 22px; }
.hero-greet.card-tagline { margin: -8px auto var(--tagline-gap); font-size: 1.5rem; }
.card-tagline + * { margin-top: 0 !important; }
/* Under it, a short gold-orange stroke like Welcome's (smaller, as the tagline is). */
.hero-greet.card-tagline::after {
  content: ""; display: block; width: 40px; height: 3px; margin: 8px auto 0; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--accent));
}
/* On Welcome, the tagline is a little bigger than on the other pages. */
.hero > .hero-greet.card-tagline { font-size: 1.85rem; }
.hero > .hero-greet.card-tagline::after { width: 48px; }
@media (max-width: 520px) and (max-height: 760px) { .hero > .hero-greet.card-tagline { font-size: 1.55rem; } }
@media (max-width: 520px) and (max-height: 620px) { .hero > .hero-greet.card-tagline { font-size: 1.4rem; } }
@media (max-width: 520px) and (max-height: 520px) { .hero > .hero-greet.card-tagline { font-size: 1.25rem; } }

/* About / Contact / Privacy links: a footer bar that, like the header, stays on screen
   while the page scrolls. Pages flipping past slide under it, as with the header. */
.footer {
  display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: auto; padding: 16px 24px; font-size: 0.85rem; color: var(--muted);
  background: var(--surface); border-top: 1px solid var(--border); /* same as the header */
  position: sticky; bottom: 0; z-index: 10;
}
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links svg {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.footer-links a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 520px) { .footer { padding: 12px 16px; } }

/* About / Contact / Privacy */
.info-page { position: relative; max-width: 720px; margin: 0 auto; }
.info-page .page-title { padding-right: 40px; }
.info-body { line-height: 1.6; }
.info-body h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.info-body ul { padding-left: 20px; margin: 6px 0; }
.info-body li { margin: 4px 0; }
.info-body .credit { margin-top: 22px; color: var(--muted); font-size: 0.85rem; }
.contact-form { margin-top: 18px; }
.contact-form .actions { justify-content: flex-end; }
.contact-form input, .contact-form textarea { width: 100%; }
/* Spam trap: off-screen rather than display:none, which some bots skip. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-sent { margin-top: 18px; }
.message-item { border-top: 1px solid var(--border); padding: 14px 0; }
.message-item header { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.message-item .hint { color: var(--muted); font-size: 0.82rem; }
/* Whether the message reached your inbox by email. */
.mail-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.02em;
}
.mail-badge svg { width: 12px; height: 12px; }
.mail-badge.ok { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); border: 1px solid color-mix(in srgb, var(--good) 45%, transparent); }
.mail-badge.no { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.message-item p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 10px; }
/* Replies sent from here, and the box to write one. */
.msg-reply { margin: 0 0 10px 18px; padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.msg-reply p { margin: 4px 0 0; }
.msg-reply-form { display: grid; gap: 8px; margin: 0 0 10px; }
.msg-reply-form textarea { width: 100%; }
.reply-error {
  margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; font-weight: 600; white-space: normal;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}
.reply-error[hidden] { display: none; }
.msg-reply-form .btn svg { width: 16px; height: 16px; }
.msg-actions { display: flex; gap: 8px; }
.msg-reply-form[hidden], .msg-actions[hidden] { display: none; }

.play-big {
  width: 92px; height: 92px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: var(--primary-ink); display: grid; place-items: center;
  margin: 22px auto 8px;
}
.play-big svg { width: 36px; height: 36px; }
.vote-row { display: flex; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.vote-row .btn { min-width: 130px; }
/* Listen: No · Skip · Yes, with Skip a small text button between the two votes. */
.listen-votes { align-items: center; }
.listen-votes .btn.big { min-width: 112px; padding: 10px 22px; font-size: 0.98rem; }
.listen-votes .listen-skip { min-width: 0; padding: 6px 10px; font-size: 0.9rem; gap: 5px; }
.listen-votes .listen-skip svg { width: 15px; height: 15px; }
@media (max-width: 520px) {
  .listen-votes { gap: 8px; flex-wrap: nowrap; }
  .listen-votes .btn.big { min-width: 0; padding: 10px 16px; }
  .listen-votes .btn svg { flex: none; }
}

/* --- phones: shorter layout ------------------------------------------- */

/* Tighter vertical spacing so the Speak and Listen cards fit on one phone
   screen with the browser's address bar showing. */
@media (max-width: 520px) {
  .topbar { padding-top: 8px; padding-bottom: 8px; row-gap: 8px; }
  main { padding-top: 12px; padding-bottom: 14px; }
  .card { padding: 16px 14px; }
  .reel { margin: -4px -14px 10px; padding-bottom: 6px; }
  .instruction { margin-bottom: 8px; }
  .prompt { min-height: 110px; gap: 8px; padding: 6px 4px; }
  .recorder { gap: 8px; margin: 10px 0 2px; }
  .mic, .play-big { width: 76px; height: 76px; }
  .mic svg { width: 32px; height: 32px; }
  .play-big { margin: 10px auto 6px; }
  .play-big svg { width: 30px; height: 30px; }
  .submit-btn { height: 50px; }
  .actions { margin-top: 12px; }
  .vote-row { margin-top: 10px; }
}

/* Phones: the app fills the screen exactly and the page itself never scrolls. Header
   and footer stay put; the Speak / Listen / Write card stretches to the space
   between them. A page too tall for that space (Welcome, About…) scrolls inside it. */
@media (max-width: 520px) {
  html, body { height: 100%; overflow: hidden; }
  body { height: 100dvh; min-height: 0; }
  .topbar, .stats, .footer { flex: none; }
  main {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    display: flex; flex-direction: column;
  }
  main > * { flex: none; width: 100%; } /* margin: auto would otherwise shrink them to fit */
  .page-card, .speak-card, .listen-card { min-height: 0; flex: 1 0 auto; }
  /* Footer on one row, to leave the card as much room as possible. */
  .footer { padding: 8px 12px; }
  .footer-links { gap: 14px; flex-wrap: nowrap; }
  .footer-links a { gap: 4px; font-size: 0.78rem; white-space: nowrap; }
  .footer-links svg { width: 14px; height: 14px; }
}
@media (max-width: 400px) { .footer-links svg { display: none; } }

/* Shorter phones: Speak, Listen and Write tighten up so the whole card fits on screen
   (and app.js scales what's left over, see fitCard). */
@media (max-width: 520px) and (max-height: 760px) {
  .topbar { padding-top: 6px; padding-bottom: 6px; row-gap: 6px; }
  .modes a { padding-top: 6px; padding-bottom: 6px; }
  main { padding-top: 10px; padding-bottom: 10px; }
  :root { --tagline-gap: 14px; }
  .hero-greet.card-tagline { margin-top: -4px; font-size: 1.3rem; }
  .prompt { min-height: 0; }
  .write-logo { width: 72px; height: 72px; margin-bottom: 2px; }
  .write-head .page-title { font-size: 1.35rem; }
  .write-head .lede { margin-bottom: 14px; font-size: 0.95rem; line-height: 1.45; }
  .write-actions { gap: 10px; }
}
@media (max-width: 520px) and (max-height: 620px) {
  :root { --tagline-gap: 10px; }
  .hero-greet.card-tagline { font-size: 1.15rem; }
  .reel { margin-bottom: 6px; }
  .instruction { margin-bottom: 4px; font-size: 0.9rem; }
  .instruction-hint { font-size: 0.82rem; }
  .prompt { gap: 6px; padding: 2px 4px; }
  .prompt .main { font-size: 1.25rem; }
  .recorder { gap: 6px; margin-top: 6px; }
  .mic, .play-big { width: 64px; height: 64px; }
  .mic svg, .play-big svg { width: 28px; height: 28px; }
  .play-big { margin: 6px auto 4px; }
  .submit-btn { height: 46px; }
  .actions { margin-top: 8px; }
  .vote-row { margin-top: 6px; }
  .write-logo { display: none; }
  .write-head .lede { font-size: 0.9rem; }
  .write-card .field { margin-bottom: 10px; }
}

/* Phones: Welcome fills the screen like Speak and Listen, its card centred in the
   space (and scaled by fitCard if still too tall). */
@media (max-width: 520px) {
  .welcome-page { display: flex; flex-direction: column; flex: 1 0 auto; }
  .welcome-page > .hero { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }
  .welcome-page .afi-cta { align-self: center; }
}
@media (max-width: 520px) and (max-height: 760px) {
  .welcome-page > .hero { padding: 20px 14px 18px; }
  .welcome-page .afi-cta { margin: 0 0 14px; }
  .welcome-page .hero-rule { margin: 0 auto 12px; }
  .welcome-page .hero-lede { margin-bottom: 30px; font-size: 0.98rem; line-height: 1.5; }
}
@media (max-width: 520px) and (max-height: 620px) {
  .welcome-page .afi-cta { margin: 0 0 10px; }
  .welcome-page .hero-lede { margin-bottom: 22px; font-size: 0.92rem; }
  .welcome-page .hero-actions { gap: 8px; }
}
/* Phones: How to help and Your voice fill the screen the same way, and the three ways
   to help become compact rows (icon, then title and text; the row is the link). */
@media (max-width: 520px) {
  .help-page, .voice-page { display: flex; flex-direction: column; flex: 1 0 auto; }
  .help-page > .help-card, .voice-page > .help-card {
    --card-gap: 16px; flex: 1 0 auto; display: flex; flex-direction: column; padding: 20px 14px;
  }
  /* As on Speak and Listen: the tagline at the top, any room left at the bottom. */
  .help-card > .card-tagline { margin-top: -6px; }
  .help-card > :last-child { margin-bottom: auto; }
  .help-page .ways { gap: 10px; }
  .help-page .way {
    display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; row-gap: 2px; align-items: center;
    padding: 12px 14px;
  }
  .help-page .way-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 11px; }
  .help-page .way h3 { margin: 0; font-size: 1.02rem; }
  .help-page .way p { font-size: 0.88rem; line-height: 1.4; }
  .help-page .way-cta { display: none; }
  .voice-page .steps { gap: 10px; }
  .voice-page .dialects p { margin-bottom: 10px; font-size: 0.92rem; }
  .voice-page .chips { gap: 6px; }
  .voice-page .chips li { padding: 4px 11px; font-size: 0.85rem; }
}

@media (max-width: 520px) and (max-height: 700px) {
  .voice-page > .help-card { --card-gap: 12px; padding-block: 16px; }
  .voice-page .journey h2 { margin-bottom: 10px; }
  .voice-page .steps { gap: 6px; }
  .voice-page .steps li { min-height: 36px; padding-top: 3px; font-size: 0.92rem; line-height: 1.4; }
  .voice-page .dialects h2 { margin-bottom: 6px; }
}

/* Phones: Partners fills the screen the same way: tagline at the top, the rest below. */
@media (max-width: 520px) {
  .partners-page { display: flex; flex-direction: column; flex: 1 0 auto; }
  .partners-page > .partners-card { flex: 1 0 auto; display: flex; flex-direction: column; }
  .partners-card > :last-child { margin-bottom: auto; }
  .partners-hero .way-icon { width: 40px; height: 40px; margin-bottom: 10px; }
  .partners-join p { margin-bottom: 16px; }
}

/* The very shortest screens: everything tightens. */
@media (max-width: 520px) and (max-height: 520px) {
  .welcome-page .hero-rule { height: 16px; margin-bottom: 6px; }
  .welcome-page > .hero { padding-block: 12px; }
  .welcome-page .pipe { margin-bottom: 10px; }
  .welcome-page .pipe-vis { height: 44px; }
  .welcome-page .pipe-flow { margin-top: 22px; }
  .welcome-page .hero-actions .btn { padding-block: 10px; }
  .welcome-page .afi-cta { margin-bottom: 8px; }
  .welcome-page .hero-actions { gap: 6px; }
  .welcome-page .hero-lede { font-size: 0.84rem; line-height: 1.4; }
}

/* The selected language's name, wherever it appears (highlightLang in app.js): bold, in
   the app's brown. */
mark.lang-hl { font-weight: 700; color: var(--primary); background: none; }

/* --- Welcome: your voice → dataset → AI model → translation (heroPipeline) ---- */
.net-lines line { stroke: var(--gold); stroke-width: 1; opacity: 0.35; animation: net-pulse 2.6s ease-in-out infinite; animation-delay: var(--d); }
.net-nodes circle { fill: var(--accent); animation: net-node 2.6s ease-in-out infinite; animation-delay: var(--d); transform-box: fill-box; transform-origin: center; }
@keyframes net-pulse { 50% { opacity: 0.9; stroke: var(--accent); } }
@keyframes net-node { 50% { transform: scale(1.35); fill: var(--gold); } }

/* 1: voice → dataset → AI model → translation. Each step: a 72px-high visual, then its label. */
.pipe { display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin: 0 auto 34px; }
.pipe-step { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.pipe-vis { height: 72px; display: grid; place-items: center; }
.pipe-step small { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.pipe-icon {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 30%, transparent);
}
.pipe-icon svg { width: 26px; height: 26px; }
.pipe-logo {
  width: 132px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, var(--surface), color-mix(in srgb, var(--surface-2) 70%, var(--surface)));
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--gold) 60%, transparent);
}
.pipe-logo .brand-cl { font-size: 24px; }
.pipe-logo .brand-my { font-size: 10px; }
.pipe-logo .brand-voices { font-size: 11px; }
.pipe-net { width: 96px; height: 64px; }
.pipe-flow { position: relative; flex: none; width: 40px; height: 4px; margin-top: 34px; border-radius: 2px; background: color-mix(in srgb, var(--gold) 35%, transparent); overflow: hidden; }
.pipe-flow i {
  position: absolute; top: -1px; left: -8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: pipe-dot 1.8s linear infinite;
}
.pipe-flow i:nth-child(2) { animation-delay: 0.6s; } .pipe-flow i:nth-child(3) { animation-delay: 1.2s; }
@keyframes pipe-dot { to { left: 100%; } }
/* The phrases are stacked in one grid cell and take turns; each draws its own box, so the
   box fits the phrase showing. Each line stays on one line: the box widens (to the right)
   rather than growing taller over its label. */
.pipe-out { display: grid; place-items: center start; }
/* The translation step: its box starts right at the dots before it and grows to the right. */
.pipe-step:last-child { align-items: stretch; }
.pipe-step:last-child .pipe-vis { place-items: center start; }
.pipe-step:last-child small { text-align: center; }
.pipe-out > span {
  grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  width: max-content; white-space: nowrap; text-align: center; font-size: 0.86rem; line-height: 1.2;
  padding: 6px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  opacity: 0; animation: pipe-word 9s infinite; animation-delay: calc(var(--k) * 3s);
}
.pipe-out b { color: var(--primary); }
.pipe-out b[lang] { color: var(--accent); }
.pipe-out i { font-style: normal; color: var(--muted); font-size: 0.8rem; }
@keyframes pipe-word { 0%, 30% { opacity: 1; } 34%, 100% { opacity: 0; } }

@media (max-width: 520px) {
  .pipe { gap: 2px; margin-bottom: 26px; }
  .pipe-vis { height: 60px; }
  .pipe-icon { width: 40px; height: 40px; } .pipe-icon svg { width: 20px; height: 20px; }
  .pipe-logo { width: 84px; height: 40px; } .pipe-logo .brand-cl { font-size: 15px; } .pipe-logo .brand-my, .pipe-logo .brand-voices { font-size: 7.5px; }
  .pipe-net { width: 52px; height: 38px; }
  .pipe-flow { width: 10px; margin-top: 28px; }
  .pipe-out > span { font-size: 0.68rem; padding: 4px 7px; border-radius: 10px; }
  .pipe-step small { font-size: 0.56rem; letter-spacing: 0.02em; }
}
@media (prefers-reduced-motion: reduce) {
  .net-lines line, .net-nodes circle, .pipe-flow i { animation: none; }
  .pipe-out > span { animation: none; } .pipe-out > span:not(:first-child) { display: none; } .pipe-out > span:first-child { opacity: 1; }
}

/* --- side navigation (renderSidenav in app.js) ------------------------- */
/* Computers: a sidebar always on the left, below the header; the pages move over
   (the header and footer keep the full width). */
:root { --sidenav-w: 228px; }
.sidenav {
  position: fixed; left: 0; top: var(--header-h, 79px); bottom: 0; z-index: 8; width: var(--sidenav-w);
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain; padding: 18px 12px calc(var(--footer-h, 53px) + 8px);
  background: var(--surface); border-right: 1px solid var(--border);
}
/* Everything about your account sits at the bottom, just above the footer. */
.sidenav-account { margin-top: auto; }
.sidenav-group { display: grid; gap: 2px; padding: 8px 0; }
.sidenav-group + .sidenav-group { border-top: 1px solid var(--border); }
.sidenav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.sidenav a span { overflow: hidden; text-overflow: ellipsis; }
.sidenav a svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 800; box-shadow: inset 3px 0 0 var(--primary); }
.nav-toggle {
  display: none; flex: none; width: 38px; height: 38px; padding: 0; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); place-items: center; cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nav-toggle:hover { background: var(--surface-2); }
.sidenav-backdrop { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.35); }
.sidenav-backdrop[hidden] { display: none; }
@media (min-width: 1101px) {
  body { padding-left: var(--sidenav-w); }
  .topbar, .footer { margin-left: calc(-1 * var(--sidenav-w)); }
}
/* Smaller screens: the same list as a drawer, opened by the ☰ button. */
@media (max-width: 1100px) {
  .nav-toggle { display: grid; }
  .sidenav {
    top: 0; z-index: 31; width: min(280px, 84vw); padding-top: 20px; padding-bottom: 16px; box-shadow: 0 0 40px rgb(0 0 0 / 0.25);
    transform: translateX(-102%); visibility: hidden; transition: transform 0.25s ease, visibility 0s 0.25s;
  }
  .sidenav.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
}
@media (max-width: 520px) { .nav-toggle { width: 34px; height: 34px; } }
@media (prefers-reduced-motion: reduce) { .sidenav { transition: none !important; } }

/* Applied by fitCard when a card is still too tall for the screen. */
.fit-card > * { zoom: var(--fit, 1); }

/* --- welcome ---------------------------------------------------------- */

.welcome { max-width: 940px; margin: 0 auto; display: grid; gap: 22px; }
.welcome h2 { font-size: 1.25rem; margin: 0 0 14px; }

/* Hero: the voice → AI pipeline, then the introduction. The brown ribbon along the top
   edge, as on the other cards, and a warm gold shade fading from the top down. */
.hero {
  text-align: center; padding: 44px 28px 40px; overflow: hidden;
  background:
    linear-gradient(var(--primary), var(--primary)) top / 100% 5px no-repeat,
    linear-gradient(to bottom, color-mix(in srgb, var(--gold) 22%, var(--surface)), var(--surface) 75%);
}
/* The tagline ("my Country Languages Too !"): brown, with a small raised "my" and a
   gold-orange gradient drifting slowly through its initials C, L and T. */
.hero-greet {
  width: fit-content; margin: 0 auto; font-size: clamp(1.45rem, 4.2vw, 2.1rem); font-weight: 800; line-height: 1.15;
  letter-spacing: 0.01em; color: var(--primary); text-wrap: balance;
  background: linear-gradient(90deg, var(--gold), var(--accent), var(--gold), var(--accent), var(--gold)) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: greet-shimmer 8s linear infinite;
}
@keyframes greet-shimmer { to { background-position: -200% 0; } }
.hero-greet-sub { display: block; }
.hero-brand-my {
  display: inline-block; margin-right: 0.08em; vertical-align: 0.9em;
  font-size: 0.36em; font-style: italic; font-weight: 700; letter-spacing: 0.02em;
  -webkit-text-fill-color: var(--primary);
}
.hero-greet .hero-greet-sub { margin-top: 8px; font-size: 0.5em; font-weight: 700; letter-spacing: 0.04em;
  -webkit-text-fill-color: var(--primary); }
/* Its initials (C, L, T) let the gradient through, coloured like "CL2". */
.hero-greet-sub b { margin-right: 0.04em; font-size: 1.35em; font-style: italic; font-weight: 800; line-height: 1; -webkit-text-fill-color: transparent; }
/* The tagline's "my" matches the one before "CL2": small, italic and raised. */
.hero-greet-sub .hero-brand-my { margin-right: 0; font-size: 0.8em; vertical-align: 0.4em; }
@media (prefers-reduced-motion: reduce) { .hero-greet { animation: none; } }
/* The page's title is for screen readers and search engines only; what shows is a
   short gold-orange stroke above the introduction. */
/* Under the pipeline: a small sound-wave of seven bars, pulsing gently like a voice. */
.hero-rule { display: flex; align-items: center; justify-content: center; gap: 5px; height: 24px; margin: 2px auto 16px; }
.hero-rule i {
  width: 5px; height: var(--h); border-radius: 3px; background: linear-gradient(to top, var(--gold), var(--accent));
  animation: rule-wave 1.3s ease-in-out infinite; animation-delay: calc(var(--k) * -0.18s);
}
@keyframes rule-wave { 50% { transform: scaleY(0.5); } }
@media (prefers-reduced-motion: reduce) { .hero-rule i { animation: none; } }
.hero-lede { max-width: 640px; margin: 0 auto 40px; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .btn svg { width: 20px; height: 20px; }
.hero-actions .btn { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.hero-actions .btn:hover { transform: translateY(-2px); }
.hero-actions .btn.primary { box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 28%, transparent); }
.hero-actions .btn.primary:hover { box-shadow: 0 12px 26px color-mix(in srgb, var(--primary) 34%, transparent); }


/* How to help: two cards, the three ways and where a recording goes (with the accents).
   Inside them the three ways are light tiles and the rest plain sections, rather than
   boxes in a box. */
.help-card { --card-gap: 30px; display: grid; gap: var(--card-gap); padding: 32px 28px; }
.help-card .welcome-h { margin-top: 0 !important; }
.help-card > .card-tagline, .partners-card > .card-tagline { margin-bottom: calc(var(--tagline-gap) - var(--card-gap)); }
.help-card .journey h2 { text-align: center; margin-bottom: 18px; }
/* The card titles (here and on Partners) in the brown of the cards' top ribbon. */
.help-card .welcome-h, .help-card .journey h2, .partners-hero h1 { color: var(--primary); }
.help-card .way { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); box-shadow: none; }
@media (max-width: 520px) { .help-card { --card-gap: 24px; padding: 24px 16px; } }

/* Three ways to help. */
.welcome-h { text-align: center; margin: 10px 0 -6px !important; }
.ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.way {
  display: flex; flex-direction: column; gap: 8px; padding: 22px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.way:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 12px 28px rgb(0 0 0 / 0.1); }
.way-icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.way-icon svg { width: 22px; height: 22px; }
.way h3 { margin: 6px 0 0; font-size: 1.12rem; }
.way p { margin: 0; flex: 1; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }
.way-cta { color: var(--primary); font-weight: 700; font-size: 0.92rem; }

/* Where your voice goes: numbered steps joined by a dashed line. */
.steps {
  list-style: none; margin: 0; padding: 0; counter-reset: step;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.steps li { counter-increment: step; position: relative; padding-top: 48px; color: var(--muted); line-height: 1.5; }
.steps li::before {
  content: counter(step); position: absolute; top: 0; left: 0; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-weight: 800;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; top: 17px; left: 46px; right: -10px; border-top: 2px dashed var(--border);
}
.steps b { color: var(--text); }

/* Dialect chips. */
.dialects { text-align: center; padding: 6px 0; }
.dialects p { max-width: 560px; margin: -4px auto 16px; color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips li {
  padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-weight: 600; font-size: 0.92rem;
}

/* --- partners (last page of the strip) --------------------------------- */

/* Everything in one card, like How to help: the partners are light tiles inside it. */
.partners-card { --card-gap: 30px; display: grid; gap: var(--card-gap); padding: 36px 28px; }
@media (max-width: 520px) { .partners-card { --card-gap: 24px; padding: 26px 16px; } }
.partners-hero { text-align: center; }
.partners-hero h1 { margin: 0 0 10px; font-size: clamp(1.25rem, 3vw, 1.7rem); line-height: 1.25; }
.partners-card .partner { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); box-shadow: none; }
.partners-hero .way-icon { margin: 0 auto 14px; }
.partner-group { display: grid; gap: 22px; }
.partners-hero .hero-lede { margin-bottom: 0; }
/* A few cards sit centred under their heading rather than in a half-empty row. */
.partner-grid { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.partner-grid li { flex: 0 1 220px; }
@media (max-width: 520px) { .partner-grid li { flex-basis: 100%; } }
.partner {
  height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 22px 18px; text-align: center; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.partner:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 12px 28px rgb(0 0 0 / 0.1); }
/* Logos sit on a light tile so dark or transparent ones stay readable in dark mode. */
.partner-logo {
  width: 100%; height: 84px; display: grid; place-items: center; padding: 10px; box-sizing: border-box;
  background: #fffaf0; border-radius: 12px;
}
.partner-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.partner-logo.initial {
  width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  font-size: 1.6rem; font-weight: 800;
}
.partner h3 { margin: 6px 0 0; font-size: 1.05rem; }
.partner p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.partners-join { text-align: center; }
.partners-join p { max-width: 560px; margin: 0 auto 20px; color: var(--muted); line-height: 1.6; }
.partners-join .btn svg { width: 20px; height: 20px; }

@media (max-width: 760px) {
  .ways { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 14px; }
  .steps li { padding: 6px 0 0 50px; min-height: 36px; }
  .steps li:not(:last-child)::after { display: none; }
}
@media (max-width: 520px) {
  .welcome { gap: 16px; }
  .hero { padding: 26px 16px 24px; }
  .afi-cta { margin-bottom: 16px; }
  .hero-actions .btn { width: 100%; }
  .way { padding: 18px; }
}

/* --- Afiwa and her tour ----------------------------------------------- */

/* "Tap Afiwa for a one-minute tour": a pill with Afiwa's face that starts her tour. */
.afi-cta {
  display: inline-flex; align-items: center; gap: 9px; margin: 0 0 18px; padding: 4px 16px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer;
  color: var(--primary); font: inherit; font-weight: 600; font-size: 0.92rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.afi-cta:hover { transform: translateY(-1px); border-color: var(--primary); box-shadow: 0 6px 16px rgb(0 0 0 / 0.08); }
.afi-cta-face { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; }
.afi-cta-face .afi { display: block; width: 100%; height: 100%; }
/* A small play badge on her face, gently pulsing. */
.afi-cta-play {
  position: absolute; right: -4px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary); color: var(--primary-ink);
  box-shadow: 0 0 0 2px var(--surface); animation: afi-pulse 2s ease-in-out infinite;
}
.afi-cta-play svg { width: 9px; height: 9px; margin-left: 1px; }
@keyframes afi-pulse { 50% { transform: scale(1.15); } }

/* Afiwa's drawing. */
.afi-bg { fill: var(--primary-soft); }
.afi-skin { fill: #8a5a3c; }
/* Lines drawn over the outfits (folds, uli art, borders); colours come from TARGETS. */
.afi-line { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.afi-fold { opacity: 0.75; }
.afi-bead { stroke: rgb(0 0 0 / 0.25); stroke-width: 0.5; }
.afi-brow { fill: none; stroke: #3a2416; stroke-width: 1.6; stroke-linecap: round; }
.afi-eyes { fill: #24160d; transform-box: fill-box; transform-origin: center; animation: afi-blink 4.6s infinite; }
.afi-cheek { fill: #d07a5f; opacity: 0.35; }
.afi-smile { fill: none; stroke: #4a2112; stroke-width: 2; stroke-linecap: round; }
.afi-mouth { fill: #4a1d10; opacity: 0; transform-box: fill-box; transform-origin: center; }
.afi.talking .afi-smile { opacity: 0; }
.afi.talking .afi-mouth { opacity: 1; animation: afi-talk 0.24s ease-in-out infinite alternate; }
@keyframes afi-blink { 0%, 93%, 100% { transform: none; } 95.5% { transform: scaleY(0.1); } }
@keyframes afi-talk { from { transform: scaleY(0.25); } }

/* The tour plays in the hero, in place of its content. */
/* The tour covers the whole page below the header (--top: where the header ends,
   set from JS). It sits under the header so the header's menus open over it. */
body.touring { overflow: hidden; }
body.touring .footer { visibility: hidden; }
.tour-stage {
  position: fixed; inset: var(--top, 0) 0 0 0; z-index: 9; overflow-y: auto; overscroll-behavior: contain;
  display: grid; place-items: center; padding: 24px 16px; background: var(--bg);
  animation: tour-in 0.25s ease;
}
@keyframes tour-in { from { opacity: 0; } }
.explainer {
  display: grid; gap: 14px; width: min(900px, 100%); padding: 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ex-screen {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; border: 1px solid var(--border);
  /* Short screens: the scene gives up height (not width) so the title row, caption and
     controls stay in view. */
  width: 100%; max-height: max(220px, calc(100dvh - var(--top, 0px) - 360px));
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 0%, var(--primary-soft), transparent 70%), var(--surface-2);
}
.ex-screen video { width: 100%; height: 100%; background: #000; }
.ex-scene {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 18px;
  animation: ex-in 0.5s ease;
}
@keyframes ex-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.ex-narrator { display: flex; align-items: center; gap: 12px; }
.ex-narrator .afi { width: 58px; height: 58px; flex: none; }
.ex-caption { margin: 0; min-height: 3em; font-size: 1.02rem; line-height: 1.5; }
.ex-controls { display: flex; align-items: center; gap: 10px; }
.ex-note {
  margin: -4px 0 0; padding: 8px 12px; border-radius: 10px; font-size: 0.86rem;
  background: var(--surface-2); color: var(--muted);
}
.ex-note[hidden] { display: none; }
.ex-controls .icon-btn { width: 38px; height: 38px; flex: none; }
.ex-controls .icon-btn svg { width: 17px; height: 17px; }
.ex-title { flex: 1; font-weight: 700; }
/* Top row: the tour's title, and × at the right. Tucked up towards the box's corner. */
.ex-top { display: flex; align-items: center; gap: 10px; margin: -14px -14px -4px 0; }
.ex-top .icon-btn { width: 34px; height: 34px; flex: none; }
.ex-top .icon-btn svg { width: 16px; height: 16px; }
.ex-parts { flex: 1; display: flex; gap: 4px; }
.ex-parts button { flex: 1; height: 18px; padding: 0; border: none; background: none; cursor: pointer; display: flex; align-items: center; }
.ex-parts span { position: relative; display: block; width: 100%; height: 5px; overflow: hidden; border-radius: 3px; background: var(--border); }
.ex-parts span::after {
  content: ""; position: absolute; inset: 0; background: var(--primary); transform: scaleX(0); transform-origin: left;
}
.ex-parts .done span::after { transform: none; }
.ex-parts .current span::after { animation: ex-grow var(--dur) linear forwards; }
.explainer.paused .ex-parts .current span::after { animation-play-state: paused; }
@keyframes ex-grow { to { transform: none; } }

/* Scene pieces. Anything with .ex-later appears at its --at time. */
.ex-later { opacity: 0; animation: ex-appear 0.45s var(--at, 1s) forwards; }
@keyframes ex-appear { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes ex-pop { from { opacity: 0; transform: scale(0.6); } }
.ex-langs { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.ex-langs span {
  padding: 10px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-weight: 700; font-size: clamp(1rem, 3vw, 1.5rem); animation: ex-pop 0.5s backwards;
}
.ex-langs span:nth-child(2) { animation-delay: 0.5s; }
.ex-langs span:nth-child(3) { animation-delay: 0.9s; }
.ex-langs span:nth-child(4) { animation-delay: 1.2s; }
.ex-langs .ex-swap { border: none; background: none; color: var(--primary); }
.ex-card {
  width: min(420px, 100%); display: grid; justify-items: center; gap: 12px; padding: 18px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.ex-sentence { margin: 0; font-weight: 700; font-size: clamp(1rem, 2.6vw, 1.3rem); }
/* Speak: the mic (caramel with a cream icon, as on the Speak page) is tapped and
   the voice comes in. */
.ex-mic {
  position: relative; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
}
.ex-mic svg { width: 26px; height: 26px; position: relative; }
.ex-ring {
  position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--primary); opacity: 0;
  animation: ex-ring 1.2s 1.4s ease-out infinite;
}
@keyframes ex-ring { from { opacity: 0.7; transform: scale(0.9); } to { opacity: 0; transform: scale(1.45); } }
.ex-bars { display: flex; align-items: center; gap: 4px; height: 28px; opacity: 0; animation: ex-show 0.3s 1.4s forwards; }
.ex-bars span {
  width: 4px; height: 100%; border-radius: 2px; background: var(--primary); transform: scaleY(0.2);
  animation: ex-voice 0.7s ease-in-out infinite alternate; animation-delay: calc(var(--j) * -0.13s);
}
@keyframes ex-show { to { opacity: 1; } }
@keyframes ex-voice { to { transform: scaleY(1); } }
/* Submit: five sentences fill in, then the pill fills and turns ready. */
/* Ten dots, filling one after another while the Submit pill fills. */
.ex-dots { display: flex; gap: 6px; }
.ex-dots span {
  width: 20px; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  animation: ex-dot 0.25s calc(0.4s + var(--d) * 0.29s) forwards;
}
@keyframes ex-dot { to { background: var(--primary); border-color: var(--primary); } }
.ex-submit {
  position: relative; overflow: hidden; width: min(250px, 100%); height: 48px; border-radius: 999px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700;
}
.ex-fill { position: absolute; inset: 0; background: var(--primary); transform: scaleX(0); transform-origin: left; animation: ex-grow 3s 0.4s linear forwards; }
.ex-submit-label { position: relative; display: inline-flex; align-items: center; gap: 8px; animation: ex-ink 0.2s 3.4s forwards; }
.ex-submit.ex-ready { background: var(--primary); }
.ex-submit.ex-ready .ex-submit-label { color: var(--primary-ink); animation: none; }
.ex-submit-label svg { width: 18px; height: 18px; }
@keyframes ex-ink { to { color: var(--primary-ink); } }
.ex-done { margin: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--good); font-weight: 800; }
.ex-done svg { width: 20px; height: 20px; }
/* Listen: the clip plays, then Yes is chosen. */
.ex-play { animation: none; }
.ex-play svg { margin-left: 3px; }
.ex-progress { width: 80%; height: 6px; overflow: hidden; border-radius: 3px; background: var(--surface-2); }
.ex-progress span { display: block; height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left; animation: ex-grow 2.4s 0.6s linear forwards; }
.ex-votes { display: flex; gap: 12px; }
.ex-votes span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid currentColor; font-weight: 700;
}
.ex-votes svg { width: 16px; height: 16px; }
.ex-yes { color: var(--good); animation: ex-vote 0.35s 3.3s forwards; }
.ex-no { color: var(--danger); opacity: 0.75; }
@keyframes ex-vote { to { background: var(--good); color: #fbf6ec; transform: scale(1.08); } }
/* Write: a sentence is typed, then the submit pill is ready. */
.ex-field {
  width: 100%; min-height: 54px; display: flex; align-items: center; padding: 12px 14px; text-align: left;
  background: var(--field); border: 1px solid var(--border); border-radius: 10px; font-weight: 600;
}
.ex-typed {
  display: inline-block; max-width: 0; overflow: hidden; white-space: nowrap; vertical-align: bottom;
  animation: ex-type 2.4s 0.5s steps(var(--n)) forwards;
}
@keyframes ex-type { to { max-width: calc(var(--n) * 1ch); } }
.ex-caret { width: 2px; height: 1.2em; margin-left: 1px; background: var(--primary); animation: ex-blink 1s steps(1) infinite; }
@keyframes ex-blink { 50% { opacity: 0; } }
/* Dataset: clips fly into the open dataset, which feeds the translator. */
.ex-flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.ex-clips { display: flex; flex-direction: column; gap: 8px; }
.ex-clips span {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  animation: ex-fly 1.1s calc(0.3s + var(--d) * 0.35s) ease-in forwards;
}
.ex-clips svg { width: 18px; height: 18px; }
@keyframes ex-fly { to { opacity: 0; transform: translateX(72px) scale(0.3); } }
.ex-db {
  display: grid; justify-items: center; gap: 6px; padding: 16px 18px; border-radius: 16px; color: var(--primary);
  background: var(--surface); border: 1px solid var(--border); animation: ex-glow 0.5s 1.5s ease 2 alternate;
}
.ex-db svg { width: 42px; height: 42px; }
.ex-db b { color: var(--text); font-size: 0.9rem; }
@keyframes ex-glow { to { box-shadow: 0 0 0 7px var(--primary-soft); } }
.ex-arrow { font-size: 1.7rem; color: var(--primary); }
.ex-translate { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.ex-translate span { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.ex-translate b { color: var(--primary); }
/* The end: Akpe! and the way in. */
.ex-end { display: grid; justify-items: center; gap: 16px; }
.ex-akpe { margin: 0; font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 800; color: var(--primary); animation: ex-pop 0.6s backwards; }

@media (max-width: 520px) {
  .tour-stage { padding: 12px; }
  .explainer { padding: 14px; }
  .ex-top { margin: -8px -8px -4px 0; }
  /* Phones: the stacked scenes are never cut off: the frame grows with its content, and
     is at least as tall as the tallest one (the dataset) so it doesn't jump. */
  .ex-screen { aspect-ratio: auto; min-height: 310px; max-height: none; }
  .ex-scene { padding: 12px; }
  .ex-caption { font-size: 0.95rem; }
  .ex-narrator .afi { width: 48px; height: 48px; }
  .ex-controls { gap: 6px; }
  /* Dataset scene stacked: clips drop into the dataset, which points down to the languages. */
  .ex-flow { flex-direction: column; gap: 10px; }
  .ex-clips { flex-direction: row; }
  .ex-clips span { animation-name: ex-drop; }
  .ex-arrow { rotate: 90deg; }
  /* Scene 1 stacked: English Français, then ⇄ (pointing down), then Ewe. */
  .ex-langs { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 10px; }
  .ex-langs .ex-swap, .ex-langs span:last-child { grid-column: 1 / -1; justify-self: center; }
  .ex-langs .ex-swap { rotate: 90deg; padding: 0; }
}
@keyframes ex-drop { to { opacity: 0; transform: translateY(56px) scale(0.3); } }
/* Reduced motion: no blinking, talking or pulsing; scenes jump to their end state. */
@media (prefers-reduced-motion: reduce) {
  .afi-eyes, .afi.talking .afi-mouth, .afi-cta-play { animation: none; }
  .ex-scene, .ex-scene * {
    animation-duration: 0.01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  }
}

/* Crawlable intro in index.html: visible only if app.js never runs. */
.js .seo-intro { display: none; }
.seo-intro { max-width: 720px; margin: 0 auto; padding: 24px 16px; line-height: 1.6; }
