/* בית המדרש הדיגיטלי — עיצוב מותאם למסכי דיו אלקטרוני: שחור על לבן, בלי אנימציות, כפתורים גדולים */
@font-face { font-family: 'David Libre'; font-weight: 400; font-display: swap; src: url('../fonts/DavidLibre-400-hebrew.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'David Libre'; font-weight: 400; font-display: swap; src: url('../fonts/DavidLibre-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'David Libre'; font-weight: 700; font-display: swap; src: url('../fonts/DavidLibre-700-hebrew.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'David Libre'; font-weight: 700; font-display: swap; src: url('../fonts/DavidLibre-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 400 700; font-display: swap; src: url('../fonts/FrankRuhlLibre-400-hebrew.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Frank Ruhl Libre'; font-weight: 400 700; font-display: swap; src: url('../fonts/FrankRuhlLibre-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Heebo'; font-weight: 400 700; font-display: swap; src: url('../fonts/Heebo-400-hebrew.woff2') format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 400 700; font-display: swap; src: url('../fonts/Heebo-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --face: 'David Libre', 'Frank Ruhl Libre', 'Times New Roman', serif;
  --ui-face: 'Heebo', 'Arial', sans-serif;
  --read-size: 26px;
  --ui-size: 20px;
  --line: 1.55;
  --ink: #000;
  --paper: #fff;
  --gray: #666;
  --light: #eee;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--ui-face); font-size: var(--ui-size); line-height: 1.4;
  direction: rtl; text-align: right;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
h1, h2, h3 { font-family: var(--face); margin: 0.4em 0; line-height: 1.25; }
h1 { font-size: 34px; } h2 { font-size: 28px; } h3 { font-size: 24px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); font-size: 22px;
}
textarea { min-height: 200px; line-height: 1.5; font-family: var(--face); }
label { display: block; margin: 12px 0 6px; font-weight: 700; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.grow { flex: 1 1 auto; }
.muted { color: var(--gray); }
.small { font-size: 17px; }
.center { text-align: center; }
.hidden { display: none !important; }
hr { border: 0; border-top: 2px solid var(--ink); margin: 20px 0; }

/* כפתורים */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; min-width: 56px; padding: 8px 20px; margin: 0;
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink);
  font-size: 22px; font-weight: 700; cursor: pointer; text-decoration: none; user-select: none; white-space: nowrap;
}
.btn:active, .btn.on { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:active { background: var(--paper); color: var(--ink); }
.btn.big { min-height: 84px; font-size: 26px; padding: 12px 24px; }
.btn.sm { min-height: 44px; min-width: 44px; font-size: 18px; padding: 4px 12px; border-radius: 8px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .35; cursor: default; }
.btn .ico { font-size: 1.2em; line-height: 1; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.btns.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* כותרת עליונה */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 3px solid var(--ink);
  background: var(--paper); position: sticky; top: 0; z-index: 20;
}
.topbar .title { flex: 1 1 auto; font-family: var(--face); font-size: 26px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: 18px; font-weight: 400; color: var(--gray); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.wrap.narrow { max-width: 760px; }

/* כרטיסים ורשימות */
.card { border: 2px solid var(--ink); border-radius: 12px; padding: 16px; margin: 14px 0; background: var(--paper); }
.card h2, .card h3 { margin-top: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 2px solid var(--light); }
.list li:last-child { border-bottom: 0; }
.list a, .list .item { display: flex; align-items: center; gap: 12px; padding: 14px 6px; min-height: 64px; text-decoration: none; }
.list .name { flex: 1 1 auto; font-family: var(--face); font-size: 26px; }
.list .meta { color: var(--gray); font-size: 17px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 2px solid var(--ink); border-radius: 999px; padding: 6px 16px; min-height: 44px; display: inline-flex; align-items: center; cursor: pointer; font-size: 18px; background: var(--paper); }
.chip.on { background: var(--ink); color: var(--paper); }
.badge { display: inline-block; border: 2px solid var(--ink); border-radius: 8px; padding: 2px 10px; font-size: 17px; }
.badge.fill { background: var(--ink); color: var(--paper); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 19px; }
table.tbl th, table.tbl td { border: 1px solid var(--ink); padding: 8px 10px; text-align: right; vertical-align: top; }
table.tbl th { background: var(--light); }
.progress { height: 18px; border: 2px solid var(--ink); border-radius: 9px; overflow: hidden; background: var(--paper); }
.progress > div { height: 100%; background: var(--ink); }

/* טקסט הלימוד */
.reader { font-family: var(--face); font-size: var(--read-size); line-height: var(--line); padding: 8px 4px 40vh; }
.reader .sec-title { font-size: 1.15em; font-weight: 700; margin: 0.8em 0 0.4em; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.reader .group-title { font-size: 0.8em; color: var(--gray); margin-top: 1em; }
.reader .seg { margin: 0 0 0.75em; }
.reader .seg .lbl { font-weight: 700; margin-left: 0.5em; }
.reader .seg.hl { background: var(--light); outline: 3px solid var(--ink); outline-offset: 4px; }
.reader p { margin: 0 0 0.5em; }
.reader .poetry { padding-right: 1.5em; }
.reader big { font-size: 1.2em; }
.reader .mam-spi-pe, .reader .mam-spi-samekh { display: inline-block; margin: 0 1em; }
.reader .footnote-marker { font-size: 0.7em; vertical-align: super; }
.reader .footnote { font-size: 0.8em; color: var(--gray); }
.reader .gemarra-italic, .reader .it-text { font-style: italic; }
.reader .rashi { font-family: var(--face); }
.reader table { border-collapse: collapse; } .reader td { border: 1px solid var(--ink); padding: 4px 8px; }
mark, .reader mark { background: var(--ink); color: var(--paper); padding: 0 3px; }

/* אזורי הקשה לדפדוף (שמאל = הבא, ימין = הקודם) */
.tapzone { position: fixed; top: 80px; bottom: 90px; width: 18%; z-index: 5; }
.tapzone.next { left: 0; } .tapzone.prev { right: 0; }

/* סרגל תחתון */
.bottombar {
  position: fixed; bottom: 0; right: 0; left: 0; display: flex; gap: 10px; padding: 10px 14px;
  border-top: 3px solid var(--ink); background: var(--paper); z-index: 20;
}
.bottombar .btn { flex: 1 1 auto; }
body.has-bottom { padding-bottom: 90px; }

/* חלונית */
.panel { position: fixed; inset: 0; background: var(--paper); z-index: 40; overflow: auto; padding: 16px; }
.panel .panel-head { display: flex; align-items: center; gap: 10px; border-bottom: 3px solid var(--ink); padding-bottom: 10px; margin-bottom: 12px; }
.panel .panel-head h2 { flex: 1 1 auto; margin: 0; }

/* הודעות */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 24px; border-radius: 10px; font-size: 20px; z-index: 60; max-width: 90vw; }
.banner { border: 3px solid var(--ink); border-radius: 12px; padding: 14px 18px; margin: 12px 0; font-size: 24px; font-family: var(--face); }
.banner.fill { background: var(--ink); color: var(--paper); }
.status-dot { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 50%; vertical-align: middle; }
.status-dot.on { background: var(--ink); }

/* לוח שנה */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-weight: 700; padding: 6px 0; border-bottom: 2px solid var(--ink); }
.cal .day { border: 1px solid var(--ink); border-radius: 8px; min-height: 96px; padding: 6px; font-size: 16px; cursor: pointer; }
.cal .day.empty { border-color: var(--light); cursor: default; }
.cal .day .d { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; }
.cal .day .h { color: var(--gray); font-size: 14px; }
.cal .day .l { font-family: var(--face); font-size: 17px; margin-top: 4px; line-height: 1.25; }
.cal .day.done { background: var(--light); }
.cal .day.done .l::before { content: '✓ '; }
.cal .day.today { outline: 3px solid var(--ink); }
.cal .day.skip { background: repeating-linear-gradient(45deg, #fff, #fff 6px, #eee 6px, #eee 12px); }

.qr { width: 260px; height: 260px; border: 3px solid var(--ink); border-radius: 12px; padding: 8px; background: #fff; }
.pinbox { max-width: 420px; margin: 40px auto; }
.pinbox input { font-size: 34px; text-align: center; letter-spacing: 8px; }

@media (max-width: 640px) {
  :root { --ui-size: 18px; }
  .wrap { padding: 10px; }
  .btn { font-size: 20px; padding: 8px 14px; }
  .topbar .title { font-size: 22px; }
  .tapzone { width: 22%; }
}
@media print {
  .topbar, .bottombar, .tapzone, .btn, .btns, .noprint { display: none !important; }
  body { padding: 0; }
  .reader { padding: 0; }
}
