@font-face { font-family: "Yiddishkeit"; src: url("/assets/title-font.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Heebo"; src: url("/assets/body-font.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #fbf7f1;
  --card: #ffffff;
  --ink: #23383a;
  --muted: #667a7c;
  --line: #ebe2d5;
  --teal: #0f7a80;
  --teal-d: #0a5c61;
  --teal-l: #e3f2f1;
  --rose: #b0485c;
  --rose-l: #fbecee;
  --gold: #b8913f;
  --done: #2f8a5b;
  --done-l: #e6f4ec;
  --shadow: 0 1px 2px rgba(35, 56, 58, .06), 0 6px 20px rgba(35, 56, 58, .07);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 17px; line-height: 1.65;
}
a { color: var(--teal-d); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, .title-font { font-family: "Yiddishkeit", "Heebo", serif; font-weight: normal; line-height: 1.3; margin: 0; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 10; background: rgba(251, 247, 241, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.top .in { max-width: 720px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.top img { width: 38px; height: 38px; border-radius: 50%; }
.top .name { font-family: "Yiddishkeit", serif; font-size: 20px; color: var(--teal-d); flex: 1; }
.top .back { border: 0; background: var(--teal-l); color: var(--teal-d); border-radius: 999px; padding: 6px 14px; font-size: 15px; cursor: pointer; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-top: 16px; }
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, #0f7a80 0%, #13696e 55%, #0a5459 100%);
}
.hero .birds { position: absolute; left: -24px; bottom: -18px; width: 190px; opacity: .14; filter: brightness(0) invert(1); pointer-events: none; }
.hero h1 { font-size: 30px; }
.hero p { margin: 6px 0 0; opacity: .92; }
.bar { height: 10px; background: rgba(255, 255, 255, .25); border-radius: 999px; overflow: hidden; margin: 14px 0 6px; }
.bar > i { display: block; height: 100%; background: #f3d9a0; border-radius: 999px; transition: width .6s ease; }
.hero .count { font-size: 15px; opacity: .95; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 17px; font-weight: 600;
  background: var(--teal); color: #fff; cursor: pointer; text-decoration: none; min-height: 48px;
}
.btn:hover { background: var(--teal-d); }
.btn.light { background: #fff; color: var(--teal-d); }
.btn.ghost { background: var(--teal-l); color: var(--teal-d); }
.btn.rose { background: var(--rose); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.hero .btn { margin-top: 16px; }
.next-wait { margin-top: 14px; background: rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px 14px; font-size: 16px; }

/* day list */
.days { list-style: none; margin: 0; padding: 0; }
.days li { border-bottom: 1px solid var(--line); }
.days li:last-child { border-bottom: 0; }
.day { display: flex; align-items: center; gap: 12px; padding: 12px 4px; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: right; }
a.day:hover { background: #faf6ef; }
.day .num {
  flex: 0 0 auto; min-width: 64px; text-align: center; font-size: 13px; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; background: var(--teal-l); color: var(--teal-d);
}
.day .t { flex: 1; font-size: 16px; line-height: 1.4; }
.day .st { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.day.done .num { background: var(--done-l); color: var(--done); }
.day.done .st { background: var(--done-l); color: var(--done); }
.day.open .st { background: var(--rose-l); color: var(--rose); }
.day.locked, .day.waiting { color: #a7b3b4; }
.day.locked .num, .day.waiting .num { background: #f2efe9; color: #a7b3b4; }
.day.locked .st, .day.waiting .st { color: #b9c2c3; }
.day.open .t { font-weight: 600; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.section-title h2 { font-size: 24px; color: var(--teal-d); }

.later { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-lock { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: #f2efe9; color: #a7b3b4; }
.lesson-head .jump { margin-top: 12px; min-height: 40px; padding: 8px 16px; font-size: 15px; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.tools .btn { flex: 1 1 200px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }

/* lesson */
.lesson-head .chip { display: inline-block; background: var(--rose-l); color: var(--rose); font-weight: 700; font-size: 14px; border-radius: 999px; padding: 3px 12px; }
.lesson-head h1 { font-size: 30px; color: var(--teal-d); margin-top: 10px; }
.imgs { display: grid; gap: 12px; margin-top: 16px; }
.imgs img { width: 100%; height: auto; border-radius: 14px; display: block; box-shadow: var(--shadow); cursor: zoom-in; background: #f3ede3; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 18px; line-height: 1.8; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 21px; color: var(--teal-d); margin: 0 0 10px; }
.audio-item { padding: 12px 0; border-top: 1px solid var(--line); }
.audio-item:first-of-type { border-top: 0; padding-top: 0; }
.audio-item .at { font-weight: 600; margin-bottom: 8px; line-height: 1.45; }
audio { width: 100%; height: 44px; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; margin-top: 8px; }
.video button { all: unset; cursor: pointer; position: absolute; inset: 0; display: grid; place-items: center; }
.video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.video .play { position: relative; width: 68px; height: 68px; border-radius: 50%; background: rgba(176, 72, 92, .92); display: grid; place-items: center; color: #fff; font-size: 26px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vt { font-weight: 600; margin-top: 12px; }
details.reading { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
details.reading:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
details.reading summary { cursor: pointer; font-weight: 700; color: var(--teal-d); font-size: 18px; }
.file-item { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.file-item:first-of-type { border-top: 0; padding-top: 0; }
.file-item .at { font-weight: 600; line-height: 1.45; }
.file-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.file-btns .btn { flex: 1 1 200px; }

.notes textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fffdf9; resize: vertical; line-height: 1.6; }
.notes textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
.note { background: #fbf6ee; border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.note .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.note .meta button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.note .tx { white-space: pre-wrap; overflow-wrap: anywhere; }

.done-box { text-align: center; }
.done-box h3 { font-size: 24px; color: var(--teal-d); margin-bottom: 6px; }
.done-box.ok { background: var(--done-l); }
.done-box.ok h3 { color: var(--done); }
.navrow { display: flex; gap: 10px; margin-top: 16px; }
.navrow .btn { flex: 1; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(20, 36, 38, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .box { background: #fff; border-radius: var(--radius); padding: 22px; max-width: 460px; width: 100%; max-height: 90vh; overflow: auto; }
.modal h3 { font-size: 24px; color: var(--teal-d); margin-bottom: 8px; }
.modal ol { padding-inline-start: 20px; margin: 6px 0 14px; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 60; display: grid; place-items: center; padding: 10px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 70; font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.linkbox { direction: ltr; text-align: left; background: #f5f1ea; border-radius: 10px; padding: 8px 10px; font-size: 13px; overflow-wrap: anywhere; user-select: all; }

/* forms (join / admin) */
.field { display: block; margin-top: 12px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fffdf9; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
.err { color: var(--rose); margin-top: 10px; min-height: 1.4em; }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.center-page .card { max-width: 440px; width: 100%; text-align: center; }
.center-page .logo { width: 110px; height: 110px; border-radius: 50%; }
.center-page form { text-align: right; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero h1, .lesson-head h1 { font-size: 26px; }
  .card { padding: 16px; }
  .body-text { font-size: 17px; }
}
