/* Kinyan reader — mobile-first, scales to desktop, prints as a study sheet.
   The layout is deliberately app-shaped (sticky header, thumb-reachable
   controls, one column of content) because this is a website standing in for
   an app; widening it for desktop should not turn it into a different design. */

@font-face {
  font-family: 'Frank Ruhl Libre';
  font-weight: 300 900;
  font-display: swap;
  src: url('FrankRuhlLibre.f9bf269666.ttf') format('truetype');
}

:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #2a2620;
  --muted: #9a917f;
  --accent: #8a6d3b;
  --line: #e7e0d2;
  --hi: #fbeecb;
  --heman: #7a5c2e;
  --en: #33564f;
  --ensep: #c2a15a;
  --dh: #8a2f2f;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06);
  --he-size: 25px;
  --maxw: 720px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17150f;
    --card: #201d16;
    --ink: #ece5d6;
    --muted: #8d8474;
    --accent: #c9a45f;
    --line: #322d22;
    --hi: #3a3016;
    --heman: #e0c383;
    --en: #8fc4b6;
    --ensep: #a9803f;
    --dh: #e8958a;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- header */

.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 0 0;
}
.top .bar {
  display: flex; align-items: center; gap: 10px;
  max-width: var(--maxw); margin: 0 auto; padding: 10px 14px;
}
.iconbtn {
  flex: none; width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--bg); color: var(--accent);
  font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn:disabled { opacity: .32; cursor: default; }
.iconbtn:active:not(:disabled) { background: var(--hi); }

.title {
  flex: 1; min-width: 0; text-align: center;
  background: none; border: 0; color: inherit; cursor: pointer; padding: 0;
  font: inherit;
}
.title .he {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 800; font-size: 19px;
  direction: rtl; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.title .sub {
  font-size: 11px; color: var(--muted); letter-spacing: .07em;
  text-transform: uppercase; margin-top: 1px;
}
.title .sub::after { content: " ▾"; opacity: .55; }
/* the vocabulary header is not a picker, so it must not look like one */
.title.static { cursor: default; }
.title.static .sub::after { content: none; }

.toolbar {
  display: flex; gap: 7px; justify-content: center; flex-wrap: wrap;
  max-width: var(--maxw); margin: 0 auto; padding: 0 14px 10px;
}
.chip {
  font-size: 12.5px; padding: 6px 13px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--bg); color: var(--accent);
  cursor: pointer; user-select: none; font-family: inherit;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:disabled { opacity: .4; cursor: default; }

/* ---------------------------------------------------------------- content */

main { max-width: var(--maxw); margin: 0 auto; padding: 10px 12px 92px; }

.seg {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 13px 11px; margin: 0 0 11px; box-shadow: var(--shadow);
}
.seg .tag {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
/* the ref ("3A:14") sits at the right edge, whatever comes before it */
.seg .tag > span:last-child { margin-left: auto; }
.seg .tag .k { color: var(--accent); font-weight: 700; }
.seg .tag .k:empty { display: none; }
/* The chazarah sheet for this segment’s sugya: a page of its own, same tab.
   First on the line, flush left, ahead of the Mishnah/Gemara label. */
.seg .tag .sheetlink {
  order: -1;
  color: var(--accent); text-decoration: none; font-weight: 600;
  border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px;
  background: var(--bg); white-space: nowrap;
}
.seg .tag .sheetlink::after { content: " ›"; }
.seg .tag .sheetlink:hover, .seg .tag .sheetlink:focus-visible {
  background: var(--accent); color: var(--card); border-color: var(--accent);
}
@media print { .seg .tag .sheetlink { display: none; } }

.words { display: flex; flex-wrap: wrap; gap: 10px 4px; direction: rtl; align-items: flex-start; }
.set { display: flex; flex-direction: column; align-items: center; margin: 0 5px; }
.setrow { display: flex; direction: rtl; gap: 0 8px; align-items: flex-start; }

.w {
  display: flex; flex-direction: column; align-items: center;
  padding: 3px 4px 2px; border-radius: 9px; cursor: pointer;
  transition: background .12s;
}
.w .he {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 500;
  font-size: var(--he-size); line-height: 1.38; color: var(--ink);
}
.w .tl {
  font-size: 11px; color: var(--muted); direction: ltr; margin-top: 1px;
  white-space: nowrap;
}
.w.sel { background: var(--hi); }
.w.sel .tl { color: var(--heman); font-weight: 600; }

.en {
  direction: ltr; font-size: 12px; line-height: 1.32; color: var(--en);
  text-align: center; margin-top: 3px; max-width: 190px;
}
.en .sep { color: var(--ensep); font-weight: 700; margin-right: 4px; }

body.hide-tl .w .tl { display: none; }
body.hide-en .en { display: none; }
body.hide-en .words { gap: 5px 10px; }
body.hide-en .set { margin: 0; }

.note {
  background: var(--card); border: 1px dashed var(--line); border-radius: 14px;
  padding: 13px 15px; color: var(--muted); font-size: 13px; margin: 0 0 11px;
}
.note b { color: var(--ink); }

/* Attribution. CC BY-NC requires credit wherever the text is shown, so this
   sits on every page and is deliberately not hidden when printing. */
.credit {
  margin: 18px 2px 0; padding-top: 12px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px; line-height: 1.6; text-align: center;
}
.credit a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- footer nav */

.pager {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
}
.pager .inner { display: flex; gap: 9px; max-width: var(--maxw); margin: 0 auto; }
.pager a, .pager span {
  flex: 1; text-align: center; padding: 11px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg); font-size: 13.5px;
  color: var(--accent); font-weight: 600;
}
.pager span { opacity: .35; }

/* ---------------------------------------------------------------- index */

.hero { text-align: center; padding: 22px 14px 6px; }
.hero h1 {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 800; font-size: 30px;
  margin: 0; direction: rtl;
}
.hero p { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

.grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  margin: 14px 0 4px;
}
.grid a {
  position: relative; display: grid; place-items: center; gap: 1px;
  aspect-ratio: 1 / 1; border-radius: 13px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.grid a:active { background: var(--hi); }
.grid a .dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ensep);
}
.grid a.plain .dot { background: transparent; }

.legend {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  color: var(--muted); font-size: 12px; margin: 14px 0 26px;
}
.legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ensep); margin-right: 5px; vertical-align: middle; }

.sectionhead {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin: 20px 0 8px; font-weight: 700;
}

/* ---------------------------------------------------------------- picker */

.picker[hidden] { display: none !important; }
.picker {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 17, 12, .45);
  display: grid; place-items: end center;
}
.picker .sheet {
  width: 100%; max-width: var(--maxw); max-height: 78vh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
}
.picker h2 { margin: 0 0 12px; font-size: 15px; text-align: center; }
.picker .close {
  display: block; width: 100%; margin-top: 12px; padding: 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--accent); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------------------------------------------------------------- responsive */

@media (min-width: 640px) {
  :root { --he-size: 27px; --maxw: 760px; }
  .en { font-size: 12.5px; max-width: 220px; }
  .w .tl { font-size: 11.5px; }
  main { padding: 16px 16px 96px; }
  .hero h1 { font-size: 36px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
}

@media (min-width: 1024px) {
  :root { --he-size: 29px; --maxw: 900px; }
  .seg { padding: 17px 18px 14px; border-radius: 18px; }
  .en { max-width: 250px; }
  /* the pager stops being a thumb bar and sits with the content */
  .pager { position: static; border-top: 0; background: transparent; padding: 4px 12px 40px; }
  main { padding-bottom: 8px; }
}

/* ---------------------------------------------------------------- print */

@page { size: letter; margin: 0.6in; }

/* A heading for paper only: the sticky header does not print. */
.print-head { display: none; }
body.hide-tl .print-head .ph-tl,
body.hide-en .print-head .ph-en { display: none; }

@media print {
  @page { margin: 0.55in; }
  /* Paper is white whatever the screen theme is, so the dark-mode tokens
     (light ink) must not reach the printer. */
  :root {
    --maxw: none; --ink: #000; --muted: #555; --en: #1f4f45; --ensep: #a9803f;
    --accent: #6b5530; --card: #fff; --bg: #fff; --line: #ccc; --hi: transparent;
    --heman: #000;
  }
  body { background: #fff; color: #000; }
  .top, .pager, .picker, .no-print, .note { display: none !important; }
  .print-head {
    display: block; text-align: center; margin: 0 0 10px; padding-bottom: 8px;
    border-bottom: 2px solid #000;
  }
  .print-head .he {
    font-family: 'Frank Ruhl Libre', serif; font-weight: 800; font-size: 22px;
    direction: rtl;
  }
  .print-head .sub { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #555; }
  .w { padding: 1px 3px; }
  .w.sel { background: none; }
  /* keep a segment's "2A:3" label on the same page as its first line */
  .seg .tag { break-after: avoid; page-break-after: avoid; }
  .print-head { break-after: avoid; }
  .w.sel .tl { font-weight: normal; }
  main { max-width: none; padding: 0; }
  .seg {
    background: none; border: 0; border-top: 1px solid #ccc;
    border-radius: 0; box-shadow: none; padding: 8px 0 4px; margin: 0 0 6px;
    break-inside: auto;
  }
  .set { break-inside: avoid; }
  .en { color: #1f4f45; }
  .w .tl { color: #555; }
  /* printing follows what is on screen, so a hidden row stays hidden */
}

/* ---------------------------------------------------------------- vocabulary */

.vocab { list-style: none; margin: 0 0 10px; padding: 0; }
.vocab li {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; margin: 0 0 6px; box-shadow: var(--shadow);
}
.vocab .vn { color: var(--muted); font-size: 10.5px; min-width: 2.1em; flex: none; }
.vocab .vw {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 500; font-size: 21px;
  direction: rtl; flex: none; min-width: 5.5em; text-align: right;
}
.vocab .vg { flex: 1; font-size: 13px; color: var(--en); direction: ltr; }
.vocab .vg.none { color: var(--muted); font-style: italic; }

@media (min-width: 640px) {
  .vocab { columns: 2; column-gap: 14px; }
  .vocab li { break-inside: avoid; }
}
@media (min-width: 1024px) { .vocab { columns: 3; } }
@media print { .vocab { columns: 2; } .vocab li { border: 0; box-shadow: none;
  background: none; padding: 3px 0; break-inside: avoid; } }

/* ---------------------------------------------------------------- quiz */

.qwrap { max-width: 560px; margin: 0 auto; }
.qbar { height: 4px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 14px; }
.qbar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s; }
.qcount { text-align: center; font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }

.qcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 18px; box-shadow: var(--shadow); text-align: center;
}
.qprompt { margin: 6px 0 4px; }
.qprompt.he { font-family: 'Frank Ruhl Libre', serif; font-weight: 500; font-size: 40px;
  direction: rtl; line-height: 1.35; }
.qprompt.en { font-size: 22px; font-weight: 600; color: var(--en); }
.qhint { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.qopts { display: grid; gap: 8px; }
.qopt {
  font: inherit; font-size: 14.5px; text-align: left; padding: 13px 15px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); cursor: pointer;
}
.qopt:active:not(:disabled) { background: var(--hi); }
.qopt:disabled { cursor: default; opacity: .75; }
.qopt.right { background: #e8f3ec; border-color: #7fae90; color: #17512f; opacity: 1; }
.qopt.wrong { background: #f7e9e6; border-color: #c79086; color: #7a2f22; opacity: 1; }

.qinput {
  width: 100%; font: inherit; font-family: 'Frank Ruhl Libre', serif; font-size: 30px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); text-align: center;
}
.qinput.right { border-color: #7fae90; background: #e8f3ec; }
.qinput.wrong { border-color: #c79086; background: #f7e9e6; }

.qgo {
  margin-top: 12px; width: 100%; font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 12px; border-radius: 12px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
}
.qgo:disabled { opacity: .45; cursor: default; }

.qfeed { margin-top: 14px; }
.qfeed .fline { font-weight: 700; font-size: 14px; }
.qfeed.good .fline { color: #17703f; }
.qfeed.bad .fline { color: #a33a26; }
.qfeed .fans { margin-top: 6px; font-size: 15px; }
.qfeed .fans .he { font-family: 'Frank Ruhl Libre', serif; font-size: 24px; direction: rtl; }
.qfeed .fnote { color: var(--muted); font-size: 12px; margin-top: 4px; }
.qdone { font-size: 40px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .qopt.right { background: #17301f; border-color: #3f7a55; color: #b9e3c6; }
  :root:not([data-theme="light"]) .qopt.wrong { background: #331d19; border-color: #8a4c40; color: #ecbcb0; }
  :root:not([data-theme="light"]) .qinput.right { background: #17301f; border-color: #3f7a55; }
  :root:not([data-theme="light"]) .qinput.wrong { background: #331d19; border-color: #8a4c40; }
}

/* ---------------------------------------------------------------- home: masechta picker */

.crumb {
  display: inline-block; margin: 4px 2px 0; padding: 6px 2px;
  font-size: 13.5px; font-weight: 600; color: var(--accent);
}

.mcards { display: grid; gap: 12px; margin: 14px 0 26px; }
.mcard {
  display: grid; gap: 4px; padding: 18px 18px 16px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink);
}
.mcard:active { background: var(--hi); }
.mcard .mhe {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 800; font-size: 30px;
  direction: rtl; text-align: right; line-height: 1.2;
}
.mcard .men { font-size: 16px; font-weight: 700; }
.mcard .mmeta { font-size: 13px; color: var(--muted); }
.mcard .mbar {
  display: block; height: 5px; margin-top: 8px; border-radius: 3px;
  background: var(--line); overflow: hidden;
}
.mcard .mbar i { display: block; height: 100%; background: var(--ensep); border-radius: 3px; }

@media (min-width: 640px) {
  .mcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}

/* ------------------------------------------------- Rashi & Tosafos pages */
/* Unvocalized text, no transliteration row: the Hebrew sits a touch smaller
   than the Gemara's, and the dibbur hamaschil — the catchwords quoted from the
   Gemara — is coloured, since in the Hebrew the dash is the only marker. */

.commentary .w .he { font-size: calc(var(--he-size) * .88); }
.set.dh .he { color: var(--dh); font-weight: 700; }
.set.dh .en { color: var(--dh); }
.dhkey { color: var(--dh); font-weight: 600; }

.ctitle {
  font-size: 13px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent); margin: 26px 2px 10px; scroll-margin-top: 120px;
}
.cseg .tag { gap: 10px; }
.cseg .tag > span:last-child { flex: none; }
.cseg .tag .k { font-family: 'Frank Ruhl Libre', serif; font-size: 14px;
  letter-spacing: 0; text-transform: none; direction: rtl; text-align: left;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cfold { background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 14px; margin: 0 0 12px; box-shadow: var(--shadow); }
.cfold summary { cursor: pointer; font-weight: 600; font-size: 14px; padding: 4px 0; }
.cfold[open] summary { margin-bottom: 8px; }
.ckind { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 12px 0 6px; }
.vocab.abbr .vg { line-height: 1.4; }
.afull { display: block; font-family: 'Frank Ruhl Libre', serif; font-size: 15px;
  color: var(--muted); direction: rtl; text-align: left; }
.avar { display: block; font-size: 11px; color: var(--accent); margin-top: 2px; }
.avar bdi { font-family: 'Frank Ruhl Libre', serif; font-size: 13px; }

@media print {
  .cfold { border: 0; box-shadow: none; padding: 0; }
  .cfold summary { display: none; }
  .set.dh .he, .set.dh .en { color: #7a2e2e; }
}

/* ---------------------------------------------------------------- pesukim */

/* A quoted verse in the Gemara: its own ink, so it reads as a quotation and
   invites a tap. Colour rather than an underline, because an underline runs
   into the nikkud under the letters. */
:root { --pq: #2c5d8f; --pqbg: #e7eef6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pq: #8db8e6; --pqbg: #1c2733; }
}
.w.pq { cursor: pointer; }
.w.pq .he { color: var(--pq); }
.w.pq:hover { background: var(--pqbg); }
.pqnote .pqkey { color: var(--pq); font-weight: 700; }

.pasuk .sheet { padding-top: 18px; }
.pasuk .pref { text-align: center; margin-bottom: 12px; }
.pasuk h2 { margin: 0; font-size: 17px; color: var(--pq); }
.pasuk .phe {
  font-family: 'Frank Ruhl Libre', serif; direction: rtl; font-size: 17px;
  color: var(--muted); margin-top: 2px;
}
.pasuk .pv {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px;
}
.pasuk .pv-he {
  margin: 0; font-family: 'Frank Ruhl Libre', serif; direction: rtl; text-align: right;
  font-size: calc(var(--he-size) * .9); line-height: 1.75;
}
.pasuk .pv-he mark {
  background: var(--pqbg); color: var(--pq); border-radius: 4px; padding: 0 2px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.pasuk .pv-he .ktiv { color: var(--muted); font-size: .8em; }
.pasuk .vn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 6px;
}
.pasuk .pv-en { margin: 8px 0 0; font-size: 14.5px; color: var(--en); line-height: 1.45; }
.pasuk .psrc { font-size: 11.5px; color: var(--muted); text-align: center; }
@media print { .w.pq .he { color: inherit; } .pqnote { display: none; } }

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

/* An amud laid out like a page of the daf: Gemara and pesukim above,
   Rashi and Tosafos below. On screen each sheet is a sheet of paper; on a
   phone the columns stack. */
.printpage main { max-width: 8.5in; }
.sheet {
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 6px; padding: 18px 20px; margin: 0 0 18px;
}
.shead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 11px; color: var(--muted); border-bottom: 1.5px solid var(--ink);
  padding-bottom: 4px; margin-bottom: 8px;
}
.shead .he { font-family: 'Frank Ruhl Libre', serif; font-size: 15px; font-weight: 800; color: var(--ink); }
.stop { display: grid; grid-template-columns: 3fr 1fr; gap: 0 14px; }
.sbot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px;
  border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px;
}
.sheet h3 {
  margin: 0 0 4px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.spes { border-left: 1px solid var(--line); padding-left: 12px; }
.scol + .scol { border-left: 1px solid var(--line); padding-left: 12px; }

.sheet .words { gap: 3px 0; }
.sheet .set { margin: 0 2px; }
.sheet .setrow { gap: 0 4px; }
.sheet .w { padding: 0 1px; cursor: default; }
.sheet .en { font-size: 8.5px; line-height: 1.2; max-width: 110px; margin-top: 0; }
.sheet .en .sep { display: none; }
.sheet .w .tl { font-size: 8px; }
.sgem .w .he { font-size: 19px; line-height: 1.25; }
.sgem .w.pq .he { color: var(--pq); }
.sgem .pqn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 9px; font-weight: 700; color: var(--pq); margin-right: 1px;
}
.pseg { margin: 0 0 4px; }
.ptag {
  display: flex; gap: 8px; font-size: 8px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.ptag .k { color: var(--accent); font-weight: 700; }
.sbot .w .he { font-size: 14px; line-height: 1.2; }
.sbot .en { font-size: 7.5px; max-width: 78px; }
.cpiece { padding: 2px 0 3px; border-bottom: 1px dotted var(--line); }
.cpiece:last-child { border-bottom: 0; }

.pcard { margin: 0 0 6px; }
.plabel {
  display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap;
  font-size: 10px; font-weight: 700; color: var(--pq);
}
.plabel .plhe {
  margin-left: auto; font-family: 'Frank Ruhl Libre', serif; font-weight: 500;
  font-size: 11px; color: var(--muted); direction: rtl;
}
.pnum {
  display: inline-block; min-width: 14px; height: 14px; line-height: 14px; border-radius: 7px;
  background: var(--pq); color: #fff; text-align: center; font-size: 9px;
}
.pcard .pv-he {
  margin: 1px 0 0; font-family: 'Frank Ruhl Libre', serif; direction: rtl; text-align: right;
  font-size: 13px; line-height: 1.45;
}
.pcard .pv-he mark { background: var(--pqbg); color: var(--pq); border-radius: 3px; padding: 0 1px; }
.pcard .pv-he .ktiv { color: var(--muted); font-size: .8em; }
.pcard .pv-he .vn { font-size: 8.5px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.pcard .pv-en { margin: 2px 0 0; font-size: 8.5px; line-height: 1.3; color: var(--en); }
.pnone { font-size: 10.5px; color: var(--muted); font-style: italic; margin: 2px 0; }

@media (max-width: 700px) {
  .sheet { padding: 12px; }
  .stop, .sbot { grid-template-columns: 1fr; }
  .spes, .scol + .scol { border-left: 0; padding-left: 0; border-top: 1px solid var(--line);
    margin-top: 8px; padding-top: 6px; }
}

@media print {
  @page { size: letter portrait; margin: 0.4in; }
  .printpage main { max-width: none; }
  .sheet {
    border: 0; box-shadow: none; border-radius: 0; padding: 0; margin: 0;
    break-before: page; page-break-before: always;
  }
  .sheet:first-of-type { break-before: auto; page-break-before: auto; }
  .stop { grid-template-columns: 3fr 1fr; }
  .sbot { grid-template-columns: 1fr 1fr; }
  .spes { border-left: 1px solid #bbb; padding-left: 10px; border-top: 0; margin-top: 0; padding-top: 0; }
  .scol + .scol { border-left: 1px solid #bbb; padding-left: 10px; border-top: 0; margin-top: 0; padding-top: 0; }
  .sbot { border-top: 1.5px solid #000; }
  .shead { border-bottom-color: #000; }
  .pcard, .set, .ptag { break-inside: avoid; }
  .ptag { break-after: avoid; }
  .printpage .sgem .w.pq .he, .sgem .pqn, .plabel, .pcard .pv-he mark { color: #1d4f80; }
  .pnum { background: #1d4f80; }
  .pcard .pv-he mark { background: #e3ecf6; }
  .printpage .credit { break-before: avoid; font-size: 8px; }
}

/* ---------------------------------------------------------------- phone menu */

/* Below 640px the toolbar folds into the ☰ button app.js adds to the header,
   and opens as a panel over the page rather than pushing it down. Without
   script (no html.js) the toolbar simply stays as it is. */
.menubtn { display: none; }
@media (max-width: 639px) {
  html.js .top .toolbar:not(.keep) { display: none; }
  html.js .menubtn { display: grid; }
  html.js .top.menu-open .toolbar:not(.keep) {
    display: flex; position: absolute; left: 0; right: 0; top: 100%;
    max-width: none; padding: 12px 14px 14px; gap: 9px;
    background: var(--card); border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .14);
  }
  html.js .top.menu-open .toolbar .chip { font-size: 13.5px; padding: 8px 15px; }
  .top.menu-open .menubtn { background: var(--hi); }
}

/* ---------------------------------------------------------------- dedication */

.dedication {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 700; direction: rtl;
  text-align: center; color: var(--heman); font-size: 16px; margin: 2px 0 10px;
}
.dedication.banner {
  font-size: 22px; margin: 14px auto 18px; padding: 12px 16px; max-width: 520px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
}
.shead .sded {
  font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: 14px;
  color: var(--ink);
}
@media print {
  .dedication { color: #000; }
  .dedication.banner { border-color: #999; box-shadow: none; }
}
