/* Hebrew acrostic finder: shared by /acrostic/ and /acrostic/en/. */
:root {
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  --bg: oklch(97.6% 0.005 200);
  --panel: oklch(95.4% 0.008 200);
  --surface: oklch(99.2% 0.003 200);
  --line: oklch(88.5% 0.01 200);
  --line-strong: oklch(78% 0.014 200);
  --text: oklch(24% 0.02 220);
  --muted: oklch(46% 0.02 220);
  --accent: oklch(46% 0.1 200);
  --accent-strong: oklch(38% 0.1 200);
  --accent-soft: oklch(93% 0.035 200);
  --on-accent: oklch(98.5% 0.01 200);
  --danger: oklch(45% 0.16 25);
  --radius: 6px;
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 0.9375rem/1.5 var(--font); color: var(--text); background: var(--bg);
}
h1, h2, p { margin: 0; }
button, select, textarea, input { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.he { font-size: 1.12em; }

/* ---------- site bar: the same top bar as the rest of geulaquiz.com (styles.css .topbar/.site-nav/.lang-switch) ---------- */
.gq-bar {
  --gq-ink: #f3efff; --gq-soft: #b9aee6; --gq-border: rgba(150, 120, 255, 0.22); --gq-current: #f5a623;
  background: radial-gradient(900px 240px at 50% -80%, #2a1a5e, #130b26 75%), #130b26;
  color: var(--gq-ink); font: 1rem/1.5 "Heebo", "Poppins", system-ui, sans-serif;
}
html[lang="en"] .gq-bar { font-family: "Poppins", "Heebo", system-ui, sans-serif; }
html[data-theme="light"] .gq-bar {
  --gq-ink: #1b1438; --gq-soft: #4b4170; --gq-border: rgba(40, 28, 90, 0.14); --gq-current: #d68a09;
  background: #f1f2f7; border-block-end: 1px solid var(--gq-border);
}
.gq-bar-in {
  display: flex; flex-wrap: wrap; align-items: center; row-gap: 10px;
  max-width: 1040px; margin: 0 auto; padding: 16px clamp(16px, 4vw, 40px);
}
.gq-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: inherit; text-decoration: none; }
.gq-brand img { filter: drop-shadow(0 0 8px rgba(255, 210, 74, 0.6)); }
.gq-nav { display: flex; align-items: center; gap: 2px; flex: 1; margin-inline-start: 16px; }
.gq-nav a {
  color: var(--gq-soft); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap; transition: color 150ms, background-color 150ms;
}
.gq-nav a:hover { color: var(--gq-ink); background: rgba(139, 92, 246, 0.14); }
.gq-nav a[aria-current="page"] { color: var(--gq-current); font-weight: 700; }
.gq-lang {
  flex: none; color: var(--gq-soft); text-decoration: none; font-size: 0.85rem; padding: 8px 14px;
  border: 1px solid var(--gq-border); border-radius: 999px; background: rgba(255, 255, 255, 0.06);
  transition: color 150ms, border-color 150ms;
}
.gq-lang:hover { color: var(--gq-ink); border-color: #ffd24a; }
/* the red menu item (the mussar shiurim), as in styles.css */
.gq-nav a.hot { color: #ff5470; font-weight: 700; }
.gq-nav a.hot:hover { color: #fff; background: rgba(255, 84, 112, 0.18); }
@media (max-width: 860px) {
  .gq-nav { order: 3; flex-basis: 100%; margin-inline-start: 0; flex-wrap: wrap; }
  .gq-nav a { padding: 8px 10px; }
  .gq-lang { margin-inline-start: auto; }
}
@media print { .gq-bar { display: none; } }

/* ---------- tool bar (title of the tool) ---------- */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  padding: 0.7rem 1.25rem; background: var(--surface); border-block-end: 1px solid var(--line);
}
.brand { flex: 1 1 18rem; min-width: 0; }
.brand h1 { font-size: 1.125rem; font-weight: 650; line-height: 1.3; }
.brand p { color: var(--muted); font-size: 0.875rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.about {
  padding: 1rem 1.25rem 1.1rem; background: var(--surface); border-block-end: 1px solid var(--line);
}
.about h2 { margin: 0 0 0.6rem; font-size: 1.15rem; }
.about h3 { margin: 1rem 0 0.35rem; font-size: 1rem; }
.about p, .about li { max-width: 68ch; }
.about p + p { margin-block-start: 0.5rem; }
.about ol, .about ul { margin: 0; padding-inline-start: 1.4rem; }
.about li + li { margin-block-start: 0.3rem; }
.about-steps li::marker { font-weight: 600; color: var(--accent); }

/* ---------- controls ---------- */
.btn {
  min-height: 2.25rem; padding: 0.3rem 0.8rem; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; transition: background-color 150ms, border-color 150ms;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn:active { background: oklch(89% 0.05 200); }
.btn:disabled { color: var(--muted); background: var(--panel); border-color: var(--line); cursor: default; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 0.2em; padding-inline: 0.4rem; }
.btn-quiet:hover { border-color: transparent; }
.btn-quiet:disabled { background: transparent; border-color: transparent; text-decoration: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button {
  min-height: 2.25rem; padding: 0.3rem 0.8rem; border: 0; background: transparent; cursor: pointer;
  transition: background-color 150ms;
}
.seg button + button { border-inline-start: 1px solid var(--line-strong); }
.seg button:hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
/* the kind of search: acrostics or gematria, as wide as the settings column */
.mode-seg { display: flex; width: 100%; margin-block-end: 1rem; }
.mode-seg button { flex: 1 1 0; padding-inline: 0.4rem; line-height: 1.25; }
textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  padding: 0.45rem 0.6rem;
}
textarea { resize: vertical; line-height: 1.6; }
textarea.he-input { font-size: 1.15rem; }
select { min-height: 2.25rem; }
select.fit { width: auto; max-width: 100%; }
.check { display: flex; align-items: flex-start; gap: 0.55rem; padding-block: 0.3rem; cursor: pointer; }
.check input { inline-size: 1.05rem; block-size: 1.05rem; margin: 0.2rem 0 0; accent-color: var(--accent); flex: none; }

/* ---------- layout ---------- */
.layout { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.pane { padding: 1rem 1.25rem 1.5rem; min-width: 0; }
.pane + .pane { border-block-start: 1px solid var(--line); }
.setup { background: var(--panel); }
.reader { background: var(--surface); }
.pane h2 { font-size: 0.8125rem; font-weight: 650; color: var(--muted); margin-block-end: 0.6rem; }
.field { margin-block-end: 1.15rem; }
.field > label:not(.check), .field > .label { display: block; font-weight: 600; margin-block-end: 0.35rem; }
.hint { color: var(--muted); font-size: 0.8125rem; margin-block-start: 0.3rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.row .grow { flex: 1; }
details.more { margin-block-start: 0.25rem; }
details.more summary { cursor: pointer; color: var(--accent-strong); padding-block: 0.3rem; }
.credit { color: var(--muted); font-size: 0.75rem; margin-block-start: 1.5rem; }
/* Phones: only the book picker shows; the other settings fold behind one button,
   so the results come up on the first screen. Wider screens never see the button. */
.setup-toggle { display: none; }
/* Where the text sits under the results (below 1120px), a button floats back up to them
   once the results have scrolled out of view. */
.to-results {
  position: fixed; inset-block-end: 1rem; inset-inline-end: 1rem; z-index: 5;
  border-radius: 999px; padding-inline: 1.1rem; font-weight: 600;
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 14px oklch(24% 0.02 220 / 0.25);
}
.to-results:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
@media (min-width: 1120px) { .to-results { display: none !important; } }
@media print { .to-results { display: none !important; } }
@media screen and (max-width: 759px) {
  .brand p { display: none; }
  .setup .book-field { margin-block-end: 0.6rem; }
  .setup-toggle {
    display: flex; align-items: center; gap: 0.5rem; width: 100%; justify-content: space-between;
    font-weight: 600; margin-block-end: 0.2rem;
  }
  .setup-toggle .setup-sum { color: var(--muted); font-weight: 400; margin-inline-start: auto; }
  .setup-toggle::after { content: "▾"; color: var(--muted); transition: transform 150ms; }
  .setup-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
  .setup-more { margin-block-start: 0.9rem; }
  .setup.folded .setup-more { display: none; }
  .setup { padding-block-end: 1rem; }
}

@media (min-width: 760px) {
  .layout { grid-template-columns: 20rem minmax(0, 1fr); }
  .setup { grid-row: span 2; border-inline-end: 1px solid var(--line); }
  .pane + .pane { border-block-start: 0; }
  .reader { border-block-start: 1px solid var(--line); }
}
@media (min-width: 1120px) {
  body { height: 100dvh; overflow: hidden; }
  /* the page itself does not scroll here, so the help scrolls inside its own panel */
  .about { max-height: min(60vh, 34rem); overflow-y: auto; }
  .layout { grid-template-columns: 20rem 23rem minmax(0, 1fr); }
  .setup { grid-row: auto; }
  .pane { overflow-y: auto; }
  .results { border-inline-end: 1px solid var(--line); }
  .reader { border-block-start: 0; }
}

/* ---------- results ---------- */
.summary { font-size: 1rem; font-weight: 600; min-height: 1.5rem; }
.results-tools { margin-block: 0.5rem 0.4rem; }
.empty { color: var(--muted); padding-block: 1.25rem; max-width: 40ch; }
.empty.error { color: var(--danger); }
.skeleton { display: grid; gap: 0.6rem; padding-block: 0.75rem; }
.skeleton span { block-size: 1.9rem; border-radius: var(--radius); background: var(--panel); animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.45; } }
.names { list-style: none; margin: 0; padding: 0; border-block-start: 1px solid var(--line); }
.names > li { border-block-end: 1px solid var(--line); }
.name-row {
  display: grid; grid-template-columns: minmax(5.2rem, auto) minmax(0, 1fr) auto; align-items: center; gap: 0.6rem;
  width: 100%; min-height: 2.6rem; padding: 0.25rem 0.5rem; border: 0; background: transparent; text-align: start; cursor: pointer;
  transition: background-color 150ms;
}
/* a group of close words: the words on their own line, the count and total under them */
.name-row.group { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.15rem; padding-block: 0.4rem; }
.name-row.group .nm { grid-column: 1 / -1; }
.name-row:hover { background: var(--accent-soft); }
.name-row[aria-expanded="true"] { background: var(--accent-soft); font-weight: 600; }
.name-row .nm { font-size: 1.2rem; }
.name-row .br { color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.name-row .tot { font-variant-numeric: tabular-nums; min-inline-size: 2ch; text-align: end; }
.name-row.none { cursor: default; color: var(--muted); }
.name-row.none:hover { background: transparent; }
.matches { list-style: none; margin: 0; padding: 0.25rem 0 0.6rem; }
.match {
  display: block; width: 100%; padding: 0.4rem 0.5rem; border: 0; border-radius: var(--radius); background: transparent;
  text-align: start; cursor: pointer; transition: background-color 150ms;
}
.match:hover { background: var(--panel); }
.match[aria-current="true"] { background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-strong); }
.match .ref { display: block; color: var(--muted); font-size: 0.8125rem; }
.match .snip { display: block; font-size: 1.15rem; line-height: 1.7; }
.forms { color: var(--muted); font-size: 0.875rem; line-height: 1.7; padding: 0.3rem 0.5rem 0.5rem; }
.forms .form { color: var(--text); font-size: 1.1rem; }
.forms .form-item { white-space: nowrap; }
/* on-screen Hebrew keyboard */
.kbd-toggle { margin-block-end: 0.5rem; padding-inline: 0.2rem; }
.kbd { display: grid; gap: 4px; margin-block-end: 1rem; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kbd-row { display: flex; justify-content: center; gap: 4px; }
.kbd .key {
  flex: 1 1 0; max-width: 2.6rem; min-width: 0; min-height: 2.5rem; padding: 0; font-size: 1.15rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); cursor: pointer;
  touch-action: manipulation;
}
.kbd .key:hover { background: var(--accent-soft); }
.kbd .key.wide { flex: 4 1 0; max-width: none; font-size: 0.9rem; }
/* skip codes: number boxes, and the open find as a grid with the word down one column */
input.num { width: 6.5em; min-height: 2.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 0.3rem 0.5rem; }
.els-note { margin-block: 0 1rem; }
.els-grid { margin: 0.2rem 0.5rem 0.8rem; }
.els-grid figcaption { color: var(--muted); font-size: 0.8125rem; margin-block-end: 0.4rem; }
.grid-box {
  display: grid; grid-template-columns: repeat(var(--cols), 1.35rem); gap: 2px;
  justify-content: start; max-width: 100%; overflow-x: auto; padding-block-end: 2px;
}
.grid-box .cell {
  display: grid; place-items: center; aspect-ratio: 1; font-size: 1.05rem; color: var(--muted);
  background: var(--panel); border-radius: 3px;
}
.grid-box .cell.hit { background: var(--c); color: var(--text); font-weight: 700; box-shadow: inset 0 0 0 1px var(--cs); }
/* kinds of finds: each its own colour in labels, and its own mark shape in the text */
.kind {
  --k: oklch(46% 0.02 220);
  display: inline-block; font-size: 0.75rem; line-height: 1.5; padding: 0 0.5em; border-radius: 999px;
  border: 1px solid var(--k); color: var(--k); background: color-mix(in oklch, var(--k) 8%, transparent); white-space: nowrap;
}
.k-first { --k: oklch(47% 0.14 250); }
.k-last { --k: oklch(46% 0.16 300); }
.k-vfirst { --k: oklch(48% 0.11 180); }
.k-vlast { --k: oklch(50% 0.12 60); }
.k-gword { --k: oklch(48% 0.13 145); }
.k-gpair { --k: oklch(48% 0.11 200); }
.k-gverse { --k: oklch(52% 0.13 70); }
.k-elsf { --k: oklch(47% 0.14 250); }
.k-elsb { --k: oklch(50% 0.17 25); }
.k-near { --k: oklch(46% 0.16 300); }
.name-row .br .kind + .kind { margin-inline-start: 0.15rem; }
.match .ref .kind { margin-inline-start: 0.2rem; vertical-align: 0.05em; }
.legend .kind { margin-inline-start: 0.3rem; }
mark.gpair { outline: 1px dashed var(--cs); outline-offset: -1px; }
mark.elsb { outline: 1px dashed var(--cs); outline-offset: -1px; }
mark.near { outline: 1px solid var(--cs); outline-offset: -1px; }
.own-btn { margin-block-start: 0.35rem; padding-inline: 0.2rem; }
.grid-box .cell.hit.both { background: linear-gradient(135deg, var(--c) 50%, var(--c2) 50%); }
.grid-box .cell.hit.three { background: linear-gradient(135deg, var(--c) 33%, var(--c2) 33% 67%, var(--c3) 67%); }
.name-row .nm .dot + .dot { margin-inline-start: -0.3rem; }

/* ---------- reader ---------- */
.reader-nav { margin-block-end: 0.5rem; }
.reader-state { color: var(--muted); font-size: 0.875rem; min-height: 2.25rem; margin-block-end: 0.25rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; color: var(--muted); font-size: 0.8125rem; margin-block-end: 0.75rem; }
.legend mark { font-size: 1.05rem; color: var(--text); margin-inline-end: 0.35em; }
.verses { direction: rtl; max-width: 46rem; margin-inline: auto 0; }
html[dir="rtl"] .verses { margin-inline: 0 auto; }
.verse { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 0.4rem; padding: 0.15rem 0.4rem; border-radius: var(--radius); }
.verse .vn { color: var(--muted); font-size: 0.8125rem; padding-block-start: 0.55rem; font-variant-numeric: tabular-nums; }
.verse .vt { font-size: 1.3rem; line-height: 1.9; }
.verse.flash { animation: flash 1.8s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes flash { from { background-color: var(--accent-soft); } to { background-color: transparent; } }
/* Colour says which name (--c light, --cs strong, set per name in the script).
   Shape says which kind: plain fill = first letters, bar underneath = last letters, ring = whole verses. */
mark { --c: oklch(89% 0.02 220); --cs: oklch(45% 0.03 220); color: inherit; background: var(--c); border-radius: 0.18em; padding: 0 0.06em; }
mark.two { background: linear-gradient(135deg, var(--c) 50%, var(--c2) 50%); }
mark.three { background: linear-gradient(135deg, var(--c) 33%, var(--c2) 33% 67%, var(--c3) 67%); }
mark.last, mark.vlast { box-shadow: inset 0 -3px 0 var(--cs); }
mark.vfirst, mark.vlast { outline: 2px solid var(--cs); outline-offset: -1px; }
/* gematria: words of the value are filled in, a whole verse of the value is underlined */
mark.gverse { background: none; box-shadow: inset 0 -2px 0 var(--cs); padding: 0; border-radius: 0; }
mark.gword, mark.gpair { background: var(--c); }
.dot { display: inline-block; inline-size: 0.7rem; block-size: 0.7rem; border-radius: 3px; background: var(--c); border: 1px solid var(--cs); margin-inline-end: 0.5rem; vertical-align: 0.05em; }

/* the find you opened: solid, so it stands out from the rest (after the other mark rules) */
mark.cur { background: var(--cs); color: #fff; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  body { height: auto; overflow: visible; background: none; }
  .topbar, .about, .setup, .results, .reader-nav, .reader-state { display: none !important; }
  .layout { display: block; }
  .pane { overflow: visible; padding: 0; }
  mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
