/* ──────────────────────────────────────────────────────────────────────────
   practice.css - אזור התרגול. נטען אחרי style.css ומשתמש באותה פלטה.
   ────────────────────────────────────────────────────────────────────────── */

/* ── רשימת התרגול ──────────────────────────────────────────────────────── */

.practice-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 34px;
  color: var(--text-muted);
  font-size: .92rem;
}

.pbar {
  flex: 1;
  max-width: 320px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent-soft);
  overflow: hidden;
}

.pbar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .5s ease;
}

/* מד ההתקדמות. שתי מידות זו לצד זו: שאלות שהושלמו וסעיפים שנפתרו.
   סעיף הוא ההתקדמות היומיומית, שאלה שלמה היא ההישג. */
.pmeter {
  flex: 1;
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pmeter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pmeter-head h2 { font-size: 1.05rem; margin: 0; }

.pmeter-pct {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-hover);
}

.pmeter .pbar { max-width: none; }

.pmeter-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 12px;
  font-size: .92rem;
  color: var(--text-muted);
}

.pmeter-nums b { color: var(--text-heading); font-size: 1rem; }

.pmeter-note {
  margin: 8px 0 0;
  font-size: .8rem;
  color: var(--text-muted);
}

.punit { margin-bottom: 44px; scroll-margin-top: 84px; }

.punit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.punit-count {
  flex: none;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 3px 11px;
}

.punit-count.is-done { background: var(--success-soft); color: var(--success); }

.punit h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.punit-blurb {
  color: var(--text-muted);
  margin: 0 0 18px;
  font-size: .95rem;
  max-width: 62ch;
}

.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.pcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.pcard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--border-strong);
}

.pcard.done { border-inline-start: 4px solid var(--success); }
.pcard.partial { border-inline-start: 4px solid var(--accent); }

.pcard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pcard-star { color: var(--accent); }

.pcard h3 { font-size: 1.06rem; }

.pcard-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: .86rem;
}

.pcard-go {
  margin-top: 8px;
  color: var(--accent-hover);
  font-size: .9rem;
  font-weight: 600;
}

.pcard-level {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--text-heading);
}

/* חמש דרגות, בעוצמה עולה - וכל אחת בדיו אחרת, כדי שהסולם ייקרא בסריקה
   מהירה ולא ידרוש לקרוא את המילה. 'מאתגר' הוא היחיד עם רקע מלא: הוא לא
   עוד שלב בסולם אלא הקצה שלו. */
.pcard-level { background: var(--lv1); color: var(--lv1-ink); }
.pcard-level.lv2 { background: var(--lv2); color: var(--lv2-ink); }
.pcard-level.lv3 { background: var(--lv3); color: var(--lv3-ink); }
.pcard-level.lv4 { background: var(--lv4); color: var(--lv4-ink); }
.pcard-level.lv5 { background: var(--iris); color: #fff; }

.offline-note {
  margin: 48px 0 12px;
  padding: 22px 24px;
  background: var(--info-soft);
  border-radius: var(--radius);
}

.offline-note h2 { font-size: 1.05rem; margin-bottom: 6px; }
.offline-note p { margin: 0; color: var(--text-muted); font-size: .93rem; max-width: 68ch; }

/* ── ראש עמוד התרגיל ───────────────────────────────────────────────────── */

.ex-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.ex-head h1 { font-size: clamp(1.4rem, 3.2vw, 1.9rem); margin-top: 6px; }

.ex-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: .84rem;
  color: var(--text-muted);
}

.ex-progress .pbar { width: 120px; flex: none; height: 6px; }
.ex-progress.is-done .pbar i { background: var(--success); }
.ex-progress.is-done { color: var(--success); font-weight: 600; }

.ex-hint {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: .88rem;
}

.ex-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.ex-tools button {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-muted);
  font: inherit;
  font-size: .86rem;
  min-height: 40px;
}

.ex-tools button svg { width: 18px; height: 18px; flex: none; }
.ex-tools button:hover { background: var(--accent-soft); color: var(--text-heading); }

.ex-tools button.is-on {
  background: var(--accent);
  color: #fff;
}

.ex-tools-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 3px;
  background: var(--border);
}

/* ── פריסה: גיליון + מלווה ─────────────────────────────────────────────── */

.ex-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: 22px;
  align-items: start;
}

.ex-sheet {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px 20px;
  box-shadow: var(--shadow);
}

.ex-statement {
  margin: 0 0 16px;
  font-size: 1.06rem;
  line-height: 1.75;
}

.ex-given {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
}

.ex-given li {
  background: var(--accent-soft);
  color: var(--text-heading);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: .88rem;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: plaintext;
}

.ex-scene { margin: 0 0 26px; }

/* ── לשון השאלה במלואה ─────────────────────────────────────────────────
   סגור כברירת מחדל: פתוח, הוא היה מציג פעמיים את אותם סעיפים ומאריך
   את העמוד בלי צורך. פתיחה בלחיצה אחת, בלי לעזוב את התרגיל. */

.ex-full {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.ex-full > summary {
  cursor: pointer;
  padding: 11px 15px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.ex-full > summary::-webkit-details-marker { display: none; }

.ex-full > summary::before {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 9px;
  border-style: solid;
  border-width: 5px 8px 5px 0;
  border-color: transparent var(--accent) transparent transparent;
  transform: translateY(-1px);
  transition: transform .15s ease;
}

.ex-full[open] > summary::before { transform: rotate(-90deg) translateX(1px); }

.ex-full-body {
  padding: 2px 15px 15px;
  border-top: 1px solid var(--border);
  font-size: .95rem;
  line-height: 1.75;
}

.ex-full-body > p { margin: 12px 0 0; }

.ex-full-given { color: var(--text-muted); font-size: .9rem; }

.ex-full-parts { list-style: none; margin: 12px 0 0; padding: 0; }

.ex-full-parts > li {
  display: grid;
  grid-template-columns: 1.5em 1fr;
  gap: 6px;
  margin-top: 7px;
}

.ex-full-letter { font-weight: 700; color: var(--text-heading); }

.ex-full-opts { margin: 5px 0 0; padding-inline-start: 1.3em; color: var(--text-muted); }

/* ── סצנות ─────────────────────────────────────────────────────────────── */

.scene {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 10px;
}

.scene-svg { display: block; width: 100%; height: auto; }

.scene-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.scene-play {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-heading);
  border-radius: 99px;
  padding: 6px 14px 6px 11px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  flex: none;
}

.scene-play:hover { border-color: var(--accent); }

.scene-play-icon {
  width: 0; height: 0;
  border-style: solid;
  border-width: 6px 0 6px 9px;
  border-color: transparent transparent transparent var(--accent);
}

.scene-play.is-playing .scene-play-icon {
  width: 9px; height: 11px;
  border: 0;
  background: var(--accent);
  -webkit-mask: linear-gradient(#000 0 0) 0 0 / 3px 100% no-repeat,
                linear-gradient(#000 0 0) 100% 0 / 3px 100% no-repeat;
          mask: linear-gradient(#000 0 0) 0 0 / 3px 100% no-repeat,
                linear-gradient(#000 0 0) 100% 0 / 3px 100% no-repeat;
}

.scene-scrub {
  flex: 1;
  min-width: 60px;
  accent-color: var(--accent);
  height: 22px;
}

.scene-readout {
  flex: none;
  font-size: .8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: plaintext;
  white-space: nowrap;
}

.scene-caption {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--text-muted);
}

.scene-fallback { color: var(--text-muted); font-size: .9rem; margin: 0; }

/* מדי אנרגיה. שלושה מדים באותו סולם, כדי שהעין תראה את החלוקה
   מתחלפת בזמן שהסכום נשאר במקומו. */

.scene-meters {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.scene-meter {
  display: grid;
  grid-template-columns: 6.6em 1fr 6.6em;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  color: var(--text-muted);
}

.scene-meter .sm-label { font-weight: 600; color: var(--text-heading); }

.scene-meter .sm-track {
  height: 9px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  direction: ltr;
}

.scene-meter .sm-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width .08s linear;
}

.scene-meter .sm-val {
  text-align: left;
  direction: ltr;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
}

/* ── סעיפים ────────────────────────────────────────────────────────────── */

.part {
  border-top: 1px solid var(--border);
  padding: 20px 0 4px;
}

.part.is-active { }

.part-head { display: flex; gap: 11px; align-items: flex-start; }

.part-tag {
  flex: none;
  width: 27px; height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--text-heading);
  font-weight: 700;
  font-size: .85rem;
  margin-top: 1px;
}

.part.is-active .part-tag { background: var(--accent); color: #fff; }
.part.is-solved .part-tag { background: var(--success); color: #fff; }

.part-prompt { margin: 0; font-weight: 600; color: var(--text-heading); }

.answer {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 14px 0 0;
  padding-inline-start: 38px;
}

.answer-field {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  min-height: 44px;
}

.answer-field:focus-within { border-color: var(--accent); }

.answer-field input {
  border: 0;
  background: none;
  padding: 10px 13px;
  font: inherit;
  font-size: 1rem;
  width: 150px;
  color: var(--text);
  direction: ltr;
  text-align: start;
}

.answer-field input:focus { outline: none; }

.answer-unit {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: .88rem;
  border-inline-start: 1px solid var(--border);
  align-self: stretch;
  display: grid;
  place-items: center;
  direction: ltr;
  background: var(--accent-soft);
}

.answer .btn { min-height: 44px; display: inline-flex; align-items: center; }

/* סעיף בחירה. האפשרויות תופסות שורה מלאה, כדי שניסוח ארוך של הנמקה
   יישאר קריא ולא יידחס לצד כפתור הבדיקה. */
.answer-choices {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.choice:hover { border-color: var(--border-strong); }

.choice input {
  margin: 2px 0 0;
  accent-color: var(--accent);
  width: 18px; height: 18px;
  flex: none;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.part.is-solved .choice:has(input:checked) {
  border-color: var(--success);
  background: var(--success-soft);
}

.answer-note {
  margin: 10px 0 0;
  padding-inline-start: 38px;
  font-size: .9rem;
  min-height: 1px;
}

.answer-note.is-ok { color: var(--success); font-weight: 600; }
.answer-note.is-no { color: var(--no); }
.answer-note.is-warn { color: var(--text-muted); }

.part.is-solved { opacity: .82; }
.part.is-solved.is-active { opacity: 1; }

/* ── המלווה ────────────────────────────────────────────────────────────── */

.ex-aside { position: sticky; top: 84px; }

.tutor {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: calc(100vh - 118px);
}

.tutor-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  flex: none;
}

.tutor-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .9rem;
  flex: none;
}

.tutor-head b { display: block; font-size: .95rem; color: var(--text-heading); }
.tutor-sub { display: block; font-size: .76rem; color: var(--text-muted); }

.tutor-close {
  margin-inline-start: auto;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: none;
}

.tutor-close:hover { background: rgba(0,0,0,.05); }

.tutor-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  scroll-behavior: smooth;
}

.tmsg { max-width: 100%; }

.tmsg-body {
  padding: 11px 14px;
  border-radius: 13px;
  font-size: .92rem;
  line-height: 1.62;
}

.tmsg-tutor .tmsg-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-start-start-radius: 4px;
}

.tmsg-student {
  align-self: flex-end;
  max-width: 85%;
}

.tmsg-student .tmsg-body {
  background: var(--info-soft);
  border: 1px solid #D6E1EC;
  border-end-end-radius: 4px;
}

.tmsg.is-ok .tmsg-body { background: var(--ok-soft); border-color: #C7E3D5; }
.tmsg.is-no .tmsg-body { background: var(--no-soft); border-color: #EBD3E0; }
.tmsg.is-hint .tmsg-body { background: var(--blue-soft); border-color: #BFE4E2; }

.tflag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  margin-inline-end: 5px;
  vertical-align: 1px;
}

.tflag-ok { background: var(--success); color: #fff; }
.tflag-no { background: var(--no); color: #fff; }
.tflag-hint { background: var(--info); color: #fff; }

.tdivider {
  text-align: center;
  font-size: .76rem;
  color: var(--text-muted);
  position: relative;
  margin: 6px 0;
}

.tdivider::before, .tdivider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 34px);
  height: 1px;
  background: var(--border);
}

.tdivider::before { inset-inline-start: 0; }
.tdivider::after { inset-inline-end: 0; }

/* בחירת הדרך: שתי אפשרויות, אחת נכונה */

.tpath { display: grid; gap: 8px; margin-top: 11px; }

.tpath-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: start;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: .89rem;
  line-height: 1.55;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}

.tpath-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.tpath-opt:disabled { cursor: default; opacity: .55; }

.tpath-opt.is-right {
  opacity: 1;
  border-color: var(--success);
  background: var(--success-soft);
}

.tpath-opt.is-wrong {
  opacity: 1;
  border-color: #C08A6E;
  background: #FAECE5;
}

.tpath-mark {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .78rem;
  color: var(--text-heading);
}

/* צ'יפים */

.tchips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.tchip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-heading);
  border-radius: 99px;
  padding: 7px 14px;
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

.tchip:hover { border-color: var(--accent); background: var(--accent-soft); }

.tchip-strong {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tchip-strong:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── נוסחאות ───────────────────────────────────────────────────────────── */

.fml {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Cambria Math", Cambria, Georgia, "Times New Roman", serif;
  font-style: italic;
  white-space: nowrap;
  color: var(--text-heading);
}

.fml sub, .fml sup { font-style: normal; font-size: .68em; }
.fml sub { vertical-align: -.28em; }
.fml sup { vertical-align: .48em; }

.fml-inline {
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 6px 2px;
  font-size: 1.02em;
}

/* שבר אמיתי ולא לוכסן. ככה הוא מופיע בדף הנוסחאות, וזה מה שהתלמיד יחפש. */
.fml-frac {
  display: inline-flex;
  flex-direction: column;
  /* middle ממרכז את השבר על אמצע השורה, כך שהאיבר שאחריו, למשל t, יושב
     מול קו השבר ולא מעליו. כמו בדף הנוסחאות. */
  vertical-align: middle;
  text-align: center;
  margin: 0 .18em;
  font-size: .92em;
}

.fml-num { padding: 0 .3em; border-bottom: 1.2px solid currentColor; line-height: 1.3; }
.fml-den { padding: 0 .3em; line-height: 1.3; }

.fml-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
}

.fml-block .fml { font-size: 1.16rem; }

.fml-tag {
  flex: none;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .01em;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--success-soft);
  color: var(--success);
}

.fml-tag.is-def { background: var(--accent-soft); color: var(--text-muted); }

/* ── סידור הנתונים ─────────────────────────────────────────────────────── */

.tsetup {
  margin-top: 11px;
  padding: 12px 13px;
  background: var(--info-soft);
  border-radius: 10px;
}

.tsetup + .tsetup { margin-top: 10px; }

.tsetup-label {
  margin: 0 0 6px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--info);
}

.tsetup .fml-block { margin-top: 0; }

.tsetup-why {
  margin: 8px 0 10px;
  font-size: .87rem;
  color: var(--text-muted);
}

/* הצהרת הציר. נגזרת מהסצנה, ולכן היא תמיד מתארת את מה שמצויר באיור. */
.tsetup-axis {
  margin: 0 0 10px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #BFE4E2;
  font-size: .85rem;
  color: var(--text);
  line-height: 1.5;
}

.tsetup-axis b { color: var(--info); }

.tsetup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.tsetup-table th,
.tsetup-table td {
  padding: 6px 8px;
  text-align: start;
  border-top: 1px solid #D6E1EC;
  vertical-align: baseline;
}

.tsetup-table tr:first-child th,
.tsetup-table tr:first-child td { border-top: 0; }

/* עמודת הסמלים כולה במראה מתמטי אחיד. בלי הרקע של fml-inline, שנועד
   להבליט נוסחה בתוך משפט ורק מרעיש בתוך טבלה. */
.tsetup-table th {
  width: 1%;
  white-space: nowrap;
  font-weight: 400;
  font-family: "Cambria Math", Cambria, Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.02rem;
  color: var(--text-heading);
  direction: ltr;
  unicode-bidi: isolate;
}

.tsetup-table th .fml-inline { background: none; padding: 0; font-size: 1em; }

.tsetup-val {
  font-weight: 700;
  color: var(--text-heading);
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: plaintext;
}

.tsetup-note { color: var(--text-muted); font-size: .82rem; }

.tsetup-table .is-unknown th,
.tsetup-table .is-unknown td { background: rgba(176, 137, 104, .12); }
.tsetup-table .is-unknown .tsetup-val { color: var(--accent-hover); }

.tsetup-foot {
  margin: 11px 0 0;
  font-size: .87rem;
  color: var(--text-muted);
}

/* כרטיס תאוריה */

.ttheory h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text-heading);
}

.ttheory p { margin: 0 0 9px; }
.ttheory ul, .ttheory ol { margin: 0 0 9px; padding-inline-start: 20px; }
.ttheory li { margin-bottom: 5px; }
.ttheory > :last-child { margin-bottom: 0; }

.ttheory-fig {
  margin-top: 12px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent-hover);
  border-radius: 99px;
  padding: 8px 15px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
}

.ttheory-fig:hover { background: var(--accent-soft); }

/* ── חלון האיור ────────────────────────────────────────────────────────── */

.fig-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(44, 42, 38, .5);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: figIn .16s ease;
}

@keyframes figIn { from { opacity: 0; } }

.fig-box {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.fig-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.fig-head b { color: var(--text-heading); }

.fig-close {
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  min-height: 40px;
}

.fig-close:hover { background: var(--accent-soft); color: var(--text-heading); }

.fig-body { padding: 18px; }
.fig-body .scene { border: 0; padding: 0; background: none; }

/* שאלה חופשית */

.tutor-ask {
  display: flex;
  gap: 7px;
  padding: 11px 13px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex: none;
}

.tutor-ask input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  padding: 9px 15px;
  font: inherit;
  font-size: .88rem;
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
}

.tutor-ask input:focus { outline: none; border-color: var(--accent); }

.tutor-ask button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 0 16px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  flex: none;
}

.tutor-ask button:hover { background: var(--accent-hover); }

.tdots { display: inline-flex; gap: 4px; padding: 3px 0; }

.tdots i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: tdot 1.1s infinite ease-in-out;
}

.tdots i:nth-child(2) { animation-delay: .16s; }
.tdots i:nth-child(3) { animation-delay: .32s; }

@keyframes tdot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ── שכבת כתיבה ────────────────────────────────────────────────────────── */

.ink-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  touch-action: auto;
  border-radius: var(--radius);
  z-index: 3;
}

.ink-canvas.is-live {
  pointer-events: auto;
  touch-action: none;   /* מונע גלילה בזמן ציור באצבע */
  cursor: crosshair;
}

body.ink-live .ex-sheet { user-select: none; }
body.ink-live .answer,
body.ink-live .scene-bar { position: relative; z-index: 4; }

/* ── הדגשות ────────────────────────────────────────────────────────────── */

mark.hl {
  background: #FBEFB8;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
  cursor: pointer;
}

mark.hl-green { background: #D8ECCF; }
mark.hl-pink { background: #F6D9E2; }
mark.hl.has-note { border-bottom: 2px solid var(--accent); }

.hl-bar {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
}

.hl-swatch {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(0,0,0,.09);
  cursor: pointer;
  padding: 0;
}

.hl-sw-yellow { background: #FBEFB8; }
.hl-sw-green { background: #D8ECCF; }
.hl-sw-pink { background: #F6D9E2; }

.hl-sep { width: 1px; height: 20px; background: var(--border); }

.hl-act {
  border: 0;
  background: none;
  color: var(--text-heading);
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
}

.hl-act:hover { background: var(--accent-soft); }
.hl-act-del { color: var(--no); }

/* ── מסכים צרים ────────────────────────────────────────────────────────── */

@media (max-width: 1080px) {
  .ex-layout { grid-template-columns: minmax(0, 1fr); }

  .ex-aside {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    transform: translateY(100%);
    transition: transform .26s ease;
    padding: 0;
  }

  body.tutor-open .ex-aside { transform: translateY(0); }

  .tutor {
    border-radius: 16px 16px 0 0;
    max-height: 74vh;
    height: 74vh;
    box-shadow: 0 -6px 30px rgba(74, 63, 44, .18);
    border-bottom: 0;
  }

  .tutor-close { display: block; }

  /* כפתור המלווה צף, כדי שיהיה תמיד בהישג אצבע */
  .tool-tutor {
    position: fixed;
    inset-inline-end: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 45;
    background: var(--accent) !important;
    color: #fff !important;
    border-radius: 99px !important;
    padding: 12px 18px !important;
    box-shadow: var(--shadow-lift);
  }

  body.tutor-open .tool-tutor { display: none; }
}

@media (max-width: 720px) {
  .ex-sheet { padding: 18px 16px 14px; }
  .ex-head { align-items: flex-start; }

  .ex-tools { width: 100%; overflow-x: auto; justify-content: flex-start; }
  .ex-tools button span { display: none; }
  .ex-tools button { padding: 9px 11px; }
  .tool-tutor span { display: inline !important; }

  .answer, .answer-note { padding-inline-start: 0; }

  /* שדה התשובה מקבל שורה משלו. כשהוא חלק עם הכפתורים באותה שורה הוא יוצא
     צר מהם, וזה משדר שהכפתור חשוב מהתשובה. */
  .answer-field { flex: 1 0 100%; }
  .answer-field input { flex: 1; width: auto; min-width: 0; }
  .answer .btn { flex: 1; justify-content: center; }

  .scene-readout { display: none; }
  .scene-bar { gap: 9px; }

  .pgrid { grid-template-columns: 1fr; }
}

/* מכשירי מגע: מטרות גדולות יותר */
@media (hover: none) {
  .tpath-opt { padding: 13px 13px; }
  .tchip { min-height: 40px; padding: 9px 15px; }
  .hl-swatch { width: 32px; height: 32px; }
  .hl-act { padding: 8px 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .tutor-thread, .pbar i, .ex-aside { scroll-behavior: auto; transition: none; }
  .tdots i { animation: none; }
}

@media print {
  .ex-tools, .ex-aside, .scene-bar, .hl-bar, .pager { display: none !important; }
  .ex-sheet { border: 0; box-shadow: none; }
}

/* ── תגיות נושא ────────────────────────────────────────────────────────
   תרגיל יושב ביחידה אחת בלבד. תגית "משלב" אומרת שהפתרון עובר גם דרך
   נושא אחר, בלי לשכפל את התרגיל לשתי רשימות. */
.ptag {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .84rem;
  color: var(--text-heading);
  text-decoration: none;
  line-height: 1.4;
}

a.ptag:hover { border-color: var(--accent); background: var(--accent-soft); }

.ptag i { font-style: normal; color: var(--text-muted); font-size: .78rem; }
.ptag em {
  font-style: normal;
  color: var(--lilac-deep);
  font-size: .74rem;
}

.ptag.is-on {
  background: var(--text-heading);
  border-color: var(--text-heading);
  color: #fff;
}
.ptag.is-on i, .ptag.is-on em { color: rgba(255, 255, 255, .72); }

.ptag.is-combine {
  background: var(--surface);
  border-style: dashed;
  border-color: var(--iris-pale);
  color: var(--lilac-deep);
  font-size: .78rem;
  padding: 3px 10px;
}

.pcard-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 0; }

.ex-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }

.ptags {
  margin-top: 40px;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ptags h2 { font-size: 1.15rem; margin: 0 0 6px; }

.ptags-note {
  margin: 0 0 16px;
  font-size: .9rem;
  color: var(--text-muted);
  max-width: 68ch;
}

.ptags-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── בחן אותי ────────────────────────────────────────────────────────
   שני מסכים: הרכבת המבחן, והמבחן עצמו. שניהם משתמשים באותם רכיבים של
   עמוד התרגיל - הסעיפים, המלווה והאיור - ולכן מה שנוסף כאן הוא רק
   טופס הבחירה, סרגל השאלות והשעון. */

.exam-builder .ex-field {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
  padding: 16px 0 0;
}
.exam-builder .ex-field:first-of-type { border-top: 0; padding-top: 8px; }

.exam-builder legend {
  padding: 0;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text-heading);
}

.chipset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  font: inherit;
  font-size: .89rem;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.ex-field-note {
  margin: 9px 0 0;
  font-size: .82rem;
  color: var(--text-muted);
}

.ex-minutes {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: .89rem;
  color: var(--text-muted);
}
.ex-minutes input {
  font: inherit;
  width: 82px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
}

.exam-go {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.exam-avail { font-size: .85rem; color: var(--text-muted); }

/* ── סרגל המבחן ──────────────────────────────────────────────────── */

.exam-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-ink);
}

.exam-steps { display: flex; gap: 6px; flex: 1 1 auto; flex-wrap: wrap; }

.exam-step {
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--ink-line);
  background: transparent;
  color: var(--on-ink-muted);
  cursor: pointer;
}
.exam-step:hover { border-color: var(--on-ink); color: var(--on-ink); }
.exam-step.is-at { background: var(--on-ink); border-color: var(--on-ink); color: var(--ink); }
.exam-step.is-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.exam-step.is-part { border-color: var(--aqua); color: var(--aqua); }

.exam-clock {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--on-ink);
}
.exam-clock.is-low { color: var(--no); }

.exam-bar .btn {
  flex: none;
  background: transparent;
  border: 1px solid var(--ink-line);
  color: var(--on-ink);
}
.exam-bar .btn:hover { background: var(--ink-2); }

/* ── כותרת השאלה במבחן ───────────────────────────────────────────── */

.exam-qhead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.exam-qhead h2 { margin: 0; font-size: 1.1rem; }

.exam-qtopic {
  font-size: .8rem;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--lilac);
  color: var(--lilac-deep);
}

/* ── סיכום ───────────────────────────────────────────────────────── */

.exam-score {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 26px;
  margin: 14px 0 4px;
}

.exam-score-big {
  flex: none;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.exam-score-big i { font-size: 1.3rem; font-style: normal; color: var(--text-muted); }

.exam-review {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

/* ── פתירת שאלת בגרות ───────────────────────────────────────────────────
   העמוד משתמש כמעט כולו בסגנונות של עמוד התרגיל: אותו סרגל כלים, אותם
   כרטיסי סעיף, אותו מלווה. מה שנוסף כאן הוא רק מה שיש בשאלת בגרות ואין
   בתרגיל - לשון שאלון ארוכה, תרשים שהגיע מהמצגת, טבלת נתונים, ובדיקה
   עצמית לסעיף שאין לו תשובה מספרית.                                     */

.bq-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .92rem;
}

.bq-statement p {
  margin: 0 0 10px;
  line-height: 1.75;
}

.bq-statement p:last-child { margin-bottom: 0; }

/* התרשים מגיע כ-SVG מתוך שקף הפתיחה של המצגת. הוא נבנה לרוחב מצגת,
   ולכן הוא מוגבל בגובה כדי שלא ידחוף את הסעיף הראשון מתחת לקיפול. */
.bq-figure {
  margin: 16px 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.bq-figure svg {
  width: 100%;
  height: auto;
  max-height: 46vh;
}

.bq-figure figcaption {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-muted);
}

.bq-table-wrap { overflow-x: auto; margin: 14px 0; }

.bq-table {
  border-collapse: collapse;
  min-width: 60%;
  margin: 0 auto;
  background: var(--surface);
  font-size: .92rem;
}

.bq-table caption {
  caption-side: top;
  padding-bottom: 6px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: .82rem;
}

.bq-table th, .bq-table td {
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  text-align: center;
}

.bq-table thead th { background: var(--accent-soft); }

.part-points {
  flex: none;
  align-self: flex-start;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 9px;
}

/* סעיף פתוח: הוכחה, הנמקה או סרטוט. התלמיד כותב כמו במחברת. */
.answer-open {
  flex: 1 1 260px;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.answer-open:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.answer.is-open { align-items: flex-start; }

/* הבדיקה העצמית נשארת מוסתרת עד שנכתבה תשובה. סעיף שנפתח לפני
   שניסו בו הוא סעיף שלא נלמד. */
.bq-check, .bq-summary {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.bq-check > summary, .bq-summary > summary {
  cursor: pointer;
  padding: 9px 14px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--info);
}

.bq-check-body, .bq-summary > div { padding: 0 14px 12px; }

.bq-check-foot {
  margin: 8px 0 0;
  font-size: .78rem;
  color: var(--text-muted);
}

.bq-sum-item { margin-bottom: 10px; font-size: .92rem; line-height: 1.65; }
.bq-sum-item b { display: block; margin-bottom: 2px; color: var(--text-heading); }

/* ── שלב ליווי מסוג חשיפה ─────────────────────────────────────────────── */

.tflag-step { background: var(--info-soft); color: var(--aqua-deep); }

.tstep-note { margin: 6px 0 0; font-size: .9rem; line-height: 1.6; }

.tstep-fml {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  text-align: center;
}

/* ── סימונים שנוספו להמרת LaTeX ───────────────────────────────────────── */

.fml-up, .fml-txt { font-style: normal; }
.fml-bf { font-style: normal; font-weight: 700; }

.fml-root {
  border-top: 1.1px solid currentColor;
  padding: 0 .12em;
  margin-right: -.05em;
}

.fml-bar { border-top: 1.1px solid currentColor; }

.fml-vec, .fml-hat {
  position: relative;
  display: inline-block;
}

.fml-vec::after, .fml-hat::after {
  position: absolute;
  top: -.62em;
  left: 0;
  right: 0;
  font-size: .62em;
  font-style: normal;
  text-align: center;
  line-height: 1;
}

.fml-vec::after { content: "→"; }
.fml-hat::after { content: "^"; }

/* ── הקישור לפתירה, ליד כדורי שאלות הבגרות בעמוד הנושא ────────────────── */

/* הכדור נשאר בגודלו והכפתור יושב מתחתיו, ולא לצדו: תא הרשת הוא 112
   פיקסלים, וחלוקה לשניים הייתה מכווצת את שניהם עד שהשנה כבר לא נקראת
   במבט אחד. */
.qpills li { display: flex; flex-direction: column; gap: 4px; }

.qpill-solve {
  flex: none;
  padding: 5px 8px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-btn, 10px);
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: .74rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.qpill-solve:hover { background: var(--accent); color: #fff; }

.ex-given-head {
  margin: 14px 0 4px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text-muted);
}

.part-paper {
  margin: 0 0 10px;
  padding: 8px 12px;
  background: var(--info-soft);
  border-radius: 9px;
  font-size: .84rem;
  color: var(--aqua-deep);
}

.part-paper a { color: inherit; font-weight: 700; }
