/* Frank Ruhl Libre, Hebrew subset, SIL Open Font Licence — see fonts/OFL.txt.
   Bundled rather than linked: the app is built to work with no network, and
   type that only arrives when online is type you cannot rely on. One variable
   file covers 400 to 700. */
@font-face {
  font-family: 'Frank Ruhl Libre';
  src: url('fonts/frank-ruhl-libre-hebrew.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

/* Daf Yomi to Go — a parchment page that reads like the printed thing. */

:root {
  --page:      #f6efe1;
  --page-warm: #efe5d2;
  --card:      #fffaf0;
  --ink:       #221b12;
  --ink-soft:  #5c4f3d;
  --ink-faint: #8b7c66;
  --rule:      #d9c9a8;
  --gold:      #9a6f18;
  --gold-soft: #c9a44a;
  --accent:    #7b2d12;
  --shadow:    0 1px 2px rgba(60, 44, 20, .08), 0 8px 24px rgba(60, 44, 20, .06);
  --radius: 14px;

  --hebrew: var(--hebrew-face, 'Frank Ruhl Libre'), 'Taamey Frank CLM',
            'Noto Serif Hebrew', 'David', 'Narkisim', 'Times New Roman', serif;
  --english: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia,
             'Times New Roman', serif;
  --ui: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;


  /* The six sedarim, in cycle order. Warm and cool alternate so the two that
     touch on the Shas strip never sit in the same family. Chosen by eye for
     this parchment; normal-vision separation is comfortable (worst adjacent
     pair ΔE 21.3), but red-green pairs collapse under protanopia, so colour
     here is always the second signal — every seder also carries its mark and
     its name, and nothing is identified by hue alone. */
  --seder-zeraim:   #3d7a35;
  --seder-moed:     #c96a2b;
  --seder-nashim:   #3f5bb0;
  --seder-nezikin:  #a8801a;
  --seder-kodashim: #8b3a86;
  --seder-tahoros:  #2a8598;

  --seg: 1.05rem;   /* driven by the font-size control */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  --page:      #16130f;
  --page-warm: #1b1712;
  --card:      #211c16;
  --ink:       #eadfcb;
  --ink-soft:  #b6a68c;
  --ink-faint: #857761;
  --rule:      #3a3128;
  --gold:      #d3ab55;
  --gold-soft: #8a6f31;
  --accent:    #e0a07a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);

  --seder-zeraim:   #6aa85f;
  --seder-moed:     #e08a4e;
  --seder-nashim:   #7d93d8;
  --seder-nezikin:  #ceac4a;
  --seder-kodashim: #b878b2;
  --seder-tahoros:  #55a8ba;
}

:root[data-theme="sepia"] {
  --page:      #e8dcc0;
  --page-warm: #e0d2b2;
  --card:      #f3e9d2;
  --ink:       #3a2c17;
  --rule:      #cbb992;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --page:      #16130f;
    --page-warm: #1b1712;
    --card:      #211c16;
    --ink:       #eadfcb;
    --ink-soft:  #b6a68c;
    --ink-faint: #857761;
    --rule:      #3a3128;
    --gold:      #d3ab55;
    --gold-soft: #8a6f31;
    --accent:    #e0a07a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);

    --seder-zeraim:   #6aa85f;
    --seder-moed:     #e08a4e;
    --seder-nashim:   #7d93d8;
    --seder-nezikin:  #ceac4a;
    --seder-kodashim: #b878b2;
    --seder-tahoros:  #55a8ba;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.5;
  overscroll-behavior-y: contain;
}

#app {
  max-width: var(--reading-width, 46rem);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- shared chrome ---------- */

.eyebrow {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ink-faint);
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--rule);
  background: var(--card);
  font-weight: 600;
  font-size: .95rem;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.985); }
.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #fffaf0;
}
:root[data-theme="dark"] .btn.primary { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .btn.primary { color: #16130f; }
}
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.hairline {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule), transparent);
  margin: 1.25rem 0;
}

.he { font-family: var(--hebrew); direction: rtl; text-align: right; }
.en { font-family: var(--english); }

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--rule);
  padding-bottom: var(--safe-b);
  z-index: 40;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .55rem 0 .5rem;
  color: var(--ink-faint);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.tabbar a.active { color: var(--gold); }
.tabbar svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- today ---------- */

.today-head { text-align: center; padding: 1.1rem 0 .5rem; }
.today-head .dates { color: var(--ink-soft); font-size: .9rem; }
.today-head .hebdate {
  font-family: var(--hebrew);
  direction: rtl;
  color: var(--gold);
  font-size: 1.05rem;
  margin-top: .15rem;
}

.daf-hero {
  margin: 1.25rem 0 .25rem;
  text-align: center;
  position: relative;
  padding: 1.15rem .5rem .35rem;
}
/* The gateway of a shaar blatt, drawn behind the name rather than around it,
   so the type sets the size and the frame follows. */
.arch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  opacity: .5;
  pointer-events: none;
}
.arch .inner { stroke-width: .7; opacity: .7; }
.daf-hero .name {
  font-family: var(--english);
  font-size: clamp(2.1rem, 9vw, 3rem);
  line-height: 1.1;
  font-weight: 600;
}
.daf-hero .name-he {
  font-family: var(--hebrew);
  direction: rtl;
  font-size: clamp(1.5rem, 6.5vw, 2rem);
  color: var(--gold);
  margin-top: .3rem;
}

.cycle {
  margin-top: 1.25rem;
}
.cycle .meter {
  height: 6px;
  border-radius: 99px;
  background: var(--page-warm);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.cycle .meter > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
}
.cycle .row {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--ink-faint);
  margin-bottom: .4rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-top: 1rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: .7rem .5rem;
  text-align: center;
}
.stat b { display: block; font-size: 1.35rem; font-family: var(--english); }
.stat span { font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }

.daynav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin-top: 1rem;
}
.daynav a {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: .6rem .8rem;
  background: var(--card);
  font-size: .85rem;
}
.daynav a small { display: block; color: var(--ink-faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.daynav a.next { text-align: right; }

/* ---------- reader ---------- */

.reader-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: -1rem -1rem 0;
  padding: max(.5rem, env(safe-area-inset-top)) 1rem .5rem;
  background: color-mix(in srgb, var(--page) 90%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.reader-bar .line1 {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.reader-bar .title { flex: 1; min-width: 0; }
.reader-bar .title b { display: block; font-size: 1.02rem; font-family: var(--english); }
.reader-bar .title span { display: block; font-family: var(--hebrew); direction: rtl; font-size: .85rem; color: var(--gold); }
.icon-btn {
  width: 2.15rem; height: 2.15rem;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid var(--rule);
  background: var(--card);
  font-size: 1rem;
  flex: none;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.segmented {
  display: flex;
  gap: .25rem;
  margin-top: .5rem;
  background: var(--page-warm);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: .2rem;
}
.segmented button {
  flex: 1;
  padding: .35rem .3rem;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.segmented button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}

.amud-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 1.6rem 0 .9rem;
}
.ornament {
  flex: 1;
  min-width: 0;
  height: 14px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.1;
  stroke-linecap: round;
  opacity: .65;
}
.ornament .dot { fill: var(--gold); stroke: none; }
.amud-head :last-child.ornament { transform: scaleX(-1); }
.amud-head b {
  font-family: var(--hebrew);
  direction: rtl;
  color: var(--gold);
  font-size: .95rem;
  letter-spacing: .04em;
}

.seg {
  padding: .85rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
}
.seg:last-child { border-bottom: none; }

.seg-he {
  font-family: var(--hebrew);
  direction: rtl;
  text-align: right;
  font-size: calc(var(--seg) * 1.24);
  line-height: var(--lh-he, 1.85);
  letter-spacing: .005em;
}
.seg-en {
  font-family: var(--english);
  font-size: var(--seg);
  line-height: var(--lh-en, 1.66);
  color: var(--ink-soft);
  margin-top: .55rem;
}
/* Sefaria bolds the literal words of the Gemara and leaves the elucidation
   plain — the same convention the printed elucidated editions use. */
.seg-en b { color: var(--ink); font-weight: 600; }

.layout-side .seg { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.layout-side .seg-en { margin-top: 0; }
@media (max-width: 34rem) {
  .layout-side .seg { grid-template-columns: 1fr; }
  .layout-side .seg-en { margin-top: .55rem; }
}

.notes { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.note-toggle {
  border: 1px solid var(--rule);
  background: var(--page-warm);
  color: var(--ink-soft);
  border-radius: 99px;
  padding: .2rem .7rem;
  font-family: var(--hebrew);
  font-size: .82rem;
}
.note-toggle[aria-expanded="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #fffaf0;
}
:root[data-theme="dark"] .note-toggle[aria-expanded="true"] { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .note-toggle[aria-expanded="true"] { color: #16130f; }
}

.note-body {
  margin-top: .55rem;
  padding: .7rem .85rem;
  background: var(--page-warm);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.note-body .note-name {
  font-family: var(--hebrew);
  direction: rtl;
  color: var(--gold);
  font-size: .8rem;
  margin-bottom: .3rem;
}
.note-body .note-he {
  font-family: var(--hebrew);
  direction: rtl;
  text-align: right;
  font-size: calc(var(--seg) * 1.04);
  line-height: 1.8;
}
.note-body .note-en {
  font-family: var(--english);
  font-size: calc(var(--seg) * .9);
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: .4rem;
}
.note-body + .note-body { margin-top: .45rem; }

/* Clears the tab bar, which is 3.7rem tall before the safe-area inset. */
.reader-foot {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(4.2rem + var(--safe-b));
  z-index: 35;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.reader-foot > div {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: .35rem .4rem;
  box-shadow: var(--shadow);
}
/* The floating controls sit on top of the page, so the last of the text needs
   room to scroll clear of them. */
.foot-clearance { height: 4rem; }

.reader-foot .mark {
  padding: .45rem 1rem;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}
.reader-foot .mark[aria-pressed="true"] { background: var(--gold); color: #fffaf0; }
:root[data-theme="dark"] .reader-foot .mark[aria-pressed="true"] { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .reader-foot .mark[aria-pressed="true"] { color: #16130f; }
}



.seder-bar { display: flex; gap: 2px; height: 26px; }
.seder-slice {
  flex-basis: 0;
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: color-mix(in srgb, var(--seder) 16%, var(--page-warm));
  overflow: hidden;
}
.seder-slice > i { display: block; height: 100%; background: var(--seder); }

.version {
  max-width: 46rem;
  margin: 0 auto;
  padding: .35rem 1rem calc(5rem + var(--safe-b));
  text-align: center;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--ink-faint);
  opacity: .75;
}

.version .builder {
  display: block;
  margin-top: .2rem;
  font-family: var(--ui);
  letter-spacing: .02em;
  text-transform: none;
}

.release { margin-bottom: 1.4rem; }
.release-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--rule);
}
.release-head b { font-family: var(--english); font-size: 1rem; }
.release-head span { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.release ul { margin: .6rem 0 0; padding-left: 1.1rem; }
.release li {
  font-size: .88rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}
.release li::marker { color: var(--gold); }

.synccode {
  margin: 0 0 .8rem;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: .3em;
  text-indent: .3em;
  text-align: center;
  color: var(--gold);
  background: var(--page-warm);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: .6rem .4rem;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 12px;
  padding: 0 .8rem;
  margin-bottom: .8rem;
}
.searchbar svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: var(--ink-faint); stroke-width: 1.8; stroke-linecap: round;
}
.searchbar input {
  flex: 1; min-width: 0;
  border: none; background: none; color: var(--ink);
  font: inherit; font-size: .92rem;
  padding: .7rem 0;
  outline: none;
}
.searchbar input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.5); }

.hit {
  display: block;
  padding: .6rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  margin-bottom: .4rem;
}
.hit b { display: block; font-family: var(--english); font-size: .9rem; }
.hit span {
  display: block;
  font-size: .82rem;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-top: .15rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.hit .hit-he { font-family: var(--hebrew); direction: rtl; text-align: right; font-size: .95rem; }

.siyum {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  animation: rise .25s ease;
}
.siyum-card {
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem 1.4rem 1.3rem;
  text-align: center;
  max-width: 22rem;
}
.siyum-card .ornament { width: 100%; height: 16px; margin-bottom: .7rem; }
.siyum-he {
  font-family: var(--hebrew); direction: rtl;
  font-size: 1.5rem; color: var(--gold); margin: 0;
}
.siyum-name {
  font-family: var(--hebrew); direction: rtl;
  font-size: 2rem; margin: .1rem 0 .5rem; color: var(--ink);
}
.siyum-en { font-size: .88rem; color: var(--ink-soft); margin: 0 0 1.1rem; line-height: 1.5; }

#note {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-family: var(--english);
  font-size: .92rem;
  line-height: 1.5;
  padding: .7rem .85rem;
  resize: vertical;
  min-height: 4.5rem;
}
#note:focus { outline: none; border-color: var(--gold); }
.notestate {
  margin: .3rem 0 0;
  font-size: .72rem;
  color: var(--gold);
  min-height: 1em;
}

.track {
  display: block;
  margin-top: 1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
}
.track b { display: block; font-family: var(--english); font-size: 1.02rem; margin-top: .1rem; }
.track .track-note { display: block; font-size: .72rem; color: var(--ink-faint); line-height: 1.45; margin-top: .35rem; }
.perakim { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.perakim a {
  display: grid; place-items: center;
  min-width: 2rem; padding: .3rem .35rem;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--page-warm);
  font-family: var(--english); font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.perakim a:hover { border-color: var(--gold); color: var(--gold); }
.track .track-he { font-family: var(--hebrew); direction: rtl; color: var(--gold); font-size: .92rem; }

.chavrusa {
  display: block;
  margin-top: 1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-faint);
  border-radius: 12px;
  background: var(--card);
}
.chavrusa.done { border-left-color: var(--gold); }
.chavrusa b { display: block; font-family: var(--english); font-size: 1rem; margin-top: .1rem; }
.chavrusa .chav-state { display: block; font-size: .84rem; color: var(--ink-soft); margin-top: .1rem; }
.chavrusa.done .chav-state { color: var(--gold); font-weight: 600; }
.chavrusa .chav-total { display: block; font-size: .72rem; color: var(--ink-faint); margin-top: .15rem; }

.icon-btn.on { background: var(--gold); border-color: var(--gold); color: #fffaf0; }
:root[data-theme="dark"] .icon-btn.on { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .icon-btn.on { color: #16130f; }
}
.seg.reading {
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border-radius: 8px;
  box-shadow: 0 0 0 .5rem color-mix(in srgb, var(--gold) 10%, transparent);
}

.offline-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(4.6rem + var(--safe-b));
  z-index: 45;
  background: var(--ink);
  color: var(--page);
  font-size: .74rem;
  font-weight: 600;
  padding: .35rem .8rem;
  border-radius: 99px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.shiur { display: flex; flex-wrap: wrap; gap: .45rem; }
.shiur a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--card);
  font-size: .85rem;
  font-weight: 600;
}
.shiur a:hover { border-color: var(--gold); color: var(--gold); }
.shiur svg { width: 13px; height: 13px; fill: currentColor; }

.findbar { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.findbar input {
  flex: 1; min-width: 0;
  border: 1px solid var(--rule); border-radius: 9px;
  background: var(--page-warm); color: var(--ink);
  font: inherit; font-size: .85rem; padding: .38rem .7rem; outline: none;
}
.findbar input:focus { border-color: var(--gold); }
.findbar #findcount { font-size: .72rem; color: var(--ink-faint); white-space: nowrap; }

.seg { position: relative; }
.seg-n {
  position: absolute; top: .85rem; inset-inline-start: -1.15rem;
  font-size: .62rem; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.seg-copy {
  position: absolute; top: .6rem; inset-inline-end: -.2rem;
  opacity: 0; padding: .15rem .3rem;
  font-size: .8rem; color: var(--ink-faint);
  transition: opacity .15s ease;
}
.seg:hover .seg-copy, .seg-copy:focus-visible { opacity: 1; }
.seg.hit-seg {
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  border-radius: 8px;
  box-shadow: 0 0 0 .4rem color-mix(in srgb, var(--gold) 12%, transparent);
}

/* Full-screen reading: the text, and nothing to look at but the text. */
body.zen .tabbar,
body.zen .findbar,
body.zen .segmented,
body.zen .version,
body.zen .dedication,
body.zen .shiur,
body.zen #note,
body.zen .notestate,
body.zen .reader-foot { display: none !important; }
body.zen #app { padding-bottom: 2rem; }

.rev-row {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .85rem;
  border: 1px solid var(--rule); border-radius: 11px;
  background: var(--card); margin-bottom: .4rem;
}
.rev-row .names { flex: 1; min-width: 0; }
.rev-row .names b { display: block; font-family: var(--english); font-size: .94rem; }
.rev-row .names span { font-size: .74rem; color: var(--ink-faint); }

.zman-list { display: grid; gap: .1rem; }
.zman {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: .6rem;
  padding: .28rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
}
.zman:last-child { border-bottom: none; }
.zman-he { font-family: var(--hebrew); direction: rtl; color: var(--gold); font-size: .88rem; }
.zman-en { font-size: .76rem; color: var(--ink-faint); }
.zman b { font-family: var(--english); font-variant-numeric: tabular-nums; font-size: .95rem; }
.zman-note { font-size: .7rem; color: var(--ink-faint); line-height: 1.45; margin: .7rem 0 0; }
.zman-note button { font: inherit; color: var(--gold); text-decoration: underline; padding: 0; }

.sizes { display: grid; gap: 2px; max-height: 17rem; overflow-y: auto; padding-right: .2rem; }
.size-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 2rem;
  align-items: center;
  gap: .5rem;
  font-size: .72rem;
}
.size-row span { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size-row i { height: 8px; border-radius: 2px; background: var(--seder, var(--gold)); min-width: 2px; }
.size-row b { color: var(--ink-faint); font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }

.jumpout { margin: 0 0 .4rem; font-size: .8rem; color: var(--gold); min-height: 1.1em; }

.keys {
  position: fixed; inset: 0; z-index: 95;
  display: grid; place-items: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.keys-card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.2rem 1.1rem 1rem; max-width: 20rem; width: 100%;
}
.key-row { display: grid; grid-template-columns: 4.5rem 1fr; gap: .6rem; align-items: baseline; padding: .22rem 0; }
.key-row kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .78rem; text-align: center;
  border: 1px solid var(--rule); border-radius: 6px;
  background: var(--page-warm); padding: .1rem .3rem;
}
.key-row span { font-size: .85rem; color: var(--ink-soft); }

.jumpbar { margin-bottom: .5rem; }
.rel-group {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: .5rem;
  padding: .35rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 45%, transparent);
}
.rel-group:last-child { border-bottom: none; }
.rel-cat { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); padding-top: .2rem; }
.rel-items { display: flex; flex-wrap: wrap; gap: .3rem; }
.rel-items a {
  font-size: .76rem;
  padding: .12rem .5rem;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--page-warm);
  color: var(--ink-soft);
}
.rel-items a:hover { border-color: var(--gold); color: var(--gold); }

.lex {
  position: fixed;
  z-index: 85;
  transform: translateX(-50%);
  max-width: min(22rem, 88vw);
  background: var(--card);
  border: 1px solid var(--gold);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: .7rem .85rem;
}
.lex-loading { color: var(--ink-faint); font-size: .85rem; }
.lex-entry + .lex-entry { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--rule); }
.lex-entry b { font-family: var(--hebrew); direction: rtl; font-size: 1.05rem; color: var(--gold); }
.lex-src { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); margin-inline-start: .4rem; }
.lex-entry p { margin: .25rem 0 0; font-size: .82rem; line-height: 1.5; color: var(--ink-soft); }

mark {
  background: color-mix(in srgb, var(--gold) 26%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 .05em;
}
.lex-hl {
  display: block; width: 100%;
  margin-top: .6rem; padding: .35rem;
  border: 1px solid var(--rule); border-radius: 8px;
  background: var(--page-warm);
  font-size: .78rem; font-weight: 600; color: var(--ink-soft);
}
.lex-hl:hover { border-color: var(--gold); color: var(--gold); }

.topics { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: 1rem; }
.topics .eyebrow { width: 100%; margin-bottom: .1rem; }
.topics a {
  font-size: .76rem; padding: .15rem .6rem;
  border: 1px solid var(--rule); border-radius: 99px;
  background: var(--page-warm); color: var(--ink-soft);
  text-transform: capitalize;
}
.topics a:hover { border-color: var(--gold); color: var(--gold); }

.intro-meta { font-size: .78rem; color: var(--ink-faint); margin: 1rem 0 .8rem; }
.intro p { font-family: var(--english); font-size: .95rem; line-height: 1.65; color: var(--ink-soft); margin: 0 0 .8rem; }
.intro p:first-child { color: var(--ink); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.wk {
  display: grid; justify-items: center; gap: .1rem;
  padding: .45rem .1rem;
  border: 1px solid var(--rule); border-radius: 10px;
  background: var(--card);
}
.wk-day { font-size: .62rem; color: var(--ink-faint); text-transform: uppercase; }
.wk-daf { font-family: var(--english); font-size: 1rem; font-variant-numeric: tabular-nums; }
.wk-mas { font-size: .56rem; color: var(--ink-faint); text-align: center; line-height: 1.1; }
.wk.done { background: color-mix(in srgb, var(--gold) 16%, var(--card)); border-color: var(--gold); }
.wk.now { outline: 2px solid var(--accent); outline-offset: 1px; }

.resume {
  display: block;
  margin-top: 1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  background: var(--card);
}
.resume b { display: block; font-family: var(--english); font-size: 1rem; margin-top: .1rem; }
.resume-bar {
  display: block; height: 4px; margin-top: .4rem;
  border-radius: 99px; background: var(--page-warm); overflow: hidden;
}
.resume-bar > i { display: block; height: 100%; background: var(--gold); }
.resume-note { display: block; font-size: .7rem; color: var(--ink-faint); margin-top: .25rem; }

#qscope {
  flex: none; max-width: 8.5rem;
  border: none; background: none; color: var(--ink-faint);
  font: inherit; font-size: .8rem; padding: .3rem 0; outline: none;
}

.weekdays { display: grid; gap: 3px; }
.wd-row {
  display: grid; grid-template-columns: 3.6rem 1fr 1.8rem;
  align-items: center; gap: .5rem; font-size: .74rem;
}
.wd-row span { color: var(--ink-soft); }
.wd-row i { height: 9px; border-radius: 2px; background: var(--gold); min-width: 2px; }
.wd-row b { color: var(--ink-faint); font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- the rest of the day ---------- */

.shabbos-card, .yahrzeit-card {
  display: block;
  margin-top: 1rem;
  padding: .7rem .9rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold-soft);
  border-radius: 12px;
  background: var(--card);
}
.shabbos-card b, .yahrzeit-card b {
  display: block;
  font-family: var(--english);
  font-size: 1.15rem;
  margin-top: .1rem;
}
.shab-note, .yz-when, .yz-note {
  display: block;
  font-size: .72rem;
  color: var(--ink-faint);
  margin-top: .2rem;
}
.yahrzeit-card { border-left-color: var(--accent); }
.yahrzeit-card.today { background: color-mix(in srgb, var(--gold) 10%, var(--card)); }
.yz-note { font-style: italic; }

/* ---------- the other daily cycles ---------- */

.tracks { display: grid; gap: .35rem; }
.track-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: .5rem .8rem;
  padding: .6rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
}
.tr-name { font-size: .72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.tr-he { font-family: var(--hebrew); font-size: 1rem; grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.tr-ref { font-family: var(--english); font-size: .95rem; grid-column: 1; }

/* ---------- go to a daf ---------- */

.jumper {
  position: fixed; inset: 0; z-index: 96;
  display: grid; align-items: start; justify-items: center;
  padding: 3.5rem 1.2rem 1.2rem;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.jump-card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; max-width: 26rem; width: 100%;
}
.jump-card input {
  width: 100%; padding: .7rem .9rem;
  border: 1px solid var(--rule); border-radius: 12px;
  background: var(--page-warm); color: var(--ink); font: inherit; font-size: 1rem;
}
.jump-hits { display: grid; gap: 2px; margin-top: .6rem; max-height: 50vh; overflow-y: auto; }
.jump-hits a {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .6rem;
  padding: .5rem .6rem; border-radius: 10px;
}
.jump-hits a:hover, .jump-hits a:focus-visible { background: var(--page-warm); }
.jump-hits b { font-family: var(--english); font-size: .98rem; font-weight: 500; }
.jump-hits span { font-size: .76rem; color: var(--ink-faint); font-family: var(--hebrew); }
.jump-foot { display: flex; gap: .5rem; margin-top: .7rem; }
.jump-foot .btn { flex: 1; }

/* ---------- past searches, browse tools ---------- */

.pastq { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0 .2rem; }
.pastq button {
  font-size: .74rem; padding: .18rem .6rem;
  border: 1px solid var(--rule); border-radius: 99px;
  background: var(--page-warm); color: var(--ink-soft); font-family: inherit;
}
.pastq button:hover { border-color: var(--gold); color: var(--gold); }
.pastq .forget { color: var(--ink-faint); border-style: dashed; }

.browse-tools { display: flex; gap: .5rem; margin: .8rem 0 .2rem; }
.browse-tools .btn { flex: 1; }

/* ---------- chazara ---------- */

.icon-btn.chaz { font-size: .82rem; font-variant-numeric: tabular-nums; }
.icon-btn.chaz.on { color: var(--gold); border-color: var(--gold); }

/* ---------- tools ---------- */

.gem-out { display: grid; gap: 1px; margin-top: .7rem; }
.gem-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .35rem .1rem; border-top: 1px solid var(--rule);
}
.gem-row span { font-size: .8rem; color: var(--ink-soft); }
.gem-row b { font-family: var(--english); font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.store-list { display: grid; gap: 1px; }
.store-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .4rem .2rem; border-bottom: 1px solid var(--rule); font-size: .85rem;
}
.store-row b { color: var(--ink-faint); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- settings: tracks and yahrzeits ---------- */

.track-pick {
  display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start;
  padding: .5rem 0; border-bottom: 1px solid var(--rule);
}
.track-pick:last-child { border-bottom: none; }
.track-pick input { margin-top: .25rem; accent-color: var(--gold); }
.track-pick .label b { display: block; font-size: .92rem; font-weight: 500; }
.track-pick .label span { display: block; font-size: .76rem; color: var(--ink-faint); }

.yz-list { display: grid; gap: .3rem; margin-bottom: .6rem; }
.yz-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.yz-row b { font-size: .92rem; font-weight: 500; }
.yz-row small { display: block; font-size: .72rem; color: var(--ink-faint); }

/* ---------- save as PDF ---------- */

.print-head, .print-note { display: none; }

.printer {
  position: fixed; inset: 0; z-index: 97;
  display: grid; place-items: center; padding: 1.5rem;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.print-card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1rem 1rem; max-width: 22rem; width: 100%;
}
.print-what { display: block; font-family: var(--english); font-size: 1.15rem; margin-bottom: .7rem; }
.print-opts { display: grid; gap: .1rem; margin-bottom: .9rem; }
.print-opts label {
  display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start;
  padding: .4rem 0; font-size: .88rem; line-height: 1.35;
}
.print-opts input { margin-top: .2rem; accent-color: var(--gold); }

/* ---------- a siyum together ---------- */

.lede { font-size: .92rem; line-height: 1.6; color: var(--ink-soft); margin: 1rem 0 0; }

.siy-list { display: grid; gap: .35rem; }
.siy-row {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .6rem .8rem; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--card);
}
.siy-label { font-family: var(--english); font-size: .95rem; }
.siy-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .16em; font-size: .8rem; color: var(--ink-faint);
}
.siy-code.big { font-size: 1.15rem; color: var(--gold); letter-spacing: .22em; }

.siy-head { text-align: center; margin: 1.2rem 0 1rem; }
.siy-head b { display: block; font-family: var(--english); font-size: 1.5rem; margin-top: .15rem; }
.siy-note { font-size: .86rem; color: var(--ink-soft); margin: .5rem 0 0; line-height: 1.5; }
.siy-meta { font-size: .76rem; color: var(--ink-faint); margin: .4rem 0 0; }

.siy-bar {
  display: flex; height: 10px; border-radius: 99px; overflow: hidden;
  background: var(--page-warm); border: 1px solid var(--rule);
}
.siy-bar > i { display: block; height: 100%; }
.siy-done { background: var(--gold); }
.siy-taken { background: var(--gold-soft); }

.siy-share {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  margin-top: .9rem; padding: .6rem .8rem;
  border: 1px dashed var(--rule); border-radius: 12px;
}

.portions { display: grid; gap: 2px; }
.portion {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: .3rem .6rem;
  padding: .5rem .7rem;
  border: 1px solid var(--rule); border-radius: 10px;
  background: var(--card);
}
.portion.taken { background: color-mix(in srgb, var(--gold) 7%, var(--card)); }
.portion.done  { background: color-mix(in srgb, var(--gold) 16%, var(--card)); border-color: var(--gold); }
.portion.mine  { border-left: 3px solid var(--accent); }
.po-name b { font-family: var(--english); font-size: .95rem; font-weight: 500; }
.po-he { font-family: var(--hebrew); font-size: .9rem; color: var(--ink-faint); margin-inline-start: .4rem; }
.po-by { font-size: .74rem; color: var(--ink-soft); text-align: right; }
.po-acts { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: .3rem; }
.btn.tiny { font-size: .72rem; padding: .2rem .55rem; border-radius: 8px; }

.segmented.wrap { flex-wrap: wrap; }

.po-sub { display: block; font-size: .7rem; color: var(--ink-faint); margin-top: .1rem; }
.po-box { accent-color: var(--gold); width: 1.05rem; height: 1.05rem; flex: none; }
.po-tick { color: var(--gold); font-size: .95rem; width: 1.05rem; text-align: center; }
.portion.free { cursor: pointer; }
.portion.free:hover { border-color: var(--gold); }
.siy-how { font-size: .84rem; color: var(--ink-soft); margin: 1rem 0 0; }

.take-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(4.6rem + var(--safe-b));
  z-index: 60;
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .6rem;
  width: min(30rem, calc(100vw - 1.6rem));
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow);
}
.take-bar[hidden] { display: none; }
.tb-count { font-size: .8rem; color: var(--ink-soft); flex: 1; font-variant-numeric: tabular-nums; }

.howto { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: .55rem; }
.howto li {
  counter-increment: step;
  display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem;
  align-items: start;
}
.howto li::before {
  content: counter(step);
  display: grid; place-items: center;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  background: var(--page-warm); border: 1px solid var(--rule);
  color: var(--gold);
  font-family: var(--english); font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.howto li b { display: block; font-size: .93rem; font-weight: 500; line-height: 1.4; }
.howto li span { display: block; font-size: .8rem; color: var(--ink-soft); line-height: 1.5; margin-top: .1rem; }
.howto.tight { gap: .4rem; margin-top: .6rem; }
.howto.tight li b { font-size: .86rem; }
.howto.tight li span { font-size: .76rem; }

.qa { font-size: .82rem; line-height: 1.55; color: var(--ink-soft); margin: 0 0 .7rem; }
.qa:last-child { margin-bottom: 0; }
.qa b { display: block; color: var(--ink); font-weight: 500; }

.siy-help { margin-top: .7rem; }
.siy-help summary {
  cursor: pointer; font-size: .8rem; color: var(--gold);
  padding: .3rem 0; list-style: none;
}
.siy-help summary::-webkit-details-marker { display: none; }
.siy-help summary::before { content: '\203a  '; }
.siy-help[open] summary::before { content: '\2039  '; }

.group-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem; margin: 1.3rem .2rem .45rem;
}
.group-all { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.group-all input { accent-color: var(--gold); width: .95rem; height: .95rem; }
.group-all span { font-size: .72rem; color: var(--ink-faint); }
.group-all:hover span { color: var(--gold); }
.group-done { font-size: .7rem; color: var(--gold); font-style: italic; }

/* ---------- dedication ---------- */

.dedication {
  margin: 1.35rem 0 .5rem;
  text-align: center;
  text-wrap: balance;
  font-family: var(--english);
  font-size: .82rem;
  font-style: italic;
  color: var(--gold);
  letter-spacing: .01em;
}
@media (min-width: 40rem) {
  .dedication { font-size: .92rem; }
}

/* ---------- the printed page ---------- */

.scan-row { display: flex; justify-content: center; margin: -.35rem 0 .5rem; }
.scan-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--rule);
  background: var(--page-warm);
  color: var(--ink-soft);
  border-radius: 99px;
  padding: .22rem .75rem;
  font-family: var(--hebrew);
  font-size: .82rem;
}
.scan-toggle svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.scan-toggle[aria-expanded="true"] { background: var(--gold); border-color: var(--gold); color: #fffaf0; }
:root[data-theme="dark"] .scan-toggle[aria-expanded="true"] { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .scan-toggle[aria-expanded="true"] { color: #16130f; }
}

.editions { margin: 0 0 .5rem; }
.editions button { font-size: .72rem; padding: .3rem .2rem; }
.scan { margin: 0 0 1rem; }
.scan-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  /* The scans are photographs of cream paper; on a dark page an untouched
     white rectangle glares, so knock it back a little. */
  background: var(--card);
}
.scan-open img { display: block; width: 100%; height: auto; }
:root[data-theme="dark"] .scan-open img { filter: brightness(.86) sepia(.12); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .scan-open img { filter: brightness(.86) sepia(.12); }
}
.scan figcaption {
  font-size: .68rem;
  color: var(--ink-faint);
  text-align: center;
  margin-top: .35rem;
}

.scan-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: color-mix(in srgb, var(--page) 96%, black);
  display: flex;
  flex-direction: column;
  padding: max(.6rem, env(safe-area-inset-top)) .6rem calc(.6rem + var(--safe-b));
  gap: .5rem;
}
.scan-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-family: var(--hebrew);
  direction: rtl;
  color: var(--gold);
  font-size: .9rem;
  flex: none;
}
.scan-stage {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  -webkit-overflow-scrolling: touch;
}
.scan-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  cursor: zoom-in;
  border-radius: 4px;
}
.scan-stage img.zoomed {
  max-width: none;
  max-height: none;
  width: 230%;
  cursor: zoom-out;
}
.scan-credit {
  flex: none;
  margin: 0;
  text-align: center;
  font-size: .68rem;
  color: var(--ink-faint);
}

.seder-icon {
  width: 17px; height: 17px;
  fill: none;
  stroke: var(--seder, var(--gold));
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
  margin-right: .4rem;
}

/* ---------- browse ---------- */

.seder-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 1.5rem 0 .5rem;
}
.seder-title .he { color: var(--seder, var(--gold)); font-size: 1rem; }

.mas-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .7rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: .4rem;
  text-align: left;
}
.mas-row .names { flex: 1; min-width: 0; }
.mas-row .names b { display: block; font-family: var(--english); font-size: .98rem; font-weight: 600; }
.mas-row .names span { font-size: .78rem; color: var(--ink-faint); }
.mas-row .mas-he { font-family: var(--hebrew); direction: rtl; color: var(--seder, var(--gold)); font-size: 1rem; }
.mas-row .ring { flex: none; }

.daf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.1rem, 1fr));
  gap: .35rem;
  padding: .2rem .1rem .9rem;
}
.daf-grid a {
  display: grid;
  place-items: center;
  padding: .45rem .1rem;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--card);
  font-family: var(--english);
  font-size: .85rem;
  position: relative;
}
.daf-grid a.learned { background: var(--gold); border-color: var(--gold); color: #fffaf0; }
:root[data-theme="dark"] .daf-grid a.learned { color: #16130f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .daf-grid a.learned { color: #16130f; }
}
.daf-grid a.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.daf-grid a .off {
  position: absolute;
  top: 2px; right: 3px;
  width: 5px; height: 5px;
  border-radius: 99px;
  background: var(--accent);
}

/* ---------- progress ---------- */

.bar-row { margin-bottom: .7rem; }
.bar-row .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .85rem;
  margin-bottom: .25rem;
}
.bar-row .top span { color: var(--ink-faint); font-size: .75rem; }
.bar-row .track {
  height: 5px;
  border-radius: 99px;
  background: var(--page-warm);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.bar-row .track > i { display: block; height: 100%; background: var(--seder, var(--gold)); }

[data-seder="Zeraim"]   { --seder: var(--seder-zeraim); }
[data-seder="Moed"]     { --seder: var(--seder-moed); }
[data-seder="Nashim"]   { --seder: var(--seder-nashim); }
[data-seder="Nezikin"]  { --seder: var(--seder-nezikin); }
[data-seder="Kodashim"] { --seder: var(--seder-kodashim); }
[data-seder="Tahoros"]  { --seder: var(--seder-tahoros); }

/* ---------- charts ---------- */

/* One data colour. Gold means "learned"; everything else is surface and rule. */
.chart { display: block; width: 100%; overflow: visible; }

.figure { margin: 0 0 1.4rem; }
.figure figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}
.figure figcaption b { font-size: .9rem; font-weight: 600; }
.figure figcaption span { font-size: .72rem; color: var(--ink-faint); text-align: right; }
.figure .readout {
  font-size: .75rem;
  color: var(--ink-faint);
  margin: .45rem 0 0;
  line-height: 1.45;
}

.strip { display: flex; gap: 1.5px; height: 32px; position: relative; }
.strip > .strip-seg {
  /* flex-basis 0 so each segment's width comes purely from its day count. */
  flex-basis: 0;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--page-warm);
  overflow: hidden;
  display: block;
  cursor: pointer;
}
.strip > .strip-seg { background: color-mix(in srgb, var(--seder, var(--gold)) 14%, var(--page-warm)); }
.strip > .strip-seg > i { display: block; height: 100%; background: var(--seder, var(--gold)); }
.strip > .strip-seg:hover, .strip > .strip-seg:focus-visible { border-color: var(--ink-faint); outline: none; }
.strip-today {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  border-radius: 1px;
  pointer-events: none;
}
.strip-today::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -4px;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid var(--ink);
}

.bands { display: flex; gap: 1.5px; margin-top: .55rem; }
.band {
  color: var(--seder);
  font-size: .58rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  padding-top: .18rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: clip;
}

.cal { height: auto; }
.cal-cell { fill: var(--page-warm); stroke: var(--rule); stroke-width: .5; }
.cal-cell.on { fill: var(--gold); stroke: var(--gold); }
.cal-month { fill: var(--ink-faint); font-size: 9px; font-family: var(--ui); }

.pace { height: auto; }
.pace-axis { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.pace-target {
  stroke: var(--ink-faint);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}
.pace-bar { fill: var(--page-warm); stroke: var(--rule); stroke-width: .5; vector-effect: non-scaling-stroke; }
.pace-bar.full { fill: var(--gold); stroke: var(--gold); }
.pace-label, .pace-tick { fill: var(--ink-faint); font-size: 11px; font-family: var(--ui); }
.pace-col:hover .pace-bar { stroke: var(--ink-faint); stroke-width: 1.5; }

.legend { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: .5rem; }
.legend span { display: flex; align-items: center; gap: .35rem; font-size: .72rem; color: var(--ink-faint); }
.legend i { width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--rule); background: var(--page-warm); }
.legend i.on { background: var(--gold); border-color: var(--gold); }
.legend i.mark { width: 2px; height: 12px; border: none; border-radius: 0; background: var(--ink); }

.tip {
  position: fixed;
  z-index: 70;
  background: var(--ink);
  color: var(--page);
  font-size: .74rem;
  font-weight: 600;
  padding: .3rem .55rem;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -130%);
  box-shadow: var(--shadow);
}

/* ---------- settings ---------- */

.set-group { margin-bottom: 1.1rem; }
.set-group > .eyebrow { margin: 0 .2rem .45rem; }
.set-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .75rem .9rem;
  border: 1px solid var(--rule);
  background: var(--card);
  width: 100%;
  text-align: left;
}
.set-item:first-of-type { border-radius: 12px 12px 0 0; }
.set-item:last-of-type { border-radius: 0 0 12px 12px; }
.set-item:only-of-type { border-radius: 12px; }
.set-item + .set-item { border-top: none; }
.set-item .label { flex: 1; min-width: 0; }
.set-item .label b { display: block; font-size: .92rem; font-weight: 600; }
.set-item .label span { display: block; font-size: .76rem; color: var(--ink-faint); line-height: 1.35; }

.switch {
  flex: none;
  width: 2.6rem; height: 1.5rem;
  border-radius: 99px;
  background: var(--page-warm);
  border: 1px solid var(--rule);
  position: relative;
  transition: background .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 1.1rem; height: 1.1rem;
  border-radius: 99px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--gold); border-color: var(--gold); }
.switch[aria-checked="true"]::after { transform: translateX(1.08rem); }

.build {
  margin: 0;
  padding-top: .7rem;
  border-top: 1px solid var(--rule);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .7rem;
  color: var(--ink-faint);
  text-align: center;
  letter-spacing: .02em;
}

/* ---------- misc ---------- */

.notice {
  border: 1px solid var(--rule);
  background: var(--page-warm);
  border-radius: 12px;
  padding: .8rem 1rem;
  font-size: .88rem;
  color: var(--ink-soft);
}
.notice b { color: var(--ink); }

.spinner {
  width: 1.15rem; height: 1.15rem;
  border: 2px solid var(--rule);
  border-top-color: var(--gold);
  border-radius: 99px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
  display: flex;
  align-items: center;
  gap: .6rem;
  justify-content: center;
  padding: 3rem 0;
  color: var(--ink-faint);
  font-size: .9rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(7rem + var(--safe-b));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--page);
  padding: .55rem 1rem;
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  z-index: 60;
  box-shadow: var(--shadow);
  animation: rise .2s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, .5rem); } }

.ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: var(--rule); }
.ring .fg { stroke: var(--seder, var(--gold)); stroke-linecap: round; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ---------- print ---------- */

/* A daf on paper: no chrome, no controls, black on white, and the commentary
   opened out rather than hidden behind chips that cannot be tapped. */
@media print {
  .tabbar, .reader-bar, .reader-foot, .version, .searchbar, .tehillim,
  .foot-clearance, .offline-bar, .toast, .scan-row, .notes, #note, .shiur,
  .notestate, .dedication + .btn, .track, .chavrusa,
  .tracks, .shabbos-card, .yahrzeit-card, .jumper, .pastq, .browse-tools,
  .resume, .week { display: none !important; }

  :root {
    --page: #fff; --page-warm: #fff; --card: #fff;
    --ink: #000; --ink-soft: #222; --ink-faint: #555; --rule: #bbb; --gold: #333;
  }
  body { background: #fff; }
  #app { max-width: none; padding: 0; }

  .seg { break-inside: avoid; page-break-inside: avoid; }
  .seg-he { font-size: 12pt; line-height: 1.7; }
  .seg-en { font-size: 10.5pt; line-height: 1.5; color: #222; }

  /* Chips are useless on paper; show every note instead. */
  [data-notebody] { display: block !important; }
  .note-toggle { display: none !important; }
  .note-body { border: none; padding: .2rem 0 0; background: none; }

  .amud-head { margin: 14pt 0 8pt; }
  .arch, .ornament { display: none !important; }
  a[href]::after { content: ""; }

  /* Room for the browser's own header and page numbers. */
  @page { margin: 16mm 14mm; }

  /* The sheet itself must never end up on the paper it asked about. */
  .printer, .keys, .jumper, .siyum { display: none !important; }

  /* Which daf this is, said once at the top. */
  .print-head {
    display: block !important;
    text-align: center;
    margin: 0 0 12pt;
    padding-bottom: 6pt;
    border-bottom: .5pt solid #999;
  }
  .print-head .ph-he { font-family: var(--hebrew); font-size: 17pt; line-height: 1.2; }
  .print-head .ph-en { font-family: var(--english); font-size: 12pt; margin-top: 1pt; }
  .print-head .ph-date { font-size: 8.5pt; color: #555; margin-top: 3pt; }
  .print-head .ph-ded { font-size: 8pt; color: #555; font-style: italic; margin-top: 4pt; }

  /* What the sheet asked to leave off. */
  body.pr-no-he .seg-he, body.pr-no-he .note-he { display: none !important; }
  body.pr-no-en .seg-en, body.pr-no-en .note-en { display: none !important; }
  body.pr-no-comm [data-notebody] { display: none !important; }

  /* The note lives in a textarea, which prints as an empty box. This is the
     same text as a plain block, and only when it was asked for. */
  body.pr-note .print-note {
    display: block !important;
    margin-top: 10pt; padding-top: 6pt;
    border-top: .5pt solid #999;
    break-inside: avoid; page-break-inside: avoid;
  }
  .print-note .pn-label {
    font-size: 8pt; letter-spacing: .06em; text-transform: uppercase; color: #555;
  }
  .print-note .pn-body {
    font-family: var(--english); font-size: 10pt; line-height: 1.5;
    white-space: pre-wrap; margin-top: 2pt;
  }
  body.pr-note .print-note:has(.pn-body:empty) { display: none !important; }

  /* An amud heading with its first passage stranded under it reads badly. */
  .amud-head { break-after: avoid; page-break-after: avoid; }
  .note-body { break-inside: avoid; page-break-inside: avoid; }
  .seg-copy, .seg-n { display: none !important; }
}
