:root{
  /* פלטת "עיתון" במבנה של אפליקציה: נייר חם, דיו, וחלודה כצבע הדגשה */
  --paper:#efe9df; --surface:#fbf9f5; --surface-2:#f3eee6;
  --ink:#1a1714; --muted:#6b6157; --rule:#d9d0c2; --rule-2:#b3a693;
  --accent:#a8431f; --accent-soft:#f3e3d8; --on-accent:#fbf9f5;
  --bar:#a8431f; --bar-ink:#fdfaf5;
  --shade:rgba(26,23,20,.16); --lift:0 6px 18px rgba(26,23,20,.10);
  --tabs-h:64px;
  /* תשובה נכונה ושגויה בבוחן. לא רק צבע: לצדו תמיד מילה */
  --ok:#2e6b3c; --ok-soft:#e2eee3; --no:#a12a2a; --no-soft:#f6e0dd;
  /* גופני מערכת בלבד. שום דבר לא נטען משרת חיצוני, ולכן אין בקשה
     לגוגל פונטס ואין דליפה של כתובת ה-IP של הקורא. */
  --sans:"Assistant","Heebo",-apple-system,"Segoe UI",system-ui,sans-serif;
  --serif:"Frank Ruhl Libre","Frank Ruehl CLM",Georgia,"Times New Roman",serif;
  --mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
@media (prefers-color-scheme:dark){:root{
  --paper:#14110e; --surface:#1d1915; --surface-2:#26211b;
  --ink:#efe9df; --muted:#a99d8f; --rule:#352e26; --rule-2:#54483b;
  --accent:#e8956a; --accent-soft:#3b2519; --on-accent:#1d1915;
  --bar:#5a2a16; --bar-ink:#f6efe6;
  --shade:rgba(0,0,0,.55); --lift:0 6px 18px rgba(0,0,0,.4);
  --ok:#8fcf9d; --ok-soft:#1f3324; --no:#f19a8f; --no-soft:#3d211d;
}}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--surface);color:var(--ink);font:16px/1.7 var(--sans)}
body.home,body.list{background:var(--paper)}
a{color:var(--accent)}
.skip{position:absolute;right:-9999px;top:8px;background:var(--surface);
  color:var(--ink);padding:8px 14px;border:1px solid var(--accent);z-index:40}
.skip:focus{right:8px}

/* ---- הסרגל העליון: פס צבע עם שם האתר. בדף הבית הכותרת יושבת בתוכו */
.bar{background:var(--bar);color:var(--bar-ink)}
.bar .inner{max-width:74rem;margin:0 auto;padding:0 20px;
  display:flex;align-items:center;gap:12px;min-height:56px;
  padding-top:env(safe-area-inset-top)}
.bar .home{font-weight:800;font-size:1.05rem;text-decoration:none;
  color:var(--bar-ink);white-space:nowrap;display:inline-flex;align-items:center;
  min-height:44px;margin-inline-end:auto}
/* בדף הבית השם כבר מופיע ככותרת גדולה בתוך הסרגל */
body.home .bar .home{display:none}
@media (max-width:980px){body.home .bar .inner{min-height:14px}}
.hero{max-width:74rem;margin:0 auto;padding:2px 20px 34px}
.hero p{margin:0;font-size:.88rem;opacity:.85}
.hero h1{margin:2px 0 0;font-size:clamp(1.9rem,8vw,2.6rem);font-weight:800;
  line-height:1.1;color:var(--bar-ink)}

/* ---- טאבים: בטלפון קבועים בתחתית, במסך רחב בתוך הסרגל העליון */
.tabs{display:flex;gap:4px}
.tabs a{display:inline-flex;align-items:center;gap:7px;min-height:44px;
  padding:0 12px;color:var(--bar-ink);opacity:.8;text-decoration:none;
  font-size:.95rem;white-space:nowrap}
.tabs a.on{opacity:1;font-weight:700;box-shadow:inset 0 -2px 0 var(--bar-ink)}
.tabs svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;
  stroke-linejoin:round;stroke-linecap:round;flex:none}
@media (max-width:980px){
  body{padding-bottom:calc(var(--tabs-h) + env(safe-area-inset-bottom))}
  .tabs{position:fixed;inset-inline:0;bottom:0;z-index:30;gap:0;
    display:grid;grid-auto-flow:column;grid-auto-columns:1fr;
    background:var(--surface);border-top:1px solid var(--rule);
    padding-bottom:env(safe-area-inset-bottom)}
  .tabs a{flex-direction:column;justify-content:center;gap:3px;
    min-height:var(--tabs-h);padding:0;color:var(--muted);opacity:1;
    font-size:.74rem;box-shadow:none}
  .tabs a.on{color:var(--accent);box-shadow:none}
  .tabs svg{width:24px;height:24px}
}

/* ---- פריסה */
main{max-width:74rem;margin:0 auto;padding:0 20px}
.page{display:grid;grid-template-columns:minmax(0,1fr) 15rem;gap:40px;
  padding-block:32px 56px;align-items:start}
body.home .page{padding-top:0}
@media (max-width:980px){.page{grid-template-columns:1fr;gap:24px}}
article{min-width:0;max-width:46rem}

.crumb{font-size:.88rem;font-weight:700;color:var(--accent);margin:0 0 6px}
.from{font-size:.92rem;color:var(--muted);margin:14px 0 0}
h1{font-weight:800;line-height:1.15;font-size:clamp(1.8rem,6vw,2.3rem);
  margin:0 0 10px;text-wrap:balance}
p.sub{color:var(--muted);margin:0 0 4px;font-size:1.02rem}
article h2{font-size:1.32rem;font-weight:800;line-height:1.3;
  margin:44px 0 6px;padding-bottom:7px;border-bottom:1px solid var(--rule-2);
  text-wrap:balance;scroll-margin-top:16px}
article h3{font-size:1.06rem;font-weight:800;margin:28px 0 4px;scroll-margin-top:16px}
body.home article h2,body.list article h2{font-size:.85rem;color:var(--muted);
  border:0;padding:0;margin:28px 0 10px}
article p,article li{max-width:66ch}
article ul,article ol{padding-inline-start:1.3em}
article li{margin-bottom:6px}
blockquote{margin:20px 0;padding:14px 16px;background:var(--surface-2);
  border-inline-start:3px solid var(--accent)}
blockquote p{margin:0}

/* ---- קוד */
code{font-family:var(--mono);font-size:.87em;background:var(--surface-2);
  padding:1px 5px;border-radius:2px}
pre{border:1px solid var(--rule);padding:14px 16px;overflow-x:auto;line-height:1.5;
  /* צל בקצה שיש מעבר לו עוד קוד. הכיסויים נגללים עם התוכן ומסתירים את
     הצל כשמגיעים לקצה, כך שהוא מופיע רק כשבאמת יש עוד */
  background:
    linear-gradient(to right,var(--surface-2) 30%,transparent) left/32px 100% no-repeat local,
    linear-gradient(to left,var(--surface-2) 30%,transparent) right/32px 100% no-repeat local,
    linear-gradient(to right,var(--shade),transparent) left/12px 100% no-repeat scroll,
    linear-gradient(to left,var(--shade),transparent) right/12px 100% no-repeat scroll,
    var(--surface-2)}
pre code{background:none;padding:0}
/* בטלפון הקוד נפרש מקצה לקצה: עוד 40 פיקסלים, כחמישה תווים בכל שורה */
@media (max-width:600px){pre{padding:12px 14px;margin-inline:-20px;
  border-inline:0}pre code{font-size:.8em}}
/* קוד נקרא משמאל לימין גם בעמוד בעברית. בלוק בלי שפה (התרשים בחומרי העזר) נשאר כמו שהוא */
code{direction:ltr;unicode-bidi:isolate}
pre:has(> code[class]){direction:ltr;text-align:left}
.rng{direction:ltr;unicode-bidi:isolate;white-space:nowrap}

/* ---- טבלאות */
.wide{overflow-x:auto;margin:18px 0}
table{border-collapse:collapse;width:100%;background:var(--surface);
  border:1px solid var(--rule);font-size:.94rem}
th,td{padding:9px 12px;text-align:right;border-bottom:1px solid var(--rule);
  vertical-align:top}
thead th{background:var(--surface-2);font-size:.85rem;color:var(--muted)}
tbody tr:last-child td{border-bottom:0}

/* ---- תוכן העניינים ומפת השיעור: מקופלים */
aside{position:sticky;top:16px;max-height:calc(100vh - 32px);overflow-y:auto}
.toc{border-inline-start:2px solid var(--rule-2);padding-inline-start:14px}
.toc summary,.map summary{font-size:.95rem;font-weight:700;color:var(--ink);
  margin:0 0 10px;cursor:pointer;list-style:none;min-height:44px;
  display:flex;align-items:center;justify-content:space-between;gap:12px}
.toc summary::-webkit-details-marker,.map summary::-webkit-details-marker{display:none}
.toc summary::after,.map summary::after{content:"▾";color:var(--accent);
  font-family:var(--sans);font-size:1rem;font-weight:400}
.toc[open] summary::after,.map[open] summary::after{content:"▴"}
.toc a{display:block;font-size:.88rem;color:var(--muted);text-decoration:none;
  padding:3px 0;line-height:1.4}
.toc a.sub{padding-inline-start:12px;font-size:.83rem}
.toc a:hover{color:var(--ink)}
.toc-m{display:none}
@media (max-width:980px){
  aside{display:none}
  .toc-m{display:block;margin:20px 0 0;border:1px solid var(--rule);
    padding:0 14px;background:var(--paper)}
  .toc-m summary{margin:0}
  .toc-m[open]{padding-bottom:8px}
  .toc-m a{min-height:44px;display:flex;align-items:center;padding:6px 0;
    border-top:1px solid var(--rule)}
}
.map{margin:22px 0;border:1px solid var(--rule);padding:0 14px;background:var(--paper)}
.map summary{margin:0;font-size:1.05rem;font-weight:800}
.map summary span{font-size:.85rem;font-weight:400;color:var(--muted);
  margin-inline-start:auto}
.map .wide{margin:0 -14px}
.map table{border:0;border-top:1px solid var(--rule)}

/* ---- אריחים: שיעור עם מספר, נושא ועמוד בלי */
.rows{display:grid;gap:8px;margin:8px 0;padding:0;list-style:none;max-width:none}
article .rows li{margin:0;max-width:none}
.rows a{display:flex;align-items:center;gap:12px;min-height:64px;
  padding:10px 12px;background:var(--surface);border:1px solid var(--rule);
  text-decoration:none;color:var(--ink)}
.rows a:hover{border-color:var(--accent)}
.rows .n{flex:none;width:48px;height:48px;display:grid;place-items:center;
  background:var(--accent-soft);color:var(--accent);font-style:normal;
  font-size:1.4rem;font-weight:800;font-variant-numeric:tabular-nums}
.rows .n.new{background:var(--accent);color:var(--on-accent)}
.rows b{display:block;font-weight:700;font-size:1rem;line-height:1.35}
.rows span{display:block;color:var(--muted);font-size:.84rem;margin-top:2px;
  font-variant-numeric:tabular-nums}

/* ---- תגיות הנושאים בדף הבית */
.tags{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0;padding:0;list-style:none;
  max-width:none}
article .tags li{margin:0}
.tags a{display:inline-flex;align-items:center;min-height:44px;padding:0 14px;
  background:var(--surface);border:1px solid var(--rule);color:var(--ink);
  text-decoration:none;font-size:.92rem;font-weight:600}
.tags a:hover{border-color:var(--accent)}

/* ---- להמשיך מאיפה שהפסקת: כרטיס שעולה על הסרגל */
.resume{margin:-18px 0 0;max-width:none;position:relative}
.resume a{display:flex;align-items:center;gap:12px;padding:14px 16px;
  background:var(--surface);border:1px solid var(--rule);box-shadow:var(--lift);
  text-decoration:none;color:var(--ink)}
.resume a>span{flex:1}
.resume small{display:block;font-size:.8rem;font-weight:700;color:var(--accent)}
.resume b{display:block;font-size:1.06rem;line-height:1.35}
.resume i{flex:none;width:44px;height:44px;display:grid;place-items:center;
  background:var(--accent);color:var(--on-accent);font-style:normal;font-size:1.2rem}

/* ---- הקודם והבא */
.pager{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:48px 0 0}
.pager a{display:block;text-decoration:none;color:var(--ink);padding:12px 14px;
  border:1px solid var(--rule);background:var(--paper);min-height:44px}
.pager a:hover{border-color:var(--accent)}
.pager .next{text-align:left}
.pager small{display:block;font-size:.82rem;font-weight:700;color:var(--accent)}
.pager b{display:block;font-weight:700;font-size:.95rem;line-height:1.4}

/* ---- תרגול: התיבה בסוף שיעור או נושא */
.drill{margin:48px 0 0;padding:14px 16px 16px;background:var(--paper);
  border:1px solid var(--rule)}
article .drill h2{margin:0 0 10px;padding:0;border:0;font-size:1.05rem}
.drill-go{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.drill-go a{display:block;min-height:44px;padding:10px 14px;background:var(--surface);
  border:1px solid var(--rule-2);text-decoration:none;color:var(--ink)}
.drill-go a:hover{border-color:var(--accent)}
.drill-go b{display:block;color:var(--accent);font-size:1rem}
.drill-go span{display:block;color:var(--muted);font-size:.84rem}
.drill + .pager{margin-top:16px}

/* ---- תרגול: כרטיסיות ובוחן */
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);
  white-space:nowrap}
.pr-pick{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px;margin:20px 0 4px}
.pr-pick label{display:block;font-size:.85rem;font-weight:700;color:var(--muted);
  margin-bottom:4px}
.pr-pick select{font:inherit;font-size:.95rem;min-height:44px;max-width:100%;
  padding:0 10px;color:var(--ink);background:var(--surface);
  border:1px solid var(--rule-2);border-radius:0}
.seg{display:inline-flex;border:1px solid var(--rule-2)}
article .seg button{border:0;color:var(--muted)}
article .seg button[aria-pressed="true"]{background:var(--accent);
  color:var(--on-accent);font-weight:700}
.pr-count{font-size:.85rem;color:var(--muted);margin:24px 0 8px;
  font-variant-numeric:tabular-nums}
article .pr-card{display:flex;flex-direction:column;justify-content:center;gap:14px;
  width:100%;min-height:15rem;padding:28px 22px;font:inherit;color:var(--ink);
  background:var(--paper);border:1px solid var(--rule-2);text-align:center}
article .pr-card.back{background:var(--surface);border-color:var(--accent)}
.pr-face{display:block;font-size:1.25rem;font-weight:700;line-height:1.55;
  text-wrap:balance}
.pr-card.back .pr-face{font-size:1.1rem;font-weight:400}
.pr-face strong{font-weight:800}
.pr-ask{display:block;font-size:.9rem;color:var(--muted);line-height:1.5}
.pr-hint{font-size:.82rem;color:var(--muted);text-align:center;margin:8px auto 0}
.pr-act{display:flex;flex-wrap:wrap;gap:10px;margin:16px 0 0}
article .pr-act button{flex:1 1 9rem}
article button.pri{background:var(--accent);border-color:var(--accent);
  color:var(--on-accent);font-weight:700}
article button.pri:hover{border-color:var(--ink)}
.pr-src{font-size:.85rem;margin:14px 0 0}
article h2.pr-q,article h2.pr-done{font-size:1.2rem;margin:0 0 14px;padding:0;
  border:0;line-height:1.5}
article h2.pr-done{font-size:1.5rem;margin-top:24px}
.pr-opts{list-style:none;padding:0;margin:0;display:grid;gap:8px;max-width:none}
article .pr-opts li{margin:0;max-width:none}
article .pr-opts button{display:flex;align-items:center;gap:12px;width:100%;
  min-height:52px;padding:8px 12px;text-align:right;font-size:1rem;
  line-height:1.45;color:var(--ink)}
article .pr-opts button:disabled{cursor:default;color:var(--ink)}
article .pr-opts button:disabled:hover{border-color:var(--rule-2)}
.pr-opts i{flex:none;width:30px;height:30px;display:grid;place-items:center;
  font-style:normal;font-weight:700;background:var(--surface-2);color:var(--muted)}
.pr-opts span{flex:1}
.pr-opts em{flex:none;font-style:normal;font-size:.8rem;font-weight:700}
article .pr-opts button.ok{background:var(--ok-soft);border-color:var(--ok)}
article .pr-opts button.no{background:var(--no-soft);border-color:var(--no)}
.pr-opts .ok i{background:var(--ok);color:var(--on-accent)}
.pr-opts .no i{background:var(--no);color:var(--on-accent)}
.pr-opts .ok em{color:var(--ok)}
.pr-opts .no em{color:var(--no)}
.pr-fb{margin:16px 0 0;padding:14px 16px;background:var(--surface-2);
  border-inline-start:3px solid var(--rule-2)}
.pr-fb p{margin:0 0 6px}
.pr-verdict{font-weight:800}
.pr-verdict.ok{color:var(--ok)}
.pr-verdict.no{color:var(--no)}
.pr-missed li{margin-bottom:8px}
.pr-empty{margin-top:24px;color:var(--muted)}

/* ---- תחתית */
footer{border-top:1px solid var(--rule);margin-top:20px}
footer .inner{max-width:74rem;margin:0 auto;padding:18px 20px 28px;
  display:flex;flex-direction:column;align-items:flex-start;gap:6px;
  color:var(--muted);font-size:.85rem}
footer .legal{display:flex;column-gap:18px;flex-wrap:wrap}
footer .legal a{color:var(--muted);display:inline-flex;align-items:center;
  min-height:44px}
footer span{line-height:1.6;margin:6px 0}
footer button,article button{font:inherit;font-size:.9rem;color:var(--accent);
  background:var(--surface);border:1px solid var(--rule-2);
  padding:0 16px;min-height:44px;cursor:pointer}
footer button:hover,article button:hover{border-color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.bar :focus-visible{outline-color:var(--bar-ink)}

/* החוברת: כל התוכן בעמוד אחד, כל פרק מתחיל בעמוד חדש בהדפסה */
.chapter{border-top:2px solid var(--rule-2);margin-top:56px;padding-top:28px}
.chapter:first-of-type{border-top:0;margin-top:0;padding-top:0}
.chapter > h2:first-child{font-size:1.7rem;border-bottom:0;margin-top:0}

@media print{
  .bar,aside,footer button,footer .legal,.toc,.skip,.pager,.resume,.tabs,
  .drill,.pr{display:none}
  body{background:#fff;color:#000;font-size:10.5pt;line-height:1.5;padding:0}
  .map{border:0;padding:0;background:none}.map summary::after{content:""}
  .page{display:block;padding:0}
  article{max-width:none}
  article h2,article h3{page-break-after:avoid}
  table,blockquote,.wide{page-break-inside:avoid}
  .chapter{page-break-before:always;border-top:0}
  .chapter:first-of-type{page-break-before:avoid}
  a{color:#000;text-decoration:none}
  thead th{background:#eee}
  @page{margin:18mm}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;
  transition:none!important}}
