/* Popover selectors — shared by "Starts with" (multi), syllables + sort (single). */
.ms {
  position: relative;
}
.ms-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-control);
  padding: 11px 13px;
  font-size: 1rem;
  cursor: pointer;
  min-width: 140px;
  text-align: left;
  white-space: nowrap;
}
.ms-btn:hover {
  border-color: #33415a;
}
.ms-btn.active {
  border-color: var(--accent);
  color: var(--ink);
}
.ms-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  padding: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  width: 264px;
}
.ms-panel[hidden] {
  display: none;
}
.ms-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.ms-grid button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--r-row);
  padding: 7px 0;
  font-size: 0.85rem;
  cursor: pointer;
}
.ms-grid button:hover {
  border-color: #33415a;
  color: var(--ink);
}
.ms-grid button.on {
  background: var(--accent);
  color: #20150a;
  font-weight: 700;
  border-color: var(--accent);
}
.ms-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.ms-actions button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--r-row);
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
}
.ms-actions button:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.ms-actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #20150a;
  font-weight: 700;
}
.ms-actions .primary:hover {
  color: #20150a;
} /* single-select list variant (syllables, sort) — :not([hidden]) so the hidden attr still wins */
.ms-panel.ms-list:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ms-panel.ms-list {
  width: 190px;
  padding: 8px;
}
.ms-opt {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--r-row);
  padding: 9px 11px;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.ms-opt:hover {
  border-color: #33415a;
  color: var(--ink);
}
.ms-opt.on {
  background: var(--accent);
  color: #20150a;
  font-weight: 700;
  border-color: var(--accent);
} /* Voice picker popover — wider panel, one row per gender with a preview button. */
.voice-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.voice-panel {
  padding: 0;
}
.voice-panel .vmsel { flex: 1; min-width: 0; }
.voice-panel .vrow {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.voice-panel .vrow label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.voice-panel .vpick {
  display: flex;
  gap: 6px;
  align-items: center;
}
.voice-panel select {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-row);
  padding: 8px 9px;
  font-size: 0.85rem;
  cursor: pointer;
}
.voice-panel select:hover {
  border-color: #33415a;
}
.voice-panel .vprev {
  flex: none;
  padding: 7px 9px;
  line-height: 1;
}
.voice-panel .vnote {
  font-size: 0.72rem;
  color: var(--dim);
  line-height: 1.35;
  margin-top: 2px;
} /* Light theme (toggled via html.light; persisted in localStorage) */
html.light {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel2: #eef1f5;
  --line: #d6dbe2;
  --ink: #1a2230;
  --muted: #566577;
  --dim: #8b97a6;
  --accent: #e0842f;
  --accent2: #2f9d86;
  --pink: #d4537e;
  --girl: #d4537e;
  --boy: #2f6fb1;
  --uni: #7d5bc0;
}
html.light .card:hover {
  border-color: #c3cad4;
}
html.light .fav-toggle.on {
  background: #fbe9f0;
}
.theme-toggle {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-control);
  padding: 7px 10px;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--accent);
} /* Phase 7 — expanded card detail */
.detailbtn.on {
  border-color: var(--accent2);
  color: var(--accent2);
}
.detail {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.22s ease,
    opacity 0.22s ease;
}
.detail.open {
  max-height: 420px;
  opacity: 1;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.drow {
  display: flex;
  gap: 10px;
  font-size: 0.86rem;
  padding: 3px 0;
  align-items: baseline;
}
.dk {
  flex: 0 0 62px;
  color: var(--dim);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 2px;
}
.dv {
  flex: 1;
  color: var(--ink);
}
.dim {
  color: var(--dim);
}
.stags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.stag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--accent2);
}
.dloading,
.dempty {
  font-size: 0.82rem;
  color: var(--dim);
  padding: 2px 0;
}
.ms-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-row);
  padding: 8px 10px;
  font-size: 0.9rem;
}
.ms-scroll {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ms-scroll button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: var(--r-row);
  padding: 8px 11px;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.ms-scroll button:hover {
  border-color: #33415a;
  color: var(--ink);
}
.ms-scroll button.on {
  background: var(--accent);
  color: #20150a;
  font-weight: 700;
  border-color: var(--accent);
}
.ms-scroll button.on::after {
  content: " ✓";
}
#culturePanel,
#scripturePanel {
  width: 236px;
}
.stag.clk {
  cursor: pointer;
}
.stag.clk:hover {
  border-color: var(--accent);
  color: var(--ink);
}
/* Mobile: cap the scrollable list to ~4 items (search bar makes a 5th row)
   so the Clear / OK actions stay visible without scrolling the page. */
@media (max-width: 900px) {
  .ms-scroll {
    max-height: 150px;
  }
}

/* Results count — a centered pill with a solid background so scrolling name cards
   don't bleed through the text (the namebar fades to transparent at its base). */
.count {
  max-width: 100%;
  margin: 0 auto 14px;
  padding: 0;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.count:empty { display: none; padding: 0; margin: 0; border: 0; }
