/* Seferlines tactile controls, Library, Add to Home Screen and update prompt.
   Every control is a paper key: a raised edge at rest, pressed down while held, sunk in when it is on.
   New controls can opt in with class="tact" (or tact-btn for a labelled button). */
:root {
  --key: #fbf8f1; --key-hover: #fdfbf7; --key-line: #d8cfbd; --key-edge: #c9bda6; --key-hi: rgba(255,255,255,.75);
  --key-drop: rgba(74,52,22,.10); --key-in: #ebe3d3; --key-in-sh: rgba(74,52,22,.20); --key-r: 7px;
  --head-h: calc(7.15rem + env(safe-area-inset-top, 0px));
}
html[data-theme="dark"] {
  --key: #2e2b26; --key-hover: #35312b; --key-line: #4a453c; --key-edge: #050404; --key-hi: rgba(255,240,215,.07);
  --key-drop: rgba(0,0,0,.45); --key-in: #191816; --key-in-sh: rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --key: #2e2b26; --key-hover: #35312b; --key-line: #4a453c; --key-edge: #050404; --key-hi: rgba(255,240,215,.07);
    --key-drop: rgba(0,0,0,.45); --key-in: #191816; --key-in-sh: rgba(0,0,0,.6);
  }
}

/* ---------- the key ---------- */
.tact, .tact-btn, .nav-btn, .date-btn, .tab, .seg button, .close, .day, .dn, .linkish, .jump a, .done-btn, .al-row,
.lib-row, .lib-tile, .lib-chip, .lib-back, button.lib-crumb, .lib-open, .sec-item, .skip, .colophon a, .stop-btn, .tact-check, .cal-day, .cal-arrow {
  background: var(--key); border: 1px solid var(--key-line); border-radius: var(--key-r);
  box-shadow: inset 0 1px 0 var(--key-hi), 0 2px 0 var(--key-edge), 0 3px 7px -3px var(--key-drop);
  transition: transform 70ms ease, box-shadow 70ms ease, background-color .15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
:is(.tact, .tact-btn, .nav-btn, .date-btn, .tab, .seg button, .close, .day, .dn, .linkish, .jump a, .done-btn, .al-row,
  .lib-row, .lib-tile, .lib-chip, .lib-back, button.lib-crumb, .lib-open, .sec-item, .skip, .colophon a, .stop-btn, .tact-check, .cal-day, .cal-arrow):not(:disabled):active {
  transform: translateY(2px); background: var(--key-in);
  box-shadow: inset 0 1px 3px var(--key-in-sh), 0 0 0 var(--key-edge);
}
/* on: sunk into the page */
.tab[aria-pressed="true"], .seg button[aria-pressed="true"], .day[aria-current="date"], .done-btn[aria-pressed="true"], .sec-item[aria-current="true"],
.tact[aria-pressed="true"], .tact-btn[aria-pressed="true"], .lib-chip[aria-pressed="true"] {
  background: var(--key-in); transform: translateY(1px);
  box-shadow: inset 0 1px 3px var(--key-in-sh), inset 0 0 0 1px var(--key-line), 0 1px 0 var(--key-hi);
}
/* off and disabled: flat, quiet */
:is(.tact, .tact-btn, .nav-btn, .seg button, .lib-row, .lib-tile, .done-btn, .sec-item):disabled {
  background: transparent; box-shadow: none; border-style: dashed; border-color: var(--key-line); color: var(--faint); cursor: default; transform: none;
}
@media (hover: hover) {
  :is(.tact, .tact-btn, .nav-btn, .date-btn, .tab, .seg button, .close, .day, .dn, .linkish, .jump a, .done-btn, .al-row,
    .lib-row, .lib-tile, .lib-chip, .lib-back, button.lib-crumb, .lib-open, .sec-item, .skip, .colophon a, .stop-btn, .tact-check, .cal-day, .cal-arrow):not(:disabled):not([aria-pressed="true"]):not([aria-current]):hover { background: var(--key-hover); }
}
.tact-btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.75rem; padding: 0 1.05rem;
  font-family: var(--en-text); font-size: .95rem; color: var(--ink); white-space: nowrap; }
.tact-btn.primary { --pf: #2a251e; --pe: #8c7b62; background: var(--pf); color: #f6f1e7; border-color: #0c0a08; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(0,0,0,.4), 0 3px 0 var(--pe), 0 4px 8px -3px rgba(40,28,10,.45); }
.tact-btn.primary:not(:disabled):active { background: #1a1612; transform: translateY(3px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.55), 0 0 0 var(--pe); }
.tact-btn.primary:disabled {
  background: transparent; color: var(--muted); border: 1px dashed var(--key-line);
  box-shadow: none; font-weight: 600; opacity: 1; cursor: default; transform: none;
}
html[data-theme="dark"] .tact-btn.primary { --pf: #e4dccd; --pe: #7d7262; color: #1b1814; border-color: #a89e8c; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(0,0,0,.12), 0 3px 0 var(--pe), 0 4px 8px -3px rgba(0,0,0,.6); }
html[data-theme="dark"] .tact-btn.primary:not(:disabled):active { background: #cfc6b5; box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 0 0 var(--pe); }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .tact-btn.primary { --pf: #e4dccd; --pe: #7d7262; color: #1b1814; border-color: #a89e8c; box-shadow: inset 0 1px 0 rgba(255,255,255,.6), inset 0 -1px 0 rgba(0,0,0,.12), 0 3px 0 var(--pe), 0 4px 8px -3px rgba(0,0,0,.6); }
  html[data-theme="auto"] .tact-btn.primary:not(:disabled):active { background: #cfc6b5; box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 0 0 var(--pe); }
}

/* ---------- toolbar ---------- */
.bar { grid-template-columns: auto 1fr auto; gap: .4rem; height: 3.6rem; padding: 0 .5rem; }
.daypick { gap: .4rem; }
.nav-btn { border-radius: var(--key-r); }
.nav-btn:disabled { color: var(--rule-strong); }
.lib-open { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--ink); flex: none; }
.lib-open svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.date-btn { border-radius: var(--key-r); }
.tabs { gap: .3rem; padding: .1rem .5rem .6rem; }
.tab { border-radius: var(--key-r); height: 2.85rem; }
.tab[aria-pressed="true"] { color: var(--ink); }
.tab[aria-pressed="true"]::after { left: 38%; right: 38%; bottom: .28rem; height: 2px; border-radius: 1px; background: var(--accent); }
@media (max-width: 479px) {
  .tabs { gap: .22rem; padding: .05rem .35rem .55rem; }
  .tab { height: 3.1rem; padding: 0 .1rem; }
  .tab[aria-pressed="true"]::after { bottom: .18rem; }
}
.progress { bottom: -1px; }

/* ---------- sheets ---------- */
.close { margin: .15rem .15rem 0 0; width: 2.75rem; height: 2.75rem; background: none; border-color: transparent; box-shadow: none; color: var(--muted); }
.close-face { width: 2.125rem; height: 2.125rem; border-radius: 6px; border: 1px solid var(--key-line); background: var(--key); display: grid; place-items: center; pointer-events: none;
  box-shadow: inset 0 1px 0 var(--key-hi), 0 1px 0 var(--key-edge); }
button.close:not(:disabled):active { transform: none; background: none; box-shadow: none; }
button.close:not(:disabled):active .close-face { transform: translateY(1px); background: var(--key-in); box-shadow: inset 0 1px 2px var(--key-in-sh); }
button.close:focus-visible { outline: none; }
button.close:focus-visible .close-face { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  button.close:not(:disabled):not([aria-pressed="true"]):not([aria-current]):hover { background: none; box-shadow: none; }
  button.close:not(:disabled):not([aria-pressed="true"]):not([aria-current]):hover .close-face { background: var(--key-hover); }
}
.days { display: grid; gap: .45rem; padding: .25rem var(--pad) .6rem; }
.day { border-top: 1px solid var(--key-line); padding: .55rem .9rem; }
.day[aria-current="date"]::before { display: none; }
.seg { border: 0; border-radius: 0; overflow: visible; gap: .4rem; padding-bottom: 3px; }
.seg button + button { border-left: 1px solid var(--key-line); }
.seg button { color: var(--ink); border-radius: var(--key-r); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: inset 0 2px 4px rgba(0,0,0,.35); }
.seg .size-now, .seg .size-now:disabled { background: transparent; border: 0; box-shadow: none; flex: 0 0 4rem; color: var(--muted); }
.sheet-foot { padding: .9rem var(--pad) .2rem; }
.sheet-foot .tact-btn { width: 100%; }

/* section menu (More) */
.sec-list { display: grid; gap: .5rem; }
.sec-list li + li { border-top: 0; }
.sec-item { padding: .7rem .95rem; }
.lib-crumbs[hidden] { display: none; }

/* ---------- in the text ---------- */
.linkish { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .95rem; margin: .2rem .15rem; text-decoration: none; color: var(--ink); font-family: var(--en-text); font-size: .92rem; }
.jump { gap: .45rem; }
.jump a { text-decoration: none; padding: 0 .9rem; }
.daynav { gap: .7rem; }
.dn { padding: .7rem .9rem; }
.done-btn { border-radius: var(--key-r); }
.al-end.done .done-btn { box-shadow: none; background: transparent; border-color: transparent; }
.al-row { margin: .3rem 0; padding: .3rem .7rem; border-radius: var(--key-r); }
.stop-btn { transition: transform 70ms ease; border-radius: var(--key-r); }
.stop-btn:active { transform: translateY(1px); background: var(--key-in); }

/* ---------- links and small controls ---------- */
.skip { min-height: 2.75rem; display: inline-flex; align-items: center; padding: 0 1rem; color: var(--ink); text-decoration: none; }
.colophon a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .65rem; margin: .1rem .05rem; color: var(--ink); text-decoration: none; vertical-align: middle; line-height: 1.2; }
.colophon p { line-height: 2; }
/* verse and halachah numbers you tap to mark your place: small keys in the margin */
.stop-btn { border-radius: 6px; padding: 0 .3rem; }
.stopped .stop-btn, .stop-btn[aria-pressed="true"] { background: var(--key-in); box-shadow: inset 0 1px 3px var(--key-in-sh); transform: translateY(1px); }

/* ---------- Add to Home Screen ---------- */
.install-opt[hidden] { display: none; }
.install-opt .tact-btn { width: 100%; }
.offline-note { margin: .55rem 0 0; font-size: .8rem; color: var(--muted); font-family: var(--en-text); }
.a2hs-banner { position: fixed; z-index: 40; left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); max-width: 30rem; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: .6rem .8rem; align-items: center; padding: .85rem .9rem .8rem;
  background: var(--key); color: var(--ink); border: 1px solid var(--key-line); border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--key-hi), 0 3px 0 var(--key-edge), 0 14px 30px -10px rgba(40,28,10,.35); animation: rise .25s ease-out; }
.a2hs-banner img { border-radius: 9px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.a2hs-bt { display: flex; flex-direction: column; gap: .1rem; font-size: .84rem; line-height: 1.35; color: var(--muted); font-family: var(--en-text); }
.a2hs-bt strong { color: var(--ink); font-size: .95rem; font-weight: 600; font-family: var(--en); }
.a2hs-acts { grid-column: 1 / -1; display: flex; gap: .5rem; justify-content: flex-end; }
.a2hs-acts .tact-btn { flex: 1 1 0; }
.a2hs .sheet-head h2 { font-size: 1.02rem; }
.a2hs-steps { list-style: none; margin: .3rem 0 0; padding: 0 var(--pad); display: grid; gap: .6rem; }
.a2hs-steps li { display: grid; grid-template-columns: 2rem 1fr; gap: .7rem; align-items: start; padding: .8rem .85rem .85rem; border: 1px solid var(--key-line); border-radius: 12px; background: var(--key);
  box-shadow: inset 0 1px 0 var(--key-hi), 0 2px 0 var(--key-edge), 0 4px 10px -4px var(--key-drop); }
.a2hs-n { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 600; font-size: .95rem; box-shadow: 0 2px 0 var(--key-edge); }
.a2hs-t { font-size: .98rem; line-height: 1.45; padding-top: .15rem; }
.a2hs-hint { display: block; margin-top: .2rem; font-size: .82rem; color: var(--muted); font-family: var(--en-text); }
.a2hs-ico { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; vertical-align: -.65rem; margin: 0 .2rem; border-radius: 9px; border: 1px solid #c9ced6;
  background: linear-gradient(#ffffff, #f2f3f5); color: #0a84ff; box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b8bec8, 0 3px 6px -2px rgba(0,0,0,.18); }
html[data-theme="dark"] .a2hs-ico { border-color: #4a4a4f; background: linear-gradient(#3a3a3e, #2c2c2f); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 0 #000, 0 3px 6px -2px rgba(0,0,0,.5); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .a2hs-ico { border-color: #4a4a4f; background: linear-gradient(#3a3a3e, #2c2c2f); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 0 #000, 0 3px 6px -2px rgba(0,0,0,.5); } }
html[data-theme="dark"] .a2hs-ico { color: #4da3ff; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .a2hs-ico { color: #4da3ff; } }
.a2hs-ico svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.a2hs-foot { padding: 1rem var(--pad) .3rem; }
.a2hs-foot .tact-btn { width: 100%; }
.a2hs-btns { display: grid; gap: .55rem; }

/* "Don't show this again": a small key with a drawn box */
.tact-check { grid-column: 1 / -1; justify-self: start; position: relative; display: inline-flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: 0 .85rem 0 .6rem;
  font-family: var(--en-text); font-size: .86rem; color: var(--ink); cursor: pointer; }
.tact-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tc-box { width: 1.25rem; height: 1.25rem; border-radius: 4px; border: 1px solid var(--key-line); background: var(--bg); display: grid; place-items: center;
  box-shadow: inset 0 1px 2px var(--key-in-sh); }
.tc-box svg { width: .95rem; height: .95rem; fill: none; stroke: var(--bg); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.tact-check:has(input:checked) { background: var(--key-in); transform: translateY(1px); box-shadow: inset 0 1px 3px var(--key-in-sh), 0 1px 0 var(--key-hi); }
.tact-check input:checked + .tc-box { background: var(--ink); border-color: var(--ink); }
.tact-check input:checked + .tc-box svg { opacity: 1; }
.tact-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.a2hs-foot .tact-check { margin-bottom: .6rem; }

/* ---------- Library calendar ---------- */
.cal { display: grid; gap: .4rem; }
.cal-head { display: grid; grid-template-columns: 2.75rem 1fr 2.75rem auto; align-items: center; gap: .4rem; }
.cal-arrow { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; color: var(--ink); }
.cal-arrow svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cal-arrow:disabled { visibility: hidden; }
.cal-title { display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; min-width: 0; }
.cal-civil { font-weight: 600; font-size: 1rem; }
.cal-heb { font-size: .78rem; color: var(--muted); font-family: var(--en-text); white-space: nowrap; }
.cal-today { padding: 0 .8rem; font-size: .85rem; }
.cal-today:disabled { visibility: hidden; }
.cal-wk, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.cal-wk span { text-align: center; font-size: .68rem; letter-spacing: .03em; color: var(--muted); padding: .2rem 0 0; }
.cal-wk .shab { color: var(--accent); }
.cal-day { min-height: 3.1rem; padding: .2rem 0 .15rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; color: var(--ink); border-radius: 8px; }
.cd-n { font-size: .98rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cd-h { font-family: var(--he); font-size: .74rem; color: var(--muted); line-height: 1.15; }
.cal-day.shab:not(:disabled) { background: color-mix(in srgb, var(--key), var(--accent) 6%); }
.cal-day.shab:disabled { background: color-mix(in srgb, transparent, var(--accent) 5%); }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-day:disabled { box-shadow: none; transform: none; background: transparent; border: 1px dashed var(--rule); color: var(--faint); }
.cal-day.none { border-color: transparent; opacity: .55; }
.cal-day.later { opacity: .6; }
.cal-day:disabled .cd-h { color: var(--faint); }
.cal-pad { min-height: 3.1rem; }
.cal-grid.in-r { animation: libR .18s ease-out; } .cal-grid.in-l { animation: libL .18s ease-out; }
.cal-grid { touch-action: pan-y; }
.cal-legend { margin-top: .2rem; }

/* ---------- saving your place ---------- */
/* number keys (verse, halachah, mishnah, kapitel): the button is a quiet 44px tap target,
   and the small key you see (about 29px) is the number inside it */
.stop-btn:has(> .num-he) { background: none !important; border-color: transparent !important; box-shadow: none !important; transform: none !important;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0; border-radius: 8px; }
.stop-btn > .num-he { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: 1.8rem; height: 1.8rem; padding: 0 .3rem;
  font-size: .9rem; line-height: 1; border: 1px solid var(--key-line); border-radius: 6px; background-color: var(--key);
  box-shadow: inset 0 1px 0 var(--key-hi), 0 2px 0 var(--key-edge), 0 2px 5px -3px var(--key-drop);
  transition: transform 70ms ease, box-shadow 70ms ease, background-color .15s ease; }
.stop-btn:not(:disabled):active > .num-he { transform: translateY(2px); background-color: var(--key-in); box-shadow: inset 0 1px 3px var(--key-in-sh), 0 0 0 var(--key-edge); }
@media (hover: hover) { .stop-btn:not([aria-pressed="true"]):hover > .num-he { background-color: var(--key-hover); } }
.stop-btn:has(> .num-he):focus-visible { outline: none; }
.stop-btn:focus-visible > .num-he { outline: 2px solid var(--accent); outline-offset: 2px; }
/* saved: sunk into the page, with a small ribbon */
.stopped .stop-btn > .num-he, .stop-btn[aria-pressed="true"] > .num-he { background-color: var(--key-in); box-shadow: inset 0 1px 3px var(--key-in-sh); transform: translateY(1px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M0 0h10v14L5 10.2 0 14z' fill='%238a2c1c'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: .4rem .58rem; background-position: left .14rem top 0; }
html[data-theme="dark"] .stopped .stop-btn > .num-he, html[data-theme="dark"] .stop-btn[aria-pressed="true"] > .num-he { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M0 0h10v14L5 10.2 0 14z' fill='%23d09a84'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .stopped .stop-btn > .num-he, html[data-theme="auto"] .stop-btn[aria-pressed="true"] > .num-he { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M0 0h10v14L5 10.2 0 14z' fill='%23d09a84'/%3E%3C/svg%3E"); } }
.coach { position: fixed; z-index: 41; left: .75rem; right: .75rem; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); max-width: 30rem; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: .7rem .8rem; align-items: center; padding: .9rem .9rem .85rem;
  background: var(--key); color: var(--ink); border: 1px solid var(--key-line); border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--key-hi), 0 3px 0 var(--key-edge), 0 14px 30px -10px rgba(40,28,10,.35); animation: rise .25s ease-out; }
.coach .tact-btn { grid-column: 1 / -1; width: 100%; }
.coach-key { position: relative; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border: 1px solid var(--key-line); border-radius: var(--key-r);
  background-color: var(--key-in); box-shadow: inset 0 1px 3px var(--key-in-sh);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M0 0h10v14L5 10.2 0 14z' fill='%238a2c1c'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: .55rem .8rem; background-position: right .3rem top 0; }
.ck-n { font-family: var(--he); font-size: 1.2rem; color: var(--ink); }
.coach-t { display: flex; flex-direction: column; gap: .15rem; font-size: .84rem; line-height: 1.38; color: var(--muted); font-family: var(--en-text); }
.coach-t strong { color: var(--ink); font-size: .96rem; font-weight: 600; font-family: var(--en); }
.toast.toast-bottom { top: auto; bottom: calc(.75rem + env(safe-area-inset-bottom, 0px)); animation: rise .2s ease-out; }
.toast.toast-bottom .tact-btn { flex: none; }

/* ---------- update prompt ---------- */
.toast { position: fixed; z-index: 45; left: .75rem; right: .75rem; top: calc(.6rem + env(safe-area-inset-top, 0px)); max-width: 28rem; margin: 0 auto;
  display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem .5rem .9rem; background: var(--key); color: var(--ink);
  border: 1px solid var(--key-line); border-radius: 12px; box-shadow: 0 3px 0 var(--key-edge), 0 12px 26px -10px rgba(40,28,10,.35); font-size: .9rem; }
.toast-t { flex: 1 1 auto; font-family: var(--en-text); }

/* ---------- Library ---------- */
.sheet.lib { padding: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; overflow: hidden; }
.sheet.lib[open] { display: flex; flex-direction: column; }
.lib-head { display: grid; grid-template-columns: 2.75rem 1fr auto; gap: .5rem; align-items: center; padding: calc(.5rem + env(safe-area-inset-top, 0px)) .6rem .55rem;
  border-bottom: 1px solid var(--rule); }
.lib-end { display: flex; align-items: center; gap: .15rem; justify-self: end; }
.lib-end .close { margin: 0; }
.lib-back { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; }
.lib-back[hidden] { display: grid; visibility: hidden; }
.lib-back svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lib-mid { min-width: 0; text-align: center; }
.lib-title { outline: none; margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-crumbs { grid-column: 1 / -1; display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: safe center; white-space: nowrap; align-items: center; gap: .3rem; padding: .1rem .1rem 4px; font-size: .82rem; color: var(--muted); font-family: var(--en-text); }
button.lib-crumb { min-height: 2.75rem; padding: 0 .75rem; font-size: .82rem; flex: none; }
.lib-crumb.now { padding: 0 .4rem; color: var(--ink); font-weight: 600; flex: none; }
.lib-sep { color: var(--faint); }
.lib-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: .9rem var(--pad) calc(2rem + env(safe-area-inset-bottom, 0px)); }
.lib-pane { max-width: 36rem; margin: 0 auto; display: grid; gap: .55rem; align-content: start; }
.lib-pane.in-r { animation: libR .2s ease-out; } .lib-pane.in-l { animation: libL .2s ease-out; }
@keyframes libR { from { transform: translateX(14px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes libL { from { transform: translateX(-14px); opacity: .4; } to { transform: none; opacity: 1; } }
.lib-list { display: grid; gap: .5rem; }
.lib-row { width: 100%; min-height: 3.5rem; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem .95rem; text-align: left; color: var(--ink); }
.lib-l { display: flex; flex-direction: column; gap: .08rem; min-width: 0; }
.lib-en { font-size: 1rem; font-weight: 600; }
.lib-sub { font-size: .8rem; color: var(--muted); font-family: var(--en-text); }
.lib-he { font-family: var(--he); font-size: 1.15rem; font-weight: 500; }
.lib-chev { width: 1rem; text-align: center; font-size: 1.35rem; line-height: 1; color: var(--muted); }
.lib-soon { font-size: .74rem; font-style: italic; font-family: var(--en-text); color: var(--faint); }
.lib-row:disabled .lib-en, .lib-row:disabled .lib-he { color: var(--faint); font-weight: 500; }
.lib-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr)); gap: .5rem; direction: rtl; }
.lib-tile { min-height: 3.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; color: var(--ink); padding: .2rem 0; }
.t-he { font-family: var(--he); font-size: 1.15rem; line-height: 1.15; }
.t-en { font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-tile:disabled { opacity: 1; border-style: dashed; border-color: var(--rule-strong); }
.lib-tile:disabled .t-he { color: var(--muted); }
.lib-tile.before { opacity: .38; border-style: dotted; border-color: var(--key-line); background: transparent; }
.lib-tile.before .t-he { color: var(--faint); }
.lib-row.before { border-style: dotted; opacity: .7; }
.lib-row.before .lib-soon { font-style: normal; }
.lib-group { margin: .9rem 0 .1rem; display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lib-group [lang="he"] { text-transform: none; letter-spacing: 0; font-size: .95rem; font-weight: 500; }
.lib-note { margin: .6rem .2rem 0; font-size: .82rem; line-height: 1.5; color: var(--muted); font-family: var(--en-text); text-align: center; }
.lib-lede { margin: 0 0 .3rem; font-size: .9rem; color: var(--muted); font-style: italic; font-family: var(--en-text); text-align: center; }
.lib-mode { margin-bottom: .35rem; }
.lib-parts { display: grid; gap: .4rem; padding: .55rem .7rem .7rem .95rem; border: 1px solid var(--key-line); border-radius: var(--key-r); }
.lib-parts-l { font-weight: 600; }
.lib-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.lib-chip { min-height: 2.75rem; padding: 0 .9rem; font-size: .88rem; font-family: var(--en-text); color: var(--ink); }
@media (min-width: 700px) {
  .sheet.lib { width: 38rem; max-width: calc(100vw - 2rem); height: 86vh; max-height: 52rem; margin: auto; border: 1px solid var(--rule-strong); border-radius: 10px; box-shadow: 0 18px 40px rgba(30,22,12,.18); }
  .lib-head { padding-top: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tact, .tact-btn, .nav-btn, .date-btn, .tab, .seg button, .close, .day, .dn, .linkish, .jump a, .done-btn, .al-row,
  .lib-row, .lib-tile, .lib-chip, .lib-back, button.lib-crumb, .lib-open, .sec-item, .skip, .colophon a, .stop-btn, .tact-check, .cal-day, .cal-arrow, .stop-btn { transition: none; }
  :is(.tact, .tact-btn, .nav-btn, .date-btn, .tab, .seg button, .close, .day, .dn, .linkish, .jump a, .done-btn, .al-row,
    .lib-row, .lib-tile, .lib-chip, .lib-back, button.lib-crumb, .lib-open, .sec-item, .skip, .colophon a, .stop-btn, .tact-check, .cal-day, .cal-arrow, .stop-btn):active { transform: none !important; }
  .tab[aria-pressed="true"], .seg button[aria-pressed="true"], .day[aria-current="date"] { transform: none; }
}
@media print {
  .a2hs-banner, .toast, .lib-open, .sheet.lib, .t-cycle { display: none !important; }
  .tact, .tact-btn, .linkish, .jump a, .done-btn, .al-row, .stop-btn { box-shadow: none !important; }
}
@media print {
  .stop-btn { min-height: 0; min-width: 0; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 1pt; }
  .stop-btn > .num-he, .stop-btn > .num-en { border: 0; box-shadow: none; background: none; height: auto; min-width: 0; min-height: 0; padding: 0; }
  .stop-btn > .num-he { font-size: 8.5pt; }
}

/* ---------- Day or night ---------- */
.opt-theme .seg button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.th-i { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Continue where you left off: room on both sides, caption underneath ---------- */
.sm-resume .linkish { display: inline-flex; justify-content: center; text-align: center; box-sizing: border-box;
  width: auto; max-width: min(100%, 22rem); padding: .55rem 1.25rem; white-space: normal; line-height: 1.3; margin: .2rem auto 0; }
.sm-resume .resume-at { display: block; margin-top: .55rem; text-align: center; }

/* ---------- room for the words: text keeps at least 12px from a key's edge ---------- */
.seg button { padding: .35rem .8rem; }
.al-row { padding-left: .8rem; padding-right: .8rem; }
.lib-row { padding-left: 1rem; padding-right: .8rem; }
.colophon a { padding: 0 .8rem; }
.close { flex: none; }
.date-btn { padding: 0 .8rem; }
@media (max-width: 374px) {
  .bar { gap: .25rem; padding: 0 .3rem; }
  .daypick { gap: .25rem; }
  .date-btn { padding: 0 .75rem; }
  .date-en { font-size: .86rem; }
  .date-he { font-size: .84rem; }
  .cal-wk, .cal-grid { gap: .2rem; }
  .lib-body { padding-left: .9rem; padding-right: .9rem; }
}

/* ---------- section tabs on phones: five equal keys, labels that fit ---------- */
@media (max-width: 479px) {
  .tab { flex: 1 1 0; min-width: 0; padding: 0 .15rem; overflow: hidden; }
  .tab-he { font-size: .95rem; white-space: nowrap; }
  .tab-en { font-size: .68rem; letter-spacing: 0; white-space: nowrap; }
  .tab[aria-pressed="true"]::after { left: 32%; right: 32%; }
}
@media (max-width: 400px) {
  .tabs { gap: .18rem; padding-left: .25rem; padding-right: .25rem; }
  .tab-he { font-size: .86rem; }
  .tab-en { font-size: .64rem; }
}

/* ---------- sheets: fit the visible screen, scroll inside, header stays put ---------- */
.sheet:not(.lib) { display: none; flex-direction: column; overflow: hidden; padding: 0;
  max-height: calc(100vh - 1.5rem); max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 1.5rem);
  box-shadow: 0 -1px 0 var(--rule); }
.sheet:not(.lib)[open] { display: flex; }
.sheet-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
.sheet:not(.lib) > .sheet-head { flex: none; position: sticky; top: 0; z-index: 1; background: var(--bg); padding-bottom: .35rem; border-bottom: 1px solid var(--rule); }
html:has(dialog[open]), html:has(dialog[open]) body { overflow: hidden; }
@media (min-width: 40rem) { .sheet:not(.lib) { box-shadow: 0 10px 28px rgba(30,22,12,.10); } }
@media (max-width: 374px) { .tabs { gap: .15rem; } .tab-he { font-size: .84rem; } .tab-en { font-size: .62rem; letter-spacing: -.005em; } }

/* ---------- bookmark in the top bar, only when a place is saved ---------- */
.marks-btn[hidden] { display: none !important; }
.marks-btn svg { width: 1.15rem; height: 1.15rem; fill: currentColor; stroke: none; }
.marks-sheet { width: calc(100% - 1.5rem); max-width: 24rem; margin: auto auto 1.25rem; max-height: min(22rem, calc(100dvh - 4rem)); }
.marks-list { list-style: none; margin: 0; padding: .35rem var(--pad) 1rem; display: grid; gap: .4rem; }
.marks-item { display: grid; grid-template-columns: 1fr 2.75rem; gap: .3rem; align-items: center; }
.marks-row { width: 100%; min-height: 2.75rem; padding: .45rem .9rem; text-align: left; display: flex; flex-direction: column; justify-content: center; gap: .08rem; color: var(--ink); }
.marks-sefer { font-weight: 600; font-size: .95rem; }
.marks-ref { font-size: .8rem; color: var(--muted); font-family: var(--en-text); line-height: 1.3; }
.marks-item .close { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  button.close:not(:disabled):active .close-face { transform: none; }
}

/* ---------- print picker, opened from the Aa sheet ---------- */
.print-range-hint { margin: .45rem 0 0; font-family: var(--en-text); font-size: .85rem; color: var(--muted); font-style: italic; line-height: 1.35; }
.print-seforim { list-style: none; margin: .35rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.print-seforim li { border-bottom: 1px solid var(--rule); }
.print-seforim .tact-check { width: 100%; align-items: center; }
.print-seforim .tact-check.is-off { color: var(--muted); }
.print-seforim .tc-off { font-family: var(--en-text); font-size: .78rem; font-style: italic; color: var(--muted); margin-inline-start: auto; padding-inline-start: .6rem; }
.print-sel { display: flex; gap: 1.4rem; margin: .55rem 0 0; }
.print-sel .linkish, .print-sel button.linkish {
  min-height: 2.75rem; padding: 0; margin: 0;
  background: none !important; border: 0 !important; box-shadow: none !important;
  font-family: var(--en-text); font-size: .88rem; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.print-sheet { background: var(--bg); }
.print-sheet .print-tip { margin: .55rem 0 0; font-family: var(--en-text); font-size: .8rem; color: var(--muted); line-height: 1.4; }
@media (min-width: 40rem) {
  .print-sheet {
    width: calc(100% - 2rem); max-width: 26rem;
    margin: auto auto 1.5rem;
    max-height: min(42rem, calc(100dvh - 3.5rem));
  }
}

/* ---------- category folders in More and the Library ---------- */
.sec-folder-btn { grid-template-columns: 1fr auto auto; }
.sec-folder-btn .sec-caret { grid-column: 3; grid-row: 1 / span 2; align-self: center; display: grid; place-items: center; width: 1.2rem; color: var(--muted); }
.sec-folder-btn .sec-caret svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.sec-folder.open > .sec-folder-btn .sec-caret svg { transform: rotate(180deg); }
.sec-folder-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.sec-folder.open > .sec-folder-body { grid-template-rows: 1fr; }
.sec-folder-body > .sec-folder-list { overflow: hidden; min-height: 0; }
.sec-folder-list { list-style: none; margin: 0; padding: .35rem 0 0 .7rem; display: grid; gap: .4rem; }
.lib-folder-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.lib-folder.open > .lib-folder-body { grid-template-rows: 1fr; }
.lib-folder-body > .lib-list { overflow: hidden; min-height: 0; padding-top: .15rem; padding-inline-start: .7rem; }
.lib-folder-btn { padding-right: 1.25rem; }
.lib-folder-btn .lib-chev {
  width: 1.25rem; height: 1.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  transform-origin: center center;
  transition: transform .2s ease;
}
.lib-folder.open > .lib-folder-btn .lib-chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  .sec-folder-body, .lib-folder-body, .sec-folder-btn .sec-caret svg, .lib-folder-btn .lib-chev { transition: none; }
}

/* ---------- print entry, a labeled pill under the reading line ---------- */
.print-entry-row {
  margin: 1.05rem 0 0;
  display: flex;
  justify-content: center;
}
.print-entry { font-size: .9rem; padding: 0 1.15rem; gap: .4rem; }
.print-entry svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
@media print { .print-entry, .print-entry-row { display: none !important; } }
