/* Chavrusa Pace — warm, classic, phone-first */
@font-face { font-family: "Frank Ruhl"; src: url(fonts/frank-ruhl-libre-hebrew-400-normal.woff2) format("woff2"); font-weight: 400; unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "Frank Ruhl"; src: url(fonts/frank-ruhl-libre-hebrew-500-normal.woff2) format("woff2"); font-weight: 500; unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "Frank Ruhl"; src: url(fonts/frank-ruhl-libre-hebrew-700-normal.woff2) format("woff2"); font-weight: 700; unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; font-display: swap; }
@font-face { font-family: "Garamond"; src: url(fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Garamond"; src: url(fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Garamond"; src: url(fonts/eb-garamond-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Garamond"; src: url(fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --bg: #f3ebde; --bg2: #ede2d1; --card: #fbf7f0; --ink: #2a2018; --ink2: #4a3d31; --muted: #7d6d5b; --line: #e3d6c2;
  --accent: #7b2d24; --accent-ink: #fff8ef; --accent-soft: #f2e1d5; --gold: #a37a2c; --gold-soft: #f3e7c8; --ok: #3f6b3a;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px -18px rgba(70,40,15,.35), 0 2px 6px -3px rgba(70,40,15,.18);
  --serif: "Garamond", "EB Garamond", "Iowan Old Style", Georgia, serif;
  --heb: "Frank Ruhl", "Frank Ruhl Libre", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --r: 22px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100c; --bg2: #1a150f; --card: #1f1912; --ink: #f2e8d8; --ink2: #dccdb5; --muted: #a8977e; --line: #352b20;
    --accent: #d6a45a; --accent-ink: #1b140c; --accent-soft: #3a2c1a; --gold: #d6a45a; --gold-soft: #3a2f1c; --ok: #8fbf83;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 30px -18px rgba(0,0,0,.8);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg);
  background-image: radial-gradient(120% 60% at 50% -10%, var(--card) 0%, transparent 60%), linear-gradient(var(--bg), var(--bg2));
  background-attachment: fixed; min-height: 100vh; line-height: 1.4;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

.top { max-width: 560px; margin: 0 auto; padding: 18px 22px 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-he { font-family: var(--heb); font-weight: 700; font-size: 26px; color: var(--accent); }
.brand-en { white-space: nowrap; font-family: var(--serif); font-size: 17px; letter-spacing: .04em; color: var(--ink2); font-variant: small-caps; }
.today { margin: 0; font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 400px) { .brand-en { display: none; } }

main { max-width: 560px; margin: 0 auto; padding: 6px 14px 40px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 20px; margin: 14px 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 23px; margin: 0; letter-spacing: .01em; }
.sub { font-size: 13px; color: var(--muted); text-align: right; }
.label { display: block; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hint.lead { margin: -4px 0 12px; font-size: 14px; }

/* ---------- hero ---------- */
.hero { padding: 22px 20px 20px; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(80% 50% at 50% 0%, var(--gold-soft), transparent 70%); opacity: .55; }
.hero > * { position: relative; }
.masechta-btn { display: flex; flex-direction: column; align-items: center; width: 100%; background: none; border: 0; padding: 4px 0 10px; cursor: pointer; }
.eyebrow { font-family: var(--heb); font-size: 16px; color: var(--gold); letter-spacing: .08em; }
.m-he { font-family: var(--heb); font-weight: 700; font-size: 54px; line-height: 1.05; color: var(--ink); }
.m-en { font-family: var(--serif); font-size: 20px; color: var(--ink2); margin-top: 2px; display: inline-flex; align-items: center; gap: 6px; }
.chev { font-family: var(--sans); font-size: 14px; color: var(--muted); transform: translateY(-3px); }

.where { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.where-main { display: flex; align-items: baseline; gap: 10px; }
.where .label { transform: translateY(-4px); }
.pos { font-family: var(--serif); font-weight: 600; font-size: 34px; font-variant-numeric: lining-nums; }
.pos-he { font-family: var(--heb); font-size: 22px; color: var(--ink2); }
.perek-now { font-family: var(--heb); font-size: 17px; color: var(--accent); }
.perek-now { display: flex; flex-direction: column; align-items: center; gap: 0; }
.perek-now .pn-en { font-family: var(--serif); font-size: 14px; color: var(--muted); letter-spacing: .02em; }

.progress { position: relative; height: 10px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--accent)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.progress-ticks { position: absolute; inset: 0; }
.progress-ticks i { position: absolute; top: 2px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--card); opacity: .9; }
.progress-cap { text-align: center; font-size: 13px; color: var(--muted); margin: 8px 0 14px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px 10px; text-align: center; }
.num { display: block; font-family: var(--serif); font-weight: 600; font-size: 46px; line-height: 1; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.cap { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }

.siyum { text-align: center; margin: 16px 0 6px; padding: 16px 12px 14px; border-radius: 18px;
  background: linear-gradient(180deg, var(--gold-soft), transparent); border: 1px solid var(--line); }
.sd-day { display: block; font-size: 17px; color: var(--ink2); font-style: italic; }
.siyum-date { font-family: var(--serif); font-size: 30px; font-weight: 500; margin: 4px 0 2px; line-height: 1.15; }
.siyum-he { font-family: var(--heb); font-size: 23px; font-weight: 500; margin: 2px 0 0; color: var(--ink2); }
.siyum-heen { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.season { display: inline-block; margin: 0; padding: 6px 14px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 14.5px; font-weight: 600; letter-spacing: .01em; }
.season-note { font-size: 13px; color: var(--ink2); margin: 8px 0 0; font-style: italic; font-family: var(--serif); font-size: 15px; }
.season-note:empty { display: none; }
.tonight { text-align: center; font-size: 14px; color: var(--ink2); margin: 12px 0 4px; }
.tonight b { font-family: var(--serif); font-size: 16px; }

.actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 14px; min-width: 0; max-width: 100%; }
.actions > * { min-width: 0; max-width: 100%; }
.btn.primary#plusOne { white-space: normal; line-height: 1.25; }
.btn { border: 0; border-radius: 16px; padding: 15px 18px; font-size: 17px; font-weight: 600; cursor: pointer; transition: transform .12s ease, filter .2s; touch-action: manipulation; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px var(--accent); font-size: 18px; padding: 17px 18px; }
.btn.primary .plus { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-right: 2px; }
.btn.secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { width: 100%; background: transparent; border: 1.5px dashed var(--line); color: var(--accent); margin-top: 12px; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 14px; padding: 6px 4px; cursor: pointer; }
.undo-row { text-align: center; font-size: 13.5px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }

/* ---------- perakim ---------- */
.perakim { list-style: none; margin: 0; padding: 0; }
.perek { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 12px; }
.perek:last-child { border-bottom: 0; }
.perek:active { background: var(--bg); }
.pk-num { font-family: var(--heb); font-size: 17px; color: var(--gold); text-align: center; }
.pk-name { font-family: var(--heb); font-size: 19px; direction: rtl; text-align: left; unicode-bidi: plaintext; }
.pk-range { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); direction: ltr; margin-top: 1px; }
.pk-bar { display: block; height: 4px; border-radius: 4px; background: var(--accent-soft); margin-top: 6px; overflow: hidden; }
.pk-bar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.pk-when { font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.perek.done .pk-name { color: var(--muted); }
.perek.done .pk-when { color: var(--ok); font-weight: 600; }
.perek.current { background: var(--gold-soft); }
.perek.current .pk-when { color: var(--ink2); font-weight: 600; }

/* ---------- pace ---------- */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 12px; }
.field.col { flex-direction: column; align-items: stretch; margin-top: 18px; }
.field-label { font-size: 15px; font-weight: 600; color: var(--ink2); }
.stepper { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.step { width: 46px; height: 44px; border: 0; background: none; font-size: 24px; color: var(--accent); cursor: pointer; }
.step-val { min-width: 54px; text-align: center; font-family: var(--serif); font-size: 24px; font-weight: 600; font-variant-numeric: lining-nums; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 8px 13px; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.day { aspect-ratio: 1 / 1.1; border: 1px solid var(--line); background: var(--bg); border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 0; }
.day .d-en { font-size: 13px; font-weight: 600; }
.day .d-he { font-family: var(--heb); font-size: 13px; color: var(--muted); }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day[aria-pressed="true"] .d-he { color: var(--accent-ink); opacity: .8; }
.toggle { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 12px; padding: 12px 0 2px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg-ui { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; }
.tg-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.toggle input:checked + .tg-ui { background: var(--accent); }
.toggle input:checked + .tg-ui::after { transform: translateX(20px); }
.toggle input:focus-visible + .tg-ui { outline: 3px solid var(--gold); outline-offset: 2px; }
.tg-text { font-size: 15px; font-weight: 600; color: var(--ink2); }
.tg-text small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.tl { position: relative; padding: 2px 0 16px 28px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 22px; bottom: -2px; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold); background: var(--card); }
.tl.now .tl-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tl-he { font-family: var(--heb); font-size: 22px; font-weight: 500; line-height: 1.15; }
.tl-en { font-family: var(--serif); font-size: 16px; color: var(--ink2); margin-left: 6px; }
.tl-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tl-date { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 3px; }
.tl-date .he { font-family: var(--heb); font-weight: 500; color: var(--ink2); }
.tl-season { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.tl-tools { display: flex; gap: 2px; flex-shrink: 0; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 15px; color: var(--ink2); padding: 0; }
.suggest { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }

/* ---------- aims ---------- */
.aims { list-style: none; margin: 0; padding: 0; }
.aim { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.aim:last-child { border-bottom: 0; }
.aim-t { font-weight: 600; font-size: 15px; }
.aim-d { font-size: 12.5px; color: var(--muted); }
.aim-r { text-align: right; font-size: 13px; }
.aim-r b { font-family: var(--serif); font-size: 20px; font-variant-numeric: lining-nums; }
.aim-r .ok { color: var(--ok); font-weight: 600; }
.aim-r .no { color: var(--accent); font-weight: 600; }
.custom-date { margin-top: 12px; }
.custom-date input { font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-height: 42px; }
.aim-custom { font-size: 14px; color: var(--ink2); margin: 4px 0 0; }
.aim-custom:empty { display: none; }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 10px 16px 30px; }
.foot p { margin: 6px 0; }

/* ---------- sheets ---------- */
dialog.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 26px 26px 0 0; background: var(--card); color: var(--ink);
  max-height: 88vh; overflow: hidden; display: none; flex-direction: column; box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  padding-bottom: env(safe-area-inset-bottom); }
dialog.sheet[open] { display: flex; animation: up .28s cubic-bezier(.2,.8,.2,1); }
dialog.sheet.center { margin: auto; border-radius: 26px; max-width: 360px; width: calc(100% - 40px); padding: 26px 22px 22px; text-align: center; }
dialog::backdrop { background: rgba(20,12,6,.45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; }
.sheet-head h2 { font-size: 24px; }
.sheet-sub { margin: 2px 0 0; color: var(--muted); font-family: var(--heb); font-size: 16px; text-align: left; }
.close { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); font-size: 15px; cursor: pointer; flex-shrink: 0; }
.search { margin: 0 20px 8px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-size: 16px; }
.picker-list { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 20px; }
.seder-h { position: sticky; top: 0; background: var(--card); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 700; padding: 12px 8px 6px; display: flex; justify-content: space-between; z-index: 1; }
.seder-h span:last-child { font-family: var(--heb); font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--gold); }
.pick { display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-radius: 12px; padding: 10px 8px; cursor: pointer; gap: 10px; }
.pick:active, .pick:hover { background: var(--bg); }
.pick .p-he { font-family: var(--heb); font-size: 21px; font-weight: 500; }
.pick .p-en { font-family: var(--serif); font-size: 16px; color: var(--ink2); margin-left: 8px; }
.pick .p-len { font-size: 12.5px; color: var(--muted); text-align: right; }
.pick.is-current { background: var(--gold-soft); }
.pick[disabled] { opacity: .4; cursor: default; }

/* ---------- wheel ---------- */
.quick { display: flex; gap: 8px; padding: 0 20px 6px; overflow-x: auto; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick .chip { white-space: nowrap; flex-shrink: 0; }
.wheel { --row: 46px; position: relative; display: grid; grid-template-columns: 1.5fr 1fr; height: calc(var(--row) * 5); margin: 8px 20px 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); perspective: 600px; }
.wheel-band { position: absolute; left: 0; right: 0; top: calc(var(--row) * 2); height: var(--row); border-radius: 12px; background: var(--bg); border: 1px solid var(--line); pointer-events: none; }
.wheel-col { position: relative; height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior: contain; padding: calc(var(--row) * 2) 0; transform-style: preserve-3d; }
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col:focus-visible { outline: none; }
.wheel-col:focus-visible ~ .wheel-band, .wheel:focus-within .wheel-band { border-color: var(--gold); }
.w-item { height: var(--row); scroll-snap-align: center; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--serif); font-size: 25px; font-variant-numeric: lining-nums tabular-nums; color: var(--ink); user-select: none; -webkit-user-select: none; backface-visibility: hidden; will-change: transform, opacity; cursor: pointer; }
.w-item .w-he { font-family: var(--heb); font-size: 20px; color: var(--muted); min-width: 2.4em; text-align: left; }
.w-item.sel .w-he { color: var(--accent); }
.w-item.off { opacity: .25 !important; }
.w-item.siyum-item { font-size: 18px; font-family: var(--sans); font-weight: 700; color: var(--accent); }
.wheel-read { text-align: center; margin: 10px 20px 4px; font-size: 14px; color: var(--ink2); min-height: 20px; }
.wheel-read b { font-family: var(--serif); font-size: 17px; }
.wheel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px 16px; }
.wheel-foot .btn { flex: 1; max-width: 220px; }
.mini-toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.haptic-switch { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; left: -100px; }

.hadran { font-family: var(--heb); font-size: 30px; font-weight: 700; color: var(--accent); margin: 0 0 6px; line-height: 1.3; }
#siyumTitle { font-size: 28px; margin-bottom: 6px; }
#siyumMsg { color: var(--ink2); margin: 0 0 18px; }

.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; background: var(--ink); color: var(--card); padding: 11px 18px; border-radius: 99px; font-size: 14.5px; font-weight: 600; transition: all .3s cubic-bezier(.2,.8,.2,1); pointer-events: none; z-index: 60; max-width: calc(100% - 40px); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 370px) { .m-he { font-size: 46px; } .num { font-size: 40px; } .siyum-date { font-size: 24px; } }
@media (min-width: 700px) { main { padding-top: 10px; } .top { padding-top: 34px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- learn ---------- */
.learn .btn { white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; width: 100%; margin-top: 10px; font-size: 16px; }
.learn .btn:first-of-type { margin-top: 0; }
.bl-he { font-family: var(--heb); font-weight: 500; font-size: 18px; }
.btn.wa { background: #1f7a4d; color: #fff; }
@media (prefers-color-scheme: dark) { .btn.wa { background: #2f8f5f; } }
.ask-chips { margin-top: 10px; justify-content: center; }
.ask-chips .chip { text-decoration: none; color: var(--ink); }
.learn-pos { font-family: var(--serif); font-size: 17px; color: var(--ink2); }
.learn.is-off { display: none; }

/* ---------- add to home screen hint ---------- */
.a2hs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: 44px 1fr 34px; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 14px 40px -12px rgba(40,20,5,.45); z-index: 40; animation: up .4s cubic-bezier(.2,.8,.2,1); }
.a2hs img { border-radius: 11px; }
.a2hs p { margin: 0; font-size: 13.5px; color: var(--ink2); }
.a2hs p > b:first-child { display: block; font-size: 15px; color: var(--ink); margin-bottom: 1px; }
.a2hs .inl { font-weight: 600; }
.share-ico { display: inline-block; border: 1.5px solid currentColor; border-radius: 5px; font-size: 11px; line-height: 1; padding: 1px 3px; transform: translateY(-1px); }
@media (display-mode: standalone) { .a2hs { display: none !important; } .top { padding-top: 10px; } }

.hint:empty { display: none; }

/* ---- v2: tappable position, smaller masechta control, catch-up card ---- */
.masechta-btn { padding: 0 0 8px; }
.masechta-btn .m-he { font-size: 34px; }
.masechta-btn .m-en { font-size: 17px; }
.m-change { font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; margin-left: 4px; background: var(--card); }
.where-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; margin: 4px 0 16px; padding: 14px 12px 12px;
  background: var(--card); border: 1.5px solid var(--gold); border-radius: 18px; cursor: pointer; color: var(--ink);
  box-shadow: 0 6px 18px -10px rgba(120,80,20,.45); -webkit-tap-highlight-color: transparent; transition: transform .12s ease, box-shadow .12s ease; font: inherit; }
.where-btn:active { transform: scale(.98); box-shadow: 0 2px 8px -6px rgba(120,80,20,.5); }
.where-btn .label { transform: none; }
.where-btn .where-main { display: flex; align-items: baseline; gap: 10px; }
.where-btn .pos { font-size: 52px; line-height: 1; }
.where-btn .pos-he { font-size: 24px; }
.pencil { font-family: var(--sans); font-size: 20px; color: var(--accent-ink); background: var(--accent); width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; align-self: center; margin-left: 2px; }
.where-hint { font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: .01em; margin-top: 2px; }
.catchup { position: relative; border: 1.5px solid var(--gold); background: linear-gradient(180deg, var(--gold-soft), var(--card) 75%); padding: 18px 18px 16px; }
.catchup[hidden] { display: none; }
.cu-title { font-family: var(--serif); font-size: 21px; line-height: 1.25; margin: 0 28px 6px 0; color: var(--ink); }
.cu-sub { font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.cu-actions { display: flex; gap: 10px; }
.cu-actions .btn { flex: 1; margin: 0; }
.cu-x { position: absolute; top: 10px; right: 10px; }

/* preview (exploring) state */
.preview-bar { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 8px);
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 999px; background: var(--ink); color: var(--bg);
  box-shadow: 0 8px 24px -10px rgba(0,0,0,.5); font-family: var(--sans); font-size: 13px; font-weight: 600; white-space: nowrap; }
.preview-bar[hidden] { display: none; }
.pv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: pvPulse 1.6s ease-in-out infinite; }
@keyframes pvPulse { 50% { opacity: .35; } }
.pv-txt { opacity: .8; font-weight: 500; }
.preview-bar button { font: inherit; border: 0; border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.pv-back { background: var(--bg); color: var(--ink); }
.pv-keep { background: transparent; color: var(--bg); opacity: .75; padding: 6px 8px !important; }
body.is-preview .hero { outline: 1.5px dashed var(--gold); outline-offset: -6px; }

.amt-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-width: 0; max-width: 100%; opacity: 0; transform: translateY(-4px); transition: opacity .2s ease, transform .2s ease; }
.amt-row.show { opacity: 1; transform: none; }
.amt-row[hidden] { display: none; }
.amt-label { font-size: 13px; font-weight: 600; color: var(--muted); flex: none; }
.amt-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 0; flex: 1 1 0; min-width: 0; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 28px; }
.amt-chips::-webkit-scrollbar { display: none; }
.amt-chips .chip { flex: none; white-space: nowrap; }
.amt-chips .chip.on { background: var(--gold-soft); border-color: var(--gold); font-weight: 600; }
.amt-chips .chip { padding: 7px 11px; font-size: 13.5px; }

/* v3: target line, our nights, days off, share */
.target-line { margin: 12px 0 0; font-size: .93rem; color: var(--ink2); line-height: 1.5; display: flex; flex-direction: column; align-items: center; gap: 2px; border-top: 1px dashed var(--line); padding-top: 10px; }
.target-line .tg-row { display: block; } .target-line .he { color: var(--muted); margin-left: 6px; }
.target-line .tg-lbl { font-family: var(--serif); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .72rem; color: var(--gold); margin-right: 4px; }
.target-line .ok { color: var(--ok); font-weight: 600; } .target-line .no { color: var(--accent); font-weight: 600; }
.target-line .tg-x { margin-left: 6px; font-size: .8rem; color: var(--muted); }
.share-btn { width: 100%; margin-top: 10px; } .share-btn .sh-ico { font-size: 1.1em; margin-right: 4px; }
.amt-chips .chip.alt { border-style: dashed; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 8px 0 14px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wk-bar { display: block; width: 100%; height: 54px; background: var(--bg2); border-radius: 8px; position: relative; overflow: hidden; }
.wk-bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 8px 8px 0 0; min-height: 0; transition: height .3s; }
.wk.off .wk-bar { background: transparent; border: 1px dashed var(--line); }
.wk.today .wk-d { color: var(--accent); font-weight: 700; }
.wk-n { font-size: .78rem; color: var(--ink2); min-height: 1em; font-variant-numeric: tabular-nums; }
.wk-d { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.history li:first-child { border-top: 0; }
.h-when { flex: 0 0 86px; color: var(--muted); } .h-what { color: var(--ink2); } .h-by { color: var(--muted); } .h-empty { color: var(--muted); }
.field.off .field-label small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.off-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.off-row input { flex: 1 1 0; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: .95rem; }
.off-to { color: var(--muted); font-size: .85rem; }
.btn.small { padding: 9px 14px; font-size: .9rem; flex: 0 0 auto; }
.off-list { list-style: none; margin: 8px 0 0; padding: 0; }
.off-list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.off-list li small { color: var(--muted); margin-left: 6px; }
.no-learn { margin: 12px 0 0; font-size: .85rem; color: var(--muted); line-height: 1.9; }
.no-learn .nl-lbl { font-weight: 600; color: var(--ink2); }
.no-learn .nl { display: inline-block; background: var(--bg2); border-radius: 8px; padding: 1px 8px; margin: 0 6px 4px 0; color: var(--ink2); }
.no-learn .nl small { color: var(--muted); }

.sync-line { margin: 8px 0 0; font-size: .82rem; color: var(--muted); text-align: center; }
.sy-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.sy-dot.wait { background: var(--gold); }
#nameSheet .search { margin: 12px 0 14px; width: 100%; box-sizing: border-box; }
#nameSheet .cu-actions { display: flex; gap: 8px; }

.share-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 10px; } .share-row .share-btn { margin-top: 0; width: 100%; } .join-btn { background: none; border: 0; color: var(--muted); font-size: 13.5px; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.sy-code { color: var(--muted); font-size: .78rem; } .sy-code b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; color: var(--ink2); }
.home-tip { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); color: var(--ink2); font-size: .88rem; line-height: 1.45; text-align: left; }
.home-tip p { margin: 0; } .home-tip .ht-code { margin-top: 6px; } .home-tip .ht-code b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#joinSheet .search { margin: 12px 0 6px; width: 100%; box-sizing: border-box; } #joinSheet .cu-actions { display: flex; gap: 8px; margin-top: 10px; } .hint.err { color: var(--accent); min-height: 1.2em; }

/* no horizontal overflow, any phone */
html, body { max-width: 100%; overflow-x: hidden; }
main { min-width: 0; max-width: 100%; }
.card, .card > * { min-width: 0; max-width: 100%; }
.share-row { min-width: 0; } .share-row .btn { white-space: normal; line-height: 1.25; padding-left: 12px; padding-right: 12px; overflow-wrap: anywhere; }
.btn.primary#plusOne { font-size: 17px; }

/* v6: tabs, home/next/settings */
body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.tabpane { display: none; } body[data-tab="home"] .tabpane[data-pane="home"], body[data-tab="next"] .tabpane[data-pane="next"], body[data-tab="settings"] .tabpane[data-pane="settings"] { display: block; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--line); }
.tabbar .tab { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 2px; border-radius: 12px; cursor: pointer; }
.tabbar .tab .tab-ico { font-size: 21px; line-height: 1; filter: grayscale(1) opacity(.7); }
.tabbar .tab[aria-current="page"] { color: var(--accent); } .tabbar .tab[aria-current="page"] .tab-ico { filter: none; }
.glance { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.glance .card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.glance .h2 { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.glance-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .93rem; align-items: baseline; }
.g-k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; } .g-v { color: var(--ink2); min-width: 0; overflow-wrap: anywhere; }
.g-v.ok { color: var(--ok); font-weight: 600; } .g-v.no { color: var(--accent); font-weight: 600; }
.see-all { margin: 4px 0 0; text-align: center; } .see-all .link { font-size: .88rem; }
.sync-pill { margin-top: 8px; }
.masechta-row { width: 100%; display: flex; justify-content: space-between; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.masechta-row .m-he2 { font-family: "Frank Ruhl", var(--serif); font-size: 1.2rem; margin-right: 6px; }
#histSheet .picker-list { padding: 0 20px 20px; } #histSheet .history li { font-size: .95rem; }

/* v7: refresh */
.top { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'brand refresh' 'today today'; align-items: center; column-gap: 10px; row-gap: 2px; }
.top .brand { grid-area: brand; } .top .refresh { grid-area: refresh; } .top .today { grid-area: today; margin: 0; min-width: 0; text-align: left; }
.refresh { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.refresh svg { transition: transform .2s; } .refresh.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ptr { position: fixed; top: 0; left: 0; right: 0; height: 0; display: flex; justify-content: center; pointer-events: none; z-index: 25; --p: 0; }
.ptr-dot { margin-top: 10px; width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--accent); border-top-color: transparent; opacity: 0; transform: translateY(-30px) rotate(0deg); transition: opacity .15s, transform .15s; }
.ptr.on .ptr-dot { opacity: calc(var(--p) * 1); transform: translateY(calc(var(--p) * 44px)) rotate(calc(var(--p) * 300deg)); }
.ptr.ready .ptr-dot { border-top-color: var(--accent); animation: spin .8s linear infinite; }
@media (max-width: 380px) { .top .today { font-size: .78rem; } }

/* keep the A2HS hint and toast above the tab bar */
.a2hs { bottom: calc(84px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(88px + env(safe-area-inset-bottom)); }
body.has-a2hs { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }

/* ---------- ahead of schedule chip ---------- */
.pace-chip { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; margin: 0 auto 10px; padding: 7px 14px 6px; border-radius: 999px; font-size: 13.5px; line-height: 1.25; border: 1px solid var(--line); background: var(--card); color: var(--ink2); }
.pace-chip b { font-weight: 650; }
.pace-chip span { font-size: 11.5px; color: var(--muted); }
.pace-chip.ahead { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--ink); }
.pace-chip.on b { color: var(--ok); }
.pace-chip.behind b { color: var(--ink2); }

/* ---------- above and beyond sheet ---------- */
dialog.ab-sheet { overflow: hidden; flex-direction: column; align-items: center; padding: 30px 24px 22px; max-width: 370px;
  background: radial-gradient(120% 70% at 50% 0%, var(--gold-soft) 0%, var(--card) 62%); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); }
dialog.ab-sheet[open] { animation: abIn .5s cubic-bezier(.2,.9,.25,1.15); }
@keyframes abIn { from { transform: scale(.88) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.ab-glow { position: absolute; left: 50%; top: -70px; width: 260px; height: 200px; transform: translateX(-50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 38%, transparent), transparent); filter: blur(6px); opacity: .0; }
.ab-sheet.play .ab-glow { animation: abGlow 2.4s ease-out forwards; }
@keyframes abGlow { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 35% { opacity: 1; } 100% { opacity: .55; transform: translateX(-50%) scale(1.1); } }
.ab-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ab-confetti i { position: absolute; top: -12px; width: 7px; height: 11px; border-radius: 2px; opacity: 0; background: var(--gold); }
.ab-confetti i[style*="--c:1"] { background: var(--accent); width: 6px; height: 6px; border-radius: 50%; }
.ab-confetti i[style*="--c:2"] { background: color-mix(in srgb, var(--gold) 55%, var(--card)); }
.ab-sheet.play .ab-confetti i { animation: abFall var(--d) cubic-bezier(.25,.6,.45,1) var(--delay) forwards; }
@keyframes abFall { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--x) * 90px), 260px) rotate(var(--r)); } }
.ab-he { position: relative; font-family: var(--heb); font-size: 26px; font-weight: 700; color: var(--accent); margin: 0 0 4px; line-height: 1.3; }
#abTitle { position: relative; font-size: 29px; margin: 0 0 4px; line-height: 1.15; }
.ab-amt { position: relative; margin: 0 0 14px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 650; }
#abMsg { position: relative; font-family: var(--serif); font-size: 19px; line-height: 1.4; color: var(--ink2); margin: 0 0 16px; text-wrap: pretty; }
.ab-ahead { position: relative; display: flex; align-items: baseline; justify-content: center; gap: 8px; margin: 0 0 18px; padding: 10px 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.ab-ahead b { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--accent); line-height: 1; }
.ab-ahead span { font-size: 14px; color: var(--ink2); }
.ab-ahead.hidden-stat { display: none; }
.ab-sheet .btn { position: relative; width: 100%; }
@media (prefers-reduced-motion: reduce) { dialog.ab-sheet[open], .ab-sheet.play .ab-glow, .ab-sheet.play .ab-confetti i { animation: none; } .ab-glow { opacity: .55; } }
