/* בדרך שלך · ורוד רך, עגול וידידותי. תפריט בצד ימין במחשב, סרגל תחתון בטלפון */
:root {
  --fs: 1; --lh: 1.7;
  --bg: #fff8fb; --surface: #ffffff; --surface-2: #fdeef4; --surface-3: #fbe1ec; --line: #f1d7e2;
  --ink: #2b1d27; --ink-2: #5d4a57; --muted: #8a7684;
  --pink: #d63a7a; --pink-dark: #b02662; --pink-soft: #fde4ee; --pink-ink: #9c1f55;
  --good: #2fa35a; --good-soft: #def4e6; --warn: #c97a10; --warn-soft: #fdf0dc; --bad: #c7384a; --bad-soft: #fbe2e5;
  --sky: #3f7fc2; --sky-soft: #e2eefa;
  --display: "Rubik", "Assistant", Arial, sans-serif;
  --body: "Assistant", "Rubik", Arial, sans-serif;
  --hand: "Amatic SC", "Rubik", cursive;
  --r: 18px; --r-sm: 12px;
  --shadow: 0 1px 2px rgba(120, 40, 80, .06), 0 6px 20px rgba(120, 40, 80, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1218; --surface: #241a21; --surface-2: #2e212a; --surface-3: #3a2934; --line: #44323e;
    --ink: #f6eaf1; --ink-2: #d9c4d1; --muted: #a8919f;
    --pink: #ef6aa0; --pink-dark: #f58bb5; --pink-soft: #4a2238; --pink-ink: #ffb3d1;
    --good: #5fcf88; --good-soft: #1f3d2a; --warn: #f0b04c; --warn-soft: #3d2f18; --bad: #f07a8a; --bad-soft: #43222a;
    --sky: #7fb3ea; --sky-soft: #1c2c40; color-scheme: dark;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root.soft-bg { --bg: #fbf5e9; --surface: #fffdf7; }
.no-tts #say, .no-tts #saySum, .no-tts #sayAlt, .no-tts [data-say] { display: none !important; }

* { box-sizing: border-box; }
html { font-size: calc(17px * var(--fs)); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); line-height: var(--lh); }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.25; margin: 0; text-wrap: balance; color: var(--ink); }
h1 { font-size: 1.85rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--pink-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; border-radius: 6px; }
.ic { width: 1.3em; height: 1.3em; flex: none; }
.ic.big { width: 56px; height: 56px; color: var(--pink); }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { inset-inline-start: 8px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===== מבנה ===== */
.boot { min-height: 100vh; display: grid; place-items: center; }
#app.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--surface); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 6px; }
.brand-mark { width: 44px; height: 44px; flex: none; }
.brand b { font-family: var(--display); font-size: 1.3rem; font-weight: 800; color: var(--pink-ink); display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: .85rem; }
.side nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--ink-2); text-decoration: none; font-weight: 600; }
.side nav a:hover { background: var(--surface-2); color: var(--ink); }
.side nav a.on { background: var(--pink-soft); color: var(--pink-ink); }
.side nav a.on .ic { color: var(--pink); }
.hand { font-family: var(--hand); font-size: 2.1rem; color: var(--pink); text-align: center; margin-top: auto; transform: rotate(-4deg); line-height: 1; }
.side-out { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; background: none; color: var(--muted); border-radius: 12px; cursor: pointer; }
.hand + .side-out { margin-top: 0; }
.side-out:hover { background: var(--surface-2); color: var(--ink); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px max(20px, env(safe-area-inset-left, 0px)) 14px max(20px, env(safe-area-inset-right, 0px)); }
.top-tools { display: flex; align-items: center; gap: 10px; }
.me { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-weight: 600; }
main { flex: 1; outline: none; }
#view { max-width: 1180px; margin: 0 auto; padding: 6px max(20px, env(safe-area-inset-right, 0px)) 60px max(20px, env(safe-area-inset-left, 0px)); display: grid; gap: 22px; }
.tabbar { display: none; }
#view > * { min-width: 0; }
.top > * { min-width: 0; }
.top .chip { white-space: normal; line-height: 1.3; }

@media (max-width: 860px) {
  #app.app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; inset: auto 0 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 9px 2px 10px; color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600; background: none; border: 0; }
  .tabbar .on { color: var(--pink); }
  #view { padding-bottom: 110px; }
  .top { padding-block: 10px; }
  h1 { font-size: 1.55rem; }
}

/* ===== רכיבים ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .1s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--pink); color: #fff; }
.btn.primary:hover { background: var(--pink-dark); }
.btn.soft { background: var(--pink-soft); color: var(--pink-ink); }
.btn.good { background: var(--good); color: #fff; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding-inline: 28px; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: .92rem; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { background: var(--pink); color: #fff; border-color: var(--pink); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; }
.card h2 { margin-bottom: 4px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 18px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .85rem; font-weight: 700; white-space: nowrap; }
.chip .ic { width: 1em; height: 1em; }
.chip.pink { background: var(--pink-soft); color: var(--pink-ink); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.sky { background: var(--sky-soft); color: var(--sky); }
.bar { height: 9px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width .5s; }
.bar.pink span { background: var(--pink); }
.ring-num { font-family: var(--display); font-weight: 800; font-size: 26px; fill: var(--ink); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .92rem; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--pink-ink); }
.crumbs .ic { width: 1em; height: 1em; }

/* טפסים */
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: .95rem; }
.field small { color: var(--muted); font-size: .85rem; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 3px var(--pink-soft); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--good); }
.switch input:checked::after { inset-inline-start: 23px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--pink-ink); box-shadow: var(--shadow); }

/* טבלאות */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; min-width: 640px; }
.t th, .t td { text-align: right; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t th { font-family: var(--display); font-weight: 600; font-size: .9rem; color: var(--ink-2); background: var(--surface-2); }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover td { background: var(--surface-2); }
.t .num { font-variant-numeric: tabular-nums; }
.t .bar { width: 110px; display: inline-block; vertical-align: middle; margin-inline-end: 8px; }

/* מסך כניסה */
#app.public { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 24px max(16px, env(safe-area-inset-right, 0px)); background: radial-gradient(circle at 85% 10%, var(--pink-soft), transparent 45%), radial-gradient(circle at 10% 90%, var(--good-soft), transparent 40%), var(--bg); }
.auth { width: min(440px, 100%); display: grid; gap: 22px; }
.auth .brand { justify-content: center; }
.auth .brand-mark { width: 60px; height: 60px; }
.auth .brand b { font-size: 1.8rem; }
.auth .card { padding: 28px; display: grid; gap: 16px; }
.auth .hand { font-size: 2.4rem; margin: 0; }
.pw { position: relative; }
.pw .input { padding-inline-end: 52px; }
.pw button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; font-weight: 600; }

/* ===== בית התלמידה ===== */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.hero-next { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--pink-soft), var(--surface-2)); border: 1px solid var(--line); border-radius: 24px; padding: 30px; display: grid; gap: 14px; }
.hero-next::after { content: ""; position: absolute; inset-inline-start: -40px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--surface-3); opacity: .7; }
.hero-next > * { position: relative; z-index: 1; }
.hero-next .kicker { display: inline-flex; gap: 8px; align-items: center; color: var(--pink-ink); font-weight: 700; }
.hero-next h1 { font-size: 2rem; max-width: 22ch; }
.hero-next .meta { color: var(--ink-2); }
.hero-art { position: absolute !important; inset-inline-end: 26px; top: 50%; transform: translateY(-50%); width: 140px; height: 140px; color: var(--pink); opacity: .9; z-index: 1; pointer-events: none; }
.hero-next:has(.hero-art) { padding-inline-end: 196px; }
@media (max-width: 640px) { .hero-art { display: none; } .hero-next, .hero-next:has(.hero-art) { padding: 22px; } .hero-next h1 { font-size: 1.5rem; } }
.week { display: flex; gap: 6px; align-items: center; }
.week i { width: 30px; height: 30px; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; font-style: normal; font-size: .75rem; font-weight: 700; color: var(--muted); }
.week i.on { background: var(--good); color: #fff; }
.week i.today { outline: 2px solid var(--pink); outline-offset: 1px; }
.side-card { display: grid; gap: 12px; justify-items: center; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.stat small { color: var(--muted); font-weight: 600; }
.stat b { font-family: var(--display); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .stat { padding: 10px; } .stat b { font-size: 1.35rem; } }
.encourage { font-family: var(--hand); font-size: 1.9rem; color: var(--pink); line-height: 1.1; }

/* כרטיסי נושאים */
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.topic-card { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.topic-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(150, 40, 90, .12); }
.topic-art { height: 120px; display: grid; place-items: center; position: relative; background-size: cover; background-position: center; }
.topic-art .ic { width: 58px; height: 58px; stroke-width: 1.5; }
.topic-art .done-badge { position: absolute; top: 10px; inset-inline-end: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; }
.topic-art .done-badge .ic { width: 18px; height: 18px; stroke-width: 2.5; }
.topic-body { padding: 14px 16px 16px; display: grid; gap: 8px; align-content: start; }
.topic-body h3 { font-size: 1.05rem; }
.topic-body .row { gap: 8px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.topic-body .bar { flex: 1; }
.t0 { background: #fde4ee; color: #c2306d; } .t1 { background: #e2f3e7; color: #2b8a4d; } .t2 { background: #fdf0dc; color: #b86b0a; }
.t3 { background: #e7e9fb; color: #4b55c4; } .t4 { background: #e0f2f4; color: #1f8590; } .t5 { background: #f6e5f8; color: #9440a6; }
@media (prefers-color-scheme: dark) { .t0, .t1, .t2, .t3, .t4, .t5 { background: var(--surface-3); } }
.part-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.part-title h2 { font-size: 1.2rem; }

/* יחידות */
.units { display: grid; gap: 10px; }
.unit-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; text-decoration: none; color: inherit; }
.unit-row:hover { border-color: var(--pink); }
.unit-num { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-family: var(--display); font-weight: 700; color: var(--ink-2); }
.unit-row.done .unit-num { background: var(--good); color: #fff; }
.unit-row.next { border: 2px solid var(--pink); background: var(--pink-soft); }
.unit-row.next .unit-num { background: var(--pink); color: #fff; }
.unit-row b { display: block; }

/* מסך יחידה */
.lesson { max-width: 760px; width: 100%; margin: 0 auto; display: grid; gap: 18px; }
.lesson-top { display: grid; gap: 10px; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 7px; border-radius: 9px; background: var(--surface-3); }
.steps i.on { background: var(--pink); }
.steps i.done { background: var(--good); }
.lesson-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 26px; display: grid; gap: 16px; box-shadow: var(--shadow); }
@media (max-width: 560px) { .lesson-card { padding: 18px; } }
.lesson-card .card-tools { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.prose { font-size: 1.08rem; max-width: 65ch; }
.prose > * + * { margin-top: .8em; }
.prose h3 { font-size: 1.2rem; color: var(--pink-ink); margin-top: 1.2em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-top: .3em; }
.prose mark { background: #fff1a8; padding: 0 .2em; border-radius: 4px; color: #2b1d27; }
.prose blockquote { margin-inline: 0; border-inline-start: 4px solid var(--pink); padding: 8px 16px; background: var(--surface-2); border-radius: 0 12px 12px 0; }
.alt-box { background: var(--sky-soft); border-radius: 18px; padding: 18px 20px; display: grid; gap: 10px; }
.alt-box h3 { color: var(--sky); display: flex; gap: 8px; align-items: center; }
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 16px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.summary-box { background: var(--good-soft); border-radius: 18px; padding: 20px; display: grid; gap: 8px; }
.summary-box h3 { color: var(--good); display: flex; gap: 8px; align-items: center; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.celebrate { text-align: center; display: grid; gap: 14px; justify-items: center; padding: 30px 20px; }
.celebrate .burst { width: 96px; height: 96px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: grid; place-items: center; animation: pop .5s ease-out; }
.celebrate .burst .ic { width: 52px; height: 52px; stroke-width: 2.4; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0 } 70% { transform: scale(1.1) } 100% { transform: scale(1); opacity: 1 } }

/* חומרים */
.files { display: grid; gap: 8px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); text-decoration: none; color: inherit; border: 0; width: 100%; text-align: right; cursor: pointer; }
.file-row:hover { background: var(--surface-3); }
.file-row .ic { color: var(--pink); }
.file-row b { flex: 1; min-width: 0; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: right; }
.linkish:hover { color: var(--pink-ink); text-decoration: underline; }
.file-row button.chip { border: 0; cursor: pointer; }
.terms { display: grid; gap: 10px; }
.term { background: var(--surface-2); border-radius: 14px; padding: 12px 16px; }
.term b { color: var(--pink-ink); }

/* מורה */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: grid; gap: 4px; }
.kpi small { color: var(--muted); font-weight: 700; }
.kpi b { font-family: var(--display); font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.alert-list { display: grid; gap: 8px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); text-decoration: none; color: inherit; }
.alert-item .ic { color: var(--warn); }
.alert-item b { flex: 1; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { min-height: 44px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search .input { padding-inline-start: 42px; }
.list-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.list-item .actions { display: flex; gap: 6px; }
@media (max-width: 560px) {
  .list-item { grid-template-columns: auto minmax(0, 1fr); }
  .list-item .actions { grid-column: 1 / -1; justify-content: flex-end; }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .topic-art { height: 84px; }
  .topic-art .ic { width: 40px; height: 40px; }
  .topic-body { padding: 10px 12px 12px; }
  .topic-body h3 { font-size: .98rem; }
  .topic-body .row.between { flex-direction: column; align-items: flex-start; gap: 4px; }
}
.dim { opacity: .55; }
.editor-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; background: var(--surface-2); border: 1.5px solid var(--line); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.editor-bar button { border: 0; background: none; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; min-width: 36px; }
.editor-bar button:hover { background: var(--surface); }
.rte { min-height: 200px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--surface); outline: none; }
.rte:focus { border-color: var(--pink); }
.rte:empty::before { content: attr(data-ph); color: var(--muted); }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, 46px); gap: 6px; }
.icon-pick button { width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.icon-pick button.on { border-color: var(--pink); background: var(--pink-soft); color: var(--pink); }
.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 26px; text-align: center; display: grid; gap: 8px; justify-items: center; background: var(--surface); cursor: pointer; }
.drop.over { border-color: var(--pink); background: var(--pink-soft); }

/* חלונות והודעות */
.modal-wrap { position: fixed; inset: 0; background: rgba(43, 29, 39, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: grid; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 6px; }
.modal-body { padding: 10px 22px; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; padding: 14px 22px 20px; flex-direction: row-reverse; }
#toasts { position: fixed; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 80; pointer-events: none; }
@media (min-width: 861px) { #toasts { bottom: 24px; } }
.toast { background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: tin .25s ease-out; max-width: calc(100vw - 32px); }
.toast.err { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .4s; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
.empty { text-align: center; display: grid; justify-items: center; gap: 10px; padding: 40px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty p { color: var(--ink-2); max-width: 46ch; }
.loading { display: flex; gap: 8px; justify-content: center; padding: 60px; }
.loading span { width: 12px; height: 12px; border-radius: 50%; background: var(--pink); animation: bounce 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .4 } 50% { transform: translateY(-8px); opacity: 1 } }

/* ===== שלב 2: מבחנים, תרגול, משימות ===== */
@media (max-width: 860px) {
  .tabbar { grid-auto-columns: minmax(68px, 1fr); overflow-x: auto; scrollbar-width: none; }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar span { white-space: nowrap; }
}
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grow { flex: 1; min-width: 0; }
.type-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-pick button { text-align: right; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.type-pick button small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.type-pick button.on { border-color: var(--pink); background: var(--pink-soft); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks.scroll { max-height: 200px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); }

/* פתרון */
.q-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.q-prompt { font-size: 1.15rem; font-weight: 600; }
.choices { display: grid; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { display: flex; align-items: center; gap: 12px; text-align: right; padding: 14px 16px; min-height: 58px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; font-size: 1.05rem; font-weight: 600; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--pink); }
.choice.on { border-color: var(--pink); background: var(--pink-soft); }
.choice .dot { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-family: var(--display); font-weight: 700; }
.choice.on .dot { background: var(--pink); color: #fff; }
.choices.two .choice { justify-content: center; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border-radius: 14px; }
@media (max-width: 560px) { .match-row { grid-template-columns: minmax(0, 1fr); } }
.fill-text { font-size: 1.15rem; line-height: 2.6; }
.fill-text .blank { display: inline-block; width: auto; min-width: 110px; min-height: 40px; padding: 4px 10px; margin: 0 4px; font-weight: 700; border-color: var(--pink); }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.case-box { background: var(--sky-soft); border-radius: 16px; padding: 16px 18px; display: grid; gap: 8px; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; }
.qdots button { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; color: var(--ink-2); }
.qdots button.done { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.qdots button.on { border-color: var(--pink); background: var(--pink); color: #fff; }
.timer { font-variant-numeric: tabular-nums; font-size: 1rem; }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.quiz-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.quiz-facts div { background: var(--surface-2); border-radius: 14px; padding: 12px; display: grid; justify-items: center; gap: 2px; text-align: center; }
.quiz-facts .ic { color: var(--pink); }
.quiz-facts b { font-family: var(--display); font-size: 1.3rem; }
.quiz-facts span { font-size: .85rem; color: var(--muted); }
.tips { margin: 0; padding-inline-start: 20px; color: var(--ink-2); display: grid; gap: 4px; }
.ans-box { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; white-space: pre-wrap; }
.model-box { background: var(--good-soft); border-radius: 12px; padding: 10px 14px; }
.model-box ul { margin: 6px 0 0; padding-inline-start: 18px; }
.grade-part { display: grid; gap: 6px; padding: 10px 0; border-top: 1px dashed var(--line); }
.res { border-inline-start: 6px solid var(--line); }
.res.ok { border-inline-start-color: var(--good); }
.res.bad { border-inline-start-color: var(--warn); }
.res.pend { border-inline-start-color: var(--sky); }
.practice-card { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: linear-gradient(135deg, var(--good-soft), var(--surface)); border: 1px solid var(--line); border-radius: 22px; padding: 22px 24px; }
.practice-card h2 { display: flex; gap: 8px; align-items: center; color: var(--good); }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; color: inherit; }
.task.late { border-color: var(--bad); }
.task.done { opacity: .7; }
.task .tick { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; color: #fff; cursor: pointer; }
.task.done .tick { background: var(--good); border-color: var(--good); }
a.task .tick, span.tick { cursor: default; color: var(--pink); }
a.task.done .tick, .task.done span.tick { color: #fff; }
details summary { cursor: pointer; }
.chart-line { width: 100%; height: auto; }

/* ===== צפייה בקבצים ודפי עבודה ===== */
.viewer { display: grid; gap: 14px; }
.viewer-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: var(--shadow); }
.viewer-doc { min-width: 0; }
.ws-help { background: var(--sky-soft); color: var(--ink); border-radius: 14px; padding: 10px 14px; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.pdf-pages { display: grid; gap: 16px; justify-items: center; overflow-x: auto; padding-bottom: 8px; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); border-radius: 6px; overflow: hidden; max-width: none; }
.pdf-page canvas { display: block; direction: ltr; }
.pdf-num { position: absolute; bottom: 8px; inset-inline-start: 8px; background: rgba(43,29,39,.6); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 99px; }
.pdf-notes { position: absolute; inset: 0; pointer-events: none; }
.pdf-note { position: absolute; pointer-events: auto; min-width: 120px; max-width: 70%; }
.pdf-note textarea, .pdf-note-text { width: 100%; min-width: 120px; font: inherit; font-size: max(14px, .9rem); color: #1d2a8c; background: rgba(255, 249, 196, .95); border: 1.5px solid #e2c34a; border-radius: 8px; padding: 4px 8px; resize: none; overflow: hidden; line-height: 1.4; direction: rtl; box-shadow: 0 2px 6px rgba(0,0,0,.12); white-space: pre-wrap; }
.pdf-note-x { position: absolute; top: -10px; inset-inline-end: -10px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--bad); color: #fff; cursor: pointer; font-weight: 700; line-height: 1; }
.viewer-doc.writing .pdf-page { cursor: crosshair; outline: 3px dashed var(--pink); }
.viewer-img { max-width: 100%; border-radius: 12px; display: block; margin: 0 auto; }
.docx { background: #fff; color: #222; border-radius: 12px; padding: clamp(18px, 4vw, 44px); box-shadow: 0 2px 12px rgba(0,0,0,.08); max-width: 860px; margin: 0 auto; width: 100%; line-height: 1.9; }
.docx table { border-collapse: collapse; width: 100%; margin: 12px 0; display: block; overflow-x: auto; }
.docx td, .docx th { border: 1px solid #ccc; padding: 6px 8px; vertical-align: top; min-width: 80px; }
.docx img { max-width: 100%; height: auto; }
.docx h1, .docx h2, .docx h3 { color: #9c1f55; }
.ws-blank { border: 0; border-bottom: 2px solid var(--pink); background: #fdf2f7; color: #1d2a8c; font: inherit; font-weight: 600; padding: 0 6px; margin: 0 3px; border-radius: 6px 6px 0 0; max-width: 100%; }
.ws-area, .ws-cell { display: block; width: 100%; border: 1.5px solid #f1c7d9; background: #fdf7fa; color: #1d2a8c; font: inherit; font-weight: 600; border-radius: 10px; padding: 8px 12px; margin: 6px 0 14px; resize: vertical; line-height: 1.6; }
.ws-cell { margin: 4px 0; min-height: 44px; }
.ws-blank:focus, .ws-area:focus, .ws-cell:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); background: #fff; }
.ws-blank.ro, .ws-area.ro, .ws-cell.ro { background: #fff9c4; }
.viewer-foot { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
@media (min-width: 861px) { .viewer-foot { bottom: 12px; } }
.textLayer-measure { line-height: 1; overflow: hidden; }
.textLayer-measure span, .textLayer-measure br { position: absolute; white-space: pre; transform-origin: 0% 0%; color: transparent; }
.pdf-blanks { position: absolute; inset: 0; }
.pdf-blank { position: absolute; border: 0; border-bottom: 2px solid var(--pink); background: rgba(253, 228, 238, .55); color: #1d2a8c; font-family: var(--body); font-weight: 700; font-size: max(11px, calc(var(--pw, 800px) * .017)); padding: 0 4px; border-radius: 4px 4px 0 0; direction: rtl; min-width: 0; }
.pdf-blank:focus { outline: 2px solid var(--pink); background: #fff; z-index: 2; }
.pdf-blank[readonly] { background: rgba(255, 249, 196, .8); }
.ws-help.key { background: var(--good-soft); }
.ws-key { display: inline-block; margin: 2px 6px 8px; padding: 2px 10px; border-radius: 8px; background: #e2f6e8; color: #1b6e3a; font-weight: 700; font-size: .92em; }
.ws-key.same { background: #d4f2dd; }
.ws-key.on-pdf { position: absolute; margin: 0; font-size: max(10px, calc(var(--pw, 800px) * .014)); white-space: nowrap; z-index: 3; pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.15); }

/* ===== ההתקדמות שלי + לחזור שוב ===== */
.progress-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .progress-grid { grid-template-columns: minmax(0, 1fr); } .progress-grid .review-col { order: -1; } }
.review-col { border-top: 5px solid var(--pink); }
.review-list { display: grid; gap: 8px; }
.review-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); text-decoration: none; color: inherit; }
.review-item:hover { background: var(--surface-3); }
.review-item small { display: block; color: var(--muted); font-size: .82rem; }
.ri-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--surface); color: var(--pink); display: grid; place-items: center; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.topic-bars { display: grid; gap: 10px; }
.topic-bar { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(0, 2fr); gap: 12px; align-items: center; text-decoration: none; color: inherit; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tb-name { font-weight: 700; }
.tb-bars { display: grid; gap: 4px; }
.tb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.tb-row small { color: var(--muted); font-size: .78rem; }
@media (max-width: 520px) { .topic-bar { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.grades-strip { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.gs-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.gs-bar { width: 70%; max-width: 34px; background: var(--pink); border-radius: 6px 6px 0 0; }
.gs-bar.pr { background: var(--sky); }
.gs-col small { font-size: .75rem; color: var(--ink-2); }
.q-img { margin: 0 0 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; overflow-x: auto; }
.q-img img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* בלי סמן הקלדה מהבהב כשלוחצים על טקסט רגיל. הסמן מופיע רק בשדות כתיבה */
body { caret-color: transparent; }
input, textarea, select, [contenteditable="true"] { caret-color: auto; }
main:focus, main:focus-visible, #view:focus { outline: none; }
.exam-ans { width: 100%; max-width: 1100px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 18px 4px; display: grid; gap: 4px; }
.exam-ans .field > span { font-weight: 700; color: var(--pink-ink); display: flex; gap: 6px; align-items: center; }

/* שאלות ותשובות ביחידה */
.qa-list { display: grid; gap: 10px; }
.qa-card { border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); }
.qa-card summary { list-style: none; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; font-weight: 600; line-height: 1.6; }
.qa-card summary::-webkit-details-marker { display: none; }
.qa-card .qa-q { flex: 1; }
.qa-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--pink-soft); color: var(--pink-ink); display: grid; place-items: center; font-weight: 800; }
.qa-card summary::after { content: "לראות תשובה"; flex: none; font-size: .85rem; color: var(--pink-ink); background: var(--pink-soft); padding: 4px 10px; border-radius: 999px; align-self: center; }
.qa-card[open] summary::after { content: "להסתיר"; }
.qa-a { padding: 0 16px 14px 16px; padding-inline-start: 58px; line-height: 1.7; }
.qa-a b { color: var(--good); }
.practice-cta { display: grid; gap: 6px; justify-items: start; background: var(--pink-soft); border-radius: 16px; padding: 18px; margin-top: 10px; }
@media (max-width: 640px) {
  .qa-card summary { flex-wrap: wrap; gap: 8px 12px; }
  .qa-card .qa-q { flex: 1 1 calc(100% - 44px); }
  .qa-card summary .icon-btn { margin-inline-start: 42px; }
  .qa-a { padding-inline-start: 16px; }
}

/* תפריט אישי */
.me-wrap { position: relative; }
button.me { cursor: pointer; font: inherit; color: inherit; }
button.me:hover { border-color: var(--pink); }
.me-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 8px; z-index: 50; display: grid; gap: 2px; }
.me-menu[hidden] { display: none; }
.me-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.me-head small { color: var(--muted); }
.me-menu a, .me-menu button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; background: none; border: 0; font: inherit; text-align: start; cursor: pointer; width: 100%; }
.me-menu a:hover, .me-menu button:hover { background: var(--pink-soft); }
.me-menu #logout3 { color: var(--bad); }

/* העוזרת */
.ai-fab { position: fixed; inset-inline-start: 18px; bottom: 18px; z-index: 60; display: flex; align-items: center; gap: 8px; background: var(--pink); color: #fff; border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.18); cursor: pointer; }
.ai-fab[hidden] { display: none; }
.ai-panel { position: fixed; inset-inline-start: 18px; bottom: 78px; z-index: 61; width: min(380px, calc(100vw - 32px)); max-height: min(560px, 70vh); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.18); display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden; }
.ai-panel[hidden] { display: none; }
.ai-panel header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--pink-soft); }
.ai-msgs { overflow-y: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.ai-msg { padding: 10px 12px; border-radius: 14px; line-height: 1.6; max-width: 90%; }
.ai-msg.me { background: var(--pink-soft); justify-self: start; }
.ai-msg.bot { background: var(--surface-2); justify-self: end; }
.ai-msg.wait { color: var(--muted); justify-self: end; }
.ai-msg .icon-btn { margin-inline-start: 6px; vertical-align: middle; }
.ai-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; }
.ai-quick button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; }
.ai-panel form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.ai-panel form .input { flex: 1; }
.ai-try { display: grid; gap: 6px; margin: -4px 0 6px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.ai-try .btn { justify-self: start; }
.ai-check { background: var(--good-soft); border-radius: 12px; padding: 10px 12px; line-height: 1.6; }
@media (max-width: 640px) { .ai-fab { bottom: 76px; } .ai-panel { bottom: 136px; } .ai-fab span { display: none; } }
