/* Reader */

.reader { max-width: 1280px; container-type: inline-size; }

.reader__layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 24px;
  align-items: start;
}
.reader__main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* Header: "← Library" and the page arrows on one line, the title under them,
   then the reading options, and how far into the book this page is. */
.reader__head { display: flex; flex-direction: column; gap: 14px; }
.reader__topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.reader__back {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--ink); border-radius: var(--radius-pill);
  padding: 0 16px; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.reader__back:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.reader__top-pager { display: flex; align-items: center; gap: 6px; }
.reader__arrow {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; color: var(--ink);
}
a.reader__arrow:hover { border-color: var(--ink); text-decoration: none; }
.reader__arrow[aria-disabled="true"] { opacity: .4; }
.reader__count { font-size: 14px; font-weight: 600; padding: 0 8px; white-space: nowrap; }
.reader__count-short { display: none; }
.reader__titlebar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; }
.reader__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reader__title-ar { font-size: 24px; color: var(--green); align-self: flex-start; }
.reader__title { font-size: 40px; line-height: 1; margin: 0; }
.reader__title--ar { font-family: var(--font-arabic); font-weight: 700; line-height: 1.35; align-self: flex-start; }
.reader__head-progress { flex: none; }

.reader__toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.reader__toggle { padding: 8px 14px; font-size: 13px; font-weight: 600; }
.reader__listen { padding: 8px 14px; font-size: 13px; }

/* ---- The page of text ---- */

.reader__page {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 48px clamp(20px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-x: clip; /* keep edge glosses from widening the page */
}
.reader__sentence {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 36px;
  align-items: start;
}
.reader__ar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 34px;
  line-height: 2;
}
.reader__en {
  display: none;
  font-style: italic;
  font-size: 20px;
  line-height: 1.45;
  color: var(--text-body);
}
.reader.is-translated .reader__en,
.reader.is-parallel .reader__en { display: block; }

/* Side by side: Arabic on the right, English on the left. */
.reader.is-parallel .reader__sentence { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); direction: rtl; }
.reader.is-parallel .reader__en { direction: ltr; font-size: 18px; padding-top: 14px; }

.reader__word {
  position: relative;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  border-radius: var(--radius-sm);
  padding: 0 4px;
}
.reader__word:hover { background: var(--sand); }
.reader__word.is-saved { box-shadow: inset 0 -2px 0 var(--green); }
.reader__word.is-selected { background: var(--word-selected); box-shadow: inset 0 -2px 0 var(--word-selected-line); }

/* Hover gloss (same look as the landing page's .gloss). */
.reader__gloss {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  z-index: 5;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--ink) 40%, transparent);
}
.reader__gloss strong { font-size: 16px; }
.reader__gloss > span { color: var(--text-on-dark-muted); }
.reader__word:is(:hover, :focus-visible):not(.is-selected) .reader__gloss { display: flex; }
.reader.is-hover-off .reader__word .reader__gloss { display: none; }

.reader__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
}
.reader__pager { display: flex; gap: 8px; align-items: center; }
.reader__page-btn { padding: 8px 14px; font-size: 14px; font-weight: 400; }

/* ---- Side panel ---- */

.reader__panel {
  padding: 0;
  border-radius: 20px;
  position: sticky;
  top: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.reader__tabs { display: flex; border-bottom: 1px solid var(--line); }
.reader__tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 14px 8px;
  font-size: 14px;
  font-weight: 600;
}
.reader__tab:hover { color: var(--ink); }
.reader__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--clay); }
.reader__tabpanel { padding: 22px; }

/* Word tab */
.reader__entry { display: flex; flex-direction: column; gap: 16px; }
.reader__entry-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.reader__entry-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.level-pill { letter-spacing: .5px; cursor: help; }
.reader__entry-ar { font-size: 46px; line-height: 1.3; }
.reader__entry-en { font-size: 30px; line-height: 1.1; }
.reader__entry-source { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.reader__facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0;
  font-size: 14px;
  align-items: baseline;
}
.reader__facts dt { color: var(--text-muted); }
.reader__facts dd { margin: 0; }
.reader__facts-root { font-size: 18px; }
.reader__family {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reader__family-title { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.reader__family-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reader__family-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; }
.reader__family-ar { font-size: 22px; }

/* Sentence tab */
.reader__analysis { display: flex; flex-direction: column; gap: 14px; }
.reader__analysis-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.reader__analysis-pos { font-size: 13px; color: var(--text-muted); }
.reader__analysis-pos strong { color: var(--ink); }
.reader__analysis-nav { display: flex; gap: 6px; }
.reader__analysis-step { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: none; color: var(--ink); }
.reader__analysis-step:hover:not(:disabled) { border-color: var(--ink); }
.reader__analysis-step:disabled { opacity: .4; }
.reader__analysis-ar { font-size: 27px; line-height: 2.2; text-align: right; }
.reader__analysis-w { background: none; border: none; padding: 0 3px; margin: 0; font: inherit; color: inherit; border-radius: 6px; cursor: pointer; }
.reader__analysis-w:hover { background: var(--sand-hover); }
.reader__analysis-w.is-selected { outline: 2px solid var(--ink); background: var(--field); }
.reader__analysis-en { margin: -8px 0 0; font-family: var(--font-serif); font-size: 19px; line-height: 1.35; color: var(--text-body); font-style: italic; }
.reader__breakdown { display: flex; flex-direction: column; gap: 12px; }
.reader__analysis-explain { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reader__explain-mark { font-size: 17px; color: var(--peach); }
.reader__analysis-note { font-size: 13px; color: var(--text-muted); }
.reader__irab { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.reader__irab-row {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}
.reader__irab-row:hover { background: var(--sand-hover); }
.reader__irab-row.is-selected { background: var(--clay-soft); }
.reader__irab-ar { font-size: 22px; }

/* Assistant tab */
.reader__chat { padding: 18px; max-height: 460px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.reader__messages { display: flex; flex-direction: column; gap: 10px; }
.reader__msg {
  align-self: flex-start;
  max-width: 88%;
  background: var(--sand);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.reader__msg--user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.reader__msg-ar { font-size: 1.15em; line-height: 1.4; }
.reader__thinking { font-size: 13px; color: var(--text-muted); }
.reader__quota {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 18px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.reader__quota a { font-weight: 700; }
.reader__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px; }
.reader__chip { font-size: 12px; cursor: pointer; white-space: normal; text-align: left; }
.reader__chip:hover { background: var(--sand-hover); }
.reader__ask { display: flex; gap: 8px; padding: 14px 18px 18px; }
.reader__ask .input { flex: 1; min-width: 0; }

/* Quiz tab */
.reader__quiz { display: flex; flex-direction: column; gap: 18px; }
.reader__question { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.reader__question-text { font-size: 15px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.reader__option {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
}
.reader__option:hover:not([aria-disabled="true"]) { border-color: var(--ink); }
.reader__option[aria-disabled="true"] { cursor: default; }
.reader__option.is-right { background: var(--green-soft); border-color: var(--green); }
.reader__option.is-wrong { background: var(--clay-soft); border-color: var(--clay); }
.reader__score { font-size: 14px; }

/* ---- Narrow: the panel goes under the text ---- */

@container (max-width: 860px) {
  .reader__layout { grid-template-columns: minmax(0, 1fr); }
  .reader__panel { position: static; }
}
@container (max-width: 560px) {
  .reader__page { padding: 28px 18px; }
  .reader__ar { font-size: 28px; gap: 2px 6px; }
  .reader__title { font-size: 32px; }
  .reader__title-ar { font-size: 21px; }
  .reader__back { min-height: 44px; padding: 0 14px; }
  .reader__arrow { width: 44px; height: 44px; }
  .reader__count { font-size: 13px; padding: 0 4px; }
  .reader__count-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .reader__count-short { display: inline; }
  /* The reading options scroll sideways in their own row. */
  .reader__toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; min-width: 0; }
  .reader__toolbar > * { flex-shrink: 0; }
  /* In the apps: no sideways scrolling. Two lines: the Vowels control with
     Listen, then the other options (they wrap further only if they must). */
  .app--native .reader__toolbar { flex-wrap: wrap; overflow-x: visible; row-gap: 8px; }
  .app--native .reader__toolbar > * { order: 2; }
  .app--native .reader__toolbar > .reader__vowels { order: 0; flex: 1 1 calc(100% - 104px); }
  .app--native .reader__toolbar > .reader__listen { order: 1; }
  .app--native .reader__toolbar > .reader__vowels .reader__vowels-option { flex: 1; min-height: 36px; }
  .reader.is-parallel .reader__sentence { grid-template-columns: minmax(0, 1fr); direction: ltr; }
  .reader.is-parallel .reader__en { padding-top: 0; }
}

/* ---------- Library book pages (reader_page_controller.js) ---------- */

.reader--page { position: relative; }
.reader__byline { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

.reader__page--plain {
  font-size: 26px;
  line-height: 2.1;
  gap: 14px;
  text-align: justify;
}
.reader__para { margin: 0; }
.reader__verse {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 40px;
  text-align: center;
}
.reader__hemistich { min-width: 0; }

.reader__w { border-radius: var(--radius-sm); cursor: pointer; transition: background-color .1s ease; }
.reader__w:hover { background: var(--sand); }
.reader.is-hover-off .reader__w:hover:not(.is-selected) { background: none; }
.reader__w.is-selected { background: var(--clay-soft); box-shadow: inset 0 -2px 0 var(--clay); }

/* Floating gloss for the word under the pointer. */
.reader__float {
  position: absolute;
  z-index: 20;
  width: max-content;
  max-width: 260px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--ink) 40%, transparent);
}
.reader__float[hidden] { display: none; }
.reader__float strong { font-size: 16px; }
.reader__float span { color: var(--text-on-dark-muted); }

.reader__footnotes { font-size: 14px; color: var(--text-muted); }
.reader__footnotes summary { cursor: pointer; font-weight: 600; }
.reader__footnotes-text { font-size: 18px; line-height: 1.8; color: var(--text-body); margin-top: 8px; }

.reader__jump { display: inline-flex; align-items: center; gap: 6px; }
.reader__jump-input { width: 72px; padding: 6px 8px; font-size: 14px; text-align: center; }
.reader__page-btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.reader__lookup { display: flex; gap: 8px; margin-bottom: 18px; }
.reader__lookup .input { flex: 1; min-width: 0; font-size: 18px; }
.reader__hint { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin: 0 0 12px; }
/* The AI's reading of a word the dictionaries don't have (reader_page_controller.js#renderAi) */
.reader__ai { margin: 0 0 14px; }
.reader__ai:empty { display: none; }
.reader__ai-label { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: var(--clay); }
.reader__ai-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reader__ai-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.reader__ai-gloss { font-size: 22px; line-height: 1.2; }
.reader__ai-ar { font-size: 24px; }
.reader__ai-meta, .reader__ai-note { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); line-height: 1.45; }
.reader__alternatives { list-style: none; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text-body); }
.reader__alternatives .ar { font-size: 20px; color: var(--ink); margin-left: 6px; }

.reader__contents { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.reader__contents a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 6px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  text-decoration: none;
}
.reader__contents a:hover { background: var(--sand); text-decoration: none; }
.reader__contents a[aria-current="page"] { background: var(--clay-soft); }
.reader__contents-item--depth-2 a { padding-right: 22px; font-size: 16px; }
.reader__contents-item--depth-3 a { padding-right: 38px; font-size: 15px; }
.reader__contents-page { font-family: var(--font-sans); font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

@media (max-width: 700px) {
  .reader__page--plain { font-size: 22px; text-align: start; }
  .reader__verse { grid-template-columns: 1fr; gap: 0; text-align: start; }
  .reader__verse .reader__hemistich + .reader__hemistich { padding-right: 24px; }
}

/* ---------- AI vowels, translation and vocabulary (library pages) ---------- */

.reader__ai-status {
  margin: 0;
  background: var(--sand);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-body);
}
.reader__paragraph { display: flex; flex-direction: column; gap: 10px; }
.reader__variant { display: flex; flex-direction: column; gap: 14px; }
.reader__variant--vowelled { display: none; }
.reader.is-vowels .reader__variant--vowelled { display: flex; }
.reader.is-vowels .reader__variant--plain { display: none; }

.reader__translation {
  display: none;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-body);
  text-align: left;
  border-left: 3px solid var(--line);
  padding-left: 14px;
}
.reader.is-translation .reader__translation { display: block; }

.reader__vocabulary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.reader__vocab { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.reader__vocab + .reader__vocab { border-top: 1px solid var(--line-soft); }
.reader__vocab-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.reader__vocab-ar { font-size: 26px; order: 2; }
.reader__vocab-en { font-size: 15px; font-weight: 600; }
.reader__vocab-note { margin: 0; font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.reader__vocab .button_to, .reader__vocab .save-word { align-self: flex-start; }

/* Notes tab: the student's note on this page, saved as they type. */
.reader__notes { display: flex; flex-direction: column; gap: 10px; }
.reader__notes .reader__hint { margin: 0; }
.reader__note { width: 100%; min-height: 160px; resize: vertical; font: inherit; line-height: 1.5; }
.reader__note-status:empty { display: none; }

/* The Qurʾān: verses run on as in the muṣḥaf, each ending with its number. */
.reader--quran .reader__page { line-height: 2.4; }
.quran__surah { margin: 6px 0 14px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.quran__surah:not(:first-child) { margin-top: 28px; }
.quran__surah-name {
  margin: 0;
  padding: 8px 16px;
  border: 1.5px solid var(--green);
  border-radius: var(--radius-pill);
  font-family: var(--font-arabic);
  font-size: 22px;
  font-weight: 400;
  color: var(--green);
}
.quran__basmala { margin: 0; font-size: 26px; }
.quran__text { margin: 0 0 12px; text-align: justify; text-align-last: center; }
.quran__verse { border-radius: var(--radius-sm); transition: background-color .2s ease; }
.quran__verse.is-reciting { background: var(--green-soft); }
.quran__marker {
  background: none;
  border: 0;
  padding: 0 2px;
  font: inherit;
  font-family: var(--font-arabic);
  color: var(--green);
  cursor: pointer;
}
.quran__marker:hover { color: var(--clay); }
.quran__credit { margin-top: 8px; font-size: 13px; }
.reader__reciter { width: auto; max-width: 220px; }

/* Correcting a page of the student's own upload (reader/_page_editor, page_edit_controller.js) */
.reader__doc-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.reader__doc-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reader__doc-badge { background: var(--sand); border-radius: var(--radius-pill); padding: 4px 12px; font-size: 12px; font-weight: 700; }
.reader__doc-badge--done { background: var(--green-soft); color: var(--green); }
.reader__doc-badge--check { background: #F7E4C8; color: var(--gold-deep); }
.reader__edit-btn { display: inline-flex; align-items: center; gap: 6px; }
.reader__w.is-unsure { background: var(--mark); border-bottom: 2px dotted #C27A1A; border-radius: 4px; }
.reader__check-note { margin-top: 12px; }
.reader__unsure-note { margin: 0 0 12px; background: var(--mark); border-radius: 12px; padding: 10px 14px; font-size: 13px; line-height: 1.45; color: var(--gold-deep); }

.reader--page.is-editing :is(.reader__page, .reader__translation, .reader__check-note, .reader__ai-status, .reader__footnotes) { display: none; }
.reader--page.is-editing .reader__pager { opacity: .45; pointer-events: none; }
.reader__editor { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.reader__editor-label { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 6px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
/* The text box stands in for the page: the same box, type and line spacing, as tall as the text. */
.reader__textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  overflow: hidden;
  resize: none;
  background: #FFFFFF;
  border: 1.5px solid var(--ink);
  border-radius: 20px;
  padding: 48px clamp(20px, 4vw, 56px);
  font-size: 26px;
  line-height: 2.1;
  color: var(--ink);
}
.reader__textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
/* The original page: in the side panel, or above the text once the panel is under it. */
.reader__scan { margin: 0; display: flex; flex-direction: column; }
.reader__scan--panel { padding: 16px; }
.reader__scan--panel .reader__scan-frame { max-height: calc(100vh - 110px); }
.reader__scan--inline { display: none; margin-bottom: 8px; }
.reader__scan--inline .reader__scan-frame { max-height: 50vh; }
.reader__scan-frame { overflow: auto; background: var(--sand); border-radius: 12px; min-height: 160px; }
.reader__scan-frame img { display: block; width: 100%; height: auto; border-radius: 12px; }
.reader__scan-missing { padding: 20px; }
.reader__scan-open { letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--clay); }
.reader--page.is-editing :is(.reader__tabs, .reader__tabpanel) { display: none; }
@container (max-width: 860px) {
  .reader__scan--panel { display: none !important; }
  .reader__scan--inline:not([hidden]) { display: flex; }
}
.reader__editor-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.reader__chars { display: flex; gap: 6px; flex-wrap: wrap; }
.reader__char {
  min-width: 34px;
  height: 34px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 20px;
  color: var(--ink);
  cursor: pointer;
}
.reader__char:hover { border-color: var(--ink); }
.reader__restore { align-self: flex-start; background: none; border: 0; padding: 0; font-size: 13px; font-weight: 600; color: var(--clay); text-decoration: underline; cursor: pointer; }
@media (max-width: 700px) {
  .reader__textarea { font-size: 22px; padding: 28px 18px; }
}

/* "You've looked this up 3 times — save it?" (learner model) */
.reader__save-prompt {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--clay-soft);
  font-size: 14px;
  color: var(--text-body);
}
.reader__save-prompt[hidden] { display: none; }

/* A Library search carried into the reader (reader/_search_bar). */
.reader-search {
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 16px;
  background: var(--sand); border-radius: 12px;
}
.reader-search__icon { flex: none; color: var(--ink-line); }
.reader-search__status { flex: 1; min-width: 0; margin: 0; font-size: 14px; color: var(--ink); }
.reader-search__q { font-size: 19px; font-weight: 700; }
.reader-search__short { display: none; }
.reader-search__buttons { display: flex; align-items: center; gap: 6px; }
.reader-search__button {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: var(--card); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.reader-search__button--next { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.reader-search__button:disabled { opacity: .45; cursor: default; }
.reader-search__close {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 50%; color: var(--ink-line); font-size: 18px;
}
.reader-search__close:hover { background: var(--sand-hover); color: var(--ink); text-decoration: none; }

/* Matches: a soft wash and underline; the current one outlined too. */
.search-mark {
  background: var(--mark); color: var(--ink); border-radius: 5px; padding: 0 4px;
  text-decoration: underline; text-decoration-color: var(--clay); text-decoration-thickness: 2px; text-underline-offset: 9px;
  scroll-margin: 120px;
}
.search-mark.is-current { background: var(--mark-current); outline: 2px solid var(--ink); outline-offset: 1px; }
.reader__word.search-mark { padding: 0; }

@media (max-width: 700px) {
  .reader-search { flex-direction: column; align-items: stretch; gap: 4px; padding: 8px 4px 4px 12px; }
  .reader-search__icon { display: none; }
  .reader-search__status { font-size: 13px; padding-right: 8px; }
  .reader-search__q { font-size: 17px; }
  .reader-search__long { display: none; }
  .reader-search__short { display: inline; }
  .reader-search__button { flex: 1; min-height: 44px; font-size: 14px; }
  .reader-search__close { width: 44px; height: 44px; font-size: 20px; }
  .search-mark { padding: 0 3px; text-underline-offset: 8px; border-radius: 4px; }
}

/* Arriving from a related passage: the bar steps through related pages (reader/_related_bar). */
.reader-search__approx { flex: none; font-family: var(--font-serif); font-size: 20px; line-height: 1; color: var(--green); }
a.reader-search__button, span.reader-search__button { display: inline-flex; align-items: center; gap: .3em; white-space: nowrap; }
a.reader-search__button:hover { text-decoration: none; border-color: var(--ink); }
a.reader-search__button--next:hover { color: var(--paper); }
span.reader-search__button { opacity: .45; }
@media (max-width: 700px) {
  .reader-search--related .reader-search__approx { display: none; }
  .reader-search__buttons > .reader-search__button { justify-content: center; }
}

/* An article added from Wikipedia: its section headings, and Qurʾān
   quotations set apart (BookPage::QURAN), left alone by the AI. */
.reader__heading { margin: 18px 0 4px; font-family: var(--font-arabic); font-weight: 700; color: var(--green); line-height: 1.4; }
.reader__heading--2 { font-size: 1.3em; }
.reader__heading--3 { font-size: 1.12em; }
.reader__paragraph:first-child .reader__heading { margin-top: 0; }
.reader__quran { margin: 14px 0; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.reader__quran-label { font-family: var(--font-sans); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.reader__quran-label .ar { letter-spacing: 0; text-transform: none; font-size: 15px; }
.reader__quran-text { margin: 8px 0; font-family: var(--font-arabic); font-size: 1.15em; line-height: 2; color: var(--ink); }
.reader__quran-note { margin: 0; font-family: var(--font-sans); font-size: 12px; color: var(--text-muted); }
.book-source--wikipedia { display: block; line-height: 1.6; }
.book-source--wikipedia .ar { font-size: 15px; }

/* Vowels: Off / Fading / Full (VowelFading), and a faded word's vowels in the gloss. */
.reader__vowels { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: var(--sand); flex-shrink: 0; }
.reader__vowels-label { padding: 0 8px 0 10px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.reader__vowels-option { border: 0; background: none; border-radius: var(--radius-pill); padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text-body); cursor: pointer; }
.reader__vowels-option[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.reader__vowels-option:focus-visible { outline: 2px solid var(--clay); outline-offset: 1px; }
.reader__vowels-note { margin: 0 0 12px; font-size: 14px; color: var(--text-muted); }
.reader__vowels-note .link-button { font-weight: 600; text-decoration: underline; color: var(--clay); }
.reader__gloss-vowels { display: block; font-size: 24px; line-height: 1.8; color: var(--peach); }
.reader:not([data-reader-vowels-value="fading"]) .reader__gloss-vowels { display: none; }

/* The page's menu (⋯): vowels practice, a reading goal. */
.reader__menu { position: relative; }
.reader__menu-button { list-style: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
                       font-size: 18px; border: 1px solid var(--line); background: var(--card); }
.reader__menu-button::-webkit-details-marker { display: none; }
.reader__menu[open] .reader__menu-button { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.reader__menu-list { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 300px; background: #fff; border: 1px solid var(--line-strong); border-radius: 14px;
                     box-shadow: 0 16px 30px -16px rgba(28, 35, 33, .45); padding: 6px; display: flex; flex-direction: column; }
.reader__menu-list form { display: contents; }
.reader__menu-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 11px 12px; border-radius: 9px; border: 0; background: none;
                     font: inherit; font-size: 14px; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; }
.reader__menu-item:hover, .reader__menu-item:focus-visible { background: var(--paper); text-decoration: none; }
.reader__menu-marks { font-family: var(--font-arabic); font-size: 17px; color: var(--clay); }
