@font-face {
  font-family: 'Yiddishkeit';
  src: url('/assets/yiddishkeit.otf') format('opentype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f5ede1;
  --card: rgba(255, 252, 247, 0.94);
  --card-solid: #fffcf7;
  --line: #e6d8c4;
  --ink: #2a2123;
  --muted: #6e6058;
  --teal: #19706b;
  --teal-dark: #0f4f4b;
  --teal-soft: #e3f1ef;
  --plum: #4f0f40;
  --plum-soft: #f4e6ef;
  --tan: #b48d63;
  --amber-soft: #fbefd9;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(79, 15, 64, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --head: 'Yiddishkeit', 'Heebo', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(245, 237, 225, 0.84), rgba(245, 237, 225, 0.95)),
    url('/assets/home-bg.jpg') center / cover no-repeat;
}
a { color: var(--teal); }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--plum); }
.brand img { width: 46px; height: 46px; }
.brand span { font-family: var(--head); font-size: 22px; line-height: 1; padding-top: 4px; }
.nav { margin-inline-start: auto; display: flex; gap: 4px; align-items: center; }
.nav a, .nav button {
  text-decoration: none;
  color: var(--teal-dark);
  background: none;
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  font-size: 16px;
}
.nav a.on { background: var(--teal-soft); color: var(--teal-dark); }
.nav .out { color: var(--muted); font-size: 14px; }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 64px; }

h1, h2, h3 { font-family: var(--head); font-weight: 700; color: var(--plum); line-height: 1.2; margin: 0; }
h1 { font-size: clamp(28px, 6vw, 40px); }
h2 { font-size: clamp(22px, 4.5vw, 30px); }
h3 { font-size: 20px; }
.lead { color: var(--muted); margin: 6px 0 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-size: 17px;
}
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--teal-dark); }
.btn.ghost:hover { background: var(--teal-soft); }
.btn.plum { background: var(--plum); border-color: var(--plum); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: 15px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ---------- watch page ---------- */
.hero { text-align: center; padding: 28px 20px; }
.hero .logo { width: 150px; margin: 0 auto 6px; }
.live-dot {
  display: inline-flex; align-items: center; gap: 8px;
  color: #b42318; font-weight: 700; font-size: 15px; margin-bottom: 6px;
}
.live-dot::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%; background: #d92d20;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1b1416;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 16px;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.when { font-size: 19px; margin-top: 10px; }
.when small { display: block; color: var(--muted); font-size: 15px; }
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 16px; direction: rtl; }
.countdown div {
  min-width: 70px; padding: 10px 6px; border-radius: 12px; background: var(--card-solid);
  border: 1px solid var(--line);
}
.countdown b { display: block; font-family: var(--head); color: var(--teal-dark); font-size: 30px; line-height: 1.1; }
.countdown span { font-size: 13px; color: var(--muted); }
.hero .btns { justify-content: center; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-head a { white-space: nowrap; font-weight: 600; text-decoration: none; }

/* ---------- lesson cards ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lcard {
  display: flex; flex-direction: column;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lcard:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(79, 15, 64, 0.14); }
.lcard .img { aspect-ratio: 16 / 9; background: #e9dfd2 center / cover no-repeat; position: relative; }
.lcard .num {
  position: absolute; top: 10px; inset-inline-start: 10px;
  background: rgba(255, 252, 247, 0.94); color: var(--plum);
  font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}
.lcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.lcard .t { font-weight: 600; font-size: 17px; line-height: 1.4; }
.lcard .d { color: var(--muted); font-size: 14px; margin-top: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal-dark);
}
.chip.therapy { background: var(--plum-soft); color: var(--plum); }
.chip.topic { background: #efe8de; color: var(--muted); }

/* ---------- archive ---------- */
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 18px; }
.search {
  flex: 1 1 240px;
  min-height: 46px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-solid);
}
.search:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.seg { display: inline-flex; background: var(--card-solid); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--teal); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- lesson page ---------- */
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.lesson-head .meta { color: var(--muted); margin-top: 6px; }
.jump {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--teal-soft), #f3ece2);
  border: 1px solid #c9e2de;
}
.jump h3 { color: var(--teal-dark); }
.jump .btns { margin-top: 10px; }
.jump .btn { justify-content: flex-start; text-align: start; height: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; border-radius: 14px; line-height: 1.35; }
.jump .btn .tm { font-variant-numeric: tabular-nums; opacity: 0.85; font-weight: 500; }

.chapters { list-style: none; margin: 10px 0 0; padding: 0; }
.chapters li { border-top: 1px solid var(--line); }
.chapters li:first-child { border-top: 0; }
.chapters button {
  width: 100%;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 6px;
  background: none; border: 0; cursor: pointer; text-align: start;
  border-radius: 10px;
}
.chapters button:hover { background: rgba(25, 112, 107, 0.06); }
.chapters li.now button { background: var(--teal-soft); }
.chapters .tm {
  flex: none; min-width: 64px; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 600; color: var(--teal-dark);
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 8px; padding: 1px 6px;
  direction: ltr;
}
.chapters .ct { flex: 1; }
.chapters .note { display: block; color: var(--muted); font-size: 14px; }
.chapters li.ex .ct { font-weight: 600; }

.two { display: grid; gap: 18px; margin-top: 18px; }
@media (min-width: 900px) { .two { grid-template-columns: 1.35fr 1fr; align-items: start; } }
.desc { white-space: pre-wrap; margin: 8px 0 0; }
.files { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.files a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-solid); text-decoration: none; font-weight: 500;
}
.files svg { width: 20px; height: 20px; flex: none; color: var(--teal); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 400px; text-align: center; }
.login .logo { width: 170px; margin: 0 auto 4px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.login input {
  min-height: 50px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; text-align: center; font-size: 18px;
}
.err { color: #b42318; min-height: 1.6em; margin: 0; font-size: 15px; }
.ok-msg { color: var(--teal-dark); min-height: 1.6em; margin: 0; font-size: 15px; }

/* ---------- admin ---------- */
.admin main { max-width: 900px; }
.admin .card { margin-top: 18px; }
.field { display: grid; gap: 4px; margin-top: 12px; }
.field label { font-weight: 600; font-size: 15px; }
.field small { color: var(--muted); font-size: 13px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 15px; min-height: 180px; direction: rtl; }
.row { display: grid; gap: 12px; }
@media (min-width: 640px) { .row.c2 { grid-template-columns: 1fr 1fr; } .row.c3 { grid-template-columns: 2fr 1fr 1fr; } }
.meet { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; margin-top: 8px; }
.meet input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; min-width: 0; }
.x { border: 0; background: none; color: #b42318; cursor: pointer; font-size: 22px; padding: 0 6px; }
.alist { list-style: none; padding: 0; margin: 12px 0 0; }
.alist li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.alist .grow { flex: 1; min-width: 0; }
.alist .sub { color: var(--muted); font-size: 13px; }
.status { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.status.pending, .status.waiting { background: var(--amber-soft); color: #8a5300; }
.status.done { background: var(--teal-soft); color: var(--teal-dark); }
.status.error { background: #fde8e7; color: #b42318; }
.status.manual { background: #efe8de; color: var(--muted); }
.frow { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin-top: 8px; }
.frow input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; min-width: 0; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--teal-dark); color: #fff; padding: 10px 20px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 50; font-weight: 600;
}
.toast.bad { background: #b42318; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .brand span { display: none; }
  .nav a, .nav button { padding: 8px 10px; }
  .card { padding: 16px; }
  .countdown div { min-width: 60px; }
  .countdown b { font-size: 24px; }
  .meet, .frow { grid-template-columns: 1fr; }
  .btns .btn { flex: 1 1 100%; }
}

/* small utilities (inline style attributes are blocked by the page CSP) */
.mauto { margin: 40px auto; }
.m0 { margin: 0; }
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.fs14 { font-size: 14px; }
.wfull { width: 100%; }
.btn.danger { margin-inline-start: auto; color: #b42318; border-color: #e3b4b0; }
