:root {
  --bg: #f6efe2;
  --ink: #2b1d0e;
  --muted: #5a4a36;
  --accent: #7a5a2b;
  --accent-soft: #b08a4f;
  --line: #d9c8a8;
  --card: #fffaf0;
  --link: #5a3a1a;
  --ok: #2e6b3a;
  --pending: #866119;
  --nuanced: #8a3a1a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --ar: "Amiri", "Scheherazade New", serif;
  --shadow: 0 2px 12px rgba(43, 29, 14, 0.08);
  --shadow-lg: 0 8px 32px rgba(43, 29, 14, 0.15);
}
/* Dark palette: applies for system dark scheme unless the user forced
   light in Settings, and always when the user forced dark. Keep the two
   blocks' token lists identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a120a;
    --ink: #f0e6d2;
    --muted: #bfae8a;
    --accent: #d9b074;
    --accent-soft: #8a6a3a;
    --line: #3a2c1a;
    --card: #241810;
    --link: #e8c98a;
    --ok: #7ac590;
    --pending: #e0b860;
    --nuanced: #e08a6a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  --bg: #1a120a;
  --ink: #f0e6d2;
  --muted: #bfae8a;
  --accent: #d9b074;
  --accent-soft: #8a6a3a;
  --line: #3a2c1a;
  --card: #241810;
  --link: #e8c98a;
  --ok: #7ac590;
  --pending: #e0b860;
  --nuanced: #e08a6a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}
/* ── Alternate palettes (Settings → Palette) ─────────────────────────
   Same structure as the default Parchment: a light block, an auto-dark
   media block, and a forced-dark block. The [data-palette][data-theme]
   combinations out-rank the parchment dark blocks by specificity, so
   ordering here is safe. All text tokens hold 4.5:1 on bg and card. */
:root[data-palette="paper"] {
  --bg: #f7f7f5;
  --ink: #1f1f1f;
  --muted: #565660;
  --accent: #3d5a80;
  --accent-soft: #98a8bd;
  --line: #d8d8d2;
  --card: #ffffff;
  --link: #2f4a6b;
  --ok: #256b35;
  --pending: #7a5c10;
  --nuanced: #963a28;
  --shadow: 0 2px 12px rgba(20, 20, 25, 0.08);
  --shadow-lg: 0 8px 32px rgba(20, 20, 25, 0.14);
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="paper"]:not([data-theme="light"]) {
    --bg: #16171a;
    --ink: #e9e9e6;
    --muted: #a6a6ad;
    --accent: #94b8e0;
    --accent-soft: #4d637d;
    --line: #34363c;
    --card: #1f2126;
    --link: #a8c8ea;
    --ok: #7ac590;
    --pending: #d9b860;
    --nuanced: #e08a6a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-palette="paper"][data-theme="dark"] {
  --bg: #16171a;
  --ink: #e9e9e6;
  --muted: #a6a6ad;
  --accent: #94b8e0;
  --accent-soft: #4d637d;
  --line: #34363c;
  --card: #1f2126;
  --link: #a8c8ea;
  --ok: #7ac590;
  --pending: #d9b860;
  --nuanced: #e08a6a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}
:root[data-palette="sage"] {
  --bg: #f1f4ea;
  --ink: #1f2a1c;
  --muted: #4c5a45;
  --accent: #43633a;
  --accent-soft: #93a888;
  --line: #ccd6c0;
  --card: #fafcf4;
  --link: #35522c;
  --ok: #2e6b3a;
  --pending: #7a5c10;
  --nuanced: #8a3a1a;
  --shadow: 0 2px 12px rgba(31, 42, 28, 0.08);
  --shadow-lg: 0 8px 32px rgba(31, 42, 28, 0.14);
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="sage"]:not([data-theme="light"]) {
    --bg: #151a11;
    --ink: #e5ecdb;
    --muted: #a9b89d;
    --accent: #a8c795;
    --accent-soft: #566b4a;
    --line: #2e3927;
    --card: #1d241a;
    --link: #bcd8a8;
    --ok: #7ac590;
    --pending: #e0b860;
    --nuanced: #e08a6a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-palette="sage"][data-theme="dark"] {
  --bg: #151a11;
  --ink: #e5ecdb;
  --muted: #a9b89d;
  --accent: #a8c795;
  --accent-soft: #566b4a;
  --line: #2e3927;
  --card: #1d241a;
  --link: #bcd8a8;
  --ok: #7ac590;
  --pending: #e0b860;
  --nuanced: #e08a6a;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
button {
  cursor: pointer;
  font-family: inherit;
}
header.site {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 2.2rem 1.25rem 1.4rem;
  text-align: center;
  position: relative;
  /* Amiri's ﷽ ligature paints ink beyond its layout box; without a clip
     the glyph's overflow widens the page's scroll area on small screens. */
  overflow-x: clip;
}
header.site .crest {
  font-family: var(--ar);
  font-size: 2.4rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}
@media (max-width: 480px) {
  header.site .crest {
    font-size: 1.9rem;
  }
}
header.site h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0.3rem 0 0.25rem;
  letter-spacing: 0.005em;
  color: var(--ink);
}
header.site h1 a {
  color: inherit;
  text-decoration: none;
}
header.site .tag {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}
header.site .tag-khitab {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.4rem;
  letter-spacing: 0.01em;
}
header.site .tag-khitab a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
}
header.site .dates {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
nav.primary {
  display: flex;
  justify-content: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
nav.primary .nav-groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.primary .nav-group {
  position: relative;
  margin: 0;
}
nav.primary .nav-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  min-height: 40px;
  cursor: pointer;
  transition: all 0.15s ease;
}
nav.primary .nav-group-btn::after {
  content: "▾";
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}
nav.primary .nav-group-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
nav.primary .nav-group-btn[aria-expanded="true"] {
  border-color: var(--accent);
}
nav.primary .nav-group-btn[aria-expanded="true"]::after {
  transform: rotate(180deg);
}
nav.primary .nav-group[data-current="true"] > .nav-group-btn {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 500;
}
nav.primary .nav-group[data-current="true"] > .nav-group-btn::after {
  color: var(--bg);
}
nav.primary .nav-menu {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.3rem;
}
nav.primary .nav-menu li {
  margin: 0;
}
nav.primary .nav-menu a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 4px;
  min-height: 40px;
  line-height: 1.4;
}
nav.primary .nav-menu a:hover,
nav.primary .nav-menu a:focus-visible {
  background: var(--bg);
  color: var(--accent);
}
nav.primary .nav-menu a[aria-current="page"] {
  background: var(--bg);
  color: var(--accent);
  font-weight: 600;
}
html.js-nav nav.primary .nav-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
}
html.js-nav nav.primary .nav-menu[hidden] {
  display: none;
}
nav.primary .nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  min-height: 40px;
  cursor: pointer;
}
nav.primary .nav-toggle-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 13px;
}
nav.primary .nav-toggle-icon::before,
nav.primary .nav-toggle-icon::after,
nav.primary .nav-toggle-icon-bar {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}
nav.primary .nav-toggle-icon::before {
  top: 0;
}
nav.primary .nav-toggle-icon-bar {
  top: 5.5px;
}
nav.primary .nav-toggle-icon::after {
  bottom: 0;
}
nav.primary .nav-toggle.is-open .nav-toggle-icon::before {
  top: 5.5px;
  transform: rotate(45deg);
}
nav.primary .nav-toggle.is-open .nav-toggle-icon-bar {
  opacity: 0;
}
nav.primary .nav-toggle.is-open .nav-toggle-icon::after {
  bottom: 5.5px;
  transform: rotate(-45deg);
}
@media (max-width: 768px) {
  nav.primary {
    flex-wrap: wrap;
  }
  nav.primary .nav-toggle {
    display: inline-flex;
  }
  nav.primary .nav-groups {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    margin-top: 0.6rem;
  }
  nav.primary .nav-groups.is-open {
    display: flex;
  }
  nav.primary .nav-group {
    width: 100%;
  }
  nav.primary .nav-group-btn {
    width: 100%;
    justify-content: space-between;
  }
  html.js-nav nav.primary .nav-menu {
    position: static;
    transform: none;
    left: auto;
    min-width: 0;
    width: 100%;
    margin: 0.3rem 0 0.4rem;
    border: none;
    box-shadow: none;
    background: transparent;
  }
}
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 6rem;
}
section {
  margin: 2.5rem 0;
  scroll-margin-top: 5rem;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  margin: 0.2rem 0 0.8rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}
h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 1.2rem 0 0.5rem;
}
h4 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0.8rem 0 0.3rem;
  color: var(--accent);
}
p {
  margin: 0.6rem 0;
}
.lede {
  font-family: var(--serif);
  font-size: 1.18rem;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.5;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.card h3 {
  margin-top: 0;
}
.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
}
.tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}
.tile .name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
}
.tile .desc {
  font-size: 0.92rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.45;
}
.ar {
  font-family: var(--ar);
  font-size: 1.5rem;
  line-height: 1.9;
  direction: rtl;
  unicode-bidi: isolate;
  color: var(--ink);
}
.ar.big {
  font-size: 2.1rem;
}
.ar.xl {
  font-size: 2.6rem;
  text-align: center;
  margin: 1rem 0;
}
.translit {
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
}
blockquote.khan {
  margin: 1.5rem 0;
  padding: 1.2rem 1.4rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  border-radius: 0 8px 8px 0;
  box-shadow: var(--shadow);
}
blockquote.khan cite {
  display: block;
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.6rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  cursor: help;
  line-height: 1.3;
  vertical-align: middle;
}
/* Badges carrying a source are clickable (cite-badge.js opens the full
   citation and marks them role="button"). The default help cursor above
   signals only the hover tooltip; a pointer cursor is what tells a
   first-time reader the site's core promise — click any claim to see its
   source — is actually one click away. Pending badges (no source id) stay
   help-cursored: they are hover-only. */
.badge[data-source-ids] {
  cursor: pointer;
}
.badge.ok {
  color: var(--ok);
}
.badge.pending {
  color: var(--pending);
}
.badge.nuanced {
  color: var(--nuanced);
  opacity: 1;
  border-width: 1.5px;
}
.badge[title]::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 400;
  /* display:none, not opacity alone: an invisible absolutely-positioned
     tooltip still widens the page's scrollable area, which put a ~100px
     horizontal scroll on every badge-bearing page at mobile widths. */
  display: none;
  width: max-content;
  max-width: min(80vw, 320px);
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 200;
  text-transform: none;
  letter-spacing: 0;
}
.badge[title]:hover::after,
.badge[title]:focus::after {
  display: block;
}
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 24px minimum target size (WCAG 2.5.8); was 19px rendered */
  width: 1.5rem;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0;
  margin-left: 0.25rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}
.info-tip:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.info-tip:active {
  transform: scale(0.95);
}
.prov {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.7rem;
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
  line-height: 1.55;
}
.method-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
  border-left: 2px solid var(--line);
  padding-left: 0.6rem;
}
.method-note summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--muted);
}
.method-note summary::-webkit-details-marker {
  display: none;
}
.method-note[open] summary {
  color: var(--text);
}
.method-note p {
  margin: 0.3rem 0 0;
}
.banner {
  background: var(--card);
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
  font-size: 0.94rem;
  line-height: 1.55;
  box-shadow: var(--shadow);
}
.banner.soft {
  border-color: var(--accent-soft);
}
.banner.note {
  border-color: var(--pending);
}
.banner strong {
  color: var(--accent);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7rem 0;
  font-size: 0.92rem;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data th,
table.data td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data thead {
  background: var(--bg);
}
table.data th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
table.data tbody tr:hover {
  background: var(--bg);
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
.barwrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
  font-size: 0.86rem;
}
.barwrap .lbl {
  width: 140px;
  flex-shrink: 0;
  color: var(--muted);
}
.bar {
  flex: 1;
  height: 9px;
  background: var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 100%);
  border-radius: 5px;
  transition: width 0.6s ease;
}
.count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 3rem;
  text-align: right;
}
input[type="text"],
input[type="search"],
input[type="number"],
select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s ease;
}
input[type="text"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
}
label {
  cursor: pointer;
}
.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.15s ease;
}
.button:hover {
  background: var(--ink);
  transform: translateY(-1px);
}
.button.secondary {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.button.secondary:hover {
  border-color: var(--accent);
  background: var(--card);
}
.verse {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.verse .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.verse .translation {
  margin: 0.6rem 0;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.verse .translation:last-child {
  border-bottom: 0;
}
.verse .translation .label {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.verse .translation .text {
  font-size: 1.02rem;
  line-height: 1.6;
}
.settings {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
}
.settings .gear {
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  width: 52px;
  height: 52px;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s ease;
}
.settings .gear:hover {
  transform: rotate(45deg) scale(1.05);
}
.panel {
  position: fixed;
  right: 1rem;
  bottom: 5.2rem;
  width: min(380px, calc(100vw - 2rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-lg);
  z-index: 41;
  max-height: 85vh;
  overflow-y: auto;
}
.panel[hidden] {
  display: none;
}
.panel h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.panel h4 {
  margin: 1rem 0 0.4rem;
  color: var(--accent);
  font-size: 0.95rem;
}
.panel .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin: 0.4rem 0;
  font-size: 0.9rem;
}
.panel select {
  font-size: 0.88rem;
  padding: 0.3rem 0.5rem;
}
.panel .check-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.3rem 0;
  font-size: 0.88rem;
}
.panel .check-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}
.panel .check-list input[type="checkbox"] {
  accent-color: var(--accent);
}
.depth-toggle {
  display: flex;
  gap: 0.3rem;
  margin: 0.5rem 0 0.8rem;
}
.depth-toggle button {
  flex: 1 1 auto;
  /* let "Encyclopedic" size its button instead of clipping */
  min-width: max-content;
  padding: 0.45rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--ink);
  transition: all 0.15s ease;
}
.depth-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}
.panel .small {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.6rem;
}
.panel .actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.panel .actions button {
  flex: 1;
  padding: 0.4rem;
  font-size: 0.82rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}
.panel .actions button:hover {
  border-color: var(--accent);
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  z-index: 99;
}
footer.site {
  max-width: 1080px;
  margin: 3rem auto 0;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}
footer.site a {
  color: var(--muted);
}
.attr {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.4rem;
}
.kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
}
.scholar-only,
.encyclopedic-only {
  display: none;
}
html[data-depth="scholar"] .scholar-only,
html[data-depth="encyclopedic"] .scholar-only,
html[data-depth="encyclopedic"] .encyclopedic-only {
  display: block;
}
html[data-depth="scholar"] td.scholar-only,
html[data-depth="encyclopedic"] td.scholar-only,
html[data-depth="encyclopedic"] td.encyclopedic-only {
  display: table-cell;
}
html[data-depth="scholar"] li.scholar-only,
html[data-depth="encyclopedic"] li.scholar-only,
html[data-depth="encyclopedic"] li.encyclopedic-only {
  display: list-item;
}
@media print {
  nav.primary,
  .settings,
  .panel {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  .card,
  .verse,
  table.data {
    border-color: #999;
    break-inside: avoid;
    background: #fff;
    box-shadow: none;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  .ar {
    color: #000;
  }
}
@media (max-width: 600px) {
  header.site h1 {
    font-size: 1.6rem;
  }
  .ar {
    font-size: 1.35rem;
  }
  .ar.xl {
    font-size: 2rem;
  }
  .barwrap .lbl {
    width: 100px;
    font-size: 0.78rem;
  }
  main {
    padding: 1rem 1rem 7rem;
  }
  nav.primary {
    padding: 0.5rem 0.4rem;
  }
  nav.primary .nav-groups {
    gap: 0.3rem;
  }
  nav.primary .nav-group-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
  }
}

/* ── Roots page: sparkline column ─────────────────────────────────── */
.root-row td.spark-cell {
  padding: 0.3rem 0.4rem;
  line-height: 0;
}

/* ── Word-family table: mobile stacked layout ────────────────────── */
@media (max-width: 480px) {
  .word-family-table {
    display: block;
  }
  .word-family-table thead {
    display: none;
  }
  .word-family-table tbody,
  .word-family-table tr,
  .word-family-table td {
    display: block;
    width: 100%;
  }
  .word-family-table tr {
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }
  .word-family-table td {
    padding: 0.15rem 0;
  }
  .word-family-table td::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 0.78rem;
  }
  .word-family-table td.ar-cell::before {
    content: "";
  }
}

/* ── Compare page: typeahead suggestion list ─────────────────────── */
.root-suggest {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  position: absolute;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow);
  min-width: 220px;
}
.root-suggest li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.root-suggest li:last-child {
  border-bottom: none;
}
.root-suggest li:hover,
.root-suggest li.active {
  background: var(--bg);
}
.root-suggest .latin {
  font-weight: 500;
}
.root-suggest .ar {
  font-family: var(--ar);
  margin: 0 0.4rem;
}
.root-suggest .meaning {
  color: var(--muted);
  font-size: 0.82rem;
}

/* ── Definition list (glossary page) ────────────────────────────── */
dt {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
  margin-top: 1.1rem;
}
dt:first-child {
  margin-top: 0;
}
dd {
  margin-inline-start: 0;
  margin-top: 0.25rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ── Inline glossary terms ───────────────────────────────────────── */
.gloss {
  text-decoration: underline dotted;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}
.gloss:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.gloss-pop {
  position: absolute;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  max-width: 320px;
}
.gloss-pop[hidden] {
  display: none;
}
.gloss-pop .gloss-pop-term {
  color: var(--accent);
}
.gloss-pop .gloss-pop-more {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--link);
}

/* ── Ask box ─────────────────────────────────────────────────────── */
.ask-section {
  max-width: 640px;
  margin: 0 auto 1rem;
  padding: 0.5rem 0 0.5rem;
}
.ask-section.hero {
  padding: 0.25rem 0 0.5rem;
}
.ask-label {
  display: block;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--ink);
}
.ask-help {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.ask-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.ask-input {
  flex: 1;
  font-size: 1.25rem;
  padding: 0.6rem 0.85rem;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  min-height: 52px;
}
.ask-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(122, 90, 43, 0.15);
  outline: none;
}
.ask-go {
  padding: 0.6rem 1.3rem;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  min-height: 52px;
  min-width: 60px;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}
.ask-go:hover {
  background: var(--ink);
  transform: translateY(-1px);
}
.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.chip {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 44px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}
.ask-feedback {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  color: #a03020;
  min-height: 1.2em;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ask-feedback {
    color: #e07060;
  }
}
:root[data-theme="dark"] .ask-feedback {
  color: #e07060;
}
@media (max-width: 640px) {
  .ask-input {
    font-size: 1.1rem;
  }
  .ask-row {
    flex-direction: column;
  }
  .ask-go {
    width: 100%;
  }
}

/* ── Recurring root highlights ────────────────────────────────────── */
.recurring-word {
  text-decoration: underline;
  text-decoration-color: rgba(122, 90, 43, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.1s ease;
}
.recurring-word:hover,
.recurring-word:focus {
  background: rgba(122, 90, 43, 0.12);
  outline: none;
}
.recurring-word.highlighted {
  background: rgba(122, 90, 43, 0.18);
  text-decoration-color: rgba(122, 90, 43, 0.65);
}
#rootTooltip {
  position: fixed;
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  pointer-events: auto;
  font-family: var(--sans);
  direction: ltr;
}
#rootTooltip[hidden] {
  display: none;
}
.rt-root {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.1rem;
}
.rt-count {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}
.rt-positions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.rt-positions a {
  font-size: 0.78rem;
  color: var(--link);
  text-decoration: none;
}
.rt-positions a:hover {
  text-decoration: underline;
}

/* ── Recurring vocabulary sidebar (Encyclopedic) ──────────────────── */
.vocab-panel {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.vocab-panel > summary {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0.9rem;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.vocab-panel > summary::after {
  content: "▾";
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--sans);
}
.vocab-panel[open] > summary::after {
  content: "▴";
}
.vocab-panel > summary::-webkit-details-marker {
  display: none;
}
.vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem 0.8rem;
}
.vocab-root-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.12s ease;
  min-height: 36px;
}
.vocab-root-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.vocab-root-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.vocab-root-name {
  font-weight: 500;
}
.vocab-root-count {
  font-size: 0.75rem;
  color: inherit;
  opacity: 0.7;
}

/* ── Cross-reference panel ────────────────────────────────────────── */
.xref-panel {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}
.xref-panel > summary {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0 0.4rem;
  user-select: none;
}
.xref-panel > summary:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.xref-panel > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.xref-panel > summary::after {
  content: "▸";
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--sans);
}
.xref-panel[open] > summary::after {
  content: "▾";
}
.xref-panel > summary::-webkit-details-marker {
  display: none;
}
.xref-list {
  margin-top: 0.25rem;
}
.xref-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.xref-item:last-child {
  border-bottom: none;
}
.xref-ref {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
  margin-bottom: 0.2rem;
}
.xref-ref:hover {
  text-decoration: underline;
}
.xref-cat {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.4rem;
  font-style: italic;
}
.xref-ar {
  font-size: 1.1rem;
  margin: 0.2rem 0 0.15rem;
  line-height: 1.8;
  display: block;
}
.xref-trans {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  display: block;
}

/* ── How we verify block ─────────────────────────────────────────── */
.verify-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.verify-example {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.verify-example h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.verify-example .claim {
  font-size: 0.95rem;
  margin: 0.25rem 0 0.5rem;
  line-height: 1.5;
}
.verify-example .trace {
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
  margin-top: 0.55rem;
  line-height: 1.5;
}

/* ── AQU identity bridge ─────────────────────────────────────────── */
.aqu-bridge {
  border-left: 3px solid var(--accent-soft);
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border-radius: 0 6px 6px 0;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 1rem 0;
}

/* ── Muted inline notes and footer links ─────────────────────────── */
.muted-note {
  font-size: 0.85rem;
  color: var(--muted);
}
footer.site .footer-links {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}
main a {
  overflow-wrap: anywhere;
}
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.back-to-top {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  box-shadow: var(--shadow);
}
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}
kbd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82em;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05em 0.4em;
}
