:root {
  --pink: #FF5F97;
  --pink-dark: #E0437D;
  --pink-soft: #FFF0F5;
  --ink: #111111;
  --ink-2: #444444;
  --muted: #777777;
  --line: #ECECEC;
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --ok: #1F9D55;
  --ok-soft: #EAF7EF;
  --warn: #B45309;
  --warn-soft: #FFF7E8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Assistant', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pink-dark); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 19px; font-weight: 700; margin-top: 1.4em; }
.muted { color: var(--muted); font-size: 15px; }
[hidden] { display: none !important; }

/* ---------- סרגל עליון ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.brand img { height: 34px; width: auto; }
.brand span { border-inline-start: 2px solid var(--pink); padding-inline-start: 10px; font-size: 18px; }
#topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#topbar nav a, #topbar nav .link {
  text-decoration: none; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 15px;
}
#topbar nav a.active { background: var(--pink-soft); color: var(--pink-dark); }
.link { background: none; border: 0; cursor: pointer; font: inherit; }

main { max-width: 920px; margin: 0 auto; padding: 28px 16px 80px; }

/* ---------- כפתורים וטפסים ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 22px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; text-decoration: none;
  transition: transform .05s ease, background .15s ease;
}
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn.pink { background: var(--pink); }
.btn.pink:hover { background: var(--pink-dark); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.small { padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.done { background: var(--ok); }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 15px; }
input[type=text], input[type=password] {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: #fff;
}
input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.err { color: #C0262D; font-weight: 600; margin-top: 12px; min-height: 1.4em; }

/* ---------- כרטיסים ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.auth { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.auth .card { text-align: start; }
.auth img { height: 64px; margin-bottom: 14px; }

/* ---------- דף הבית ---------- */
.hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 26px; }
.hero h1 span { color: var(--pink); }
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--pink); border-radius: 999px; transition: width .4s ease; }
.overall { min-width: 240px; flex: 1; max-width: 340px; }
.overall b { font-size: 26px; }
.modules { display: grid; gap: 14px; }
.mod {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center;
  text-decoration: none; color: inherit;
}
.mod:hover { border-color: var(--pink); }
.mod .ico { width: 56px; height: 56px; border-radius: 14px; background: var(--pink-soft); display: grid; place-items: center; font-size: 28px; }
.mod .num { color: var(--pink-dark); font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.mod h2 { font-size: 19px; margin: 2px 0 2px; }
.mod p { margin: 0; color: var(--muted); font-size: 15px; }
.mod .state { text-align: center; font-size: 14px; font-weight: 700; color: var(--muted); min-width: 84px; }
.mod.locked { opacity: .55; cursor: not-allowed; }
.mod.locked .ico { background: #F2F2F2; filter: grayscale(1); }
.mod.passed .state { color: var(--ok); }
.mod .progress { margin-top: 8px; height: 6px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--line); color: var(--ink-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.pink { background: var(--pink-soft); color: var(--pink-dark); }

/* ---------- דף מודול ---------- */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.lessons { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; }
.lessons a {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; text-decoration: none; color: inherit; font-weight: 600;
}
.lessons a:hover { border-color: var(--pink); }
.lessons .chk { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; flex: none; }
.lessons .done .chk { background: var(--ok); border-color: var(--ok); color: #fff; }
.lessons .meta { margin-inline-start: auto; color: var(--muted); font-size: 14px; font-weight: 400; white-space: nowrap; }
.quizbox { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--ink); color: #fff; }
.quizbox h3 { margin: 0; }
.quizbox p { margin: 4px 0 0; color: #ccc; font-size: 15px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- שיעור ---------- */
.lesson-body { font-size: 18px; }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 16px; background: #fff; border-radius: 12px; overflow: hidden; }
.lesson-body th, .lesson-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.lesson-body th { background: #F6F6F6; font-weight: 700; white-space: nowrap; }
.lesson-body ul, .lesson-body ol { padding-inline-start: 1.3em; }
.lesson-body li { margin: 4px 0; }
.callout { background: var(--pink-soft); border-inline-start: 4px solid var(--pink); padding: 14px 16px; border-radius: 10px; margin: 16px 0; }
.callout.warn { background: var(--warn-soft); border-color: #F59E0B; }
.callout ol { margin: 8px 0 0; }
.script { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 18px; margin: 12px 0; }
.script p { margin: 10px 0; }
.script .who { color: var(--pink-dark); font-weight: 800; }
.note { display: block; color: var(--warn); font-size: 15px; font-weight: 600; }
.steps li { margin: 8px 0; }
.check { list-style: none; padding-inline-start: 0 !important; }
.check li { padding-inline-start: 30px; position: relative; }
.check li::before { content: '☐'; position: absolute; inset-inline-start: 4px; color: var(--pink); }
.tpl { position: relative; background: #F7F7F7; border: 1px dashed #D9D9D9; border-radius: 12px; padding: 14px 16px 52px; margin: 10px 0 18px; }
.tpl pre { margin: 0; font-family: inherit; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.lesson-body td, .links li { overflow-wrap: anywhere; }
.tpl .copy { position: absolute; bottom: 10px; inset-inline-start: 12px; background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.tasks li { margin: 10px 0; }
.tasks label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer; font-size: 17px; }
.tasks input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--pink); flex: none; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 32px; flex-wrap: wrap; }

/* ---------- מדיה ---------- */
.media { display: grid; gap: 14px; margin: 18px 0 24px; }
.media .item { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.media .item .cap { padding: 10px 14px; font-weight: 700; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.media .item .cap small { color: var(--muted); font-weight: 400; }
.player { position: relative; background: #000; }
.player.yt { aspect-ratio: 16/9; }
.player iframe, .player video { display: block; width: 100%; height: 100%; border: 0; }
.player video { aspect-ratio: 16/9; background: #000; }
.player.audio { background: var(--pink-soft); padding: 12px; }
.player audio { width: 100%; display: block; }
.mwm {
  position: absolute; z-index: 3; pointer-events: none; user-select: none;
  color: rgba(255,255,255,.55); font-size: 13px; font-weight: 700; text-shadow: 0 0 3px rgba(0,0,0,.6);
  transition: top 1.2s ease, left 1.2s ease; white-space: nowrap;
}
.player.audio .mwm { color: rgba(0,0,0,.25); text-shadow: none; }
.missing { padding: 26px; color: #bbb; text-align: center; font-size: 15px; }

/* סימן מים על כל הדף */
#wm {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 120px 90px; padding: 60px; opacity: .045;
  transform: rotate(-24deg) scale(1.5);
}
#wm span { font-size: 18px; font-weight: 800; color: #000; white-space: nowrap; user-select: none; }

/* ---------- מבחן ---------- */
.q { margin: 0 0 14px; }
.q h3 { margin: 0 0 10px; font-size: 18px; }
.q .opts { display: grid; gap: 8px; }
.q .opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; margin: 0; background: #fff; }
.q .opt:hover { border-color: #ccc; }
.q .opt input { accent-color: var(--pink); margin-top: 6px; }
.q .opt:has(input:checked) { border-color: var(--pink); background: var(--pink-soft); }
.q.ok { border-color: var(--ok); }
.q.bad { border-color: #E5484D; }
.q .why { margin-top: 10px; color: #A1262B; font-weight: 600; font-size: 15px; }
.result { text-align: center; margin-bottom: 18px; }
.result .score { font-size: 54px; font-weight: 800; }
.result.pass .score { color: var(--ok); }
.result.fail .score { color: var(--pink-dark); }

/* ---------- שליפה מהירה ---------- */
.cheat section { margin-bottom: 16px; }
.cheat h2 { font-size: 20px; }
.cheat table { font-size: 15px; }
.links { list-style: none; padding: 0 !important; }
.links li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- ניהול ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; background: #fff; }
.tbl th, .tbl td { padding: 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.tbl th { font-size: 13px; color: var(--muted); font-weight: 700; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.flag { color: #C0262D; font-weight: 700; }
.pw { font-family: ui-monospace, Menlo, monospace; font-size: 20px; letter-spacing: .06em; background: var(--pink-soft); padding: 10px 14px; border-radius: 10px; display: inline-block; direction: ltr; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-mod { margin-bottom: 10px; }
.admin-mod summary { cursor: pointer; font-weight: 700; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.admin-mod ul { font-size: 15px; margin: 10px 0 0; }

#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px; font-weight: 700;
  opacity: 0; transition: all .25s ease; z-index: 100; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 25px; }
  #topbar { padding: 8px 12px; }
  .brand img { height: 26px; }
  .brand span { font-size: 15px; }
  #topbar nav a, #topbar nav .link { padding: 5px 8px; font-size: 14px; }
  .mod { grid-template-columns: 44px 1fr; }
  .mod .ico { width: 44px; height: 44px; font-size: 22px; }
  .mod .state { grid-column: 1 / -1; text-align: start; }
  .card { padding: 16px; }
  .lesson-body { font-size: 17px; }
  .lesson-body th { white-space: normal; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- הדפסה (שמירה כ-PDF) ---------- */
@media print {
  #topbar, .lesson-nav, .no-print, #toast, .tpl .copy { display: none !important; }
  body { background: #fff; font-size: 13pt; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-lesson { break-before: page; }
  .print-lesson:first-of-type { break-before: auto; }
  #wm { opacity: .06; position: fixed; }
  .print-footer { position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: 9pt; color: #999; }
  a { color: inherit; text-decoration: none; }
}
.print-footer { display: none; }
@media print { .print-footer { display: block; } }

/* צילומי מסך בתוך שיעור */
.lesson-body img.shot{display:block;max-width:min(320px,100%);height:auto;margin:10px 0 16px;border:1px solid #e5e5e5;border-radius:12px;box-shadow:0 2px 10px rgba(0,0,0,.08)}
